summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-24 14:02:08 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-24 14:03:36 -0700
commite4b8cf89a1b798a2f266b3dbc01b82155320ea9d (patch)
tree04ffc21b2e14f6b53419e00afa54cfcb04c6fcd8 /qt-ui/divelistview.cpp
parent10e567515161f23510874236efd2f105c033ecec (diff)
downloadsubsurface-e4b8cf89a1b798a2f266b3dbc01b82155320ea9d.tar.gz
Dive list: move trip merging logic into divelist.c
This also fixes a couple of issues with the existing code: - removes a memory leak - treats null and "" the same Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 1f716ed57..77a51343b 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -535,17 +535,9 @@ void DiveListView::merge_trip(const QModelIndex &a, int offset)
dive_trip_t *trip_a = (dive_trip_t *)a.data(DiveTripModel::TRIP_ROLE).value<void *>();
dive_trip_t *trip_b = (dive_trip_t *)b.data(DiveTripModel::TRIP_ROLE).value<void *>();
- // TODO: merge_trip on the C code? some part of this needs to stay ( getting the trips from the model,
- // but not the algorithm.
if (trip_a == trip_b || !trip_a || !trip_b)
return;
-
- if (!trip_a->location && trip_b->location)
- trip_a->location = strdup(trip_b->location);
- if (!trip_a->notes && trip_b->notes)
- trip_a->notes = strdup(trip_b->notes);
- while (trip_b->dives)
- add_dive_to_trip(trip_b->dives, trip_a);
+ combine_trips(trip_a, trip_b);
rememberSelection();
reload(currentLayout, false);
fixMessyQtModelBehaviour();