From 0799d046ba976a15fea537ff3dc790b6d9b28cbd Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 6 Oct 2017 07:51:02 -0700 Subject: Disable editDiveSiteButton without dive site name Entering a name first creates and hooks up a dive site which we can then use in the edit dive site dialog to store modifications. This doesn't really fix these two bugs, but it might impact whether they can still be recreated See #633 See #636 Signed-off-by: Dirk Hohndel --- desktop-widgets/tab-widgets/maintab.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'desktop-widgets/tab-widgets/maintab.cpp') diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 2d4ba6403..62d818183 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -589,6 +589,7 @@ void MainTab::updateDiveInfo(bool clear) ui.locationTags->hide(); else ui.locationTags->show(); + ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty()); /* unset the special value text for date and time, just in case someone dove at midnight */ ui.dateEdit->setSpecialValueText(QString("")); ui.timeEdit->setSpecialValueText(QString("")); @@ -969,7 +970,7 @@ void MainTab::acceptChanges() weightModel->changed = false; MainWindow::instance()->setEnabledToolbar(true); acceptingEdit = false; - ui.editDiveSiteButton->setEnabled(true); + ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty()); } void MainTab::resetPallete() @@ -1045,7 +1046,7 @@ void MainTab::rejectChanges() weightModel->changed = false; cylindersModel->updateDive(); weightModel->updateDive(); - ui.editDiveSiteButton->setEnabled(true); + ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty()); } #undef EDIT_TEXT2 -- cgit v1.2.3-70-g09d2