on xenial help sign in
more tweaks/cleanup
4e43d62Michael Zanetti
plugins/Unity/Launcher/appdrawermodel.cpp+5−2
@@ -2,8 +2,7 @@
2#include "ualwrapper.h"
2#include "ualwrapper.h"
3
3
4#include <QDebug>
4#include <QDebug>
5−
5+#include <QDateTime>
6−#include <ubuntu-app-launch/registry.h>
7
6
8AppDrawerModel::AppDrawerModel(QObject *parent):
7AppDrawerModel::AppDrawerModel(QObject *parent):
9 AppDrawerModelInterface(parent)
8 AppDrawerModelInterface(parent)
@@ -17,6 +16,7 @@ AppDrawerModel::AppDrawerModel(QObject *parent):
17 m_list.append(new LauncherItem(appId, info.name, info.icon, this));
16 m_list.append(new LauncherItem(appId, info.name, info.icon, this));
18 qDebug() << "added" << appId;
17 qDebug() << "added" << appId;
19 }
18 }
19+ qsrand(QDateTime::currentMSecsSinceEpoch() / 100);
20}
20}
21
21
22int AppDrawerModel::rowCount(const QModelIndex &parent) const
22int AppDrawerModel::rowCount(const QModelIndex &parent) const
@@ -33,6 +33,9 @@ QVariant AppDrawerModel::data(const QModelIndex &index, int role) const
33 return m_list.at(index.row())->name();
33 return m_list.at(index.row())->name();
34 case RoleIcon:
34 case RoleIcon:
35 return m_list.at(index.row())->icon();
35 return m_list.at(index.row())->icon();
36+ case RoleUsage:
37+ // FIXME: u-a-l needs to provide API for usage stats.
38+ return qrand();
36 }
39 }
37
40
38 return QVariant();
41 return QVariant();
plugins/Unity/Launcher/launchermodel.h−7
@@ -27,12 +27,6 @@ class GSettings;
27class DBusInterface;
27class DBusInterface;
28class ASAdapter;
28class ASAdapter;
29
29
30−namespace ubuntu {
31− namespace app_launch {
32− class Registry;
33− }
34−}
35−
36using namespace unity::shell::launcher;
30using namespace unity::shell::launcher;
37using namespace unity::shell::application;
31using namespace unity::shell::application;
38
32
@@ -91,7 +85,6 @@ private:
91 ASAdapter *m_asAdapter;
85 ASAdapter *m_asAdapter;
92
86
93 ApplicationManagerInterface *m_appManager;
87 ApplicationManagerInterface *m_appManager;
94− std::shared_ptr<ubuntu::app_launch::Registry> m_ualRegistry;
95
88
96 friend class LauncherModelTest;
89 friend class LauncherModelTest;
97};
90};
qml/Launcher/Drawer.qml+15
@@ -15,6 +15,12 @@ FocusScope {
15 property bool draggingHorizontally: false
15 property bool draggingHorizontally: false
16 property int dragDistance: 0
16 property int dragDistance: 0
17
17
18+ onFocusChanged: {
19+ if (focus) {
20+ searchField.selectAll();
21+ }
22+ }
23+
18 Rectangle {
24 Rectangle {
19 anchors.fill: parent
25 anchors.fill: parent
20 color: "#BF000000"
26 color: "#BF000000"
@@ -40,6 +46,11 @@ FocusScope {
40 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
46 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
41 placeholderText: i18n.tr("Search...")
47 placeholderText: i18n.tr("Search...")
42 focus: true
48 focus: true
49+ onAccepted: {
50+ if (searchField.displayText != "" && listLoader.item && listLoader.item.currentItem) {
51+ root.applicationSelected(listLoader.item.currentItem.appId);
52+ }
53+ }
43 }
54 }
44
55
45 Item {
56 Item {
@@ -167,6 +178,8 @@ FocusScope {
167 // which messes up the ListView.
178 // which messes up the ListView.
168 height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
179 height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
169
180
181+ readonly property string appId: model.appId
182+
170 DrawerGridView {
183 DrawerGridView {
171 id: mostUsedGridView
184 id: mostUsedGridView
172 anchors.fill: parent
185 anchors.fill: parent
@@ -209,6 +222,8 @@ FocusScope {
209 color: "#20ffffff"
222 color: "#20ffffff"
210 aspect: UbuntuShape.Flat
223 aspect: UbuntuShape.Flat
211
224
225+ readonly property string appId: model.appId
226+
212 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
227 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
213 // which messes up the ListView.
228 // which messes up the ListView.
214 height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) +
229 height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) +