summaryrefslogtreecommitdiffstats
path: root/qt-models/divetripmodel.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-09-23 21:22:48 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-11 16:22:27 -0700
commitf427226b3b605523bc8285dbdaaa7f6993af6e6a (patch)
treee025722f92883fbac72b3584d6b4fb301bb8a40d /qt-models/divetripmodel.cpp
parent4fbb8ef399a356e0b1a7393311c22ca68c50a14d (diff)
downloadsubsurface-f427226b3b605523bc8285dbdaaa7f6993af6e6a.tar.gz
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r--qt-models/divetripmodel.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index 58ccc0fd2..406c5eee6 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -643,8 +643,6 @@ void DiveTripModel::setupModelData()
beginResetModel();
- if (autogroup)
- autogroup_dives();
items.clear();
while (--i >= 0) {
dive *d = get_dive(i);
@@ -665,7 +663,6 @@ void DiveTripModel::setupModelData()
if (it == items.end()) {
// We didn't find an entry for this trip -> add one
items.emplace_back(trip, d);
-
} else {
// We found the trip -> simply add the dive
it->dives.push_back(d);