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>
This commit is contained in:
Dirk Hohndel 2013-11-12 14:21:50 +09:00
parent 94222fbe49
commit a683a217b9
3 changed files with 20 additions and 11 deletions

View file

@ -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.