@@ -26,7 +26,7 @@ FocusScope {
28 property int panelWidth: 0
28 property int panelWidth: 0
29− readonly property bool moving: listLoader.item && listLoader.item.moving
29+ readonly property bool moving: singleGroupListView && singleGroupListView.moving
30 readonly property Item searchTextField: searchField
30 readonly property Item searchTextField: searchField
31 readonly property real delegateWidth: units.gu(10)
31 readonly property real delegateWidth: units.gu(10)
@@ -51,10 +51,6 @@ FocusScope {
51 event.accepted = true;
51 event.accepted = true;
55− property alias selectedTab: sections.selectedIndex
58 MouseArea {
54 MouseArea {
59 anchors.fill: parent
55 anchors.fill: parent
60 hoverEnabled: true
56 hoverEnabled: true
@@ -83,60 +79,34 @@ FocusScope {
83 anchors.fill: parent
79 anchors.fill: parent
84 anchors.leftMargin: root.panelWidth
80 anchors.leftMargin: root.panelWidth
86− TextField {
82+ Item {
87− id: searchField
83+ id: searchFieldContainer
88− objectName: "searchField"
84+ height: units.gu(4)
89 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
85 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
90− placeholderText: i18n.tr("Search…")
92− KeyNavigation.down: sections
94− onAccepted: {
87+ TextField {
95− if (searchField.displayText != "" && listLoader.item) {
88+ id: searchField
96− // In case there is no currentItem (it might have been filtered away) lets reset it to the first item
89+ objectName: "searchField"
97− if (!listLoader.item.currentItem) {
90+ anchors {
98− listLoader.item.currentIndex = 0;
91+ left: parent.left
100− root.applicationSelected(listLoader.item.getFirstAppId());
93+ right: parent.right
94+ bottom: parent.bottom
95+ bottomMargin: units.gu(1)
102− }
97+ placeholderText: i18n.tr("Search…")
106− id: sectionsContainer
107− anchors { left: parent.left; top: searchField.bottom; right: parent.right; }
108− height: sections.height
114− objectName: "drawerSections"
117− KeyNavigation.up: searchField
118− KeyNavigation.down: headerFocusScope
100+ KeyNavigation.down: singleGroupListView
119− KeyNavigation.backtab: searchField
120− KeyNavigation.tab: headerFocusScope
124− text: i18n.tr("Apps")
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.
131− // text: i18n.ctr("Most used apps", "Most used")
135− Rectangle {
102+ onAccepted: {
136− anchors.bottom: parent.bottom
103+ if (searchField.displayText != "" && singleGroupListView) {
137− height: units.dp(1)
104+ // In case there is no currentItem (it might have been filtered away) lets reset it to the first item
138− color: 'gray'
105+ if (!appList.currentItem) {
139− width: contentContainer.width
106+ appList.currentIndex = 0;
108+ root.applicationSelected(appList.getFirstAppId());
@@ -144,10 +114,10 @@ FocusScope {
144 FocusScope {
114 FocusScope {
145 id: headerFocusScope
115 id: headerFocusScope
146 objectName: "headerFocusScope"
116 objectName: "headerFocusScope"
147− KeyNavigation.up: sections
117+ KeyNavigation.up: searchField
148− KeyNavigation.down: listLoader.item
118+ KeyNavigation.down: singleGroupListView
149− KeyNavigation.backtab: sections
119+ KeyNavigation.backtab: searchField
150− KeyNavigation.tab: listLoader.item
120+ KeyNavigation.tab: singleGroupListView
151 activeFocusOnTab: true
121 activeFocusOnTab: true
153 GSettings {
123 GSettings {
@@ -170,32 +140,9 @@ FocusScope {
175− objectName: "drawerListLoader"
176− anchors { left: parent.left; top: sectionsContainer.bottom; right: parent.right; bottom: parent.bottom }
178− KeyNavigation.up: headerFocusScope
179− KeyNavigation.down: searchField
180− KeyNavigation.backtab: headerFocusScope
181− KeyNavigation.tab: searchField
184− switch (sections.selectedIndex) {
185− case 0: return singleGroupComponent;
186− case 1: return aToZComponent;
190− target: listLoader.item || null
191− property: "objectName"
192− value: "drawerItemList"
196 MouseArea {
143 MouseArea {
197 id: horizontalDragDetector
144 id: horizontalDragDetector
198− parent: listLoader.item ? listLoader.item : null
145+ parent: singleGroupListView
199 anchors.fill: parent
146 anchors.fill: parent
200 propagateComposedEvents: true
147 propagateComposedEvents: true
201 property int oldX: 0
148 property int oldX: 0
@@ -227,83 +174,37 @@ FocusScope {
231− id: singleGroupComponent
233− id: singleGroupListView
236− id: singleGroupModel
237− Component.onCompleted: {
238− append({"name": i18n.tr("Apps")});
242− delegate: Item {
177+ Item {
243− width: parent.width - units.gu(2)
178+ anchors {
244− anchors.horizontalCenter: parent.horizontalCenter
179+ left: parent.left
245−
180+ right: parent.right
246− readonly property string appId: model.appId
181+ top: searchFieldContainer.bottom
247−
182+ bottom: parent.bottom
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)
254− anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: units.gu(1) }
255− height: rows * delegateHeight
258− focus: index == aToZListView.currentIndex
260− model: AppDrawerProxyModel {
262− source: sortProxyModel
263− dynamicSortFilter: false
265− delegateWidth: root.delegateWidth
266− delegateHeight: units.gu(11)
267− delegate: drawerDelegateComponent
187+ id: singleGroupListView
273− Component {
190+ contentHeight: appListContainer.height
278− model: AppDrawerProxyModel {
192+ anchors.fill: parent
279− source: sortProxyModel
280− sortBy: AppDrawerProxyModel.SortByAToZ
281− group: AppDrawerProxyModel.GroupByAToZ
282− dynamicSortFilter: false
285− delegate: UbuntuShape {
194+ Item {
195+ id: appListContainer
286 width: parent.width - units.gu(2)
196 width: parent.width - units.gu(2)
287 anchors.horizontalCenter: parent.horizontalCenter
197 anchors.horizontalCenter: parent.horizontalCenter
289− aspect: UbuntuShape.Flat
291 readonly property string appId: model.appId
199 readonly property string appId: model.appId
293 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
201 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
294 // which messes up the ListView.
202 // which messes up the ListView.
295− height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) +
203+ height: (Math.ceil(appList.model.count / appList.columns) * appList.delegateHeight) + units.gu(2)
296− categoryNameLabel.implicitHeight + units.gu(2)
299− id: categoryNameLabel
300− anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
304 DrawerGridView {
205 DrawerGridView {
305− id: gridView
206+ id: appList
306− anchors { left: parent.left; top: categoryNameLabel.bottom; right: parent.right; topMargin: units.gu(1) }
207+ anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: units.gu(1) }
307 height: rows * delegateHeight
208 height: rows * delegateHeight
309 interactive: false
210 interactive: false
@@ -312,7 +213,6 @@ FocusScope {
312 model: AppDrawerProxyModel {
213 model: AppDrawerProxyModel {
313 id: categoryModel
214 id: categoryModel
314 source: sortProxyModel
215 source: sortProxyModel
315− filterLetter: model.letter
316 dynamicSortFilter: false
216 dynamicSortFilter: false
318 delegateWidth: root.delegateWidth
218 delegateWidth: root.delegateWidth