aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-24 12:32:18 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-24 12:32:18 -0700
commit72f0516f6dc36fb3813563a76dac86d946aba5b8 (patch)
tree11ee661194f29ba9f81e77caef030464f7da3e6c /qt-ui/maintab.cpp
parent446ab45858b509e56029e5c1557a12ca3680a674 (diff)
downloadsubsurface-72f0516f6dc36fb3813563a76dac86d946aba5b8.tar.gz
Disable info widget when canceling 'add dive' for a first dive
One more corner case that we cover correctly. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 6a3d46a99..d9249046f 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -469,6 +469,11 @@ void MainTab::rejectChanges()
ui->notes->setText(notesBackup[NULL].notes );
ui->location->setText(notesBackup[NULL].location);
}else{
+ if (editMode == ADD) {
+ // clean up
+ delete_single_dive(selected_dive);
+ DivePlannerPointsModel::instance()->cancelPlan();
+ }
struct dive *curr = current_dive;
ui->notes->setText(notesBackup[curr].notes );
ui->location->setText(notesBackup[curr].location);
@@ -520,10 +525,8 @@ void MainTab::rejectChanges()
ui->watertemp->setPalette(p);
ui->dateTimeEdit->setPalette(p);
if (editMode == ADD) {
- // clean up
- delete_single_dive(selected_dive);
- selected_dive = -1;
- DivePlannerPointsModel::instance()->cancelPlan();
+ // more clean up
+ updateDiveInfo(selected_dive);
mainWindow()->showProfile();
mainWindow()->refreshDisplay();
}