QML UI: enable modification of ratings

This enables editing of visibility and ratings for a dive.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
Joakim Bygdell 2017-07-28 19:28:52 +02:00 committed by Dirk Hohndel
parent 9d7eb33a33
commit 6a47af2d16
3 changed files with 38 additions and 3 deletions

View file

@ -832,7 +832,7 @@ bool QMLManager::checkDepth(DiveObjectHelper *myDive, dive *d, QString depth)
// update the dive and return the notes field, stripped of the HTML junk
void QMLManager::commitChanges(QString diveId, QString date, QString location, QString gps, QString duration, QString depth,
QString airtemp, QString watertemp, QString suit, QString buddy, QString diveMaster, QString weight, QString notes,
QString startpressure, QString endpressure, QString gasmix, QString cylinder)
QString startpressure, QString endpressure, QString gasmix, QString cylinder, int rating, int visibility)
{
struct dive *d = get_dive_by_uniq_id(diveId.toInt());
DiveObjectHelper *myDive = new DiveObjectHelper(d);
@ -936,6 +936,14 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
free(d->divemaster);
d->divemaster = strdup(qPrintable(diveMaster));
}
if (myDive->rating() != rating) {
diveChanged = true;
d->rating = rating;
}
if (myDive->visibility() != visibility) {
diveChanged = true;
d->visibility = visibility;
}
if (myDive->notes() != notes) {
diveChanged = true;
free(d->notes);