diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-04 22:13:18 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-04-04 14:30:06 -0700 |
commit | 4cdea48926456a96dd882f16d4dae48dcbb7ef23 (patch) | |
tree | 1de06a4841dda065434f0316f41bee87a956ab62 /mobile-widgets | |
parent | e43362fdcfb60d5f5b714ec473a193f6b5aa5fe5 (diff) | |
download | subsurface-4cdea48926456a96dd882f16d4dae48dcbb7ef23.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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) |