summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-07-22 09:23:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-11 16:22:27 -0700
commitdd9af8e72e169256f2d3ea53cff9d5bbd8feb9fa (patch)
tree2265ef07aa8b4944bac689cf84e5454501e39230 /desktop-widgets/simplewidgets.cpp
parentba9c35215e88dea0505e0f82531941797fc1ce7d (diff)
downloadsubsurface-dd9af8e72e169256f2d3ea53cff9d5bbd8feb9fa.tar.gz
Undo: make editing of dive-time an undoable operation
The whole undo system assumes that the indexes in the dive table do not change under its feet. On desktop, there seems only one exception left: editing of the dive time. To circumvent this, hook editing of the dive-time to the already existing UndoShiftTime command. This introduces a temporary UI-inconsistency: this is the only edit that is reflected in the undo-list. This will be fixed in due course, when other edit actions are also made undoable. UndoShiftTime is changed to take pointers to dives (which should be stable by now) instead of uniq-ids. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/simplewidgets.cpp')
-rw-r--r--desktop-widgets/simplewidgets.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index 25345551a..b7f985bc9 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -240,18 +240,13 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton *button)
if (amount != 0) {
// DANGER, DANGER - this could get our dive_table unsorted...
int i;
- struct dive *dive;
- QVector<int> affectedDives;
- for_each_dive (i, dive) {
- if (!dive->selected)
- continue;
-
- affectedDives.append(dive->id);
+ struct dive *d;
+ QVector<dive *> affectedDives;
+ for_each_dive (i, d) {
+ if (d->selected)
+ affectedDives.append(d);
}
MainWindow::instance()->undoStack->push(new UndoShiftTime(affectedDives, amount));
- MainWindow::instance()->dive_list()->rememberSelection();
- MainWindow::instance()->refreshDisplay();
- MainWindow::instance()->dive_list()->restoreSelection();
}
}
}