summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 51720a317..d2386ecf1 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -776,23 +776,16 @@ void DiveListView::deleteDive()
if (!d)
return;
- //TODO: port this to C-code.
int i;
- // after a dive is deleted the ones following it move forward in the dive_table
- // so instead of using the for_each_dive macro I'm using an explicit for loop
- // to make this easier to understand
int lastDiveNr = -1;
QList<struct dive*> deletedDives; //a list of all deleted dives to be stored in the undo command
for_each_dive (i, d) {
if (!d->selected)
continue;
- struct dive* undo_entry = alloc_dive();
- copy_dive(get_dive(i), undo_entry);
- deletedDives.append(undo_entry);
- delete_single_dive(i);
- i--; // so the next dive isn't skipped... it's now #i
+ deletedDives.append(d);
lastDiveNr = i;
}
+ // the actual dive deletion is happening in the redo command that is implicitly triggered
UndoDeleteDive *undoEntry = new UndoDeleteDive(deletedDives);
MainWindow::instance()->undoStack->push(undoEntry);
if (amount_selected == 0) {