diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-11-12 14:41:29 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-12 14:41:29 +0900 |
commit | 662b1061f0e6a83ce25b4a187bf7fa3b2efd59e1 (patch) | |
tree | 2947609a8aa9fe0058f4d7fd170e5d0c95673144 /qt-ui/maintab.cpp | |
parent | a683a217b9cbc402a7db0eb77071d1d8151c03cf (diff) | |
download | subsurface-662b1061f0e6a83ce25b4a187bf7fa3b2efd59e1.tar.gz |
Handle add dive cancel correctly
This should leave the program in a consistent state after add dive was
cancelled (and do the right thing in case the dive list was empty).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index d5199d447..7ee6e834c 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -544,6 +544,7 @@ void MainTab::resetPallete() void MainTab::rejectChanges() { + EditMode lastMode = editMode; tabBar()->setTabIcon(0, QIcon()); // Notes tabBar()->setTabIcon(1, QIcon()); // Equipment @@ -552,11 +553,11 @@ void MainTab::rejectChanges() ui.notes->setText(notesBackup[NULL].notes ); ui.location->setText(notesBackup[NULL].location); } else { - if (editMode == ADD) { + if (lastMode == ADD) { // clean up DivePlannerPointsModel::instance()->cancelPlan(); delete_single_dive(selected_dive); - } else if (editMode == MANUALLY_ADDED_DIVE ) { + } else if (lastMode == MANUALLY_ADDED_DIVE ) { DivePlannerPointsModel::instance()->undoEdition(); // that's BOGUS... just copy the original dive back and be done with it... } struct dive *curr = current_dive; @@ -617,7 +618,7 @@ void MainTab::rejectChanges() ui.equipmentButtonBox->hide(); notesBackup.clear(); resetPallete(); - if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE) { + if (lastMode == ADD || lastMode == MANUALLY_ADDED_DIVE) { // more clean up updateDiveInfo(selected_dive); mainWindow()->showProfile(); |