on xenial help sign in
fix issues from review
71cf8c5Michael Zanetti
plugins/Unity/Launcher/appdrawermodel.cpp+17
@@ -1,3 +1,19 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
1#include "appdrawermodel.h"
17#include "appdrawermodel.h"
2#include "ualwrapper.h"
18#include "ualwrapper.h"
3
19
@@ -38,6 +54,7 @@ QVariant AppDrawerModel::data(const QModelIndex &index, int role) const
38 return m_list.at(index.row())->keywords();
54 return m_list.at(index.row())->keywords();
39 case RoleUsage:
55 case RoleUsage:
40 // FIXME: u-a-l needs to provide API for usage stats.
56 // FIXME: u-a-l needs to provide API for usage stats.
57+ // don't forget to drop the qsrand() call in the ctor when dropping this.
41 return qrand();
58 return qrand();
42 }
59 }
43
60
plugins/Unity/Launcher/appdrawermodel.h+16
@@ -1,3 +1,19 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
1
17
2#include <unity/shell/launcher/AppDrawerModelInterface.h>
18#include <unity/shell/launcher/AppDrawerModelInterface.h>
3
19
plugins/Unity/Launcher/ualwrapper.cpp+20−4
@@ -1,3 +1,19 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
1#include <QDebug>
17#include <QDebug>
2
18
3#include "ualwrapper.h"
19#include "ualwrapper.h"
@@ -16,13 +32,13 @@ QStringList UalWrapper::installedApps()
16 QStringList appIds;
32 QStringList appIds;
17 try {
33 try {
18 for (const std::shared_ptr<Application> &app : Registry::installedApps()) {
34 for (const std::shared_ptr<Application> &app : Registry::installedApps()) {
19− if (!QString::fromStdString(app->appId().package).isEmpty()) {
35+ if (!app->appId().package.value().empty()) {
20− appIds << QString::fromStdString(app->appId().package) + QStringLiteral("_") + QString::fromStdString(app->appId().appname);
36+ appIds << QString::fromStdString(app->appId().package.value() + "_" + app->appId().appname.value());
21 } else {
37 } else {
22 appIds << QString::fromStdString(app->appId().appname);
38 appIds << QString::fromStdString(app->appId().appname);
23 }
39 }
24 }
40 }
25− } catch(std::runtime_error &e) {
41+ } catch (const std::runtime_error &e) {
26 qWarning() << "ubuntu-all-launch threw an exception listing apps:" << e.what();
42 qWarning() << "ubuntu-all-launch threw an exception listing apps:" << e.what();
27 }
43 }
28
44
@@ -49,7 +65,7 @@ UalWrapper::AppInfo UalWrapper::getApplicationInfo(const QString &appId)
49 info.keywords << QString::fromStdString(keyword);
65 info.keywords << QString::fromStdString(keyword);
50 }
66 }
51 info.valid = true;
67 info.valid = true;
52− } catch(std::runtime_error &e) {
68+ } catch (const std::runtime_error &e) {
53 qWarning() << "ubuntu-app-launch threw an exception getting app info for appId:" << appId << ":" << e.what();
69 qWarning() << "ubuntu-app-launch threw an exception getting app info for appId:" << appId << ":" << e.what();
54 }
70 }
55
71
plugins/Unity/Launcher/ualwrapper.h+16
@@ -1,3 +1,19 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
1#include <QObject>
17#include <QObject>
2
18
3class UalWrapper: public QObject
19class UalWrapper: public QObject
plugins/Utils/appdrawerproxymodel.cpp+16
@@ -1,3 +1,19 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
1#include "appdrawerproxymodel.h"
17#include "appdrawerproxymodel.h"
2
18
3#include <QDebug>
19#include <QDebug>
plugins/Utils/appdrawerproxymodel.h+16
@@ -1,3 +1,19 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
1#include <QSortFilterProxyModel>
17#include <QSortFilterProxyModel>
2
18
3#include <unity/shell/launcher/AppDrawerModelInterface.h>
19#include <unity/shell/launcher/AppDrawerModelInterface.h>
qml/Launcher/Drawer.qml+6−1
@@ -39,6 +39,7 @@ FocusScope {
39 }
39 }
40
40
41 function focusInput() {
41 function focusInput() {
42+ searchField.selectAll();
42 searchField.focus = true;
43 searchField.focus = true;
43 }
44 }
44
45
@@ -46,6 +47,10 @@ FocusScope {
46 property alias selectedTab: sections.selectedIndex
47 property alias selectedTab: sections.selectedIndex
47 }
48 }
48
49
50+ MouseArea {
51+ anchors.fill: parent
52+ }
53+
49 Rectangle {
54 Rectangle {
50 anchors.fill: parent
55 anchors.fill: parent
51 color: "#BF000000"
56 color: "#BF000000"
@@ -69,7 +74,7 @@ FocusScope {
69 TextField {
74 TextField {
70 id: searchField
75 id: searchField
71 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
76 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
72− placeholderText: i18n.tr("Search...")
77+ placeholderText: i18n.tr("Search…")
73 focus: true
78 focus: true
74 onAccepted: {
79 onAccepted: {
75 if (searchField.displayText != "" && listLoader.item && listLoader.item.currentItem) {
80 if (searchField.displayText != "" && listLoader.item && listLoader.item.currentItem) {
qml/Launcher/Launcher.qml+1−8
@@ -378,7 +378,7 @@ FocusScope {
378 }
378 }
379
379
380 Behavior on x {
380 Behavior on x {
381− enabled: !dragArea.dragging && !launcherDragArea.drag.active && !drawer.draggingHorizontally// && panel.animate;
381+ enabled: !dragArea.dragging && !launcherDragArea.drag.active && !drawer.draggingHorizontally
382 NumberAnimation {
382 NumberAnimation {
383 duration: 300
383 duration: 300
384 easing.type: Easing.OutCubic
384 easing.type: Easing.OutCubic
@@ -587,11 +587,4 @@ FocusScope {
587 }
587 }
588 }
588 }
589 ]
589 ]
590− transitions: [
591− Transition {
592− from: "fromState"
593− to: "toState"
594−
595− }
596− ]
597}
590}
tests/mocks/Unity/Launcher/MockAppDrawerModel.cpp+16
@@ -1,3 +1,19 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
1#include "MockAppDrawerModel.h"
17#include "MockAppDrawerModel.h"
2
18
3#include <QDebug>
19#include <QDebug>
tests/mocks/Unity/Launcher/MockAppDrawerModel.h+15
@@ -1,3 +1,18 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
1
16
2#include <unity/shell/launcher/AppDrawerModelInterface.h>
17#include <unity/shell/launcher/AppDrawerModelInterface.h>
3
18