@@ -4,208 +4,213 @@ import Unity.Launcher 0.1
4import Utils 0.1
4import Utils 0.1
5import "../Components"
5import "../Components"
7−Rectangle {
7+FocusScope {
11 property int panelWidth: 0
10 property int panelWidth: 0
12 readonly property bool moving: listLoader.item && listLoader.item.moving
11 readonly property bool moving: listLoader.item && listLoader.item.moving
14 signal applicationSelected(string appId)
13 signal applicationSelected(string appId)
16− AppDrawerModel {
15+ Rectangle {
20− AppDrawerProxyModel {
22− source: appDrawerModel
23− filterString: searchField.text
28 anchors.fill: parent
16 anchors.fill: parent
29− anchors.leftMargin: root.panelWidth
17+ color: "#BF000000"
31− TextField {
19+ AppDrawerModel {
32− id: searchField
20+ id: appDrawerModel
33− anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
34− placeholderText: i18n.tr("Search...")
37− Item {
23+ AppDrawerProxyModel {
38− id: sectionsContainer
24+ id: sortProxyModel
39− anchors { left: parent.left; top: searchField.bottom; right: parent.right; }
25+ source: appDrawerModel
40− height: sections.height
26+ filterString: searchField.text
57− anchors.bottom: parent.bottom
60− width: contentContainer.width
66− id: listLoader
30+ id: contentContainer
67− anchors { left: parent.left; top: sectionsContainer.bottom; right: parent.right; bottom: parent.bottom; leftMargin: units.gu(1); rightMargin: units.gu(1) }
31+ anchors.fill: parent
68− sourceComponent: sections.selectedIndex == 0 ? aToZComponent : mostUsedComponent
32+ anchors.leftMargin: root.panelWidth
36+ anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
37+ placeholderText: i18n.tr("Search...")
71− Component {
41+ Item {
72− id: mostUsedComponent
42+ id: sectionsContainer
73− ListView {
43+ anchors { left: parent.left; top: searchField.bottom; right: parent.right; }
74− anchors.fill: parent
44+ height: sections.height
75− topMargin: units.gu(1)
76− bottomMargin: units.gu(1)
78 clip: true
45 clip: true
80− header: MoreAppsHeader {
48+ Sections {
81 width: parent.width
50 width: parent.width
82− height: units.gu(6)
51+ actions: [
85− model: AppDrawerProxyModel {
60+ Rectangle {
86− source: sortProxyModel
61+ anchors.bottom: parent.bottom
87− group: AppDrawerProxyModel.GroupByAll
62+ height: units.dp(1)
64+ width: contentContainer.width
90− delegate: UbuntuShape {
69+ Loader {
91− width: parent.width
70+ id: listLoader
92− color: "#20ffffff"
71+ anchors { left: parent.left; top: sectionsContainer.bottom; right: parent.right; bottom: parent.bottom; leftMargin: units.gu(1); rightMargin: units.gu(1) }
93− aspect: UbuntuShape.Flat
72+ sourceComponent: sections.selectedIndex == 0 ? aToZComponent : mostUsedComponent
94− // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
73+ }
95− // which messes up the ListView.
96− height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
98− DrawerGridView {
75+ Component {
99− id: mostUsedGridView
76+ id: mostUsedComponent
100− anchors.fill: parent
78+ anchors.fill: parent
101− topMargin: units.gu(1)
79+ topMargin: units.gu(1)
102− bottomMargin: units.gu(1)
80+ bottomMargin: units.gu(1)
103− clip: true
82+ clip: true
84+ header: MoreAppsHeader {
89+ model: AppDrawerProxyModel {
105− model: sortProxyModel
90+ source: sortProxyModel
91+ group: AppDrawerProxyModel.GroupByAll
94+ delegate: UbuntuShape {
97+ aspect: UbuntuShape.Flat
98+ // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
99+ // which messes up the ListView.
100+ height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
108− delegateWidth: units.gu(8)
102+ DrawerGridView {
109− delegateHeight: units.gu(10)
103+ id: mostUsedGridView
110− delegate: drawerDelegateComponent
104+ anchors.fill: parent
111− }
105+ topMargin: units.gu(1)
112− }
106+ bottomMargin: units.gu(1)
116− Component {
109+ model: sortProxyModel
119− anchors.fill: parent
120− topMargin: units.gu(1)
121− bottomMargin: units.gu(1)
122− spacing: units.gu(1)
125− header: MoreAppsHeader {
130− model: AppDrawerProxyModel {
112+ delegateWidth: units.gu(8)
131− source: sortProxyModel
113+ delegateHeight: units.gu(10)
132− group: AppDrawerProxyModel.GroupByAToZ
114+ delegate: drawerDelegateComponent
135− delegate: UbuntuShape {
120+ Component {
136− width: parent.width
121+ id: aToZComponent
138− aspect: UbuntuShape.Flat
140− // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
141− // which messes up the ListView.
122+ ListView {
142− height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) +
123+ anchors.fill: parent
143− categoryNameLabel.implicitHeight + units.gu(2)
124+ topMargin: units.gu(1)
125+ bottomMargin: units.gu(1)
126+ spacing: units.gu(1)
129+ header: MoreAppsHeader {
145− Label {
134+ model: AppDrawerProxyModel {
146− id: categoryNameLabel
135+ source: sortProxyModel
147− anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
136+ group: AppDrawerProxyModel.GroupByAToZ
151− DrawerGridView {
139+ delegate: UbuntuShape {
152− id: gridView
140+ width: parent.width
153− anchors { left: parent.left; top: categoryNameLabel.bottom; right: parent.right; topMargin: units.gu(1) }
141+ color: "#20ffffff"
142+ aspect: UbuntuShape.Flat
144+ // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
145+ // which messes up the ListView.
154− height: rows * delegateHeight
146+ height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) +
147+ categoryNameLabel.implicitHeight + units.gu(2)
156− interactive: false
149+ Label {
150+ id: categoryNameLabel
151+ anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
157+ anchors { left: parent.left; top: categoryNameLabel.bottom; right: parent.right; topMargin: units.gu(1) }
158+ height: rows * delegateHeight
158− model: AppDrawerProxyModel {
162+ model: AppDrawerProxyModel {
159− id: categoryModel
163+ id: categoryModel
160− source: sortProxyModel
164+ source: sortProxyModel
161− filterLetter: model.letter
165+ filterLetter: model.letter
167+ delegateWidth: units.gu(8)
168+ delegateHeight: units.gu(10)
169+ delegate: drawerDelegateComponent
163− delegateWidth: units.gu(8)
164− delegateHeight: units.gu(10)
165− delegate: drawerDelegateComponent
173− id: drawerDelegateComponent
175− width: GridView.view.cellWidth
176− height: units.gu(10)
178− onClicked: root.applicationSelected(model.appId)
176+ Component {
177+ id: drawerDelegateComponent
179+ width: GridView.view.cellWidth
180+ height: units.gu(10)
180− Column {
182+ onClicked: root.applicationSelected(model.appId)
182− anchors.horizontalCenter: parent.horizontalCenter
183− height: childrenRect.height
184− spacing: units.gu(1)
186− UbuntuShape {
184+ Column {
188− width: units.gu(6)
185+ width: units.gu(8)
189− height: 7.5 / 8 * width
190 anchors.horizontalCenter: parent.horizontalCenter
186 anchors.horizontalCenter: parent.horizontalCenter
187+ height: childrenRect.height
188+ spacing: units.gu(1)
193+ height: 7.5 / 8 * width
194+ anchors.horizontalCenter: parent.horizontalCenter
191− backgroundMode: UbuntuShape.SolidColor
195+ backgroundMode: UbuntuShape.SolidColor
192− backgroundColor: UbuntuColors.lightGrey
196+ backgroundColor: UbuntuColors.lightGrey
193− radius: "medium"
197+ radius: "medium"
194− borderSource: 'undefined'
198+ borderSource: 'undefined'
195− source: Image {
199+ source: Image {
196− id: sourceImage
200+ id: sourceImage
197− sourceSize.width: appIcon.width
201+ sourceSize.width: appIcon.width
198− source: model.icon
202+ source: model.icon
204+ sourceFillMode: UbuntuShape.PreserveAspectCrop
200− sourceFillMode: UbuntuShape.PreserveAspectCrop
204− text: model.name
208+ text: model.name
205− width: parent.width
209+ width: parent.width
206− horizontalAlignment: Text.AlignHCenter
210+ horizontalAlignment: Text.AlignHCenter
207− fontSize: "small"
211+ fontSize: "small"
208− elide: Text.ElideRight
212+ elide: Text.ElideRight