From 1e527fb9f01388df2248a90efc7de26c90faec75 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 13 Nov 2021 12:13:15 -0800 Subject: [PATCH] mobile: correctly store manually entered GPS If there was no pre-existing dive site for a dive, manually entered GPS information didn't get saved. Signed-off-by: Dirk Hohndel --- mobile-widgets/qmlmanager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index f6e9cad08..6b422c741 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -850,6 +850,7 @@ static void setupDivesite(DiveSiteChange &res, struct dive *d, struct dive_site res.location = location; } else { res.createdDs.reset(alloc_dive_site_with_name(locationtext)); + res.createdDs->location = location; d->dive_site = res.createdDs.get(); } res.changed = true; @@ -981,7 +982,10 @@ bool QMLManager::checkLocation(DiveSiteChange &res, struct dive *d, QString loca if (formatDiveGPS(d) != gps) { double lat, lon; if (parseGpsText(gps, &lat, &lon)) { - qDebug() << "parsed GPS, using it"; + if (location.isEmpty()) + location = gps; + if (verbose) + qDebug() << "parsed GPS" << gps << ", using it for dive site" << location; // there are valid GPS coordinates - just use them setupDivesite(res, d, ds, lat, lon, qPrintable(location)); } else {