on xenial help sign in
Add a no-group section and fix styling
acc1ca9Dalton Durst
qml/Launcher/Drawer.qml+38−46
@@ -121,11 +121,14 @@ FocusScope {
121
121
122 actions: [
122 actions: [
123 Action {
123 Action {
124+ text: i18n.tr("Apps")
125+ },
126+ Action {
124− text: i18n.ctr("Apps sorted alphabetically", "A-Z")
127+ text: i18n.ctr("Apps sorted and grouped alphabetically", "A-Z")
125 // TODO: Disabling this for now as we don't get the right input from u-a-l yet.
128 // TODO: Disabling this for now as we don't get the right input from u-a-l yet.
126−// },
129+ // },
127−// Action {
130+ // Action {
128−// text: i18n.ctr("Most used apps", "Most used")
131+ // text: i18n.ctr("Most used apps", "Most used")
129 }
132 }
130 ]
133 ]
131
134
@@ -179,8 +182,8 @@ FocusScope {
179
182
180 sourceComponent: {
183 sourceComponent: {
181 switch (sections.selectedIndex) {
184 switch (sections.selectedIndex) {
182− case 0: return aToZComponent;
185+ case 0: return singleGroupComponent;
183− case 1: return mostUsedComponent;
186+ case 1: return aToZComponent;
184 }
187 }
185 }
188 }
186 Binding {
189 Binding {
@@ -225,49 +228,42 @@ FocusScope {
225 }
228 }
226
229
227 Component {
230 Component {
228− id: mostUsedComponent
231+ id: singleGroupComponent
229 DrawerListView {
232 DrawerListView {
230− id: mostUsedListView
233+ id: singleGroupListView
231−
232− header: MoreAppsHeader {
233− width: parent.width
234− height: units.gu(6)
235− highlighted: headerFocusScope.activeFocus
236− onClicked: headerFocusScope.trigger();
237− }
238
234
239− model: AppDrawerProxyModel {
235+ model: ListModel {
240− source: sortProxyModel
236+ id: singleGroupModel
241− group: AppDrawerProxyModel.GroupByAll
237+ Component.onCompleted: {
242− sortBy: AppDrawerProxyModel.SortByUsage
238+ append({"name": i18n.tr("Apps")});
243− dynamicSortFilter: false
239+ }
244 }
240 }
245
241
246− delegate: UbuntuShape {
242+ delegate: Item {
247 width: parent.width - units.gu(2)
243 width: parent.width - units.gu(2)
248 anchors.horizontalCenter: parent.horizontalCenter
244 anchors.horizontalCenter: parent.horizontalCenter
249− color: "#20ffffff"
250− aspect: UbuntuShape.Flat
251− // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
252− // which messes up the ListView.
253− height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
254
245
255 readonly property string appId: model.appId
246 readonly property string appId: model.appId
256
247
257− DrawerGridView {
248+ // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
258− id: mostUsedGridView
249+ // which messes up the ListView.
259− anchors.fill: parent
250+ height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) + units.gu(2)
260− topMargin: units.gu(1)
261− bottomMargin: units.gu(1)
262− clip: true
263
251
264− interactive: true
252+ DrawerGridView {
265− focus: index == mostUsedListView.currentIndex
253+ id: gridView
254+ anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: units.gu(1) }
255+ height: rows * delegateHeight
266
256
267− model: sortProxyModel
257+ interactive: false
258+ focus: index == aToZListView.currentIndex
268
259
260+ model: AppDrawerProxyModel {
261+ id: categoryModel
262+ source: sortProxyModel
263+ dynamicSortFilter: false
264+ }
269 delegateWidth: root.delegateWidth
265 delegateWidth: root.delegateWidth
270− delegateHeight: units.gu(10)
266+ delegateHeight: units.gu(11)
271 delegate: drawerDelegateComponent
267 delegate: drawerDelegateComponent
272 }
268 }
273 }
269 }
@@ -279,13 +275,6 @@ FocusScope {
279 DrawerListView {
275 DrawerListView {
280 id: aToZListView
276 id: aToZListView
281
277
282− header: MoreAppsHeader {
283− width: parent.width
284− height: units.gu(6)
285− highlighted: headerFocusScope.activeFocus
286− onClicked: headerFocusScope.trigger();
287− }
288−
289 model: AppDrawerProxyModel {
278 model: AppDrawerProxyModel {
290 source: sortProxyModel
279 source: sortProxyModel
291 sortBy: AppDrawerProxyModel.SortByAToZ
280 sortBy: AppDrawerProxyModel.SortByAToZ
@@ -327,7 +316,7 @@ FocusScope {
327 dynamicSortFilter: false
316 dynamicSortFilter: false
328 }
317 }
329 delegateWidth: root.delegateWidth
318 delegateWidth: root.delegateWidth
330− delegateHeight: units.gu(10)
319+ delegateHeight: units.gu(11)
331 delegate: drawerDelegateComponent
320 delegate: drawerDelegateComponent
332 }
321 }
333 }
322 }
@@ -340,7 +329,7 @@ FocusScope {
340 AbstractButton {
329 AbstractButton {
341 id: drawerDelegate
330 id: drawerDelegate
342 width: GridView.view.cellWidth
331 width: GridView.view.cellWidth
343− height: units.gu(10)
332+ height: units.gu(11)
344 objectName: "drawerItem_" + model.appId
333 objectName: "drawerItem_" + model.appId
345
334
346 readonly property bool focused: index === GridView.view.currentIndex && GridView.view.activeFocus
335 readonly property bool focused: index === GridView.view.currentIndex && GridView.view.activeFocus
@@ -349,7 +338,7 @@ FocusScope {
349 z: loader.active ? 1 : 0
338 z: loader.active ? 1 : 0
350
339
351 Column {
340 Column {
352− width: units.gu(8)
341+ width: units.gu(9)
353 anchors.horizontalCenter: parent.horizontalCenter
342 anchors.horizontalCenter: parent.horizontalCenter
354 height: childrenRect.height
343 height: childrenRect.height
355 spacing: units.gu(1)
344 spacing: units.gu(1)
@@ -382,8 +371,11 @@ FocusScope {
382 id: label
371 id: label
383 text: model.name
372 text: model.name
384 width: parent.width
373 width: parent.width
374+ anchors.horizontalCenter: parent.horizontalCenter
385 horizontalAlignment: Text.AlignHCenter
375 horizontalAlignment: Text.AlignHCenter
386 fontSize: "small"
376 fontSize: "small"
377+ wrapMode: Text.WordWrap
378+ maximumLineCount: 2
387 elide: Text.ElideRight
379 elide: Text.ElideRight
388
380
389 Loader {
381 Loader {
qml/Launcher/DrawerGridView.qml+2−2
@@ -20,8 +20,8 @@ import "../Components"
20FocusScope {
20FocusScope {
21 id: root
21 id: root
22
22
23− property int delegateWidth: units.gu(10)
23+ property int delegateWidth: units.gu(11)
24− property int delegateHeight: units.gu(10)
24+ property int delegateHeight: units.gu(11)
25 property alias delegate: gridView.delegate
25 property alias delegate: gridView.delegate
26 property alias model: gridView.model
26 property alias model: gridView.model
27 property alias interactive: gridView.interactive
27 property alias interactive: gridView.interactive