diff options
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index f7944c90c..003fc053d 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -142,8 +142,17 @@ void RenumberDialog::renumberOnlySelected(bool selected) void RenumberDialog::buttonClicked(QAbstractButton *button) { - if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) - renumber_dives(ui.spinBox->value(), selectedOnly); + if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { + QMap<int,int> renumberedDives; + int i; + struct dive *dive = NULL; + for_each_dive (i, dive) { + if (!selectedOnly || dive->selected) + renumberedDives.insert(dive->id, dive->number); + } + UndoRenumberDives *undoCommand = new UndoRenumberDives(renumberedDives, ui.spinBox->value()); + MainWindow::instance()->undoStack->push(undoCommand); + } } RenumberDialog::RenumberDialog(QWidget *parent) : QDialog(parent), selectedOnly(false) |