From 6b283e598a3a08c6133d66b5d5617370296e7d0e Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 8 Nov 2018 16:58:33 +0100 Subject: Dive list: replace dive-list of trips by a table The dives of each trip were kept in a list. Replace this by a struct dive_table. This will make it significantly easier to keep the dives of a trip in sorted state. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 8bae01d86..cc98286a2 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1275,8 +1275,6 @@ bool QMLManager::undoDelete(int id) struct dive_trip *trip = deletedDive->divetrip; tripflag_t tripflag = deletedDive->tripflag; // this gets overwritten in add_dive_to_trip() deletedDive->divetrip = NULL; - deletedDive->next = NULL; - deletedDive->pprev = NULL; add_dive_to_trip(deletedDive, trip); deletedDive->tripflag = tripflag; } @@ -1309,11 +1307,11 @@ void QMLManager::deleteDive(int id) memset(deletedTrip, 0, sizeof(struct dive_trip)); } // if this is the last dive in that trip, remember the trip as well - if (d->divetrip && d->divetrip->nrdives == 1) { + if (d->divetrip && d->divetrip->dives.nr == 1) { *deletedTrip = *d->divetrip; deletedTrip->location = copy_string(d->divetrip->location); deletedTrip->notes = copy_string(d->divetrip->notes); - deletedTrip->nrdives = 0; + deletedTrip->dives.nr = 0; deletedDive->divetrip = deletedTrip; } DiveListModel::instance()->removeDiveById(id); -- cgit v1.2.3-70-g09d2