diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-09-30 19:29:03 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-30 19:24:38 -0400 |
commit | 0847447cda75a0d932b682e08ffd0ef73affb046 (patch) | |
tree | 3d0eff0b1126584f733934a9bd4845820f487744 /qt-ui | |
parent | 2794af41664a22736b796c3d152b4cca04ef3ea1 (diff) | |
download | subsurface-0847447cda75a0d932b682e08ffd0ef73affb046.tar.gz |
Make 'Choose dive site' work as 'Rename'
But it will actually create a new dive site, not just rename the existing
one.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/maintab.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 8857e3b4f..a70f3901e 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -885,13 +885,17 @@ void MainTab::updateDiveSite(int divenr) } newDs = get_dive_site_by_uuid(pickedUuid); - copy_dive_site(newDs, &displayed_dive_site); + + // Copy everything from the displayed_dive_site, so we have the latitude, longitude, notes, etc. + // The user *might* be using wrongly the 'choose dive site' just to edit the name of it, sigh. + if(origDs) { + copy_dive_site(origDs, newDs); + free(newDs->name); + newDs->name = copy_string(qPrintable(ui.location->text().constData())); + newDs->uuid = pickedUuid; + } if (origDs && pickedUuid != origDs->uuid && same_string(origDs->notes, "SubsurfaceWebservice")) { - // this is a special case - let's keep the GPS data and - // remove the original dive site if this was the only user - newDs->latitude.udeg = origDs->latitude.udeg; - newDs->longitude.udeg = origDs->longitude.udeg; if (!is_dive_site_used(origDs->uuid, false)) { if (verbose) qDebug() << "delete the autogenerated dive site" << origDs->name; |