[PATCH] Copy coordinates when renaming site
Miika Turkia
miika.turkia at gmail.com
Thu Apr 14 12:39:32 PDT 2016
Let's not discard our GPS location when editing site name on mobile.
Fixes #1051
Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
mobile-widgets/qmlmanager.cpp | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 51a06f0..ce7ca4f 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -570,10 +570,22 @@ parsed:
if (ds)
locationtext = ds->name;
if (!same_string(locationtext, qPrintable(location))) {
+ double lat = 0, lon = 0;
diveChanged = true;
- // this is not ideal - and it's missing the gps information
- // but for now let's just create a new dive site
+
+ // As we create a new dive site, we need to grab the
+ // coordinates if we have them
+
+ if (ds && ds->latitude.udeg && ds->longitude.udeg) {
+ lat = ds->latitude.udeg;
+ lon = ds->longitude.udeg;
+ }
ds = get_dive_site_by_uuid(create_dive_site(qPrintable(location), d->when));
+
+ if (lat && lon) {
+ ds->latitude.udeg = lat;
+ ds->longitude.udeg = lon;
+ }
d->dive_site_uuid = ds->uuid;
}
if (!gps.isEmpty()) {
--
2.5.0
More information about the subsurface
mailing list