mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add ability to undo deleted dives
Before the dive is deleted, a copy is made and passed to the undo buffer. When edit->undo is clicked, this dive is restored to the dive list. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8d1e4557a9
commit
d60a620193
3 changed files with 35 additions and 10 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
#include "qthelper.h"
|
||||
#include "undobuffer.h"
|
||||
|
||||
// # Date Rtg Dpth Dur Tmp Wght Suit Cyl Gas SAC OTU CNS Loc
|
||||
static int defaultWidth[] = { 70, 140, 90, 50, 50, 50, 50, 70, 50, 50, 70, 50, 50, 500};
|
||||
|
@ -730,6 +731,9 @@ void DiveListView::deleteDive()
|
|||
for_each_dive (i, d) {
|
||||
if (!d->selected)
|
||||
continue;
|
||||
struct dive* undo_entry = alloc_dive();
|
||||
copy_dive(get_dive(i), undo_entry);
|
||||
MainWindow::instance()->undoBuffer->recordbefore("Delete Dive", undo_entry);
|
||||
delete_single_dive(i);
|
||||
i--; // so the next dive isn't skipped... it's now #i
|
||||
lastDiveNr = i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue