Debian Codegraph @

src/app/qml/components/HeadState/LocationsHeadState.qml

raw
1 /*
2 * Copyright (C) 2016
3 * Andrew Hayzen <[email protected]>
4 * Victor Thompson <[email protected]>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 import QtQuick 2.12
20 import Lomiri.Components 1.3
21
22 State {
23 name: "default"
24
25 property PageHeader thisHeader: PageHeader {
26 id: locationsheader
27
28 flickable: thisPage.flickable
29 visible: thisPage.state === "default"
30 title: i18n.tr("Locations")
31
32 leadingActionBar {
33 actions: [
34 Action {
35 iconName: "down"
36 objectName: "back"
37 onTriggered: thisPage.pop()
38 }
39 ]
40 objectName: "locationsLeadingActionBar"
41 }
42
43 trailingActionBar {
44 actions: [
45 Action {
46 iconName: "add"
47 objectName: "addLocation"
48 visible: !networkError
49 onTriggered: mainPageStack.push(Qt.resolvedUrl("../../ui/AddLocationPage.qml"))
50 }
51 ]
52 objectName: "locationsTrailingActionBar"
53 }
54
55 //creates option to swipe in header to close a page by using a MouseArea
56 // MouseArea {
57 // id: swipeToActionArea
58 // anchors.fill: parent
59 // //allows click events for items underneath the mouse area
60 // propagateComposedEvents: true
61 // //configure drag behavior for header
62 // drag.target: parent
63 // drag.axis: Drag.YAxis
64 // drag.minimumY: 0
65 // drag.threshold: locationsheader.height/3
66 // drag.maximumY: locationsheader.height*3
67 // onReleased: {
68 // bottomEdge.collapse();
69 // delayTimer.start();
70 // }
71 //
72 // //TODO: add timer to slide down header y in slow motion, call collapse at the end of timer
73 // // at the same time reduce opacity to zero to show page underneath
74 // // maybe using NumberAnimation on y on this?
75 //
76 // //header position needs to be set back to y=0 for next page call
77 // Timer {
78 // id: delayTimer
79 // //interval needs to be a minimum of 200, otherwise collapse is not entirely finished
80 // //this will result in the page flickering when y is set back to zero
81 // interval: 200; running: false; repeat: false;
82 // onTriggered: {
83 // locationsheader.y = 0 //reset to zero position
84 // }
85 // }
86 // }
87 }
88 property Item thisPage
89
90 PropertyChanges {
91 target: thisPage
92 header: thisHeader
93 }
94 }