From f427226b3b605523bc8285dbdaaa7f6993af6e6a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 23 Sep 2018 21:22:48 +0200 Subject: Undo: make diverse trip-related operations undo-able AddDivesToTrip, CreateTrip, AutogroupDives, RemoveAutogenTrips and MergeTrips basically all did the same thing as RemoveDivesFromTrip, which was already implemented. Thus, factor our the common functionality and hook it up to make all these functions undo-able. Don't do the autogroup-call everytime the dive-list is rebuilt (that would create innumberable undo-actions), but only on dive-load / import or if expressly asked by the user [by switching the autogroup flag]. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 9254230f9..22431de30 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1300,7 +1300,7 @@ void QMLManager::deleteDive(int id) deletedDive = alloc_dive(); copy_dive(d, deletedDive); if (!deletedTrip) { - deletedTrip = (struct dive_trip *)calloc(1, sizeof(struct dive_trip)); + deletedTrip = alloc_trip(); } else { free(deletedTrip->location); free(deletedTrip->notes); -- cgit v1.2.3-70-g09d2