aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-05-06 15:56:28 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-08 13:14:51 -0700
commit543f226db0512e0f058eeb85a79439c580a3d12e (patch)
tree21883df57871381fd91f9f28ad9d0dcb7e565cde /qt-ui/mainwindow.cpp
parente3ef1b7a1ea58d7f6f912dc00412d7ee954cb5fe (diff)
downloadsubsurface-543f226db0512e0f058eeb85a79439c580a3d12e.tar.gz
Planner: Offer to discard the plan when Quit is triggered in planner.
Upon pressing Ctrl-Q or the window close button a modal dialog was shown to remind the user that the planned dive is not saved. This patch triggers the "cancel plan" action before trying to quit. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index b03fbe14c..fb5e3af8e 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -352,11 +352,17 @@ void MainWindow::on_actionPreferences_triggered()
void MainWindow::on_actionQuit_triggered()
{
- if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
- ui.InfoWidget->isEditing()) {
+ if (ui.InfoWidget->isEditing()) {
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file."));
return;
}
+ if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) {
+ DivePlannerPointsModel::instance()->cancelPlan();
+ if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING)
+ // The planned dive was not discarded
+ return;
+ }
+
if (unsaved_changes() && (askSaveChanges() == false))
return;
writeSettings();