diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-02-19 14:06:03 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-10 09:25:57 -0700 |
commit | 3464e776e23996b9e6085509919713da3c3e44f5 (patch) | |
tree | 19b514bca8efb55b12ee5ffff202240458c069c0 /mobile-widgets/qmlmanager.cpp | |
parent | 968278fe9125729b6dae163d1362d48adc53b554 (diff) | |
download | subsurface-3464e776e23996b9e6085509919713da3c3e44f5.tar.gz |
mobile UI: add ability to remove dive from its trip
If we remove the newest dive from its trip, it becomes inaccessible in the app,
but the dive data saved to disk appears to be correct.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index cbd82ade2..c4ddac44e 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1282,6 +1282,23 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt } } +void QMLManager::removeDiveFromTrip(int id) +{ + struct dive *d = get_dive_by_uniq_id(id); + if (!d) { + appendTextToLog(QString("Asked to remove non-existing dive with id %1 from its trip.").arg(id)); + return; + } + if (!d->divetrip) { + appendTextToLog(QString("Asked to remove dive with id %1 from its trip (but it's not part of a trip).").arg(id)); + return; + } + QVector <dive *> dives; + dives.append(d); + Command::removeDivesFromTrip(dives); + changesNeedSaving(); +} + void QMLManager::changesNeedSaving() { // we no longer save right away on iOS because file access is so slow; on the other hand, |