From 4cdea48926456a96dd882f16d4dae48dcbb7ef23 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 4 Apr 2020 22:13:18 +0200 Subject: mobile: properly recognize changed dive site QMLManager::checkLocation() would only return true if the dive-site itself was changed, not if the dive-site was set to a different site. Thus, in some cases edit events could be lost. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 847f1dd71..46baf06f0 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -915,6 +915,7 @@ parsed: bool QMLManager::checkLocation(DiveSiteChange &res, const DiveObjectHelper &myDive, struct dive *d, QString location, QString gps) { struct dive_site *ds = get_dive_site_for_dive(d); + bool changed = false; qDebug() << "checkLocation" << location << "gps" << gps << "dive had" << myDive.location << "gps" << myDive.gas; if (myDive.location != location) { ds = get_dive_site_by_name(qPrintable(location), &dive_site_table); @@ -924,6 +925,7 @@ bool QMLManager::checkLocation(DiveSiteChange &res, const DiveObjectHelper &myDi ds = res.createdDs.get(); } d->dive_site = ds; + changed = true; } // now make sure that the GPS coordinates match - if the user changed the name but not // the GPS coordinates, this still does the right thing as the now new dive site will @@ -950,7 +952,7 @@ bool QMLManager::checkLocation(DiveSiteChange &res, const DiveObjectHelper &myDi appendTextToLog(QString("wasn't able to parse gps string '%1'").arg(gps)); } } - return res.changed; + return changed | res.changed; } bool QMLManager::checkDuration(const DiveObjectHelper &myDive, struct dive *d, QString duration) -- cgit v1.2.3-70-g09d2