diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/locationinformation.cpp | 4 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 75faf87d6..cc6405947 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -91,7 +91,7 @@ void LocationInformationWidget::acceptChanges() currentDs->notes = copy_string(uiString); } if (dive_site_is_empty(currentDs)) { - delete_dive_site(currentDs->uuid); + LocationInformationModel::instance()->removeRow(get_divesite_idx(currentDs)); displayed_dive.dive_site_uuid = 0; } @@ -104,7 +104,7 @@ void LocationInformationWidget::acceptChanges() void LocationInformationWidget::rejectChanges() { if (currentDs && dive_site_is_empty(currentDs)) { - delete_dive_site(currentDs->uuid); + LocationInformationModel::instance()->removeRow(get_divesite_idx(currentDs)); displayed_dive.dive_site_uuid = 0; } resetState(); 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) |