diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-10-04 12:22:36 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-04 17:08:58 -0700 |
commit | 7f0c7eeb24ea5502acc25c08dc9807dd17d141b3 (patch) | |
tree | 3231deeb6c892d71c6b54239e5cd4e9d879c2c3e /mobile-widgets | |
parent | 41f24f2859c36a8bf11baff86c99b6a313cecec2 (diff) | |
download | subsurface-7f0c7eeb24ea5502acc25c08dc9807dd17d141b3.tar.gz |
QML UI: change the dive edit to not be an overlay
This way the accidental closing of the edit (and loss of data)
should no longer happen.
See: #495
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 22c9799cd..7246843f8 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -58,18 +58,26 @@ Kirigami.Page { left: currentItem ? (currentItem.modelData && currentItem.modelData.dive.gps !== "" ? mapAction : null) : null } } - PropertyChanges { target: detailsEditScroll; sheetOpen: false } - PropertyChanges { target: pageStack.contentItem; interactive: true } }, State { name: "edit" - PropertyChanges { target: detailsEditScroll; sheetOpen: true } - PropertyChanges { target: pageStack.contentItem; interactive: false } + PropertyChanges { + target: diveDetailsPage; + actions { + right: cancelAction + left: null + } + } }, State { name: "add" - PropertyChanges { target: detailsEditScroll; sheetOpen: true } - PropertyChanges { target: pageStack.contentItem; interactive: false } + PropertyChanges { + target: diveDetailsPage; + actions { + right: cancelAction + left: null + } + } } ] @@ -89,6 +97,14 @@ Kirigami.Page { } } + property QtObject cancelAction: Kirigami.Action { + text: qsTr("Cancel edit") + iconName: "dialog-cancel" + onTriggered: { + endEditMode() + } + } + property QtObject mapAction: Kirigami.Action { text: qsTr("Show on map") iconName: "gps" @@ -183,10 +199,9 @@ Kirigami.Page { diveDetailsPage.state = "edit" } - //onWidthChanged: diveDetailsListView.positionViewAtIndex(diveDetailsListView.currentIndex, ListView.Beginning); - Item { anchors.fill: parent + visible: diveDetailsPage.state == "view" ListView { id: diveDetailsListView anchors.fill: parent @@ -198,7 +213,6 @@ Kirigami.Page { highlightFollowsCurrentItem: true focus: true clip: false - //cacheBuffer: parent.width * 3 // cache one item on either side (this is in pixels) snapMode: ListView.SnapOneItem highlightRangeMode: ListView.StrictlyEnforceRange onMovementEnded: { @@ -219,18 +233,10 @@ Kirigami.Page { } ScrollIndicator.horizontal: ScrollIndicator { } } - Kirigami.OverlaySheet { - id: detailsEditScroll - parent: diveDetailsPage - rootItem.z: 0 - onSheetOpenChanged: { - if (!sheetOpen) { - endEditMode() - } - } - DiveDetailsEdit { - id: detailsEdit - } - } + } + + DiveDetailsEdit { + id: detailsEdit + visible: diveDetailsPage.state != "view" ? true : false } } |