aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/command_divelist.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-30 18:39:27 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit58f2e5f77c2faaf4c2f75767ee8fde67cc0931ac (patch)
tree9f76fbf3ccb1cb17c516f077af08810f11fcb40d /desktop-widgets/command_divelist.cpp
parent837ab6c90b7952095c0dadf2de18db883b0f5ecf (diff)
downloadsubsurface-58f2e5f77c2faaf4c2f75767ee8fde67cc0931ac.tar.gz
Undo: use QUndoStack::isClean() to determine unsaved changes
Properly implement the unsaved-changes flag(s). Since we currently have two kinds of changes, there are two flags: 1) dive_list_changed in divelist.c marks non-undoable changes. This flag is only cleared on save or load. 2) QUndoStack::isClean() is used to determine the state of undoable changes. Every time the user returns to the state where they saved, this flag is cleared. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/command_divelist.cpp')
-rw-r--r--desktop-widgets/command_divelist.cpp14
1 files changed, 0 insertions, 14 deletions
diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp
index 4e1359ea7..31696f2ff 100644
--- a/desktop-widgets/command_divelist.cpp
+++ b/desktop-widgets/command_divelist.cpp
@@ -411,7 +411,6 @@ void AddDive::redoit()
divesAndSitesToRemove = addDives(divesToAdd);
sort_trip_table(&trip_table); // Though unlikely, adding a dive may reorder trips
- mark_divelist_changed(true);
// Select the newly added dive
restoreSelection(divesAndSitesToRemove.dives, divesAndSitesToRemove.dives[0]);
@@ -500,8 +499,6 @@ void ImportDives::redoit()
// Remember dives and sites to remove
divesAndSitesToRemove = std::move(divesAndSitesToRemoveNew);
-
- mark_divelist_changed(true);
}
void ImportDives::undoit()
@@ -517,8 +514,6 @@ void ImportDives::undoit()
// ...and restore the selection
restoreSelection(selection, currentDive);
-
- mark_divelist_changed(true);
}
DeleteDive::DeleteDive(const QVector<struct dive*> &divesToDeleteIn)
@@ -536,7 +531,6 @@ void DeleteDive::undoit()
{
divesToDelete = addDives(divesToAdd);
sort_trip_table(&trip_table); // Though unlikely, removing a dive may reorder trips
- mark_divelist_changed(true);
// Select all re-added dives and make the first one current
dive *currentDive = !divesToDelete.dives.empty() ? divesToDelete.dives[0] : nullptr;
@@ -547,7 +541,6 @@ void DeleteDive::redoit()
{
divesToAdd = removeDives(divesToDelete);
sort_trip_table(&trip_table); // Though unlikely, adding a dive may reorder trips
- mark_divelist_changed(true);
// Deselect all dives and select dive that was close to the first deleted dive
dive *newCurrent = nullptr;
@@ -587,8 +580,6 @@ void ShiftTime::redoit()
// Negate the time-shift so that the next call does the reverse
timeChanged = -timeChanged;
-
- mark_divelist_changed(true);
}
bool ShiftTime::workToBeDone()
@@ -611,7 +602,6 @@ RenumberDives::RenumberDives(const QVector<QPair<dive *, int>> &divesToRenumberI
void RenumberDives::undoit()
{
renumberDives(divesToRenumber);
- mark_divelist_changed(true);
}
bool RenumberDives::workToBeDone()
@@ -634,8 +624,6 @@ void TripBase::redoit()
{
moveDivesBetweenTrips(divesToMove);
sort_trip_table(&trip_table); // Though unlikely, moving dives may reorder trips
-
- mark_divelist_changed(true);
}
void TripBase::undoit()
@@ -764,7 +752,6 @@ void SplitDivesBase::redoit()
{
divesToUnsplit = addDives(splitDives);
unsplitDive = removeDives(diveToSplit);
- mark_divelist_changed(true);
// Select split dives and make first dive current
restoreSelection(divesToUnsplit.dives, divesToUnsplit.dives[0]);
@@ -775,7 +762,6 @@ void SplitDivesBase::undoit()
// Note: reverse order with respect to redoit()
diveToSplit = addDives(unsplitDive);
splitDives = removeDives(divesToUnsplit);
- mark_divelist_changed(true);
// Select unsplit dive and make it current
restoreSelection(diveToSplit.dives, diveToSplit.dives[0] );