From bebcbfe92ac29681db0f4662b930c5f8a48448d3 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 16 Jul 2014 19:44:06 -0300 Subject: Desselects the trip before dive add / plan, and reselects it on cancel When we had a trip selected, we ignored that and simply called the DiveAdd functions, but the mainTab code that deal with selections to show one or more dives or trips asked how many trips were selected to the DiveList, and since a trip was selected things go kabum. Fixes #606 Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 2 ++ qt-ui/mainwindow.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 439e114df..4c46d36ac 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -808,6 +808,8 @@ void MainTab::rejectChanges() resetPallete(); // no harm done to call cancelPlan even if we were not in ADD or PLAN mode... DivePlannerPointsModel::instance()->cancelPlan(); + if(lastMode == ADD) + MainWindow::instance()->dive_list()->restoreSelection(); // now make sure that the correct dive is displayed if (selected_dive >= 0) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 6e6859e2f..c84766038 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -470,6 +470,11 @@ void MainWindow::on_actionAddDive_triggered() if(!plannerStateClean()) return; + if (dive_list()->selectedTrips().count() >= 1){ + dive_list()->rememberSelection(); + dive_list()->clearSelection(); + } + ui.ListWidget->endSearch(); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD); -- cgit v1.2.3-70-g09d2