summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2018-09-13 17:33:07 +0200
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2018-09-14 10:00:54 +0200
commit5133a38d259b2ef187d3707a10fd93f8078dea35 (patch)
tree072253c5270c5c15affdefb62e6880484160f8b2 /desktop-widgets
parentd94f81362396c864e34e993231a522d7cac394e4 (diff)
downloadsubsurface-5133a38d259b2ef187d3707a10fd93f8078dea35.tar.gz
Desktop: disable UI elements that make no sense during editing
As described in the referenced issue, we where able to navigate to nonlogical static pages (like information, statistics. extra data) when adding a dive. These are output style pages that make no sense on edit or add. Further, disable access to some pages when entering edit mode. Notice that the small change in file mainwindow.cpp is simply because this this not work at all, and became superfluous any way. Fixes: #1445 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mainwindow.cpp3
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp10
2 files changed, 10 insertions, 3 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 1028a0f7c..d11d3c762 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -1054,9 +1054,6 @@ void MainWindow::on_actionAddDive_triggered()
// now show the mostly empty main tab
information()->updateDiveInfo();
- // show main tab
- information()->setCurrentIndex(0);
-
information()->addDiveStarted();
graphics()->setAddState();
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 7112458f1..eb8292b1a 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -270,6 +270,11 @@ void MainTab::toggleTriggeredColumn()
void MainTab::addDiveStarted()
{
+ ui.tabWidget->setCurrentIndex(0);
+ ui.tabWidget->setTabEnabled(2, false);
+ ui.tabWidget->setTabEnabled(3, false);
+ ui.tabWidget->setTabEnabled(4, false);
+ ui.tabWidget->setTabEnabled(5, false);
enableEdition(ADD);
}
@@ -339,6 +344,9 @@ void MainTab::enableEdition(EditMode newEditMode)
MainWindow::instance()->dive_list()->setEnabled(false);
MainWindow::instance()->setEnabledToolbar(false);
MainWindow::instance()->enterEditState();
+ ui.tabWidget->setTabEnabled(2, false);
+ ui.tabWidget->setTabEnabled(3, false);
+ ui.tabWidget->setTabEnabled(5, false);
if (isTripEdit) {
// we are editing trip location and notes
@@ -534,6 +542,8 @@ void MainTab::updateDiveInfo(bool clear)
ui.tabWidget->setTabText(0, tr("Notes"));
ui.tabWidget->setTabEnabled(1, true);
ui.tabWidget->setTabEnabled(2, true);
+ ui.tabWidget->setTabEnabled(3, true);
+ ui.tabWidget->setTabEnabled(4, true);
ui.tabWidget->setTabEnabled(5, true);
// Recover the tab selected for last dive
if (!lastSelectedDive)