diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/maintab.cpp | 5 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 5002a2880..6bb6f14f8 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -771,10 +771,7 @@ void MainTab::acceptChanges() } if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE) { fixup_dive(current_dive); - if (dive_table.nr == 1) - current_dive->number = 1; - else if (selected_dive == dive_table.nr - 1 && get_dive(dive_table.nr - 2)->number) - current_dive->number = get_dive(dive_table.nr - 2)->number + 1; + set_dive_nr_for_current_dive(); MainWindow::instance()->showProfile(); mark_divelist_changed(true); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 9912d60bd..b27f2b606 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -402,6 +402,12 @@ void MainWindow::planCanceled() void MainWindow::planCreated() { + // get the new dive selected and assign a number if reasonable + dive_list()->unselectDives(); + select_dive(dive_table.nr - 1); + dive_list()->selectDive(selected_dive); + set_dive_nr_for_current_dive(); + showProfile(); refreshDisplay(); } |