@@ -26,7 +26,7 @@ FocusScope {
2626 id: root
2727
2828 property int panelWidth: 0
29− readonly property bool moving: listLoader.item && listLoader.item.moving
29+ readonly property bool moving: singleGroupListView && singleGroupListView.moving
3030 readonly property Item searchTextField: searchField
3131 readonly property real delegateWidth: units.gu(10)
3232
@@ -51,10 +51,6 @@ FocusScope {
5151 event.accepted = true;
5252 }
5353
54− Settings {
55− property alias selectedTab: sections.selectedIndex
56− }
57−
5854 MouseArea {
5955 anchors.fill: parent
6056 hoverEnabled: true
@@ -83,60 +79,34 @@ FocusScope {
8379 anchors.fill: parent
8480 anchors.leftMargin: root.panelWidth
8581
86− TextField {
87− id: searchField
88− objectName: "searchField"
82+ Item {
83+ id: searchFieldContainer
84+ height: units.gu(4)
8985 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
90− placeholderText: i18n.tr("Search…")
91−
92− KeyNavigation.down: sections
9386
94− onAccepted: {
95− if (searchField.displayText != "" && listLoader.item) {
96− // In case there is no currentItem (it might have been filtered away) lets reset it to the first item
97− if (!listLoader.item.currentItem) {
98− listLoader.item.currentIndex = 0;
99− }
100− root.applicationSelected(listLoader.item.getFirstAppId());
87+ TextField {
88+ id: searchField
89+ objectName: "searchField"
90+ anchors {
91+ left: parent.left
92+ top: parent.top
93+ right: parent.right
94+ bottom: parent.bottom
95+ bottomMargin: units.gu(1)
10196 }
102− }
103− }
97+ placeholderText: i18n.tr("Search…")
98+ z: 100
10499
105− Item {
106− id: sectionsContainer
107− anchors { left: parent.left; top: searchField.bottom; right: parent.right; }
108− height: sections.height
109− clip: true
110− z: 2
111−
112− Sections {
113− id: sections
114− objectName: "drawerSections"
115− width: parent.width
116−
117− KeyNavigation.up: searchField
118− KeyNavigation.down: headerFocusScope
119− KeyNavigation.backtab: searchField
120− KeyNavigation.tab: headerFocusScope
121−
122− actions: [
123− Action {
124− text: i18n.tr("Apps")
125− },
126− Action {
127− text: i18n.ctr("Apps sorted and grouped alphabetically", "A-Z")
128− // TODO: Disabling this for now as we don't get the right input from u-a-l yet.
129− // },
130− // Action {
131− // text: i18n.ctr("Most used apps", "Most used")
132− }
133− ]
100+ KeyNavigation.down: singleGroupListView
134101
135− Rectangle {
136− anchors.bottom: parent.bottom
137− height: units.dp(1)
138− color: 'gray'
139− width: contentContainer.width
102+ onAccepted: {
103+ if (searchField.displayText != "" && singleGroupListView) {
104+ // In case there is no currentItem (it might have been filtered away) lets reset it to the first item
105+ if (!appList.currentItem) {
106+ appList.currentIndex = 0;
107+ }
108+ root.applicationSelected(appList.getFirstAppId());
109+ }
140110 }
141111 }
142112 }
@@ -144,10 +114,10 @@ FocusScope {
144114 FocusScope {
145115 id: headerFocusScope
146116 objectName: "headerFocusScope"
147− KeyNavigation.up: sections
148− KeyNavigation.down: listLoader.item
149− KeyNavigation.backtab: sections
150− KeyNavigation.tab: listLoader.item
117+ KeyNavigation.up: searchField
118+ KeyNavigation.down: singleGroupListView
119+ KeyNavigation.backtab: searchField
120+ KeyNavigation.tab: singleGroupListView
151121 activeFocusOnTab: true
152122
153123 GSettings {
@@ -170,32 +140,9 @@ FocusScope {
170140 }
171141 }
172142
173− Loader {
174− id: listLoader
175− objectName: "drawerListLoader"
176− anchors { left: parent.left; top: sectionsContainer.bottom; right: parent.right; bottom: parent.bottom }
177−
178− KeyNavigation.up: headerFocusScope
179− KeyNavigation.down: searchField
180− KeyNavigation.backtab: headerFocusScope
181− KeyNavigation.tab: searchField
182−
183− sourceComponent: {
184− switch (sections.selectedIndex) {
185− case 0: return singleGroupComponent;
186− case 1: return aToZComponent;
187− }
188− }
189− Binding {
190− target: listLoader.item || null
191− property: "objectName"
192− value: "drawerItemList"
193− }
194− }
195−
196143 MouseArea {
197144 id: horizontalDragDetector
198− parent: listLoader.item ? listLoader.item : null
145+ parent: singleGroupListView
199146 anchors.fill: parent
200147 propagateComposedEvents: true
201148 property int oldX: 0
@@ -227,83 +174,37 @@ FocusScope {
227174 }
228175 }
229176
230− Component {
231− id: singleGroupComponent
232− DrawerListView {
233− id: singleGroupListView
234−
235− model: ListModel {
236− id: singleGroupModel
237− Component.onCompleted: {
238− append({"name": i18n.tr("Apps")});
239− }
240− }
241−
242− delegate: Item {
243− width: parent.width - units.gu(2)
244− anchors.horizontalCenter: parent.horizontalCenter
245−
246− readonly property string appId: model.appId
247−
248− // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
249− // which messes up the ListView.
250− height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) + units.gu(2)
251−
252− DrawerGridView {
253− id: gridView
254− anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: units.gu(1) }
255− height: rows * delegateHeight
256−
257− interactive: false
258− focus: index == aToZListView.currentIndex
259−
260− model: AppDrawerProxyModel {
261− id: categoryModel
262− source: sortProxyModel
263− dynamicSortFilter: false
264− }
265− delegateWidth: root.delegateWidth
266− delegateHeight: units.gu(11)
267− delegate: drawerDelegateComponent
268− }
269− }
177+ Item {
178+ anchors {
179+ left: parent.left
180+ right: parent.right
181+ top: searchFieldContainer.bottom
182+ bottom: parent.bottom
270183 }
271− }
184+ z: 1
185+
186+ Flickable {
187+ id: singleGroupListView
188+ clip: true
272189
273− Component {
274− id: aToZComponent
275− DrawerListView {
276− id: aToZListView
190+ contentHeight: appListContainer.height
277191
278− model: AppDrawerProxyModel {
279− source: sortProxyModel
280− sortBy: AppDrawerProxyModel.SortByAToZ
281− group: AppDrawerProxyModel.GroupByAToZ
282− dynamicSortFilter: false
283− }
192+ anchors.fill: parent
284193
285− delegate: UbuntuShape {
194+ Item {
195+ id: appListContainer
286196 width: parent.width - units.gu(2)
287197 anchors.horizontalCenter: parent.horizontalCenter
288− color: "#20ffffff"
289− aspect: UbuntuShape.Flat
290198
291199 readonly property string appId: model.appId
292200
293201 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
294202 // which messes up the ListView.
295− height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) +
296− categoryNameLabel.implicitHeight + units.gu(2)
297−
298− Label {
299− id: categoryNameLabel
300− anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
301− text: model.letter
302− }
203+ height: (Math.ceil(appList.model.count / appList.columns) * appList.delegateHeight) + units.gu(2)
303204
304205 DrawerGridView {
305− id: gridView
306− anchors { left: parent.left; top: categoryNameLabel.bottom; right: parent.right; topMargin: units.gu(1) }
206+ id: appList
207+ anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: units.gu(1) }
307208 height: rows * delegateHeight
308209
309210 interactive: false
@@ -312,7 +213,6 @@ FocusScope {
312213 model: AppDrawerProxyModel {
313214 id: categoryModel
314215 source: sortProxyModel
315− filterLetter: model.letter
316216 dynamicSortFilter: false
317217 }
318218 delegateWidth: root.delegateWidth