summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/maintab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/tab-widgets/maintab.cpp')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 0f0a2a84b..7dda4c0e7 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -491,10 +491,15 @@ void MainTab::updateDiveInfo()
// don't execute this while adding / planning a dive
if (editMode == MANUALLY_ADDED_DIVE || MainWindow::instance()->graphics->isPlanner())
return;
- if (!isEnabled() && current_dive)
- setEnabled(true);
- if (isEnabled() && !current_dive)
- setEnabled(false);
+
+ // If there is no current dive, disable all widgets except the last, which is the dive site tab.
+ // TODO: Conceptually, the dive site tab shouldn't even be a tab here!
+ bool enabled = current_dive != nullptr;
+ ui.equipmentTab->setEnabled(enabled);
+ ui.notesTab->setEnabled(enabled);
+ for (int i = 0; i < extraWidgets.size() - 1; ++i)
+ extraWidgets[i]->setEnabled(enabled);
+
editMode = IGNORE; // don't trigger on changes to the widgets
for (auto widget : extraWidgets) {