diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-12-16 16:37:44 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-12-16 16:37:44 -0800 |
commit | fe88a2a4765c45bcea8387438574f9c1014997b8 (patch) | |
tree | 1105d966df1260bebac2509ccc80bc7d41fdc152 /qt-ui/mainwindow.cpp | |
parent | 397898434e52ba1e1cc593e83d43080918698a9b (diff) | |
download | subsurface-fe88a2a4765c45bcea8387438574f9c1014997b8.tar.gz |
Don't quit while dive is edited
If the user edits a dive and then quits we try to ask them to finish
editing, first. If the user did this by either clicking the little 'x'
in the window decoration or by hitting Alt-F4 (or similar), we didn't
have that question (only the 'save changes' question in case the dive list
had already been modified.
Fixes #374
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 1ea115fc7..fbe37793b 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -700,6 +700,13 @@ void MainWindow::writeSettings() void MainWindow::closeEvent(QCloseEvent *event) { + if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING || + ui.InfoWidget->isEditing()) { + QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file.")); + event->ignore(); + return; + } + if (helpView && helpView->isVisible()){ helpView->close(); helpView->deleteLater(); |