on xenial help sign in
merge
commit7a4ba52bfad0e8fdc3d54cc830e2044aed809d33 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 3 Jul 2014, 11:08 (12 years ago) parentb69bcf19ecb67c
42 files changed+446−119
debian/changelog+40 debian/control+1−1 plugins/Dash/CardCreator.js+7−4 plugins/Powerd/Powerd.cpp+16−16 plugins/Powerd/Powerd.h+8−8 plugins/Unity/CMakeLists.txt+1 plugins/Unity/Session/CMakeLists.txt+17 plugins/Unity/Session/dbusunitysessionservice.cpp+46 plugins/Unity/Session/dbusunitysessionservice.h+82 plugins/Unity/Session/plugin.cpp+40 plugins/Unity/Session/plugin.h+34 plugins/Unity/Session/qmldir+3 po/es.po+7−7 qml/Components/PageHeader.qml+3−2 qml/Components/SearchHistoryModel.qml−41 qml/Dash/CardVerticalJournal.qml−3 qml/Dash/Dash.qml−3 qml/Dash/DashContent.qml−3 qml/Dash/GenericScopeView.qml−2 qml/Dash/ScopeItem.qml−3 qml/Greeter/LoginList.qml+4−4 qml/ScopeTool.qml−1 qml/Shell.qml+26−1 src/main.cpp+1 tests/mocks/AccountsService/AccountsService.cpp+3−1 tests/mocks/AccountsService/CMakeLists.txt−2 tests/mocks/Powerd/Powerd.h+7−7 tests/mocks/Unity/Launcher/CMakeLists.txt−2 tests/mocks/Unity/Launcher/MockLauncherItem.cpp+3−1 tests/mocks/Unity/fake_categories.cpp+1−1 tests/mocks/Unity/fake_scope.cpp+5 tests/mocks/Unity/fake_scope.h+2 tests/plugins/Dash/cardcreator/1.res+1 tests/plugins/Dash/cardcreator/3.res+1 tests/plugins/Dash/cardcreator/5.res+1−1 tests/plugins/Unity/CMakeLists.txt+1 tests/plugins/Unity/Session/CMakeLists.txt+20 tests/plugins/Unity/Session/sessionbackendtest.cpp+64 tests/qmltests/Components/tst_LazyImage.qml−1 tests/qmltests/Components/tst_PageHeader.qml−1 tests/qmltests/Dash/tst_DashContent.qml−2 tests/qmltests/tst_Shell.qml+1−1
debian/changelog+40
@@ -1,3 +1,43 @@
1+unity8 (7.89+14.10.20140627-0ubuntu1) utopic; urgency=low
2+
3+ [ Michael Terry ]
4+ * Fix path in launcher mock after moving our mock icons, to avoid a
5+ lot of "icon not found" warnings during qmluitests.
6+ * Fix the testMultiGreeter qmluitest. Incoming method variables are
7+ apparently read-only in Qt5.3. (LP: #1332488)
8+
9+ [ CI bot ]
10+ * Resync trunk
11+
12+ [ Michał Sawicz ]
13+ * Adapt scope mock to new api and quiet unused variable warnings.
14+ * Fix dynamic overlay height. (LP: #1334879)
15+ * Don't center items in CardVerticalJournal, kind of beats the
16+ purpose... Also don't bind unnecessarily.
17+
18+ [ Ying-Chun Liu ]
19+ * Fix LP:1330957 Fix some failed test cases. (LP: #1330957)
20+
21+ [ Albert Astals ]
22+ * Don't seem to need this waitForRendering And makes test fail in 5.3
23+
24+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 27 Jun 2014 08:47:58 +0000
25+
26+unity8 (7.89+14.10.20140624.1-0ubuntu1) utopic; urgency=low
27+
28+ [ Alberto Aguirre ]
29+ * Update Powerd plugin and Shell.qml to accommodate changes in the
30+ display power state notification.
31+
32+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 24 Jun 2014 17:11:08 +0000
33+
34+unity8 (7.89+14.10.20140624-0ubuntu1) utopic; urgency=low
35+
36+ [ Ying-Chun Liu ]
37+ * Add logout support. Reviewed by: Daniel d'Andrada (LP: #1302213)
38+
39+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 24 Jun 2014 08:17:09 +0000
40+
141unity8 (7.89+14.10.20140623.1-0ubuntu1) utopic; urgency=low
242
343 [ Michał Sawicz ]
debian/control+1−1
@@ -17,7 +17,7 @@ Build-Depends: cmake,
1717 libpulse-dev,
1818 libqmenumodel-dev (>= 0.2.7),
1919 libqt5xmlpatterns5-dev,
20− libunity-api-dev (>= 7.82),
20+ libunity-api-dev (>= 7.83),
2121 libunity-mir-dev,
2222 libusermetricsoutput1-dev,
2323 libxcb1-dev,
plugins/Dash/CardCreator.js+7−4
@@ -113,7 +113,7 @@ var kOverlayLoaderCode = 'Loader { \n\
113113 visible: showHeader && status == Loader.Ready; \n\
114114 sourceComponent: ShaderEffect { \n\
115115 id: overlay; \n\
116− height: fixedHeaderHeight > 0 ? fixedHeaderHeight + units.gu(1) * 2 : headerHeight; \n\
116+ height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
117117 opacity: 0.6; \n\
118118 property var source: ShaderEffectSource { \n\
119119 id: shaderSource; \n\
@@ -363,11 +363,11 @@ function cardString(template, components) {
363363 }
364364 }
365365 var headerLeftAnchor;
366− var headerLeftAnchorHasMagin = false;
366+ var headerLeftAnchorHasMargin = false;
367367 if (isHorizontal && hasArt) {
368368 headerLeftAnchor = 'left: artShapeHolder.right; \n\
369369 leftMargin: units.gu(1);\n';
370− headerLeftAnchorHasMagin = true;
370+ headerLeftAnchorHasMargin = true;
371371 } else {
372372 headerLeftAnchor = 'left: parent.left;\n';
373373 }
@@ -392,7 +392,7 @@ function cardString(template, components) {
392392 if (!hasHeaderRow) {
393393 anchors += headerLeftAnchor;
394394 anchors += headerVerticalAnchors;
395− if (!headerLeftAnchorHasMagin) {
395+ if (!headerLeftAnchorHasMargin) {
396396 anchors += 'leftMargin: units.gu(1);\n'
397397 }
398398 } else {
@@ -444,6 +444,9 @@ function cardString(template, components) {
444444 titleAnchors = "right: parent.right;";
445445 titleAnchors += headerLeftAnchor;
446446 titleAnchors += headerVerticalAnchors;
447+ if (!headerLeftAnchorHasMargin) {
448+ titleAnchors += 'leftMargin: units.gu(1);\n'
449+ }
447450 }
448451 subtitleAnchors = 'left: titleLabel.left; \n\
449452 leftMargin: titleLabel.leftMargin; \n\
plugins/Powerd/Powerd.cpp+16−16
@@ -19,35 +19,35 @@
1919#include "Powerd.h"
2020#include <QDBusPendingCall>
2121
22−void autoBrightnessChanged(GSettings *settings, const gchar *key, QDBusInterface *powerd)
22+void autoBrightnessChanged(GSettings *settings, const gchar *key, QDBusInterface *unityScreen)
2323{
2424 bool value = g_settings_get_boolean(settings, key);
25− powerd->asyncCall("userAutobrightnessEnable", QVariant(value));
25+ unityScreen->asyncCall("userAutobrightnessEnable", QVariant(value));
2626}
2727
2828Powerd::Powerd(QObject* parent)
2929 : QObject(parent),
30− powerd(NULL)
30+ unityScreen(NULL)
3131{
32− powerd = new QDBusInterface("com.canonical.powerd",
33− "/com/canonical/powerd",
34− "com.canonical.powerd",
35− QDBusConnection::SM_BUSNAME(), this);
32+ unityScreen = new QDBusInterface("com.canonical.Unity.Screen",
33+ "/com/canonical/Unity/Screen",
34+ "com.canonical.Unity.Screen",
35+ QDBusConnection::SM_BUSNAME(), this);
3636
37− powerd->connection().connect("com.canonical.powerd",
38− "/com/canonical/powerd",
39− "com.canonical.powerd",
40− "DisplayPowerStateChange",
41− this,
42− SIGNAL(displayPowerStateChange(int, unsigned int)));
37+ unityScreen->connection().connect("com.canonical.Unity.Screen",
38+ "/com/canonical/Unity/Screen",
39+ "com.canonical.Unity.Screen",
40+ "DisplayPowerStateChange",
41+ this,
42+ SIGNAL(displayPowerStateChange(int, int)));
4343
4444 systemSettings = g_settings_new("com.ubuntu.touch.system");
45− g_signal_connect(systemSettings, "changed::auto-brightness", G_CALLBACK(autoBrightnessChanged), powerd);
46− autoBrightnessChanged(systemSettings, "auto-brightness", powerd);
45+ g_signal_connect(systemSettings, "changed::auto-brightness", G_CALLBACK(autoBrightnessChanged), unityScreen);
46+ autoBrightnessChanged(systemSettings, "auto-brightness", unityScreen);
4747}
4848
4949Powerd::~Powerd()
5050{
51− g_signal_handlers_disconnect_by_data(systemSettings, powerd);
51+ g_signal_handlers_disconnect_by_data(systemSettings, unityScreen);
5252 g_object_unref(systemSettings);
5353}
plugins/Powerd/Powerd.h+8−8
@@ -28,15 +28,15 @@ class Powerd: public QObject
2828{
2929 Q_OBJECT
3030 Q_ENUMS(Status)
31− Q_FLAGS(DisplayFlag DisplayFlags)
31+ Q_ENUMS(DisplayStateChangeReason)
3232
3333public:
34− enum DisplayFlag {
35− UseProximity = 1, // Use proximity sensor to override screen state
36− DisableAutoBrightness = 2, // Force autobrightness to be disabled
37− Bright = 4, // Request the screen to stay bright
34+ enum DisplayStateChangeReason {
35+ Unknown = 0,
36+ Inactivity = 1, // Display changed state due to inactivity
37+ PowerKey = 2, // Display changed state due to user pressing power key
38+ Proximity = 3, // Display changed state due to proximity events
3839 };
39− Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
4040
4141 enum Status {
4242 Off,
@@ -47,10 +47,10 @@ public:
4747 ~Powerd();
4848
4949Q_SIGNALS:
50− void displayPowerStateChange(int status, unsigned int flags);
50+ void displayPowerStateChange(int status, int reason);
5151
5252private:
53− QDBusInterface *powerd;
53+ QDBusInterface *unityScreen;
5454 GSettings *systemSettings;
5555};
5656
plugins/Unity/CMakeLists.txt+1
@@ -1,2 +1,3 @@
11add_subdirectory(Indicators)
22add_subdirectory(Launcher)
3+add_subdirectory(Session)
plugins/Unity/Session/CMakeLists.txtnew file+17
@@ -0,0 +1,17 @@
1+include_directories(
2+ ${CMAKE_CURRENT_SOURCE_DIR}
3+)
4+
5+set(QMLSESSIONPLUGIN_SRC
6+ plugin.cpp
7+ dbusunitysessionservice.cpp
8+ )
9+
10+add_library(UnitySession-qml MODULE
11+ ${QMLSESSIONPLUGIN_SRC}
12+ )
13+
14+qt5_use_modules(UnitySession-qml DBus Qml)
15+
16+# export the qmldir and qmltypes files
17+add_unity8_plugin(Unity.Session 0.1 Unity/Session TARGETS UnitySession-qml)
plugins/Unity/Session/dbusunitysessionservice.cppnew file+46
@@ -0,0 +1,46 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it under
5+ * the terms of the GNU Lesser General Public License version 3, as published by
6+ * the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but WITHOUT
9+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+ * Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+// local
18+#include "dbusunitysessionservice.h"
19+
20+// Qt
21+#include <QDBusConnection>
22+
23+DBusUnitySessionService::DBusUnitySessionService() : QObject()
24+{
25+ QDBusConnection connection = QDBusConnection::sessionBus();
26+
27+ connection.registerService("com.canonical.Unity");
28+ connection.registerObject("/com/canonical/Unity/Session", this,
29+ QDBusConnection::ExportScriptableSignals
30+ | QDBusConnection::ExportScriptableSlots
31+ | QDBusConnection::ExportScriptableInvokables);
32+}
33+
34+DBusUnitySessionService::~DBusUnitySessionService()
35+{
36+}
37+
38+void DBusUnitySessionService::Logout()
39+{
40+ Q_EMIT logoutReady();
41+}
42+
43+void DBusUnitySessionService::RequestLogout()
44+{
45+ Q_EMIT logoutRequested(false);
46+}
plugins/Unity/Session/dbusunitysessionservice.hnew file+82
@@ -0,0 +1,82 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it under
5+ * the terms of the GNU Lesser General Public License version 3, as published by
6+ * the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but WITHOUT
9+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+ * Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#ifndef DBUSUNITYSESSIONSERVICE_H
18+#define DBUSUNITYSESSIONSERVICE_H
19+
20+#include <QObject>
21+
22+/**
23+ * DBusUnitySessionService provides com.canonical.Unity.Session dbus
24+ * interface.
25+ *
26+ * com.canonical.Unity.Session interface provides public methods
27+ * and signals to handle Logout/Reboot/Shutdown.
28+ */
29+class DBusUnitySessionService : public QObject
30+{
31+ Q_OBJECT
32+ Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.Session")
33+
34+public:
35+ DBusUnitySessionService();
36+ ~DBusUnitySessionService();
37+
38+Q_SIGNALS:
39+ /**
40+ * logoutRequested signal
41+ *
42+ * This signal is emitted when some applications request the system to
43+ * logout.
44+ * @param have_inhibitors if there are any special running applications
45+ * which inhibit the logout.
46+ */
47+ void logoutRequested(bool have_inhibitors);
48+
49+ /**
50+ * logoutReady signal
51+ *
52+ * This signal is emitted when all the apps are closed. And the system
53+ * is safe to logout.
54+ */
55+ void logoutReady();
56+
57+public Q_SLOTS:
58+ /**
59+ * Logout the system.
60+ *
61+ * This method directly logout the system without user's confirmation.
62+ * Ordinary applications should avoid calling this method. Please call
63+ * RequestLogout() to ask the user to decide logout or not.
64+ * This method will stop all the running applications and then signal
65+ * logoutReady when all the apps stopped.
66+ */
67+ Q_SCRIPTABLE void Logout();
68+
69+ /**
70+ * Issue a logout request.
71+ *
72+ * This method emit the logoutRequested signal to the shell with a boolean
73+ * which indicates if there's any inhibitors. The shell should receive
74+ * this signal and display a dialog to ask the user to confirm the logout
75+ * action. If confirmed, shell can call Logout() method to kill the apps
76+ * and then logout
77+ */
78+ Q_SCRIPTABLE void RequestLogout();
79+
80+};
81+
82+#endif // DBUSUNITYSESSIONSERVICE_H
plugins/Unity/Session/plugin.cppnew file+40
@@ -0,0 +1,40 @@
1+/*
2+ * Copyright (C) 2014 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+ * Authors: Ying-Chun Liu (PaulLiu) <paul.liu@canonical.com>
17+ */
18+
19+#include "plugin.h"
20+#include "dbusunitysessionservice.h"
21+
22+#include <QAbstractItemModel>
23+#include <QDBusConnection>
24+#include <QtQml/qqml.h>
25+
26+static QObject *dbusunitysessionservice_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
27+{
28+ Q_UNUSED(engine)
29+ Q_UNUSED(scriptEngine)
30+
31+ return new DBusUnitySessionService();
32+}
33+
34+void SessionPlugin::registerTypes(const char *uri)
35+{
36+ qmlRegisterType<QAbstractItemModel>();
37+
38+ Q_ASSERT(uri == QLatin1String("Unity.Session"));
39+ qmlRegisterSingletonType<DBusUnitySessionService>(uri, 0, 1, "DBusUnitySessionService", dbusunitysessionservice_provider);
40+}
plugins/Unity/Session/plugin.hnew file+34
@@ -0,0 +1,34 @@
1+/*
2+ * Copyright (C) 2014 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+ * Authors: Ying-Chun Liu (PaulLiu) <paul.liu@canonical.com>
17+ */
18+
19+#ifndef SESSION_PLUGIN_H
20+#define SESSION_PLUGIN_H
21+
22+#include <QtQml/QQmlEngine>
23+#include <QtQml/QQmlExtensionPlugin>
24+
25+class SessionPlugin : public QQmlExtensionPlugin
26+{
27+ Q_OBJECT
28+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29+
30+public:
31+ void registerTypes(const char *uri);
32+};
33+
34+#endif
plugins/Unity/Session/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Unity.Session
2+plugin UnitySession-qml
3+typeinfo UnitySession.qmltypes
po/es.po+7−7
@@ -8,14 +8,14 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-06-13 09:55+0200\n"
11−"PO-Revision-Date: 2014-06-02 06:28+0000\n"
12−"Last-Translator: benjisp94 <benjisp94@gmail.com>\n"
11+"PO-Revision-Date: 2014-06-26 03:08+0000\n"
12+"Last-Translator: Adolfo Jayme <fitoschido@gmail.com>\n"
1313"Language-Team: Spanish <es@li.org>\n"
1414"MIME-Version: 1.0\n"
1515"Content-Type: text/plain; charset=UTF-8\n"
1616"Content-Transfer-Encoding: 8bit\n"
17−"X-Launchpad-Export-Date: 2014-06-17 06:51+0000\n"
18−"X-Generator: Launchpad (build 17045)\n"
17+"X-Launchpad-Export-Date: 2014-06-27 07:13+0000\n"
18+"X-Generator: Launchpad (build 17077)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -83,7 +83,7 @@ msgstr "Llamada de emergencia"
8383
8484#: qml/Components/Lockscreen.qml:231
8585msgid "OK"
86−msgstr ""
86+msgstr "Aceptar"
8787
8888#: qml/Components/PageHeader.qml:365
8989msgid "Recent searches"
@@ -100,11 +100,11 @@ msgstr "Hola"
100100
101101#: qml/Components/PinLockscreen.qml:198
102102msgid "CANCEL"
103−msgstr ""
103+msgstr "CANCELAR"
104104
105105#: qml/Components/PinLockscreen.qml:216
106106msgid "DONE"
107−msgstr ""
107+msgstr "HECHO"
108108
109109#: qml/Components/SeeMore.qml:35
110110msgid "See more"
qml/Components/PageHeader.qml+3−2
@@ -20,17 +20,18 @@ import Ubuntu.Components.Themes.Ambiance 1.1
2020import Ubuntu.Components.Popups 1.0
2121import Ubuntu.Components.ListItems 1.0
2222
23+import "SearchHistoryModel"
24+
2325Item {
2426 id: root
2527 implicitHeight: headerContainer.height + units.gu(2) + bottomContainer.height
26− height: implicitHeight
2728
2829 property bool showBackButton: false
2930 property string title
3031 property string imageSource
3132
3233 property bool searchEntryEnabled: false
33− property ListModel searchHistory
34+ property ListModel searchHistory: SearchHistoryModel
3435 property alias searchQuery: searchTextField.text
3536 property bool searchInProgress: false
3637
qml/Components/SearchHistoryModel.qmldeleted−41
@@ -1,41 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−
17−import QtQuick 2.0
18−
19−// TODO sanitize input, move to persistent storage
20−
21−ListModel {
22− function addQuery(newQuery) {
23− // strip whitespaces
24− newQuery = newQuery.replace(/^\s+|\s+$/g, '');
25− // ignore empty queries
26− if (newQuery == "") return
27− for (var i = 0; i < count; i++) {
28− if (get(i).query == newQuery) {
29− // promote existing entry
30− move(i, 0, 1)
31− return
32− }
33− }
34− // add a new entry
35− insert(0, { "query": newQuery })
36− if (count > 3) {
37− // remove entries if there's more than three
38− remove(3)
39− }
40− }
41−}
qml/Dash/CardVerticalJournal.qml−3
@@ -67,11 +67,8 @@ DashRenderer {
6767 id: loader
6868 sourceComponent: cardTool.cardComponent
6969 width: cardTool.cardWidth
70− anchors.horizontalCenter: parent.horizontalCenter
7170 onLoaded: {
7271 item.objectName = "delegate" + index;
73− item.width = Qt.binding(function() { return cardTool.cardWidth; });
74− item.height = Qt.binding(function() { return cardTool.cardHeight; });
7572 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
7673 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
7774 item.cardData = Qt.binding(function() { return model; });
qml/Dash/Dash.qml−3
@@ -26,7 +26,6 @@ Showable {
2626
2727 visible: shown
2828
29− property ListModel searchHistory: SearchHistoryModel {}
3029 property bool searchable: !dashContent.previewOpen && !scopeItem.previewOpen
3130
3231 property string showScopeOnLoaded: "clickscope"
@@ -76,7 +75,6 @@ Showable {
7675 height: parent.height
7776 model: filteredScopes
7877 scopes: scopes
79− searchHistory: dash.searchHistory
8078 visible: x != -width
8179 onGotoScope: {
8280 dash.setCurrentScope(scopeId, true, false);
@@ -110,7 +108,6 @@ Showable {
110108 anchors.left: dashContent.right
111109 width: parent.width
112110 height: parent.height
113− searchHistory: dash.searchHistory
114111 scale: dash.contentScale
115112 clip: scale != 1.0
116113 visible: scope != null
qml/Dash/DashContent.qml−3
@@ -28,8 +28,6 @@ Item {
2828 readonly property alias currentIndex: dashContentList.currentIndex
2929 property alias previewOpen: previewListView.open
3030
31− property ListModel searchHistory
32−
3331 signal scopeLoaded(string scopeId)
3432 signal gotoScope(string scopeId)
3533 signal openScope(var scope)
@@ -147,7 +145,6 @@ Item {
147145
148146 onLoaded: {
149147 item.objectName = scope.id
150− item.searchHistory = dashContent.searchHistory;
151148 item.previewListView = previewListView;
152149 item.scope = Qt.binding(function() { return scope })
153150 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
qml/Dash/GenericScopeView.qml−2
@@ -33,7 +33,6 @@ FocusScope {
3333 property Item previewListView: null
3434 property string title
3535 property bool hasBackAction: false
36− property ListModel searchHistory
3736 property bool enableHeightBehaviorOnNextCreation: false
3837 property var categoryView: categoryView
3938
@@ -315,7 +314,6 @@ FocusScope {
315314 id: pageHeader
316315 width: parent.width
317316 title: scopeView.title
318− searchHistory: scopeView.searchHistory
319317 showBackButton: scopeView.hasBackAction
320318 searchEntryEnabled: true
321319 searchInProgress: scopeView.scope.searchInProgress
qml/Dash/ScopeItem.qml−3
@@ -25,8 +25,6 @@ Item {
2525 property alias scope: scopeView.scope
2626 property alias previewOpen: previewListView.open
2727
28− property ListModel searchHistory
29−
3028 signal back
3129 signal gotoScope(string scopeId)
3230 signal openScope(var scope)
@@ -50,7 +48,6 @@ Item {
5048 isCurrent: scope != null
5149 title: scope ? scope.name : ""
5250 hasBackAction: true
53− searchHistory: root.searchHistory
5451 previewListView: previewListView
5552
5653 onBackClicked: root.back();
qml/Greeter/LoginList.qml+4−4
@@ -257,13 +257,13 @@ Item {
257257
258258 onShowMessage: {
259259 // inefficient, but we only rarely deal with messages
260− text = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>");
260+ var html = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>")
261261 if (isError)
262− text = "<font color=\"#df382c\">" + text + "</font>"
262+ html = "<font color=\"#df382c\">" + html + "</font>"
263263 if (infoLabel.text == "")
264− infoLabel.text = text;
264+ infoLabel.text = html
265265 else
266− infoLabel.text = infoLabel.text + "<br>" + text;
266+ infoLabel.text = infoLabel.text + "<br>" + html
267267 }
268268
269269 onShowPrompt: {
qml/ScopeTool.qml−1
@@ -73,7 +73,6 @@ Rectangle {
7373 id: dashContent
7474
7575 model: filteredScopes
76− searchHistory: SearchHistoryModel { }
7776 property var scope: scopes.getScope(currentIndex)
7877
7978 anchors {
qml/Shell.qml+26−1
@@ -31,6 +31,7 @@ import "Panel"
3131import "Components"
3232import "Notifications"
3333import Unity.Notifications 1.0 as NotificationBackend
34+import Unity.Session 0.1
3435
3536FocusScope {
3637 id: shell
@@ -267,6 +268,30 @@ FocusScope {
267268 }
268269 }
269270
271+ Connections {
272+ target: DBusUnitySessionService
273+
274+ function closeAllApps() {
275+ while (true) {
276+ var app = ApplicationManager.get(0);
277+ if (app === null) {
278+ break;
279+ }
280+ ApplicationManager.stopApplication(app.appId);
281+ }
282+ }
283+
284+ onLogoutRequested: {
285+ // TODO: Display a dialog to ask the user to confirm.
286+ DBusUnitySessionService.Logout();
287+ }
288+
289+ onLogoutReady: {
290+ closeAllApps();
291+ Qt.quit();
292+ }
293+ }
294+
270295 Loader {
271296 id: applicationsDisplayLoader
272297 anchors.fill: parent
@@ -427,7 +452,7 @@ FocusScope {
427452 onDisplayPowerStateChange: {
428453 // We ignore any display-off signals when the proximity sensor
429454 // is active. This usually indicates something like a phone call.
430− if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
455+ if (status == Powerd.Off && reason != Powerd.Proximity) {
431456 greeter.showNow();
432457 }
433458
src/main.cpp+1
@@ -161,6 +161,7 @@ Load the testability driver");
161161
162162 view->setSource(source);
163163 view->setColor("transparent");
164+ QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));
164165
165166 if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || parser.isSet(fullscreenOption)) {
166167 view->showFullScreen();
tests/mocks/AccountsService/AccountsService.cpp+3−1
@@ -18,9 +18,11 @@
1818
1919#include "AccountsService.h"
2020
21+#include <paths.h>
22+
2123AccountsService::AccountsService(QObject* parent)
2224 : QObject(parent),
23− m_backgroundFile(TOP_SRCDIR "/qml/graphics/phone_background.jpg"),
25+ m_backgroundFile(qmlDirectory() + "graphics/phone_background.jpg"),
2426 m_statsWelcomeScreen(true)
2527{
2628}
tests/mocks/AccountsService/CMakeLists.txt−2
@@ -1,5 +1,3 @@
1−add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
2−
31add_library(MockAccountsService-qml MODULE
42 AccountsService.cpp
53 plugin.cpp
tests/mocks/Powerd/Powerd.h+7−7
@@ -25,15 +25,15 @@ class Powerd: public QObject
2525{
2626 Q_OBJECT
2727 Q_ENUMS(Status)
28− Q_FLAGS(DisplayFlag DisplayFlags)
28+ Q_ENUMS(DisplayStateChangeReason)
2929
3030public:
31− enum DisplayFlag {
32− UseProximity = 1, // Use proximity sensor to override screen state
33− DisableAutoBrightness = 2, // Force autobrightness to be disabled
34− Bright = 4, // Request the screen to stay bright
31+ enum DisplayStateChangeReason {
32+ Unknown = 0,
33+ Inactivity = 1, // Display changed state due to inactivity
34+ PowerKey = 2, // Display changed state due to user pressing power key
35+ Proximity = 3, // Display changed state due to proximity events
3536 };
36− Q_DECLARE_FLAGS(DisplayFlags, DisplayFlag)
3737
3838 enum Status {
3939 Off,
@@ -43,7 +43,7 @@ public:
4343 explicit Powerd(QObject *parent = 0);
4444
4545Q_SIGNALS:
46− void displayPowerStateChange(int status, unsigned int flags);
46+ void displayPowerStateChange(int status, int reason);
4747};
4848
4949#endif
tests/mocks/Unity/Launcher/CMakeLists.txt−2
@@ -1,7 +1,5 @@
11pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
22
3−add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
4−
53include_directories(
64 ${CMAKE_CURRENT_SOURCE_DIR}
75)
tests/mocks/Unity/Launcher/MockLauncherItem.cpp+3−1
@@ -20,6 +20,8 @@
2020#include "MockLauncherItem.h"
2121#include "MockQuickListModel.h"
2222
23+#include <paths.h>
24+
2325using namespace unity::shell::launcher;
2426
2527MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent):
@@ -27,7 +29,7 @@ MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopF
2729 m_appId(appId),
2830 m_desktopFile(desktopFile),
2931 m_name(name),
30− m_icon(TOP_SRCDIR "/graphics/applicationIcons/" + icon + ".png"),
32+ m_icon(qmlDirectory() + "graphics/applicationIcons/" + icon + ".png"),
3133 m_pinned(false),
3234 m_running(false),
3335 m_recent(false),
tests/mocks/Unity/fake_categories.cpp+1−1
@@ -50,7 +50,7 @@ void Categories::addSpecialCategory(QString const& categoryId, QString const& na
5050 }
5151}
5252
53−bool Categories::overrideCategoryJson(QString const& categoryId, QString const& json)
53+bool Categories::overrideCategoryJson(QString const& /* categoryId */, QString const& /* json */)
5454{
5555 qFatal("Using un-implemented Categories::overrideCategoryJson");
5656}
tests/mocks/Unity/fake_scope.cpp+5
@@ -155,6 +155,11 @@ bool Scope::hasDepartments() const
155155 return true;
156156}
157157
158+QVariantMap Scope::customizations() const
159+{
160+ return QVariantMap();
161+}
162+
158163unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
159164{
160165 if (id.isEmpty())
tests/mocks/Unity/fake_scope.h+2
@@ -64,6 +64,8 @@ public:
6464 Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
6565 Q_INVOKABLE void loadDepartment(const QString& id) override;
6666
67+ QVariantMap customizations() const override;
68+
6769protected:
6870
6971 QString m_id;
tests/plugins/Dash/cardcreator/1.res+1
@@ -68,6 +68,7 @@ Label {
6868 anchors { right: parent.right;left: parent.left;
6969top: artShapeHolder.bottom;
7070 topMargin: units.gu(1);
71+leftMargin: units.gu(1);
7172 }
7273 elide: Text.ElideRight;
7374 fontSize: "small";
tests/plugins/Dash/cardcreator/3.res+1
@@ -68,6 +68,7 @@ Label {
6868 anchors { right: parent.right;left: parent.left;
6969top: artShapeHolder.bottom;
7070 topMargin: units.gu(1);
71+leftMargin: units.gu(1);
7172}
7273 elide: Text.ElideRight;
7374 fontSize: "small";
tests/plugins/Dash/cardcreator/5.res+1−1
@@ -73,7 +73,7 @@ Loader {
7373 visible: showHeader && status == Loader.Ready;
7474 sourceComponent: ShaderEffect {
7575 id: overlay;
76− height: fixedHeaderHeight > 0 ? fixedHeaderHeight + units.gu(1) * 2 : headerHeight;
76+ height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
7777 opacity: 0.6;
7878 property var source: ShaderEffectSource {
7979 id: shaderSource;
tests/plugins/Unity/CMakeLists.txt+1
@@ -1,2 +1,3 @@
11add_subdirectory(Indicators)
22add_subdirectory(Launcher)
3+add_subdirectory(Session)
tests/plugins/Unity/Session/CMakeLists.txtnew file+20
@@ -0,0 +1,20 @@
1+include_directories(
2+ ${CMAKE_CURRENT_BINARY_DIR}
3+ ${CMAKE_SOURCE_DIR}/plugins/Unity/Session
4+)
5+
6+add_definitions(-DSM_BUSNAME=sessionBus)
7+add_definitions(-DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
8+add_definitions(-DSESSION_TESTING)
9+
10+### SessionBackendTest
11+set(testBackendCommand dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/sessionbackendtestExec
12+ --parameter -o --parameter ${CMAKE_BINARY_DIR}/sessionbackendtest.xml,xunitxml
13+ --parameter -o --parameter -,txt)
14+add_test(NAME sessionbackendtest COMMAND ${testBackendCommand})
15+add_custom_target(sessionbackendtest ${testBackendCommand})
16+add_executable(sessionbackendtestExec
17+ sessionbackendtest.cpp
18+ ${CMAKE_SOURCE_DIR}/plugins/Unity/Session/dbusunitysessionservice.cpp
19+)
20+qt5_use_modules(sessionbackendtestExec Test Core Qml DBus)
tests/plugins/Unity/Session/sessionbackendtest.cppnew file+64
@@ -0,0 +1,64 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU Lesser General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Ying-Chun Liu (PaulLiu) <paul.liu@canonical.com>
18+ */
19+
20+#include <QtTest>
21+#include <QDBusConnection>
22+#include <QDBusMessage>
23+#include <QDBusInterface>
24+#include <QDBusReply>
25+#include <QDBusVariant>
26+
27+#include "dbusunitysessionservice.h"
28+
29+class SessionBackendTest : public QObject
30+{
31+ Q_OBJECT
32+
33+private Q_SLOTS:
34+
35+ void initTestCase() {
36+ }
37+
38+ void testDbusIfaceMethods_data() {
39+ QTest::addColumn<QString>("method");
40+
41+ QTest::newRow("Logout") << "RequestLogout";
42+ }
43+
44+ void testDbusIfaceMethods() {
45+ QFETCH(QString, method);
46+
47+ DBusUnitySessionService dbusUnitySessionService;
48+
49+ QDBusConnection con = QDBusConnection::sessionBus();
50+ QDBusInterface interface ("com.canonical.Unity",
51+ "/com/canonical/Unity/Session",
52+ "com.canonical.Unity.Session",
53+ con);
54+ QDBusReply<void> reply;
55+
56+ QCOMPARE(interface.isValid(), true);
57+ reply = interface.call(method);
58+ QCOMPARE(reply.isValid(), true);
59+
60+ }
61+};
62+
63+QTEST_GUILESS_MAIN(SessionBackendTest)
64+#include "sessionbackendtest.moc"
tests/qmltests/Components/tst_LazyImage.qml−1
@@ -152,7 +152,6 @@ Rectangle {
152152
153153 function test_lazyimage(data) {
154154 data.func();
155− waitForRendering(baseRect);
156155
157156 if (data.transition) {
158157 // wait for the transition to complete
tests/qmltests/Components/tst_PageHeader.qml−1
@@ -201,7 +201,6 @@ Item {
201201 }
202202
203203 searchEntryEnabled: true
204− searchHistory: SearchHistoryModel {}
205204 title: "%^$%^%^&%^&%^$%GHR%"
206205 imageSource: showImageCheckBox.checked ? titleImageSource : ""
207206 showBackButton: showBackButtonCheckBox.checked
tests/qmltests/Dash/tst_DashContent.qml−2
@@ -47,8 +47,6 @@ Item {
4747 model: scopesModel
4848 }
4949 scopes : scopesModel
50−
51− searchHistory: SearchHistoryModel {}
5250 }
5351
5452 SignalSpy {
tests/qmltests/tst_Shell.qml+1−1
@@ -195,7 +195,7 @@ Item {
195195 tryCompare(mainApp, "state", ApplicationInfo.Running);
196196
197197 // Try to suspend while proximity is engaged...
198− Powerd.displayPowerStateChange(Powerd.Off, Powerd.UseProximity);
198+ Powerd.displayPowerStateChange(Powerd.Off, Powerd.Proximity);
199199 tryCompare(greeter, "showProgress", 0);
200200
201201 // Now really suspend