Skip to content

Commit 5c87eab

Browse files
committed
1 parent 904fd66 commit 5c87eab

File tree

5 files changed

+61
-42
lines changed

5 files changed

+61
-42
lines changed

src/Changelog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ TBD - 2.4
5555
- Enhancement: ADIF Added SUBMM band.
5656
- Enhancement: Completed the names of the fields in the log view widget.
5757
- Enhancement: Added several ADIF fields (Closes #396, #507, #508, #719)
58+
- Bigfix: ADIF import: Do not add 0 as default iota_id & my_iota_id (Closes #768)
59+
- Bugfix: ADIF import: Do not add a 0 as default k_index (Closes #767)
5860
- Bugfix: ALTITUDE gets a wrong data on ADIF import if no ALTITUDE is present in the ADIF file (Closes #765)
5961
- Bugfix: Default mode for 60m band is USB. (Closes #596)
6062
- BugFix: Data loss: Data not managed by the UI may be lost if eddited (Closes #722)

src/adif.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ bool Adif::isValidFreq(const QString &_b)
265265

266266
bool Adif::isValidPower(const QString &_b)
267267
{
268-
return (_b.toDouble()>0);
268+
return (_b.toDouble()>0.0);
269269
}
270270

271271
QString Adif::getADIFBoolFromBool(const bool _b)
@@ -298,7 +298,7 @@ bool Adif::isValidDXCC(const QString &_b)
298298

299299
bool Adif::isValidAge(const QString &_b)
300300
{
301-
return ((_b.toInt()>=0) && (_b.toInt()<=120));
301+
return ((_b.toInt()>0) && (_b.toInt()<=120));
302302
}
303303

304304
bool Adif::isValidAnt_EL(const QString &_b)

src/dataproxy_sqlite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7372,7 +7372,7 @@ QString DataProxy_SQLite::getADIFFromQSOQuery(QSqlRecord rec, ExportMode _em, bo
73727372
qso.setCQZone((getADIFValueFromRec(rec, "cqz")).toInt());
73737373
qso.setItuZone((getADIFValueFromRec(rec, "ituz")).toInt());
73747374
qso.setDXCC((getADIFValueFromRec(rec, "dxcc")).toInt());
7375-
//qDebug() << Q_FUNC_INFO << ": - 100";
7375+
qDebug() << Q_FUNC_INFO << ": - 100";
73767376

73777377
qso.setAddress(getADIFValueFromRec(rec, "address"));
73787378
qso.setAge((getADIFValueFromRec(rec, "age")).toDouble());

src/mainqsoentrywidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ bool MainQSOEntryWidget::setMode(const QString &_mode)
723723
{
724724
//TODO: If the mode is not already selected, add the mode automatically.
725725
logEvent (Q_FUNC_INFO, "Start" + _mode, Debug);
726-
qDebug() << Q_FUNC_INFO << ": " << _mode;
726+
//qDebug() << Q_FUNC_INFO << ": " << _mode;
727727
if (modeComboBox->findText(_mode, Qt::MatchCaseSensitive) < 0)
728728
{
729729
//qDebug() << Q_FUNC_INFO << " - NOT found";

src/qso.cpp

Lines changed: 55 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,11 @@ void QSO::clear()
638638

639639
// VARIABLES for ADIF //////////
640640
address = QString();
641-
age = 0;
641+
age = -1;
642642
altitude = -10000;
643-
a_index = 0;
644-
ant_az = 0.0;
645-
ant_el = 0.0;
643+
a_index = -1;
644+
ant_az = -91.0;
645+
ant_el = -91.0;
646646
ant_path = QString();
647647
arrl_sect = QString();
648648
award_submitted = QString();
@@ -664,7 +664,7 @@ void QSO::clear()
664664
credit_granted = QString();
665665
credit_submitted = QString();
666666
darc_dok = QString();
667-
distance = 0;
667+
distance = -1;
668668
dxcc = 0;
669669
email = QString();
670670
ownerCall = QString();
@@ -673,8 +673,8 @@ void QSO::clear()
673673
eQSLSDate = QDate();
674674
eqsl_qsl_rcvd = QString();
675675
eqsl_qsl_sent = QString();
676-
fists = 0;
677-
fists_cc = 0;
676+
fists = -1;
677+
fists_cc = -1;
678678
forceInit = false;
679679
freq_tx = 0;
680680
freq_rx = 0;
@@ -688,9 +688,9 @@ void QSO::clear()
688688
hamqth_status = QString();
689689
hamqthUpdateDate = QDate();
690690
iota = QString();
691-
iota_ID = 0;
691+
iota_ID = -1;
692692
itu_zone = 0;
693-
k_index = 0;
693+
k_index = -1;
694694
latitude = QString();
695695
longitude = QString();
696696
QSLLoTWRDate = QDate();
@@ -708,11 +708,11 @@ void QSO::clear()
708708
my_country = QString();
709709
my_cqz = 0;
710710
my_dxcc = 0;
711-
my_fists = 0;
711+
my_fists = -1;
712712
my_gridsquare = QString();
713713
my_gridsquare_ext = QString();
714714
my_iota = QString();
715-
my_iota_ID = 0;
715+
my_iota_ID = -1;
716716
my_itu_zone = 0;
717717
my_latitude = QString();
718718
my_longitude = QString();
@@ -762,7 +762,7 @@ void QSO::clear()
762762
pwr_rx = 0.0;
763763
satMode = QString();
764764
satName = QString();
765-
sfi = 0;
765+
sfi = -1;
766766
sig = QString();
767767
sig_info = QString();
768768
silent_key = false;
@@ -1863,12 +1863,13 @@ QString QSO::getPOTA_Ref()
18631863

18641864
bool QSO::setAge(const double _c)
18651865
{
1866-
if ((0 <= _c) && (_c <= 120))
1866+
//qDebug() << Q_FUNC_INFO << ": " << _c;
1867+
if ((0 >= _c) && (_c <= 120))
18671868
{
18681869
age = _c;
18691870
return true;
18701871
}
1871-
age = 0;
1872+
age = -1;
18721873
return false;
18731874
}
18741875

@@ -3910,13 +3911,16 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
39103911
query.bindValue(":ituz", getItuZone());
39113912
query.bindValue(":dxcc", getDXCC());
39123913
query.bindValue(":address", getAddress());
3913-
query.bindValue(":age", getAge());
3914+
if (adif->isValidAge(QString::number(getAge())))
3915+
query.bindValue(":age", getAge());
39143916
if (adif->isValidAltitude(QString::number(getAltitude())))
39153917
query.bindValue(":altitude", getAltitude());
3916-
3917-
query.bindValue(":a_index", getA_Index());
3918-
query.bindValue(":ant_az", getAnt_az());
3919-
query.bindValue(":ant_el", getAnt_el());
3918+
if (adif->isValidA_Index(QString::number(getA_Index())))
3919+
query.bindValue(":a_index", getA_Index());
3920+
if (adif->isValidAnt_AZ(QString::number(getAnt_az())))
3921+
query.bindValue(":ant_az", getAnt_az());
3922+
if (adif->isValidAnt_EL(QString::number(getAnt_el())))
3923+
query.bindValue(":ant_el", getAnt_el());
39203924

39213925
query.bindValue(":ant_path", getAnt_Path());
39223926
query.bindValue(":arrl_sect", getARRL_Sect());
@@ -3936,16 +3940,19 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
39363940
query.bindValue(":credit_submitted", getCreditSubmitted());
39373941
query.bindValue(":credit_granted,", getCreditGranted());
39383942
query.bindValue(":darc_dok", getDarcDok ());
3939-
query.bindValue(":distance", getDistance());
3943+
if (adif->isValidDistance(QString::number(getDistance())))
3944+
query.bindValue(":distance", getDistance());
39403945
query.bindValue(":email", getEmail());
39413946
query.bindValue(":eq_call", getEQ_Call());
39423947
query.bindValue(":eqsl_qslrdate", util->getDateSQLiteStringFromDate(getEQSLQSLRDate()));
39433948
query.bindValue(":eqsl_qslsdate", util->getDateSQLiteStringFromDate(getEQSLQSLSDate()));
39443949

39453950
query.bindValue(":eqsl_qsl_rcvd", getEQSLQSL_RCVD());
39463951
query.bindValue(":eqsl_qsl_sent", getEQSLQSL_SENT());
3947-
query.bindValue(":fists", getFists ());
3948-
query.bindValue(":fists_cc", getFistsCC ());
3952+
if (adif->isValidFISTS(QString::number(getFists())))
3953+
query.bindValue(":fists", getFists ());
3954+
if (adif->isValidFISTS(QString::number(getFistsCC())))
3955+
query.bindValue(":fists_cc", getFistsCC ());
39493956

39503957
query.bindValue(":force_init", util->boolToCharToSQLite (getForceInit()));
39513958
query.bindValue(":freq_tx", getFreqTX());
@@ -3960,17 +3967,19 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
39603967
query.bindValue(":hamqth_qso_upload_date", getHamQTHUpdateDate());
39613968
query.bindValue(":hamqth_qso_upload_status", getHamQTHStatus());
39623969

3963-
39643970
query.bindValue(":iota", getIOTA());
3965-
query.bindValue(":iota_island_id", getIotaID());
3966-
query.bindValue(":k_index", getK_Index());
3971+
if (adif->isValidIOTA_islandID(QString::number(getIotaID())))
3972+
query.bindValue(":iota_island_id", getIotaID());
3973+
if (adif->isValidK_Index(QString::number(getK_Index())))
3974+
query.bindValue(":k_index", getK_Index());
39673975
query.bindValue(":lat", getLatitude());
39683976
query.bindValue(":lon", getLongitude());
39693977
query.bindValue(":lotw_qslrdate", util->getDateSQLiteStringFromDate(getLoTWQSLRDate()));
39703978
query.bindValue(":lotw_qslsdate", util->getDateSQLiteStringFromDate(getLoTWQSLSDate()));
39713979
query.bindValue(":lotw_qsl_rcvd", getLoTWQSL_RCVD());
39723980
query.bindValue(":lotw_qsl_sent", getLoTWQSL_SENT());
3973-
query.bindValue(":max_bursts", getMaxBursts());
3981+
if (adif->isValidNRBursts(QString::number(getMaxBursts())))
3982+
query.bindValue(":max_bursts", getMaxBursts());
39743983
query.bindValue(":ms_shower", getMsShower());
39753984
if (adif->isValidAltitude(QString::number(getMyAltitude())))
39763985
query.bindValue(":my_altitude", getMyAltitude());
@@ -3986,7 +3995,8 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
39863995
query.bindValue(":my_gridsquare", getMyGridSquare());
39873996
query.bindValue(":my_gridsquare_ext", getMyGridSquare_ext());
39883997
query.bindValue(":my_iota", getMyIOTA());
3989-
query.bindValue(":my_iota_island_id", getMyIotaID());
3998+
if (adif->isValidIOTA_islandID(QString::number(getMyIotaID())))
3999+
query.bindValue(":my_iota_island_id", getMyIotaID());
39904000
query.bindValue(":my_itu_zone", getMyITUZone ());
39914001
query.bindValue(":my_lat", getMyLatitude());
39924002
query.bindValue(":my_lon", getMyLongitude());
@@ -4006,8 +4016,10 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
40064016
query.bindValue(":my_vucc_grids", getMyVUCCGrids());
40074017
query.bindValue(":name", getName());
40084018
query.bindValue(":notes", getNotes());
4009-
query.bindValue(":nr_bursts", getNrBursts());
4010-
query.bindValue(":nr_pings", getNrPings());
4019+
if (adif->isValidNRBursts(QString::number(getNrBursts())))
4020+
query.bindValue(":nr_bursts", getNrBursts());
4021+
if (adif->isValidPings(QString::number(getNrPings())))
4022+
query.bindValue(":nr_pings", getNrPings());
40114023
query.bindValue(":operator", getOperatorCallsign());
40124024
query.bindValue(":owner_callsign", getOwnerCallsign());
40134025
query.bindValue(":pfx", getPrefix());
@@ -4033,34 +4045,39 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
40334045
query.bindValue(":qth", getQTH());
40344046
query.bindValue(":region", getRegion ());
40354047
query.bindValue(":rig", getRig ());
4036-
4037-
query.bindValue(":rx_pwr", getRXPwr());
4048+
if (adif->isValidPower(QString::number(getRXPwr())))
4049+
query.bindValue(":rx_pwr", getRXPwr());
40384050
query.bindValue(":sat_mode", getSatMode());
40394051
query.bindValue(":sat_name",getSatName());
4040-
query.bindValue(":sfi", getSFI());
4052+
if (adif->isValidSFI(QString::number(getSFI())))
4053+
query.bindValue(":sfi", getSFI());
40414054
query.bindValue(":sig", getSIG());
40424055
query.bindValue(":sig_info", getSIG_INFO ());
40434056
query.bindValue(":silent_key", util->boolToCharToSQLite (getSilentKey ()));
40444057
query.bindValue(":skcc", getSkcc ());
40454058

40464059
query.bindValue(":sota_ref", getSOTA_REF());
40474060
query.bindValue(":srx_string", getSrxString());
4048-
4049-
query.bindValue(":srx", getSrx());
4061+
if (adif->isValidSRX(QString::number(getSrx())))
4062+
query.bindValue(":srx", getSrx());
40504063
query.bindValue(":stx_string", getStxString());
4051-
query.bindValue(":stx", getStx());
4064+
if (adif->isValidSTX(QString::number(getStx())))
4065+
query.bindValue(":stx", getStx());
40524066
query.bindValue(":state", getState());
40534067
query.bindValue(":station_callsign", getStationCallsign());
40544068
//query.bindValue(":submode", getModeIdFromModeName ());
40554069

40564070
query.bindValue(":swl", util->boolToCharToSQLite (getSwl()));
4057-
query.bindValue(":uksmg", getUksmg ());
4071+
if (adif->isValidUKSMG(QString::number(getUksmg())))
4072+
query.bindValue(":uksmg", getUksmg ());
40584073
query.bindValue(":usaca_counties", getUsacaCounties ());
40594074
query.bindValue(":ve_prov", getVeProv ());
40604075
query.bindValue(":wwff_ref", getWWFF_Ref());
40614076
query.bindValue(":vucc_grids", getVUCCGrids());
4062-
query.bindValue(":ten_ten", getTenTen());
4063-
query.bindValue(":tx_pwr", getTXPwr());
4077+
if (adif->isValidTenTen(QString::number(getTenTen())))
4078+
query.bindValue(":ten_ten", getTenTen());
4079+
if (adif->isValidPower(QString::number(getTXPwr())))
4080+
query.bindValue(":tx_pwr", getTXPwr());
40644081
query.bindValue(":web", getWeb());
40654082
query.bindValue(":qso_date_off", util->getDateSQLiteStringFromDate(getDateOff()));
40664083
query.bindValue(":lognumber", getLogId());

0 commit comments

Comments
 (0)