mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mobile: add ability to update trip details
This creates up to two undo events. This seems like such a small issue that it's not worth creating yet another undo command for this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4b4df28ecd
commit
eaa1a5126b
2 changed files with 22 additions and 0 deletions
|
@ -1282,6 +1282,27 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
|
|||
}
|
||||
}
|
||||
|
||||
void QMLManager::updateTripDetails(QString tripIdString, QString tripLocation, QString tripNotes)
|
||||
{
|
||||
int tripId = tripIdString.toInt();
|
||||
dive_trip_t *trip = get_trip_by_uniq_id(tripId);
|
||||
if (!trip) {
|
||||
qDebug() << "updateTripData: cannot find trip for tripId" << tripIdString;
|
||||
return;
|
||||
}
|
||||
bool changed = false;
|
||||
if (tripLocation != trip->location) {
|
||||
changed = true;
|
||||
Command::editTripLocation(trip, tripLocation);
|
||||
}
|
||||
if (tripNotes != trip->notes) {
|
||||
changed = true;
|
||||
Command::editTripNotes(trip, tripNotes);
|
||||
}
|
||||
if (changed)
|
||||
changesNeedSaving();
|
||||
}
|
||||
|
||||
void QMLManager::removeDiveFromTrip(int id)
|
||||
{
|
||||
struct dive *d = get_dive_by_uniq_id(id);
|
||||
|
|
|
@ -177,6 +177,7 @@ public slots:
|
|||
QString watertemp, QString suit, QString buddy,
|
||||
QString diveMaster, QString weight, QString notes, QStringList startpressure,
|
||||
QStringList endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility, QString state);
|
||||
void updateTripDetails(QString tripIdString, QString tripLocation, QString tripNotes);
|
||||
void removeDiveFromTrip(int id);
|
||||
void addDiveToTrip(int id, int tripId);
|
||||
void changesNeedSaving();
|
||||
|
|
Loading…
Reference in a new issue