QML UI: enable editing of weight

But only if there is only one weight system defined in the dive. Otherwise
display a read only text that explains that this cannot be edited.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-02-05 22:54:47 -08:00
parent ad7fb80d0a
commit a4ec520601
4 changed files with 26 additions and 5 deletions

View file

@ -70,7 +70,14 @@ MobileComponents.Page {
buddy = diveDetailsListView.currentItem.modelData.dive.buddy
divemaster = diveDetailsListView.currentItem.modelData.dive.divemaster
notes = diveDetailsListView.currentItem.modelData.dive.notes
weight = diveDetailsListView.currentItem.modelData.dive.sumWeight
if (diveDetailsListView.currentItem.modelData.dive.singleWeight) {
// we have only one weight, go ahead, have fun and edit it
weight = diveDetailsListView.currentItem.modelData.dive.sumWeight
} else {
// careful when translating, this text is "magic" in DiveDetailsEdit.qml
weight = "cannot edit multiple weight systems"
}
diveDetailsPage.state = "edit"
}
}