diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-11-15 13:42:49 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-15 13:42:49 -0800 |
commit | 0c833ef03bc77d637cfb0ffb989a4462a56aa06e (patch) | |
tree | 110c2842a20a4d39602c236a2e2a5ec07a1a6d62 /qt-ui | |
parent | e5308c068f76115a28c9fe0c0e14ca87b96d4f90 (diff) | |
download | subsurface-0c833ef03bc77d637cfb0ffb989a4462a56aa06e.tar.gz |
Don't close the active file or start "add dive" while editing a dive
Seems rather obvious to me - the language in the warning doesn't sound
very smooth, though.
Fixes #246
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/mainwindow.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 06b0be08d..31e1d64f0 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -99,6 +99,10 @@ void MainWindow::on_actionNew_triggered() void MainWindow::on_actionOpen_triggered() { + if (ui.InfoWidget->isEditing()) { + QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before opening a new file." ); + return; + } QString filename = QFileDialog::getOpenFileName(this, tr("Open File"), lastUsedDir(), filter()); if (filename.isEmpty()) return; @@ -131,6 +135,10 @@ void MainWindow::cleanUpEmpty() void MainWindow::on_actionClose_triggered() { + if (ui.InfoWidget->isEditing()) { + QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before closing the file." ); + return; + } if (unsaved_changes() && (askSaveChanges() == FALSE)) return; @@ -204,8 +212,9 @@ void MainWindow::enableDcShortcuts() void MainWindow::on_actionDivePlanner_triggered() { - if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING){ - QMessageBox::warning(this, tr("Warning"), "First finish the current edition before trying to do another." ); + if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING || + ui.InfoWidget->isEditing()) { + QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before trying to plan a dive." ); return; } disableDcShortcuts(); @@ -261,8 +270,9 @@ void MainWindow::on_actionEditDeviceNames_triggered() void MainWindow::on_actionAddDive_triggered() { - if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING){ - QMessageBox::warning(this, tr("Warning"), "First finish the current edition before trying to do another." ); + if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING || + ui.InfoWidget->isEditing()) { + QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before trying to add a dive." ); return; } dive_list()->rememberSelection(); |