summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2015-06-01 23:13:51 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-01 21:36:48 -0700
commit6cd85d9b731ef646b605d483dbbcddbc70283338 (patch)
treeacb08cd7f45fbcf375a7f41525fb102ebd9fdbd0 /qt-ui/maintab.cpp
parentee9746c622e84ed8385c8bbd0e6ffa61f4c813a4 (diff)
downloadsubsurface-6cd85d9b731ef646b605d483dbbcddbc70283338.tar.gz
Simplify model handling and crashes fixes
So, there's only one crash left (that I put a big TODO: on the maintab.cpp about) and I'll fix it tomorrow as it's quite late here and I'm almost sleeping at the keyboard. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index cc09ed723..85d45b357 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -243,6 +243,10 @@ void MainTab::disableGeoLookupEdition()
}
void MainTab::prepareDiveSiteEdit() {
+ // TODO: This is wrong. We can only set this if we Accepted the dive site edit
+ // And not if we cancelled. Currently we are seting directly without even
+ // thinking - but too tired, fix this tomorrow.
+
uint32_t dive_site_uuid = LocationInformationModel::instance()->addDiveSite(tr("Unnamed"));
displayed_dive.dive_site_uuid = dive_site_uuid;
emit requestDiveSiteEdit(dive_site_uuid);
@@ -429,7 +433,10 @@ bool MainTab::isEditing()
void MainTab::showLocation()
{
- ui.location->setCurrentText(get_dive_location(&displayed_dive));
+ if (get_dive_site_by_uuid(displayed_dive.dive_site_uuid))
+ ui.location->setCurrentText(get_dive_location(&displayed_dive));
+ else
+ ui.location->setCurrentIndex(-1);
}
void MainTab::updateDiveInfo(bool clear)