summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-12 14:21:50 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-12 14:21:50 +0900
commita683a217b9cbc402a7db0eb77071d1d8151c03cf (patch)
tree70feca17903583297e9247eed332a8d4a76223fe /qt-ui/mainwindow.cpp
parent94222fbe4905ea3f0e982b61a69290439c7f4e2d (diff)
downloadsubsurface-a683a217b9cbc402a7db0eb77071d1d8151c03cf.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp8
1 files changed, 3 insertions, 5 deletions
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.