on xenial help sign in
more tweaks/cleanup
commit4e43d62d54e49e1723c342e5061e7724bb8dffa7 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 4 Nov 2016, 13:09 (10 years ago) parent55c9ca5
3 files changed+20−9
plugins/Unity/Launcher/appdrawermodel.cpp+5−2 plugins/Unity/Launcher/launchermodel.h−7 qml/Launcher/Drawer.qml+15
plugins/Unity/Launcher/appdrawermodel.cpp+5−2
@@ -2,8 +2,7 @@
22#include "ualwrapper.h"
33
44#include <QDebug>
5−
6−#include <ubuntu-app-launch/registry.h>
5+#include <QDateTime>
76
87AppDrawerModel::AppDrawerModel(QObject *parent):
98 AppDrawerModelInterface(parent)
@@ -17,6 +16,7 @@ AppDrawerModel::AppDrawerModel(QObject *parent):
1716 m_list.append(new LauncherItem(appId, info.name, info.icon, this));
1817 qDebug() << "added" << appId;
1918 }
19+ qsrand(QDateTime::currentMSecsSinceEpoch() / 100);
2020}
2121
2222int AppDrawerModel::rowCount(const QModelIndex &parent) const
@@ -33,6 +33,9 @@ QVariant AppDrawerModel::data(const QModelIndex &index, int role) const
3333 return m_list.at(index.row())->name();
3434 case RoleIcon:
3535 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();
3639 }
3740
3841 return QVariant();
plugins/Unity/Launcher/launchermodel.h−7
@@ -27,12 +27,6 @@ class GSettings;
2727class DBusInterface;
2828class ASAdapter;
2929
30−namespace ubuntu {
31− namespace app_launch {
32− class Registry;
33− }
34−}
35−
3630using namespace unity::shell::launcher;
3731using namespace unity::shell::application;
3832
@@ -91,7 +85,6 @@ private:
9185 ASAdapter *m_asAdapter;
9286
9387 ApplicationManagerInterface *m_appManager;
94− std::shared_ptr<ubuntu::app_launch::Registry> m_ualRegistry;
9588
9689 friend class LauncherModelTest;
9790};
qml/Launcher/Drawer.qml+15
@@ -15,6 +15,12 @@ FocusScope {
1515 property bool draggingHorizontally: false
1616 property int dragDistance: 0
1717
18+ onFocusChanged: {
19+ if (focus) {
20+ searchField.selectAll();
21+ }
22+ }
23+
1824 Rectangle {
1925 anchors.fill: parent
2026 color: "#BF000000"
@@ -40,6 +46,11 @@ FocusScope {
4046 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
4147 placeholderText: i18n.tr("Search...")
4248 focus: true
49+ onAccepted: {
50+ if (searchField.displayText != "" && listLoader.item && listLoader.item.currentItem) {
51+ root.applicationSelected(listLoader.item.currentItem.appId);
52+ }
53+ }
4354 }
4455
4556 Item {
@@ -167,6 +178,8 @@ FocusScope {
167178 // which messes up the ListView.
168179 height: (Math.ceil(mostUsedGridView.model.count / mostUsedGridView.columns) * mostUsedGridView.delegateHeight) + units.gu(2)
169180
181+ readonly property string appId: model.appId
182+
170183 DrawerGridView {
171184 id: mostUsedGridView
172185 anchors.fill: parent
@@ -209,6 +222,8 @@ FocusScope {
209222 color: "#20ffffff"
210223 aspect: UbuntuShape.Flat
211224
225+ readonly property string appId: model.appId
226+
212227 // NOTE: Cannot use gridView.rows here as it would evaluate to 0 at first and only update later,
213228 // which messes up the ListView.
214229 height: (Math.ceil(gridView.model.count / gridView.columns) * gridView.delegateHeight) +