Skip to content

Commit

Permalink
Update dialog assert to not close dialogs in many cases
Browse files Browse the repository at this point in the history
  • Loading branch information
shermp committed Oct 17, 2021
1 parent 53b7277 commit f3a8c18
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/ndb/NDBCfmDlg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#include "NDBCfmDlg.h"

#define DLG_ASSERT(ret, cond, str) if (!(cond)) { \
errString = QString("%1: %2").arg(__func__).arg(str); \
return (ret); \
}

#define DLG_ASSERT_CLOSE(ret, cond, str) if (!(cond)) { \
errString = QString("%1: %2").arg(__func__).arg(str); \
if (dlg) { \
connectStdSignals(); \
Expand Down Expand Up @@ -114,7 +119,7 @@ N3ConfirmationTextEditField* NDBCfmDlg::createTextEditField() {

enum Result NDBCfmDlg::createDialog(enum dialogType dlgType) {
DLG_ASSERT(ForbiddenError, !dlg, "dialog already open");
DLG_ASSERT(
DLG_ASSERT_CLOSE(
SymbolError,
symbols.ConfirmationDialogFactory_getConfirmationDialog &&
symbols.ConfirmationDialogFactory_showTextEditDialog &&
Expand All @@ -127,7 +132,7 @@ enum Result NDBCfmDlg::createDialog(enum dialogType dlgType) {
"could not find one or more standard dialog symbols"
);
if (dlgType == TypeLineEdit) {
DLG_ASSERT(
DLG_ASSERT_CLOSE(
SymbolError,
(symbols.N3ConfirmationTextEditField__N3ConfirmationTextEditFieldKS ||
symbols.N3ConfirmationTextEditField__N3ConfirmationTextEditField) &&
Expand All @@ -139,18 +144,18 @@ enum Result NDBCfmDlg::createDialog(enum dialogType dlgType) {
switch (dlgType) {
case TypeStd:
dlg = symbols.ConfirmationDialogFactory_getConfirmationDialog(nullptr);
DLG_ASSERT(NullError, dlg, "could not get confirmation dialog");
DLG_ASSERT_CLOSE(NullError, dlg, "could not get confirmation dialog");
currActiveType = TypeStd;
break;

case TypeLineEdit:
dlg = symbols.ConfirmationDialogFactory_showTextEditDialog("");
DLG_ASSERT(NullError, dlg, "could not get line edit dialog");
DLG_ASSERT_CLOSE(NullError, dlg, "could not get line edit dialog");
dlg->hide();
tef = createTextEditField();
DLG_ASSERT(NullError, tef, "error getting text edit field");
DLG_ASSERT_CLOSE(NullError, tef, "error getting text edit field");
tle = symbols.N3ConfirmationTextEditField__textEdit(tef);
DLG_ASSERT(NullError, tle, "error getting TouchLineEdit");
DLG_ASSERT_CLOSE(NullError, tle, "error getting TouchLineEdit");
// Make the 'Go' key accept the dialog.
if (!QObject::connect(tef, SIGNAL(commitRequested()), dlg, SIGNAL(accepted()))) {
nh_log("unable to connect N3ConfirmationTextEditField::commitRequested() to ConfirmationDialog::accepted()");
Expand Down

0 comments on commit f3a8c18

Please sign in to comment.