From 13f49999db0865669cfc3105e9838436f816575b Mon Sep 17 00:00:00 2001 From: Ladislav Foldyna Date: Wed, 1 Mar 2023 12:07:27 +0100 Subject: [PATCH] Fixed #176 - QSO Detail: Added posibility to change _SENT Status Values --- ui/QSODetailDialog.cpp | 46 ++++++++++++++++++++++++++++++++++++------ ui/QSODetailDialog.ui | 12 +++++------ 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/ui/QSODetailDialog.cpp b/ui/QSODetailDialog.cpp index ace8004d..631fdc63 100644 --- a/ui/QSODetailDialog.cpp +++ b/ui/QSODetailDialog.cpp @@ -187,6 +187,28 @@ QSODetailDialog::QSODetailDialog(const QSqlRecord &qso, ui->qslPaperSentStatusBox->addItem(tr("Queued"), QVariant("Q")); ui->qslPaperSentStatusBox->addItem(tr("Ignored"), QVariant("I")); + /* Combo Mapping */ + /* do no use DEFINE_CONTACT_FIELDS_ENUMS for it because + * DEFINE_CONTACT_FIELDS_ENUMS has a different ordering. + * Ordering below is optimized for a new Contact Widget only + */ + ui->qslLotwSentStatusBox->addItem(tr("No"), QVariant("N")); + ui->qslLotwSentStatusBox->addItem(tr("Yes"), QVariant("Y")); + ui->qslLotwSentStatusBox->addItem(tr("Requested"), QVariant("R")); + ui->qslLotwSentStatusBox->addItem(tr("Queued"), QVariant("Q")); + ui->qslLotwSentStatusBox->addItem(tr("Ignored"), QVariant("I")); + + /* Combo Mapping */ + /* do no use DEFINE_CONTACT_FIELDS_ENUMS for it because + * DEFINE_CONTACT_FIELDS_ENUMS has a different ordering. + * Ordering below is optimized for a new Contact Widget only + */ + ui->qslEqslSentStatusBox->addItem(tr("No"), QVariant("N")); + ui->qslEqslSentStatusBox->addItem(tr("Yes"), QVariant("Y")); + ui->qslEqslSentStatusBox->addItem(tr("Requested"), QVariant("R")); + ui->qslEqslSentStatusBox->addItem(tr("Queued"), QVariant("Q")); + ui->qslEqslSentStatusBox->addItem(tr("Ignored"), QVariant("I")); + QMapIterator iter(qslRcvdEnum); while( iter.hasNext() ) @@ -308,9 +330,9 @@ QSODetailDialog::QSODetailDialog(const QSqlRecord &qso, mapper->addMapping(ui->qslLotwReceiveDateLabel, LogbookModel::COLUMN_LOTW_RCVD_DATE); mapper->addMapping(ui->qslLotwSentDateLabel, LogbookModel::COLUMN_LOTW_SENT_DATE); mapper->addMapping(ui->qslEqslReceiveStatusLabel, LogbookModel::COLUMN_EQSL_QSL_RCVD); - mapper->addMapping(ui->qslEqslSentStatusLabel, LogbookModel::COLUMN_EQSL_QSL_SENT); + mapper->addMapping(ui->qslEqslSentStatusBox, LogbookModel::COLUMN_EQSL_QSL_SENT); mapper->addMapping(ui->qslLotwReceiveStatusLabel, LogbookModel::COLUMN_LOTW_RCVD); - mapper->addMapping(ui->qslLotwSentStatusLabel, LogbookModel::COLUMN_LOTW_SENT); + mapper->addMapping(ui->qslLotwSentStatusBox, LogbookModel::COLUMN_LOTW_SENT); mapper->addMapping(ui->qslReceivedMsgEdit, LogbookModel::COLUMN_QSLMSG, "text"); mapper->addMapping(ui->qslSentViaBox, LogbookModel::COLUMN_QSL_SENT_VIA); mapper->addMapping(ui->qslViaEdit, LogbookModel::COLUMN_QSL_VIA); @@ -900,6 +922,18 @@ bool QSODetailDialog::doValidation() && ui->myGridEdit->text().toUpper() != myPOTAGrid.getGrid().toUpper(), 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")); + + 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")); + qCDebug(runtime) << "Validation result: " << allValid; return allValid; } @@ -1410,6 +1444,8 @@ void QSOEditMapperDelegate::setEditorData(QWidget *editor, || editor->objectName() == "qslSentViaBox" || editor->objectName() == "qslPaperSentStatusBox" || editor->objectName() == "qslPaperReceiveStatusBox" + || editor->objectName() == "qslLotwSentStatusBox" + || editor->objectName() == "qslEqslSentStatusBox" ) { QComboBox* combo = qobject_cast(editor); @@ -1459,9 +1495,7 @@ void QSOEditMapperDelegate::setEditorData(QWidget *editor, return; } else if ( editor->objectName() == "qslEqslReceiveStatusLabel" - || editor->objectName() == "qslEqslSentStatusLabel" || editor->objectName() == "qslLotwReceiveStatusLabel" - || editor->objectName() == "qslLotwSentStatusLabel" ) { QLabel* label = qobject_cast(editor); @@ -1539,6 +1573,8 @@ void QSOEditMapperDelegate::setModelData(QWidget *editor, || editor->objectName() == "qslSentViaBox" || editor->objectName() == "qslPaperSentStatusBox" || editor->objectName() == "qslPaperReceiveStatusBox" + || editor->objectName() == "qslLotwSentStatusBox" + || editor->objectName() == "qslEqslSentStatusBox" ) { QComboBox* combo = static_cast(editor); @@ -1615,11 +1651,9 @@ void QSOEditMapperDelegate::setModelData(QWidget *editor, else if ( editor->objectName() == "qslEqslReceiveDateLabel" || editor->objectName() == "qslEqslSentDateLabel" || editor->objectName() == "qslEqslReceiveStatusLabel" - || editor->objectName() == "qslEqslSentStatusLabel" || editor->objectName() == "qslLotwReceiveDateLabel" || editor->objectName() == "qslLotwSentDateLabel" || editor->objectName() == "qslLotwReceiveStatusLabel" - || editor->objectName() == "qslLotwSentStatusLabel" || editor->objectName() == "qslReceivedMsgEdit" ) { diff --git a/ui/QSODetailDialog.ui b/ui/QSODetailDialog.ui index b68a3941..849d9dbd 100644 --- a/ui/QSODetailDialog.ui +++ b/ui/QSODetailDialog.ui @@ -1453,9 +1453,9 @@ - - - - + + + <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/> @@ -1604,9 +1604,9 @@ - - - - + + + <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/>