mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
968278fe91
commit
3464e776e2
3 changed files with 26 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue