summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-15 14:56:32 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-15 14:56:32 -0700
commit36ba353450b9df1b4d75aa6a4deef8fb10400f1a (patch)
treea17ebadbcc1c651c3aff4f6bfb36da31ebc21f1d
parent4a1b9312f38222af6ef1f19b8551cfdeb47ad8df (diff)
downloadsubsurface-36ba353450b9df1b4d75aa6a4deef8fb10400f1a.tar.gz
Correctly check if tank is in use
We always checked if the tank was in use by the planner / dive editor - even if we were not in dive edit mode. With this patch, when not in dive edit mode, we check our cylinder "used" flag instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/models.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 01a3c33b3..1689139e1 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -336,7 +336,10 @@ void CylindersModel::remove(const QModelIndex &index)
return;
}
cylinder_t *cyl = &current->cylinder[index.row()];
- if (DivePlannerPointsModel::instance()->tankInUse(cyl->gasmix.o2.permille, cyl->gasmix.he.permille)) {
+ if ((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING &&
+ DivePlannerPointsModel::instance()->tankInUse(cyl->gasmix.o2.permille, cyl->gasmix.he.permille)) ||
+ (DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING && cyl->used))
+ {
QMessageBox::warning(MainWindow::instance(), TITLE_OR_TEXT(
tr("Cylinder cannot be removed"),
tr("This gas in use. Only cylinders that are not used in the dive can be removed.")),