summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-02-22 14:05:13 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-10 09:25:57 -0700
commiteaa1a5126bc0f50ba1e7ae59a895385b6d4e6614 (patch)
treef30ae91d7292a4de1e53c92428035a6129aec9c6 /mobile-widgets/qmlmanager.cpp
parent4b4df28ecdd528c3ad74b95b6ab00a29f24d256a (diff)
downloadsubsurface-eaa1a5126bc0f50ba1e7ae59a895385b6d4e6614.tar.gz
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>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index a55bdb7e2..1e0717adb 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -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);