on xenial help sign in
Remove the swipe to close the Drawer :(

In order to avoid glitchy MouseArea inside Flickable behavior (events not getting delivered or geing created when they shouldn't), remove the MouseArea! Unfortunately, this means that we lose the ability to drag the Drawer away... We can bring it back later when we know how to implement it better, but for now we'll use the BFB as a Back button when the Drawer is pulled out.

commit1259b902ff880d5a2f23b220d1d2d5c3c572f06a authorDalton Durst <d@ltondur.st> dateTue 2 Apr 2019, 13:42 (8 years ago) parent69b5391
4 files changed+227−108
qml/Launcher/Drawer.qml+17−106 qml/Launcher/Launcher.qml+11−1 qml/Launcher/LauncherPanel.qml+2−1 qml/Launcher/graphics/back.svg+197
qml/Launcher/Drawer.qml+17−106
@@ -26,7 +26,7 @@ FocusScope {
2626 id: root
2727
2828 property int panelWidth: 0
29− readonly property bool moving: singleGroupListView && singleGroupListView.moving
29+ readonly property bool moving: appList && appList.moving
3030 readonly property Item searchTextField: searchField
3131 readonly property real delegateWidth: units.gu(10)
3232
@@ -81,7 +81,7 @@ FocusScope {
8181
8282 Item {
8383 id: searchFieldContainer
84− height: units.gu(4)
84+ height: units.gu(6)
8585 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
8686
8787 TextField {
@@ -92,15 +92,15 @@ FocusScope {
9292 top: parent.top
9393 right: parent.right
9494 bottom: parent.bottom
95− bottomMargin: units.gu(1)
95+ bottomMargin: units.gu(2)
9696 }
9797 placeholderText: i18n.tr("Search…")
9898 z: 100
9999
100− KeyNavigation.down: singleGroupListView
100+ KeyNavigation.down: appList
101101
102102 onAccepted: {
103− if (searchField.displayText != "" && singleGroupListView) {
103+ if (searchField.displayText != "" && appList) {
104104 // In case there is no currentItem (it might have been filtered away) lets reset it to the first item
105105 if (!appList.currentItem) {
106106 appList.currentIndex = 0;
@@ -111,116 +111,27 @@ FocusScope {
111111 }
112112 }
113113
114− FocusScope {
115− id: headerFocusScope
116− objectName: "headerFocusScope"
117− KeyNavigation.up: searchField
118− KeyNavigation.down: singleGroupListView
119− KeyNavigation.backtab: searchField
120− KeyNavigation.tab: singleGroupListView
121− activeFocusOnTab: true
122−
123− GSettings {
124− id: settings
125− schema.id: "com.canonical.Unity8"
126− }
127−
128− Keys.onPressed: {
129− switch (event.key) {
130− case Qt.Key_Return:
131− case Qt.Key_Enter:
132− case Qt.Key_Space:
133− trigger();
134− event.accepted = true;
135− }
136− }
137−
138− function trigger() {
139− Qt.openUrlExternally(settings.appstoreUri)
140− }
141− }
142−
143− MouseArea {
144− id: horizontalDragDetector
145− parent: singleGroupListView
146− anchors.fill: parent
147− propagateComposedEvents: true
148− property int oldX: 0
149− onPressed: {
150− if (root.firstOpen) {
151− mouse.accepted = false;
152− root.firstOpen = false;
153− return;
154− }
155− oldX = mouseX;
156− }
157− onMouseXChanged: {
158− var diff = oldX - mouseX;
159− root.draggingHorizontally |= diff > units.gu(2);
160− if (!root.draggingHorizontally) {
161− return;
162− }
163− parent.interactive = false;
164− root.dragDistance += diff;
165− oldX = mouseX
166− }
167− onReleased: reset();
168− onCanceled: reset();
169− function reset() {
170− if (root.draggingHorizontally) {
171− root.draggingHorizontally = false;
172− parent.interactive = true;
173− }
174− }
175− }
176−
177− Item {
114+ DrawerGridView {
115+ id: appList
178116 anchors {
179117 left: parent.left
180118 right: parent.right
181119 top: searchFieldContainer.bottom
182120 bottom: parent.bottom
183121 }
184− z: 1
185−
186− Flickable {
187− id: singleGroupListView
188− clip: true
189−
190− contentHeight: appListContainer.height
191−
192− anchors.fill: parent
193−
194− Item {
195− id: appListContainer
196− width: parent.width - units.gu(2)
197− anchors.horizontalCenter: parent.horizontalCenter
198−
199− readonly property string appId: model.appId
200−
201− // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
202− // which messes up the ListView.
203− height: (Math.ceil(appList.model.count / appList.columns) * appList.delegateHeight) + units.gu(2)
204−
205− DrawerGridView {
206− id: appList
207− anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: units.gu(1) }
208− height: rows * delegateHeight
122+ height: rows * delegateHeight
123+ clip: true
209124
210− interactive: false
211− focus: index == aToZListView.currentIndex
125+ focus: index == aToZListView.currentIndex
212126
213− model: AppDrawerProxyModel {
214− id: categoryModel
215− source: sortProxyModel
216− dynamicSortFilter: false
217− }
218− delegateWidth: root.delegateWidth
219− delegateHeight: units.gu(11)
220− delegate: drawerDelegateComponent
221− }
222− }
127+ model: AppDrawerProxyModel {
128+ id: categoryModel
129+ source: sortProxyModel
130+ dynamicSortFilter: false
223131 }
132+ delegateWidth: root.delegateWidth
133+ delegateHeight: units.gu(11)
134+ delegate: drawerDelegateComponent
224135 }
225136 }
226137
qml/Launcher/Launcher.qml+11−1
@@ -179,7 +179,11 @@ FocusScope {
179179 if (focusInputField) {
180180 drawer.focusInput();
181181 }
182− switchToNextState("drawer")
182+ if (state === "drawer") {
183+ switchToNextState("")
184+ } else {
185+ switchToNextState("drawer")
186+ }
183187 }
184188
185189 Keys.onPressed: {
@@ -588,6 +592,7 @@ FocusScope {
588592 PropertyChanges {
589593 target: panel
590594 x: -root.panelWidth
595+ showCloseIcon: false
591596 }
592597 PropertyChanges {
593598 target: drawer
@@ -600,6 +605,7 @@ FocusScope {
600605 PropertyChanges {
601606 target: panel
602607 x: -root.x // so we never go past panelWidth, even when teased by tutorial
608+ showCloseIcon: false
603609 }
604610 PropertyChanges {
605611 target: drawer
@@ -614,6 +620,10 @@ FocusScope {
614620 anchors.rightMargin: -drawer.width + root.x // so we never go past panelWidth, even when teased by tutorial
615621 focus: true
616622 }
623+ PropertyChanges {
624+ target: panel
625+ showCloseIcon: true
626+ }
617627 },
618628 State {
619629 name: "visibleTemporary"
qml/Launcher/LauncherPanel.qml+2−1
@@ -35,6 +35,7 @@ Rectangle {
3535 property bool moving: launcherListView.moving || launcherListView.flicking
3636 property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed
3737 || dndArea.containsMouse || dashItem.hovered
38+ property bool showCloseIcon: false
3839 property int highlightIndex: -2
3940 property bool shortcutHintsShown: false
4041 readonly property bool quickListOpen: quickList.state === "open"
@@ -97,7 +98,7 @@ Rectangle {
9798 sourceSize.width: width
9899 sourceSize.height: height
99100 anchors.centerIn: parent
100− source: "graphics/home.svg"
101+ source: root.showCloseIcon ? "graphics/back.svg": "graphics/home.svg"
101102 rotation: root.rotation
102103 }
103104 AbstractButton {
qml/Launcher/graphics/back.svgnew file+197
@@ -0,0 +1,197 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+
4+<svg
5+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6+ xmlns:cc="http://creativecommons.org/ns#"
7+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8+ xmlns:svg="http://www.w3.org/2000/svg"
9+ xmlns="http://www.w3.org/2000/svg"
10+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12+ width="96"
13+ height="96"
14+ id="svg4874"
15+ version="1.1"
16+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
17+ viewBox="0 0 96 96.000001"
18+ sodipodi:docname="back.svg">
19+ <defs
20+ id="defs4876">
21+ <clipPath
22+ clipPathUnits="userSpaceOnUse"
23+ id="clipPath16">
24+ <path
25+ d="m 0,595.28 841.89,0 L 841.89,0 0,0 0,595.28 Z"
26+ id="path18"
27+ inkscape:connector-curvature="0" />
28+ </clipPath>
29+ </defs>
30+ <sodipodi:namedview
31+ id="base"
32+ pagecolor="#ffffff"
33+ bordercolor="#666666"
34+ borderopacity="1.0"
35+ inkscape:pageopacity="0.0"
36+ inkscape:pageshadow="2"
37+ inkscape:zoom="10.685496"
38+ inkscape:cx="50.995361"
39+ inkscape:cy="57.096039"
40+ inkscape:document-units="px"
41+ inkscape:current-layer="layer1"
42+ showgrid="true"
43+ showborder="true"
44+ fit-margin-top="0"
45+ fit-margin-left="0"
46+ fit-margin-right="0"
47+ fit-margin-bottom="0"
48+ inkscape:snap-bbox="true"
49+ inkscape:bbox-paths="true"
50+ inkscape:bbox-nodes="true"
51+ inkscape:snap-bbox-edge-midpoints="true"
52+ inkscape:snap-bbox-midpoints="true"
53+ inkscape:object-paths="true"
54+ inkscape:snap-intersection-paths="true"
55+ inkscape:object-nodes="true"
56+ inkscape:snap-smooth-nodes="true"
57+ inkscape:snap-midpoints="true"
58+ inkscape:snap-object-midpoints="true"
59+ inkscape:snap-center="true"
60+ showguides="true"
61+ inkscape:guide-bbox="true"
62+ inkscape:snap-global="true"
63+ inkscape:window-width="1920"
64+ inkscape:window-height="1012"
65+ inkscape:window-x="0"
66+ inkscape:window-y="32"
67+ inkscape:window-maximized="1">
68+ <inkscape:grid
69+ type="xygrid"
70+ id="grid5451"
71+ empspacing="8" />
72+ <sodipodi:guide
73+ orientation="1,0"
74+ position="8,-8.0000001"
75+ id="guide4063"
76+ inkscape:locked="false" />
77+ <sodipodi:guide
78+ orientation="1,0"
79+ position="4,-8.0000001"
80+ id="guide4065"
81+ inkscape:locked="false" />
82+ <sodipodi:guide
83+ orientation="0,1"
84+ position="-8,88.000001"
85+ id="guide4067"
86+ inkscape:locked="false" />
87+ <sodipodi:guide
88+ orientation="0,1"
89+ position="-8,92.000001"
90+ id="guide4069"
91+ inkscape:locked="false" />
92+ <sodipodi:guide
93+ orientation="0,1"
94+ position="104,4"
95+ id="guide4071"
96+ inkscape:locked="false" />
97+ <sodipodi:guide
98+ orientation="0,1"
99+ position="-5,8.0000001"
100+ id="guide4073"
101+ inkscape:locked="false" />
102+ <sodipodi:guide
103+ orientation="1,0"
104+ position="88,-8.0000001"
105+ id="guide4077"
106+ inkscape:locked="false" />
107+ <sodipodi:guide
108+ orientation="0,1"
109+ position="-8,84.000001"
110+ id="guide4074"
111+ inkscape:locked="false" />
112+ <sodipodi:guide
113+ orientation="1,0"
114+ position="12,-8.0000001"
115+ id="guide4076"
116+ inkscape:locked="false" />
117+ <sodipodi:guide
118+ orientation="1,0"
119+ position="84,-8.0000001"
120+ id="guide4080"
121+ inkscape:locked="false" />
122+ <sodipodi:guide
123+ position="48,-8.0000001"
124+ orientation="1,0"
125+ id="guide4170"
126+ inkscape:locked="false" />
127+ <sodipodi:guide
128+ position="-8,48"
129+ orientation="0,1"
130+ id="guide4172"
131+ inkscape:locked="false" />
132+ <sodipodi:guide
133+ position="92,-8.0000001"
134+ orientation="1,0"
135+ id="guide4760"
136+ inkscape:locked="false" />
137+ <sodipodi:guide
138+ position="104,12"
139+ orientation="0,1"
140+ id="guide4207"
141+ inkscape:locked="false" />
142+ </sodipodi:namedview>
143+ <metadata
144+ id="metadata4879">
145+ <rdf:RDF>
146+ <cc:Work
147+ rdf:about="">
148+ <dc:format>image/svg+xml</dc:format>
149+ <dc:type
150+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
151+ <dc:title />
152+ </cc:Work>
153+ </rdf:RDF>
154+ </metadata>
155+ <g
156+ inkscape:label="Layer 1"
157+ inkscape:groupmode="layer"
158+ id="layer1"
159+ transform="translate(67.857146,-78.50504)">
160+ <g
161+ inkscape:label="Layer 1"
162+ id="layer1-695"
163+ transform="translate(-2.8652345e-6,-1.4294891e-5)">
164+ <g
165+ transform="matrix(0,-1,-1,0,373.50506,516.50504)"
166+ id="g4845-27"
167+ style="display:inline">
168+ <g
169+ inkscape:export-ydpi="90"
170+ inkscape:export-xdpi="90"
171+ inkscape:export-filename="next01.png"
172+ transform="matrix(-0.9996045,0,0,1,575.94296,-611.00001)"
173+ id="g4778-56"
174+ inkscape:label="Layer 1">
175+ <g
176+ transform="matrix(-1,0,0,1,575.99999,611)"
177+ id="g4780-75"
178+ style="display:inline">
179+ <path
180+ style="display:inline;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1"
181+ d="m 437.00209,379.49587 c -5.24691,4.1449 -10.54573,8.128 -15.94494,11.7914 -6.00476,4.0757 -11.8322,7.7257 -17.4773,10.9536 -5.20923,2.9783 -9.64507,5.2206 -13.59532,7.0003 -3.95086,-1.7798 -8.3889,-4.0213 -13.59947,-7.0003 -5.64495,-3.2278 -11.47152,-6.8778 -17.47731,-10.9536 -5.39821,-3.6627 -10.69595,-7.6466 -15.94285,-11.7914 h 7.93911 c 3.15098,2.4002 6.38063,4.7681 9.75501,7.0752 4.26477,2.9172 8.6291,5.6557 13.09079,8.2194 4.52823,2.6011 10.75085,5.7064 15.00884,7.7151 h 0.002 l 1.22173,0.5752 1.22172,-0.5752 h 0.002 c 4.25899,-2.0087 10.48126,-5.1138 15.00884,-7.7151 4.46175,-2.5637 8.82538,-5.3023 13.09078,-8.2194 3.37342,-2.307 6.60393,-4.6749 9.75502,-7.0752 h 7.9412 z"
182+ id="path4265-0-4"
183+ inkscape:connector-curvature="0" />
184+ <rect
185+ style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:4;marker:none;enable-background:accumulate"
186+ id="rect4782-01"
187+ width="96.037987"
188+ height="96"
189+ x="-438.00244"
190+ y="345.36221"
191+ transform="scale(-1,1)" />
192+ </g>
193+ </g>
194+ </g>
195+ </g>
196+ </g>
197+</svg>