summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/undocommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/undocommands.cpp')
-rw-r--r--desktop-widgets/undocommands.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/desktop-widgets/undocommands.cpp b/desktop-widgets/undocommands.cpp
index 9a56b4e9d..16f87fa23 100644
--- a/desktop-widgets/undocommands.cpp
+++ b/desktop-widgets/undocommands.cpp
@@ -147,7 +147,7 @@ void UndoDeleteDive::redo()
}
-UndoShiftTime::UndoShiftTime(QVector<int> changedDives, int amount)
+UndoShiftTime::UndoShiftTime(const QVector<dive *> &changedDives, int amount)
: diveList(changedDives), timeChanged(amount)
{
setText(tr("delete %n dive(s)", "", changedDives.size()));
@@ -155,10 +155,9 @@ UndoShiftTime::UndoShiftTime(QVector<int> changedDives, int amount)
void UndoShiftTime::undo()
{
- for (int i = 0; i < diveList.count(); i++) {
- dive *d = get_dive_by_uniq_id(diveList.at(i));
+ for (dive *d: diveList)
d->when -= timeChanged;
- }
+
// Changing times may have unsorted the dive table
sort_table(&dive_table);
mark_divelist_changed(true);