summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-05-28 15:43:32 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-28 12:25:36 -0700
commit1e4f744165608d208690531d5ff5da558ccd31d2 (patch)
tree75353340237c12c1f617ebc7646d2f7dcf38e6ad /qt-ui/diveplanner.cpp
parent2f8f632cf6c1b4627b5307b6f325d6e8f6291f82 (diff)
downloadsubsurface-1e4f744165608d208690531d5ff5da558ccd31d2.tar.gz
Fixes showing the Empty Profile when Add / Plan dive is cancelled.
for some reason the next selected dive is NULL after cancelling the plan. I'm investigating. This patch fixes the show of the empty profile and it also untangles some parts of the code, keeping the mainwindow where it should belong : the mainwindow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index e8e0b2ca3..6943283d9 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -256,7 +256,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
connect(ui.buttonBox, SIGNAL(rejected()), plannerModel, SLOT(cancelPlan()));
connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(removeFakeDiveForAddAndPlan()));
connect(plannerModel, SIGNAL(planCreated()), MainWindow::instance(), SLOT(showProfile()));
- connect(plannerModel, SIGNAL(planCanceled()), MainWindow::instance(), SLOT(showProfile()));
+ connect(plannerModel, SIGNAL(planCanceled()), MainWindow::instance(), SLOT(planCanceled()));
/* set defaults. */
ui.startTime->setTime(QTime(1, 0));
@@ -653,18 +653,14 @@ void DivePlannerPointsModel::cancelPlan()
return;
}
}
- // we unselected all dives earlier, so restore that first and then recreate the dive list
- MainWindow::instance()->removeFakeDiveForAddAndPlan();
- MainWindow::instance()->dive_list()->restoreSelection();
- MainWindow::instance()->dive_list()->reload(DiveTripModel::CURRENT);
- MainWindow::instance()->refreshDisplay();
- emit planCanceled();
+
if (mode != ADD) {
free(stagingDive);
stagingDive = NULL;
}
setPlanMode(NOTHING);
diveplan.dp = NULL;
+ emit planCanceled();
}
DivePlannerPointsModel::Mode DivePlannerPointsModel::currentMode() const