summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 2c17648d6..8147e7f3a 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -654,6 +654,27 @@ void MainWindow::on_actionAddDive_triggered()
graphics()->plotDive();
}
+void MainWindow::on_actionEditDive_triggered()
+{
+ if (information()->isEditing() || DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) {
+ QMessageBox::warning(this, tr("Warning"), tr("Please, first finish the current edition before trying to do another."));
+ return;
+ }
+
+ const bool isTripEdit = dive_list()->selectedTrips().count() >= 1;
+ if (!current_dive || isTripEdit || strcmp(current_dive->dc.model, "manually added dive")) {
+ return;
+ }
+
+ DivePlannerPointsModel::instance()->clear();
+ disableShortcuts();
+ DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);
+ graphics()->setAddState();
+ setApplicationState("EditDive");
+ DivePlannerPointsModel::instance()->loadFromDive(current_dive);
+ information()->enableEdition(MainTab::MANUALLY_ADDED_DIVE);
+}
+
void MainWindow::on_actionRenumber_triggered()
{
RenumberDialog::instance()->renumberOnlySelected(false);