aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/tab-widgets/TabDiveEquipment.cpp')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveEquipment.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
index 5105029a3..ad13e6b7e 100644
--- a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
@@ -3,11 +3,14 @@
#include "maintab.h"
#include "desktop-widgets/simplewidgets.h" // For isGnome3Session()
#include "desktop-widgets/modeldelegates.h"
+#include "core/dive.h"
+#include "core/selection.h"
#include "commands/command.h"
#include "qt-models/cylindermodel.h"
#include "qt-models/weightmodel.h"
+#include <QMessageBox>
#include <QSettings>
#include <QCompleter>
@@ -162,10 +165,21 @@ void TabDiveEquipment::editCylinderWidget(const QModelIndex &index)
if (!index.isValid())
return;
- if (index.column() == CylindersModel::REMOVE)
+ if (index.column() == CylindersModel::REMOVE) {
+ int cylinder_id = cylindersModel->mapToSource(index).row();
+ for (dive *d: getDiveSelection()) {
+ if (cylinder_with_sensor_sample(d, cylinder_id)) {
+ if (QMessageBox::warning(this, tr("Remove cylinder?"),
+ tr("The deleted cylinder has sensor readings, which will be lost.\n"
+ "Do you want to continue?"),
+ QMessageBox::Yes|QMessageBox::No) != QMessageBox::Yes)
+ return;
+ }
+ }
divesEdited(Command::removeCylinder(cylindersModel->mapToSource(index).row(), false));
- else
+ } else {
ui.cylinders->edit(index);
+ }
}
void TabDiveEquipment::editWeightWidget(const QModelIndex &index)