Fix a couple of problems with dive merging

- Dive list no longer has messed up trip entries
- Dive list is now correctly marked as modified after trips are merged
- When data file is closed, the list of selected trips is cleared which
  avoids a potential crash when loading a new data file

Fixes #286

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-11-17 14:37:10 -08:00
parent 962abba1f7
commit 7a6ff7a53c
2 changed files with 5 additions and 0 deletions

View file

@ -437,7 +437,11 @@ void DiveListView::merge_trip(const QModelIndex &a, int offset)
trip_a->notes = strdup(trip_b->notes);
while (trip_b->dives)
add_dive_to_trip(trip_b->dives, trip_a);
rememberSelection();
reload(currentLayout, false);
fixMessyQtModelBehaviour();
restoreSelection();
mark_divelist_changed(TRUE);
}
void DiveListView::mergeTripAbove()

View file

@ -145,6 +145,7 @@ void MainWindow::on_actionClose_triggered()
while (dive_table.nr)
delete_single_dive(0);
dive_list()->selectedTrips.clear();
/* clear the selection and the statistics */
selected_dive = -1;