summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 18:01:00 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 18:01:00 -0700
commita12b10c008c4cce58db3b128349b7d9ce1a61296 (patch)
treebc9be55b13e73854391b9140b4575d8d04225d39 /qt-ui/maintab.cpp
parentd211bc55be8420ca5d6bc6a252f9318fc9c4fc43 (diff)
downloadsubsurface-a12b10c008c4cce58db3b128349b7d9ce1a61296.tar.gz
Ask before discarding edits
This is equivalent to what we do for the planner. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index fe579acb9..63e5d3a67 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -27,6 +27,7 @@
#include <QPalette>
#include <QScrollBar>
#include <QShortcut>
+#include <QMessageBox>
MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
weightModel(new WeightModel(this)),
@@ -780,6 +781,13 @@ void MainTab::resetPallete()
void MainTab::rejectChanges()
{
EditMode lastMode = editMode;
+ if (lastMode != NONE && current_dive && memcmp(&editedDive, current_dive, sizeof(struct dive))) {
+ if (QMessageBox::warning(MainWindow::instance(), TITLE_OR_TEXT(tr("Discard the Changes?"),
+ tr("You are about to discard your changes.")),
+ QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard) != QMessageBox::Discard) {
+ return;
+ }
+ }
editMode = NONE;
tabBar()->setTabIcon(0, QIcon()); // Notes
tabBar()->setTabIcon(1, QIcon()); // Equipment