diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2015-06-04 00:30:26 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-03 21:44:49 -0700 |
commit | 8ff78263029e233ff3efb3895f91b85c745bb4a2 (patch) | |
tree | f137b687d1d4dc8234d8d37d19537b3016683ffd /qt-ui/locationinformation.cpp | |
parent | af22ebf3f14cd2a38921c06bf0ce2fc85d862579 (diff) | |
download | subsurface-8ff78263029e233ff3efb3895f91b85c745bb4a2.tar.gz |
Fix reject changes for add/edit
Reject changes was correct only for Edit, but not for Add. When in add
mode we need to retrieve the old dive site, and when in edit mode we
should do nothing.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/locationinformation.cpp')
-rw-r--r-- | qt-ui/locationinformation.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 17eccf5f2..9f1262bb3 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -113,10 +113,15 @@ void LocationInformationWidget::createDiveSite() void LocationInformationWidget::rejectChanges() { - if (currentDs && dive_site_is_empty(currentDs)) { + if (current_mode == CREATE_DIVE_SITE) { + LocationInformationModel::instance()->removeRow(get_divesite_idx(currentDs)); + if (displayed_dive.dive_site_uuid) { + displayed_dive_site = *get_dive_site_by_uuid(displayed_dive.dive_site_uuid); + } + } else if ((currentDs && dive_site_is_empty(currentDs))) { LocationInformationModel::instance()->removeRow(get_divesite_idx(currentDs)); - displayed_dive.dive_site_uuid = 0; } + resetState(); emit stopFilterDiveSite(); emit informationManagementEnded(); |