From a1e0a23eab7f074c5137044f3cb102d764392919 Mon Sep 17 00:00:00 2001 From: Ladislav Foldyna Date: Wed, 31 May 2023 17:39:41 +0200 Subject: [PATCH] Fixed #207 - QSL Sent Date fields are not filled if QSL Sent Status fields are Y --- Changelog | 1 + ui/NewContactWidget.cpp | 21 +- ui/QSODetailDialog.cpp | 64 ++++-- ui/QSODetailDialog.ui | 484 ++++++++++++++++++++++------------------ 4 files changed, 327 insertions(+), 243 deletions(-) diff --git a/Changelog b/Changelog index 4181d26d..bba98180 100644 --- a/Changelog +++ b/Changelog @@ -4,6 +4,7 @@ TBC - 0.23.0 - [NEW] - Online Map - based on locale, the map language is selected (Only EN, FR, GE supported - issue #180) - Fixed After entering longer QTH, the field content is not left-aligned (issue #157) - Fixed wrong QSO Time in case of JTDX (issue #204) +- Fixed QSL Sent Date fields are not filled if QSL Sent Status fields are Y (issue #207) 2023/05/07 - 0.22.0 - [NEW] - ADIF Import - My Profile is used to define default values diff --git a/ui/NewContactWidget.cpp b/ui/NewContactWidget.cpp index 3017e01d..a9397860 100644 --- a/ui/NewContactWidget.cpp +++ b/ui/NewContactWidget.cpp @@ -1020,17 +1020,32 @@ void NewContactWidget::addAddlFields(QSqlRecord &record, const StationProfile &p if ( record.value("qsl_sent").toString().isEmpty() ) { - record.setValue("qsl_sent", ui->qslSentBox->itemData(ui->qslSentBox->currentIndex())); + QVariant sentState = ui->qslSentBox->itemData(ui->qslSentBox->currentIndex()); + record.setValue("qsl_sent", sentState); + if ( sentState == QVariant("Y") ) + { + record.setValue("qsl_sdate", QDate::currentDate()); + } } if ( record.value("lotw_qsl_sent").toString().isEmpty() ) { - record.setValue("lotw_qsl_sent", ui->lotwQslSentBox->itemData(ui->lotwQslSentBox->currentIndex())); + QVariant sentState = ui->lotwQslSentBox->itemData(ui->lotwQslSentBox->currentIndex()); + record.setValue("lotw_qsl_sent", sentState); + if ( sentState == QVariant("Y") ) + { + record.setValue("lotw_qslsdate", QDate::currentDate()); + } } if ( record.value("eqsl_qsl_sent").toString().isEmpty() ) { - record.setValue("eqsl_qsl_sent", ui->eQSLSentBox->itemData(ui->eQSLSentBox->currentIndex())); + QVariant sentState = ui->eQSLSentBox->itemData(ui->eQSLSentBox->currentIndex()); + record.setValue("eqsl_qsl_sent", sentState); + if ( sentState == QVariant("Y") ) + { + record.setValue("eqsl_qslsdate", QDate::currentDate()); + } } record.setValue("qsl_rcvd", "N"); diff --git a/ui/QSODetailDialog.cpp b/ui/QSODetailDialog.cpp index 83ad9011..6809a5e0 100644 --- a/ui/QSODetailDialog.cpp +++ b/ui/QSODetailDialog.cpp @@ -75,6 +75,8 @@ QSODetailDialog::QSODetailDialog(const QSqlRecord &qso, ui->dateTimeOffEdit->setDisplayFormat(locale.formatDateShortWithYYYY() + " " + locale.formatTimeLongWithoutTZ()); ui->qslPaperReceiveDateEdit->setDisplayFormat(locale.formatDateShortWithYYYY()); ui->qslPaperSentDateEdit->setDisplayFormat(locale.formatDateShortWithYYYY()); + ui->qslEqslSentDateEdit->setDisplayFormat(locale.formatDateShortWithYYYY()); + ui->qslLotwSentDateEdit->setDisplayFormat(locale.formatDateShortWithYYYY()); /* Mapper setting */ mapper->setModel(model); @@ -329,9 +331,9 @@ QSODetailDialog::QSODetailDialog(const QSqlRecord &qso, mapper->addMapping(ui->qslPaperSentStatusBox, LogbookModel::COLUMN_QSL_SENT); mapper->addMapping(ui->qslPaperReceiveStatusBox, LogbookModel::COLUMN_QSL_RCVD); mapper->addMapping(ui->qslEqslReceiveDateLabel, LogbookModel::COLUMN_EQSL_QSLRDATE); - mapper->addMapping(ui->qslEqslSentDateLabel, LogbookModel::COLUMN_EQSL_QSLSDATE); + mapper->addMapping(ui->qslEqslSentDateEdit, LogbookModel::COLUMN_EQSL_QSLSDATE); mapper->addMapping(ui->qslLotwReceiveDateLabel, LogbookModel::COLUMN_LOTW_RCVD_DATE); - mapper->addMapping(ui->qslLotwSentDateLabel, LogbookModel::COLUMN_LOTW_SENT_DATE); + mapper->addMapping(ui->qslLotwSentDateEdit, LogbookModel::COLUMN_LOTW_SENT_DATE); mapper->addMapping(ui->qslEqslReceiveStatusLabel, LogbookModel::COLUMN_EQSL_QSL_RCVD); mapper->addMapping(ui->qslEqslSentStatusBox, LogbookModel::COLUMN_EQSL_QSL_SENT); mapper->addMapping(ui->qslLotwReceiveStatusLabel, LogbookModel::COLUMN_LOTW_RCVD); @@ -954,16 +956,43 @@ bool QSODetailDialog::doValidation() tr("Based on POTA record, my Grid does not match POTA Grid - expecting ")+ " " + myPOTAGrid.getGrid() + ""); allValid &= highlightInvalid(ui->lotwHeaderLabel, - ui->qslLotwSentDateLabel->text() != tr("-") - && ( ui->qslLotwSentStatusBox->currentData().toString() == 'N' - || ui->qslLotwSentStatusBox->currentData().toString() == 'I' ), - tr("LoTW Sent Status to No or Ignore does not make any sense if QSL has already been uploaded")); + ui->qslLotwSentDateEdit->date() != ui->qslLotwSentDateEdit->minimumDate() + && ui->qslLotwSentStatusBox->currentData().toString() == "N", + tr("LoTW Sent Status to No does not make any sense if QSL Sent Date is set. Set Date to 1.1.1900 to leave the date field blank")); + + allValid &= highlightInvalid(ui->lotwHeaderLabel, + ui->qslLotwSentDateEdit->date() == ui->qslLotwSentDateEdit->minimumDate() + && ( ui->qslLotwSentStatusBox->currentData().toString() == "Y" + // || ui->qslLotwSentStatusBox->currentData().toString() == "Q" // QLog does not set date for Q state + // || ui->qslLotwSentStatusBox->currentData().toString() == "I" // QLog does not set date for I state + ), + tr("Date should be present for LoTW Sent Status Yes")); + + allValid &= highlightInvalid(ui->eqslHeaderLabel, + ui->qslEqslSentDateEdit->date() != ui->qslEqslSentDateEdit->minimumDate() + && ui->qslEqslSentStatusBox->currentData().toString() == "N", + tr("eQSL Sent Status to No does not make any sense if QSL Sent Date is set. Set Date to 1.1.1900 to leave the date field blank")); allValid &= highlightInvalid(ui->eqslHeaderLabel, - ui->qslEqslSentDateLabel->text() != tr("-") - && ( ui->qslEqslSentStatusBox->currentData().toString() == 'N' - || ui->qslEqslSentStatusBox->currentData().toString() == 'I' ), - tr("eQSL Sent Status to No or Ignore does not make any sense if QSL has already been uploaded")); + ui->qslEqslSentDateEdit->date() == ui->qslEqslSentDateEdit->minimumDate() + && ( ui->qslEqslSentStatusBox->currentData().toString() == "Y" + // || ui->qslEqslSentStatusBox->currentData().toString() == "Q" // QLog does not set date for Q state + // || ui->qslEqslSentStatusBox->currentData().toString() == "I" // QLog does not set date for I state + ), + tr("Date should be present for eQSL Sent Status Yes")); + + allValid &= highlightInvalid(ui->qslSentLabel, + ui->qslPaperSentDateEdit->date() != ui->qslPaperSentDateEdit->minimumDate() + && ui->qslPaperSentStatusBox->currentData().toString() == "N", + tr("Paper Sent Status to No does not make any sense if QSL Sent Date is set. Set Date to 1.1.1900 to leave the date field blank")); + + allValid &= highlightInvalid(ui->qslSentLabel, + ui->qslPaperSentDateEdit->date() == ui->qslPaperSentDateEdit->minimumDate() + && ( ui->qslPaperSentStatusBox->currentData().toString() == "Y" + // || ui->qslPaperSentStatusBox->currentData().toString() == "Q" // QLog does not set date for Q state + // || ui->qslPaperSentStatusBox->currentData().toString() == "I" // QLog does not set date for I state + ), + tr("Date should be present for Paper Sent Status Yes")); qCDebug(runtime) << "Validation result: " << allValid; return allValid; @@ -1535,10 +1564,7 @@ void QSOEditMapperDelegate::setEditorData(QWidget *editor, return; } else if ( editor->objectName() == "qslEqslReceiveDateLabel" - || editor->objectName() == "qslEqslSentDateLabel" - || editor->objectName() == "qslLotwReceiveDateLabel" - || editor->objectName() == "qslLotwSentDateLabel" - ) + || editor->objectName() == "qslLotwReceiveDateLabel" ) { QLabel* label = qobject_cast(editor); @@ -1604,7 +1630,9 @@ void QSOEditMapperDelegate::setEditorData(QWidget *editor, } } else if ( editor->objectName() == "qslPaperReceiveDateEdit" - || editor->objectName() == "qslPaperSentDateEdit") + || editor->objectName() == "qslPaperSentDateEdit" + || editor->objectName() == "qslLotwSentDateEdit" + || editor->objectName() == "qslEqslSentDateEdit" ) { QDateEdit *dateEdit = qobject_cast(editor); @@ -1683,7 +1711,9 @@ void QSOEditMapperDelegate::setModelData(QWidget *editor, } } else if ( editor->objectName() == "qslPaperReceiveDateEdit" - || editor->objectName() == "qslPaperSentDateEdit" ) + || editor->objectName() == "qslPaperSentDateEdit" + || editor->objectName() == "qslLotwSentDateEdit" + || editor->objectName() == "qslEqslSentDateEdit" ) { QDateEdit *dateEdit = qobject_cast(editor); @@ -1716,10 +1746,8 @@ void QSOEditMapperDelegate::setModelData(QWidget *editor, return; } else if ( editor->objectName() == "qslEqslReceiveDateLabel" - || editor->objectName() == "qslEqslSentDateLabel" || editor->objectName() == "qslEqslReceiveStatusLabel" || editor->objectName() == "qslLotwReceiveDateLabel" - || editor->objectName() == "qslLotwSentDateLabel" || editor->objectName() == "qslLotwReceiveStatusLabel" || editor->objectName() == "qslReceivedMsgEdit" ) diff --git a/ui/QSODetailDialog.ui b/ui/QSODetailDialog.ui index 1e7b353f..97ceeb32 100644 --- a/ui/QSODetailDialog.ui +++ b/ui/QSODetailDialog.ui @@ -1441,167 +1441,37 @@ 4 - - - - - - - - - - - - true + + + + + 0 + 0 + - Manage QSL Card + Sent - - + + - + - - - - <b>Yes</b> - an outgoing QSL card has been sent; the QSO has been uploaded to, and accepted by, the online service<br/><b>No</b> - do not send an outgoing QSL card; do not upload the QSO to the online service<br/><b>Requested</b> - the contacted station has requested a QSL card; the contacted station has requested the QSO be uploaded to the online service<br/><b>Queued</b> - an outgoing QSL card has been selected to be sent; a QSO has been selected to be uploaded to the online service<br/> + + + - - - - - QSL Sent via - - - - - - - - 0 - 0 - - - - - 105 - 0 - - - - Qt::WheelFocus - - - - - - - Received Message: - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - Received - - - - - - - - 0 - 0 - - - - - 75 - true - - - - Paper - - - - - - - - 0 - 0 - - - - - 75 - true - - - - LoTW - - - - - - - - 0 - 0 - - - - - 75 - true - - - - eQSL - - - - - - - QSL via - - - @@ -1609,35 +1479,17 @@ - - - - - - - - - - - - - - <b>Yes</b> - an outgoing QSL card has been sent; the QSO has been uploaded to, and accepted by, the online service<br/><b>No</b> - do not send an outgoing QSL card; do not upload the QSO to the online service<br/><b>Requested</b> - the contacted station has requested a QSL card; the contacted station has requested the QSO be uploaded to the online service<br/><b>Queued</b> - an outgoing QSL card has been selected to be sent; a QSO has been selected to be uploaded to the online service<br/> - - - - - - - + + - + - - + - @@ -1645,15 +1497,18 @@ - - + + + + true + - + Manage QSL Card - - + + 0 @@ -1661,52 +1516,28 @@ - Sent + - - - - true - + + - Show QSL Card + - - - - - - 0 - 0 - - + + - - - - - 0 - 0 - - - - - 0 - 0 - - - - Qt::StrongFocus - - - 25 + + + + QSL Sent via @@ -1766,6 +1597,130 @@ + + + + + 0 + 0 + + + + + 105 + 0 + + + + Qt::WheelFocus + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Paper + + + + + + + + + + 0 + 0 + + + + Blank + + + + 1900 + 1 + 1 + + + + + 1900 + 1 + 1 + + + + + + + + <b>Yes</b> - an outgoing QSL card has been sent; the QSO has been uploaded to, and accepted by, the online service<br/><b>No</b> - do not send an outgoing QSL card; do not upload the QSO to the online service<br/><b>Requested</b> - the contacted station has requested a QSL card; the contacted station has requested the QSO be uploaded to the online service<br/><b>Queued</b> - an outgoing QSL card has been selected to be sent; a QSO has been selected to be uploaded to the online service<br/> + + + + + + + + + + + + 0 + 0 + + + + Blank + + + + 1900 + 1 + 1 + + + + + 1900 + 1 + 1 + + + + + + + + <b>Yes</b> - an outgoing QSL card has been sent; the QSO has been uploaded to, and accepted by, the online service<br/><b>No</b> - do not send an outgoing QSL card; do not upload the QSO to the online service<br/><b>Requested</b> - the contacted station has requested a QSL card; the contacted station has requested the QSO be uploaded to the online service<br/><b>Queued</b> - an outgoing QSL card has been selected to be sent; a QSO has been selected to be uploaded to the online service<br/> + + + + + + + + + true + + + Show QSL Card + + + @@ -1819,23 +1774,108 @@ - - - - - - - - - - - - - - - - - - - + + + + Received Message: + + + + + + + + 0 + 0 + + + + Received + + + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 20 + 20 + + + + + + + + QSL via + + + + + + + + 0 + 0 + + + + + 75 + true + + + + LoTW + + + + + + + + 0 + 0 + + + + + 75 + true + + + + eQSL + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Qt::StrongFocus + + + 25 + +