on xenial help sign in
fix issues from review
commit71cf8c5b46f6ac72d46943d158a2484fc9aba578 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 24 Nov 2016, 17:17 (10 years ago) parent89f4fc0
10 files changed+139−13
plugins/Unity/Launcher/appdrawermodel.cpp+17 plugins/Unity/Launcher/appdrawermodel.h+16 plugins/Unity/Launcher/ualwrapper.cpp+20−4 plugins/Unity/Launcher/ualwrapper.h+16 plugins/Utils/appdrawerproxymodel.cpp+16 plugins/Utils/appdrawerproxymodel.h+16 qml/Launcher/Drawer.qml+6−1 qml/Launcher/Launcher.qml+1−8 tests/mocks/Unity/Launcher/MockAppDrawerModel.cpp+16 tests/mocks/Unity/Launcher/MockAppDrawerModel.h+15
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+
117#include "appdrawermodel.h"
218#include "ualwrapper.h"
319
@@ -38,6 +54,7 @@ QVariant AppDrawerModel::data(const QModelIndex &index, int role) const
3854 return m_list.at(index.row())->keywords();
3955 case RoleUsage:
4056 // 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.
4158 return qrand();
4259 }
4360
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+
117
218#include <unity/shell/launcher/AppDrawerModelInterface.h>
319
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+
117#include <QDebug>
218
319#include "ualwrapper.h"
@@ -16,13 +32,13 @@ QStringList UalWrapper::installedApps()
1632 QStringList appIds;
1733 try {
1834 for (const std::shared_ptr<Application> &app : Registry::installedApps()) {
19− if (!QString::fromStdString(app->appId().package).isEmpty()) {
20− appIds << QString::fromStdString(app->appId().package) + QStringLiteral("_") + QString::fromStdString(app->appId().appname);
35+ if (!app->appId().package.value().empty()) {
36+ appIds << QString::fromStdString(app->appId().package.value() + "_" + app->appId().appname.value());
2137 } else {
2238 appIds << QString::fromStdString(app->appId().appname);
2339 }
2440 }
25− } catch(std::runtime_error &e) {
41+ } catch (const std::runtime_error &e) {
2642 qWarning() << "ubuntu-all-launch threw an exception listing apps:" << e.what();
2743 }
2844
@@ -49,7 +65,7 @@ UalWrapper::AppInfo UalWrapper::getApplicationInfo(const QString &appId)
4965 info.keywords << QString::fromStdString(keyword);
5066 }
5167 info.valid = true;
52− } catch(std::runtime_error &e) {
68+ } catch (const std::runtime_error &e) {
5369 qWarning() << "ubuntu-app-launch threw an exception getting app info for appId:" << appId << ":" << e.what();
5470 }
5571
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+
117#include <QObject>
218
319class 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+
117#include "appdrawerproxymodel.h"
218
319#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+
117#include <QSortFilterProxyModel>
218
319#include <unity/shell/launcher/AppDrawerModelInterface.h>
qml/Launcher/Drawer.qml+6−1
@@ -39,6 +39,7 @@ FocusScope {
3939 }
4040
4141 function focusInput() {
42+ searchField.selectAll();
4243 searchField.focus = true;
4344 }
4445
@@ -46,6 +47,10 @@ FocusScope {
4647 property alias selectedTab: sections.selectedIndex
4748 }
4849
50+ MouseArea {
51+ anchors.fill: parent
52+ }
53+
4954 Rectangle {
5055 anchors.fill: parent
5156 color: "#BF000000"
@@ -69,7 +74,7 @@ FocusScope {
6974 TextField {
7075 id: searchField
7176 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
72− placeholderText: i18n.tr("Search...")
77+ placeholderText: i18n.tr("Search…")
7378 focus: true
7479 onAccepted: {
7580 if (searchField.displayText != "" && listLoader.item && listLoader.item.currentItem) {
qml/Launcher/Launcher.qml+1−8
@@ -378,7 +378,7 @@ FocusScope {
378378 }
379379
380380 Behavior on x {
381− enabled: !dragArea.dragging && !launcherDragArea.drag.active && !drawer.draggingHorizontally// && panel.animate;
381+ enabled: !dragArea.dragging && !launcherDragArea.drag.active && !drawer.draggingHorizontally
382382 NumberAnimation {
383383 duration: 300
384384 easing.type: Easing.OutCubic
@@ -587,11 +587,4 @@ FocusScope {
587587 }
588588 }
589589 ]
590− transitions: [
591− Transition {
592− from: "fromState"
593− to: "toState"
594−
595− }
596− ]
597590}
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+
117#include "MockAppDrawerModel.h"
218
319#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+ */
116
217#include <unity/shell/launcher/AppDrawerModelInterface.h>
318