summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-13 23:08:33 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-13 23:08:33 -0800
commit3ea2e15bd2f20e0f84bf02a468c3273a347ac554 (patch)
treecbeb5ec53d446c32c410fb08661f374b1ccf47fc /qt-ui
parent7ca3d859dc304674fe9e48c3ab3925303615a1c2 (diff)
downloadsubsurface-3ea2e15bd2f20e0f84bf02a468c3273a347ac554.tar.gz
Don't add empty dive sites
It makes no sense to keep them around, it makes no sense to have dives refer to them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/simplewidgets.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index f32ce9b19..27050f6e2 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -708,6 +708,13 @@ void LocationInformationWidget::acceptChanges()
free(currentDs->notes);
currentDs->notes = copy_string(uiString);
}
+ if (dive_site_is_empty(currentDs)) {
+ delete_dive_site(currentDs->uuid);
+ displayed_dive.dive_site_uuid = 0;
+ setLocationId(0);
+ } else {
+ setLocationId(currentDs->uuid);
+ }
mark_divelist_changed(true);
emit informationManagementEnded();
}
@@ -715,7 +722,13 @@ void LocationInformationWidget::acceptChanges()
void LocationInformationWidget::rejectChanges()
{
Q_ASSERT(currentDs != NULL);
- setLocationId(currentDs->uuid);
+ if (dive_site_is_empty(currentDs)) {
+ delete_dive_site(currentDs->uuid);
+ displayed_dive.dive_site_uuid = 0;
+ setLocationId(0);
+ } else {
+ setLocationId(currentDs->uuid);
+ }
emit informationManagementEnded();
}