diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2016-04-14 22:39:32 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-14 12:57:40 -0700 |
commit | 9e787a2476e49bb4793cdaeae4c097019d29e9dd (patch) | |
tree | 5b63e0f76ff3cf652e41215fb2e09809fa1c2ba5 | |
parent | 67742856b2d8b3659505fd094cd0c6b86785da26 (diff) | |
download | subsurface-9e787a2476e49bb4793cdaeae4c097019d29e9dd.tar.gz |
Copy coordinates when renaming site
Let's not discard our GPS location when editing site name on mobile.
Fixes #1051
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 2303af3e5..a10115981 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -575,10 +575,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()) { |