aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2018-12-03 11:36:55 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2018-12-11 09:26:18 +0100
commitb75081cc592df6ec074b1a5cf5e5b1c8c62a8780 (patch)
tree6fc9db6c76ae8462fedefb5c1b08197ffadb8c4e /desktop-widgets
parent99b2de85b5f71ad7bfd57bda5f0fb3b595b2b94f (diff)
downloadsubsurface-b75081cc592df6ec074b1a5cf5e5b1c8c62a8780.tar.gz
Invalidate git cache when removing dive from trip
... otherwise this change is not saved when saving to git. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/command_divelist.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp
index 2c474cf94..4e5c455f3 100644
--- a/desktop-widgets/command_divelist.cpp
+++ b/desktop-widgets/command_divelist.cpp
@@ -92,6 +92,7 @@ dive *DiveListBase::addDive(DiveToAdd &d)
res->hidden_by_filter = !show;
add_single_dive(d.idx, res); // Return ownership to backend
+ invalidate_dive_cache(res); // Ensure that dive is written in git_save()
// If the dive to be removed is selected, we will inform the frontend
// later via a signal that the dive changed.
@@ -191,7 +192,7 @@ std::vector<dive *> DiveListBase::addDives(std::vector<DiveToAdd> &divesToAdd)
// This helper function renumbers dives according to an array of id/number pairs.
// The old numbers are stored in the array, thus calling this function twice has no effect.
-// TODO: switch from uniq-id to indexes once all divelist-actions are controlled by undo-able commands
+// TODO: switch from uniq-id to indices once all divelist-actions are controlled by undo-able commands
static void renumberDives(QVector<QPair<dive *, int>> &divesToRenumber)
{
for (auto &pair: divesToRenumber) {
@@ -199,6 +200,7 @@ static void renumberDives(QVector<QPair<dive *, int>> &divesToRenumber)
if (!d)
continue;
std::swap(d->number, pair.second);
+ invalidate_dive_cache(d);
}
// Emit changed signals per trip.
@@ -239,6 +241,7 @@ static OwningTripPtr moveDiveToTrip(DiveToTrip &diveToTrip)
// Store old trip and get new trip we should associate this dive with
std::swap(trip, diveToTrip.trip);
add_dive_to_trip(diveToTrip.dive, trip);
+ invalidate_dive_cache(diveToTrip.dive); // Ensure that dive is written in git_save()
return res;
}