From a683a217b9cbc402a7db0eb77071d1d8151c03cf Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 12 Nov 2013 14:21:50 +0900 Subject: First steps to make add dive work with the correct infrastructure This just makes sure that we do the right thing with the staging drive, that we don't mess up the selection, the we are smart about using our helper functions, etc. Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 348d08c44..a0bbcf04b 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -283,11 +283,7 @@ void MainWindow::on_actionAddDive_triggered() } // clear the selection - for (int i = 0; i < dive_table.nr; i++) { - struct dive *d = get_dive(i); - if (d && d->selected) - deselect_dive(i); - } + dive_list()->unselectDives(); disableDcShortcuts(); DivePlannerPointsModel::instance()->clear(); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD); @@ -296,6 +292,8 @@ void MainWindow::on_actionAddDive_triggered() dive->when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset(); dive->dc.model = "manually added dive"; // don't translate! this is stored in the XML file record_dive(dive); + // this isn't in the UI yet, so let's call the C helper function - we'll fix this up when + // accepting the dive select_dive(get_divenr(dive)); ui.InfoWidget->updateDiveInfo(selected_dive); ui.stackedWidget->setCurrentIndex(PLANNERPROFILE); // Planner. -- cgit v1.2.3-70-g09d2