mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: assign a dive number if the right number seems obvious
Use the same logic as we do for newly added dives. As a side effect this patch appears to fix the issues with getting the newly planned dive selected. Fixes #692 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
88fe28636e
commit
0f1381f160
4 changed files with 16 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue