diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2019-11-07 00:17:34 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-11-08 20:50:05 +0100 |
commit | ae27dd77a74423ab17e83268030794e34d4f61c0 (patch) | |
tree | 0b7a389a0be4feb1860e33e8fe8e860fce2bc84d | |
parent | 9e09a7d920985b678a44146500b29e856c7c23aa (diff) | |
download | subsurface-ae27dd77a74423ab17e83268030794e34d4f61c0.tar.gz |
Mobile: consistently refer to the dive list model
The number of different ways we tried to refer to the model made my head spin.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qml/DiveList.qml | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index 0f9939817..865feca35 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -330,7 +330,7 @@ Kirigami.ScrollablePage { } Controls.Label { text: { - diveListView.model ? diveListView.model.tripShortDate(section) : "no data model" + diveListModel ? diveListModel.tripShortDate(section) : "no data model" } color: subsurfaceTheme.primaryTextColor font.pointSize: subsurfaceTheme.smallPointSize @@ -346,16 +346,18 @@ Kirigami.ScrollablePage { MouseArea { anchors.fill: headingBackground onClicked: { - if (diveTripModel.activeTrip() === section) - diveTripModel.setActiveTrip("") - else - diveTripModel.setActiveTrip(section) + if (diveListModel) { + if (diveListModel.activeTrip() === section) + diveListModel.setActiveTrip("") + else + diveListModel.setActiveTrip(section) + } } } Controls.Label { id: sectionText text: { - diveListView.model ? diveListView.model.tripTitle(section) : "no data model" + diveListModel ? diveListModel.tripTitle(section) : "no data model" } wrapMode: Text.WrapAtWordBoundaryOrAnywhere visible: text !== "" @@ -491,7 +493,7 @@ Kirigami.ScrollablePage { anchors.fill: parent opacity: 1.0 - startPage.opacity visible: opacity > 0 - model: page.diveListModel + model: diveListModel currentIndex: -1 delegate: diveDelegate header: filterHeader @@ -578,7 +580,8 @@ Kirigami.ScrollablePage { function setCurrentDiveListIndex(idx, noScroll) { // pick the dive in the dive list and make sure its trip is expanded diveListView.currentIndex = idx - diveTripModel.setActiveTrip(diveListView.currentItem.myData.tripId) + if (diveListModel) + diveListModel.setActiveTrip(diveListView.currentItem.myData.tripId) // update the diveDetails page to also show that dive detailsWindow.showDiveIndex(idx) |