on xenial help sign in
Merge.
commit0470a26c9ec7d3e5dafbd52df92ffac033c1af77 authorMichał Sawicz <michal.sawicz@canonical.com> dateTue 5 Aug 2014, 22:03 (12 years ago) parentdaf36328e45b88
132 files changed+2793−2139
CMakeLists.txt+1 cmake/modules/QmlTest.cmake+1−1 data/CMakeLists.txt+5−2 data/unity8-dash.conf+22 data/unity8-dash.desktop.in+9 data/unity8.conf+1−7 debian/changelog+58 debian/control+2−1 debian/unity8.install+3 plugins/AccountsService/AccountsService.cpp+21−1 plugins/AccountsService/AccountsService.h+13 plugins/AccountsService/plugin.cpp+1 plugins/Dash/CardAttributes.qml+65 plugins/Dash/CardCreator.js+76−7 plugins/Dash/qmldir+1 plugins/LightDM/plugin.cpp+2 plugins/Unity/CMakeLists.txt+1 plugins/Unity/DashCommunicator/CMakeLists.txt+19 plugins/Unity/DashCommunicator/dashcommunicator.cpp+43 plugins/Unity/DashCommunicator/dashcommunicator.h+35 plugins/Unity/DashCommunicator/dashcommunicatorservice.cpp+30 plugins/Unity/DashCommunicator/dashcommunicatorservice.h+38 plugins/Unity/DashCommunicator/dbusdashcommunicatorservice.cpp+39 plugins/Unity/DashCommunicator/dbusdashcommunicatorservice.h+39 plugins/Unity/DashCommunicator/plugin.cpp+31 plugins/Unity/DashCommunicator/plugin.h+34 plugins/Unity/DashCommunicator/qmldir+3 plugins/Unity/Launcher/launchermodel.cpp+5 po/am.po+10−10 po/da.po+7−7 po/el.po+6−6 po/fa.po+51−49 po/hu.po+8−8 po/is.po+6−6 po/km.po+7−7 po/pl.po+7−7 po/pt_BR.po+11−11 po/ru.po+18−18 po/sv.po+6−6 po/ug.po+1−1 po/uk.po+4−4 po/zh_CN.po+1−1 qml/Components/EdgeDemo.qml+5−6 qml/Components/PageHeader.qml+24−7 qml/Components/PassphraseLockscreen.qml+3 qml/Dash/Apps/CloseIcon.qml−62 qml/Dash/Apps/RunningApplicationTile.qml−136 qml/Dash/Apps/RunningApplicationsGrid.qml−105 qml/Dash/Apps/graphics/close_btn@9.png qml/Dash/CardTool.qml+27−2 qml/Dash/Dash.qml+8 qml/Dash/DashApplication.qml+29 qml/Dash/DashApps.qml−40 qml/Dash/DashContent.qml+1−3 qml/Dash/GenericScopeView.qml+2−11 qml/Dash/ScopeListView.qml−5 qml/Dash/graphics/phone/screenshots/unity8-dash@12.png qml/Launcher/Launcher.qml+2−3 qml/Launcher/LauncherDelegate.qml+9−6 qml/Launcher/graphics/notification@30.png qml/Launcher/graphics/notification@30.sci−5 qml/Panel/Indicators/DefaultIndicatorPage.qml+1−1 qml/Shell.qml+53−153 qml/Stages/PhoneStage.qml+59−26 qml/Stages/SpreadDelegate.qml+6 qml/Stages/TabletStage.qml+85−41 qml/Stages/TransformedSpreadDelegate.qml+6−5 qml/Stages/TransformedTabletSpreadDelegate.qml+28 run.sh+15−6 src/CMakeLists.txt+1 src/Dash/CMakeLists.txt+12 src/Dash/main.cpp+74 src/main.cpp+7 tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+1−1 tests/autopilot/unity8/application_lifecycle/tests/test_url_dispatcher.py+3−2 tests/autopilot/unity8/fixture_setup.py+64 tests/autopilot/unity8/process_helpers.py+89−20 tests/autopilot/unity8/shell/emulators/dash.py+21−12 tests/autopilot/unity8/shell/emulators/greeter.py+4−1 tests/autopilot/unity8/shell/emulators/main_window.py+34−20 tests/autopilot/unity8/shell/tests/__init__.py+141−48 tests/autopilot/unity8/shell/tests/test_emulators.py+8−19 tests/autopilot/unity8/shell/tests/test_lock_screen.py+7−47 tests/autopilot/unity8/shell/tests/test_notifications.py+12−7 tests/autopilot/unity8/shell/tests/test_upstart.py+20−5 tests/mocks/AccountsService/AccountsService.cpp+12−2 tests/mocks/AccountsService/AccountsService.h+12 tests/mocks/AccountsService/CMakeLists.txt+4−1 tests/mocks/AccountsService/plugin.cpp+1 tests/mocks/LightDM/GreeterPrivate.h+2 tests/mocks/LightDM/demo/CMakeLists.txt+4−2 tests/mocks/LightDM/demo/GreeterPrivate.cpp+202−30 tests/mocks/LightDM/demo/UsersModelPrivate.cpp+1−1 tests/mocks/LightDM/full/GreeterPrivate.cpp+1−1 tests/mocks/LightDM/single-pin/GreeterPrivate.cpp+1−1 tests/mocks/LightDM/single-pin/UsersModelPrivate.cpp+1−1 tests/mocks/Unity/Application/ApplicationInfo.cpp−62 tests/mocks/Unity/Application/ApplicationInfo.h−10 tests/mocks/Unity/Application/ApplicationManager.cpp+17−147 tests/mocks/Unity/Application/ApplicationManager.h−16 tests/mocks/Unity/Application/ApplicationScreenshotProvider.cpp+1−1 tests/mocks/Unity/CMakeLists.txt+2−1 tests/mocks/Unity/DashCommunicator/CMakeLists.txt+18 tests/mocks/Unity/DashCommunicator/dashcommunicator.cpp+37 tests/mocks/Unity/DashCommunicator/dashcommunicator.h+39 tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.cpp+33 tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.h+36 tests/mocks/Unity/DashCommunicator/plugin.cpp+31 tests/mocks/Unity/DashCommunicator/plugin.h+34 tests/mocks/Unity/DashCommunicator/qmldir+3 tests/mocks/Unity/fake_scopes.cpp+5 tests/mocks/Unity/fake_scopes.h+1 tests/plugins/Dash/CMakeLists.txt+1 tests/plugins/Dash/cardcreator/1.res+63−61 tests/plugins/Dash/cardcreator/2.res+94−91 tests/plugins/Dash/cardcreator/3.res+77−74 tests/plugins/Dash/cardcreator/5.res+119−117 tests/plugins/Dash/cardcreator/7.res+128 tests/plugins/Dash/cardcreator/7.tst+3 tests/plugins/Dash/cardcreatortest.cpp+9−1 tests/plugins/Dash/listviewwithpageheadersectiontest.cpp−1 tests/plugins/Dash/tst_CardAttributes.qml+54 tests/qmltests/CMakeLists.txt−1 tests/qmltests/Components/tst_PageHeader.qml+36−6 tests/qmltests/Dash/Apps/tst_RunningApplicationsGrid.qml−217 tests/qmltests/Dash/CardHelpers.js+5−3 tests/qmltests/Dash/tst_Card.qml+4−2 tests/qmltests/Dash/tst_Dash.qml+19 tests/qmltests/Greeter/tst_Lockscreen.qml+11−5 tests/qmltests/Stages/tst_PhoneStage.qml+3−2 tests/qmltests/tst_Shell.qml+63−280 tests/qmltests/tst_ShellWithPin.qml+4−37
CMakeLists.txt+1
@@ -96,6 +96,7 @@ include(autopilot)
9696declare_autopilot_test(shell unity8.shell ${CMAKE_SOURCE_DIR}/tests/autopilot/)
9797
9898set(SHELL_APP unity8)
99+set(DASH_APP unity8-dash)
99100set(SCOPE_TOOL unity-scope-tool)
100101
101102include_directories(
cmake/modules/QmlTest.cmake+1−1
@@ -135,7 +135,7 @@ macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS)
135135 set(testCommand
136136 LD_LIBRARY_PATH=${LD_PATH}
137137 ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
138− -o ${CMAKE_BINARY_DIR}/${CLASSNAME}Test.xml,xunitxml
138+ -o ${CMAKE_BINARY_DIR}/${CLASS_NAME}Test.xml,xunitxml
139139 -o -,txt)
140140
141141 add_qmltest_target(test${CLASS_NAME} "${testCommand}" FALSE TRUE)
data/CMakeLists.txt+5−2
@@ -1,7 +1,10 @@
1−# generate desktop file
1+# generate desktop files
22configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY)
3+configure_file(${DASH_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${DASH_APP}.desktop @ONLY)
34
45# install desktop files
5−install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop
6+install(FILES
7+ ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop
8+ ${CMAKE_CURRENT_BINARY_DIR}/${DASH_APP}.desktop
69 DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
710 )
data/unity8-dash.confnew file+22
@@ -0,0 +1,22 @@
1+description "Unity Shell v8 Dash"
2+author "Michael Zanetti <michael.zanetti@canonical.com>"
3+
4+emits scope-ui-starting
5+
6+start on started unity8
7+stop on stopping unity8
8+
9+kill timeout 120
10+
11+respawn
12+
13+pre-start script
14+ if [ -z "$UNITY_SCOPES_LIST" ]; then
15+ # FIXME: remove once we have this in dconf
16+ initctl set-env UNITY_SCOPES_LIST="scopes;clickscope;musicaggregator;videoaggregator"
17+ fi
18+
19+ initctl emit scope-ui-starting
20+end script
21+
22+exec ${BINARY:-unity8-dash} $ARGS --desktop_file_hint=/usr/share/applications/unity8-dash.desktop
data/unity8-dash.desktop.innew file+9
@@ -0,0 +1,9 @@
1+[Desktop Entry]
2+Type=Application
3+Name=Unity 8 Dash
4+Comment=The converged Unity shell dash
5+Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8-dash
6+Terminal=false
7+Icon=unity8
8+NoDisplay=true
9+X-Ubuntu-Touch=true
data/unity8.conf+1−7
@@ -1,7 +1,7 @@
11description "Unity Shell v8"
22author "Ricardo Mendoza <ricmm@ubuntu.com>"
33
4−emits scope-ui-starting indicator-services-start
4+emits indicator-services-start
55
66start on ((xsession SESSION=ubuntu-touch) or (xsession SESSION=ubuntu-touch-surfaceflinger)) and started dbus
77stop on desktop-end
@@ -34,11 +34,6 @@ pre-start script
3434 gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'MIR_SOCKET': '$MIR_SERVER_FILE'}"
3535 fi
3636
37− if [ -z "$UNITY_SCOPES_LIST" ]; then
38− # FIXME: remove once we have this in dconf
39− initctl set-env UNITY_SCOPES_LIST="scopes;clickscope;musicaggregator;videoaggregator"
40− fi
41−
4237 # Remove the socket if still there
4338 if [ -S "$MIR_SERVER_FILE" ]; then
4439 rm "$MIR_SERVER_FILE"
@@ -46,7 +41,6 @@ pre-start script
4641
4742 initctl set-env --global MIR_SERVER_PROMPT_FILE=1
4843
49− initctl emit scope-ui-starting
5044 initctl emit --no-wait indicator-services-start
5145end script
5246
debian/changelog+58
@@ -1,3 +1,61 @@
1+unity8 (8.00+14.10.20140805-0ubuntu1) utopic; urgency=low
2+
3+ [ Michael Zanetti ]
4+ * Split the dash from the shell into a separate app (LP: #1232687)
5+
6+ [ Leo Arias ]
7+ * Update the autopilot tests to work with the new dash app.
8+
9+ [ Daniel d'Andrada ]
10+ * Split the dash from the shell into a separate app (LP: #1232687)
11+
12+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 05 Aug 2014 12:06:31 +0000
13+
14+unity8 (8.00+14.10.20140731.1-0ubuntu1) utopic; urgency=low
15+
16+ [ Gerry Boland ]
17+ * Fix the run.sh script - pretend to be running with qtmir and emit
18+ SIGSTOP at the right time
19+
20+ [ Ying-Chun Liu ]
21+ * Implement Attribute UI. (LP: #1282460)
22+
23+ [ Albert Astals ]
24+ * Hide search history popup as soon as you start typing As discussed
25+ with Mike and Saviq
26+ * Compile with for scopes-v3 unity-api
27+ * PageHeader: Unfocus search field when search entry is selected
28+ * Show search field if the search query changes
29+ * Test: Add a condition for art.height being > 0 means stuff has
30+ already been layouted a bit without it it can happen that we get 0
31+ for everything at startup and tests still pass
32+ * Remove leftover in test of an old headerless implementation
33+
34+ [ Michael Zanetti ]
35+ * Drop Recent apps category from Dash (LP: #1281092)
36+ * update launcher count emblems to match new spec (LP: #1338984)
37+
38+ [ Bill Filler ]
39+ * disable predictive text for dash search field (LP: #1340409)
40+
41+ [ CI bot ]
42+ * Resync trunk
43+
44+ [ Antti Kaijanmäki ]
45+ * DefaultIndicatorPage: use Loader status to determine the visible
46+ property. (LP: #1350555)
47+
48+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 31 Jul 2014 16:51:01 +0000
49+
50+unity8 (8.00+14.10.20140729.1-0ubuntu1) utopic; urgency=low
51+
52+ [ Michael Terry ]
53+ * Check user's pin/password using PAM, instead of a plaintext keyfile.
54+ New build dependency: libpam0g-dev for phone unlock with PAM (LP:
55+ #1234983)
56+
57+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 29 Jul 2014 23:36:30 +0000
58+
159unity8 (8.00+14.10.20140729-0ubuntu1) utopic; urgency=medium
260
361 [ Gerry Boland ]
debian/control+2−1
@@ -19,11 +19,12 @@ Build-Depends: cmake,
1919 libgsettings-qt-dev,
2020 libhardware-dev,
2121 libhud-client2-dev,
22+ libpam0g-dev,
2223 libpay2-dev,
2324 libpulse-dev,
2425 libqmenumodel-dev (>= 0.2.8),
2526 libqt5xmlpatterns5-dev,
26− libunity-api-dev (>= 7.85),
27+ libunity-api-dev (>= 7.87),
2728 libusermetricsoutput1-dev,
2829 libxcb1-dev,
2930 pkg-config,
debian/unity8.install+3
@@ -1,6 +1,9 @@
11data/unity8.conf usr/share/upstart/sessions/
2+data/unity8-dash.conf usr/share/upstart/sessions/
23usr/bin/unity8
4+usr/bin/unity8-dash
35usr/share/applications/unity8.desktop
6+usr/share/applications/unity8-dash.desktop
47usr/share/unity8/Greeter
58usr/share/unity8/Hud
69usr/share/unity8/Launcher
plugins/AccountsService/AccountsService.cpp+21−1
@@ -26,7 +26,8 @@ AccountsService::AccountsService(QObject* parent)
2626 m_service(new AccountsServiceDBusAdaptor(this)),
2727 m_user(qgetenv("USER")),
2828 m_demoEdges(false),
29− m_statsWelcomeScreen(false)
29+ m_statsWelcomeScreen(false),
30+ m_passwordDisplayHint(Keyboard)
3031{
3132 connect(m_service, SIGNAL(propertiesChanged(const QString &, const QString &, const QStringList &)),
3233 this, SLOT(propertiesChanged(const QString &, const QString &, const QStringList &)));
@@ -47,6 +48,7 @@ void AccountsService::setUser(const QString &user)
4748 updateDemoEdges();
4849 updateBackgroundFile();
4950 updateStatsWelcomeScreen();
51+ updatePasswordDisplayHint();
5052}
5153
5254bool AccountsService::demoEdges() const
@@ -70,6 +72,11 @@ bool AccountsService::statsWelcomeScreen() const
7072 return m_statsWelcomeScreen;
7173}
7274
75+AccountsService::PasswordDisplayHint AccountsService::passwordDisplayHint() const
76+{
77+ return m_passwordDisplayHint;
78+}
79+
7380void AccountsService::updateDemoEdges()
7481{
7582 auto demoEdges = m_service->getUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges").toBool();
@@ -97,6 +104,15 @@ void AccountsService::updateStatsWelcomeScreen()
97104 }
98105}
99106
107+void AccountsService::updatePasswordDisplayHint()
108+{
109+ PasswordDisplayHint passwordDisplayHint = (PasswordDisplayHint)m_service->getUserProperty(m_user, "com.ubuntu.AccountsService.SecurityPrivacy", "PasswordDisplayHint").toInt();
110+ if (m_passwordDisplayHint != passwordDisplayHint) {
111+ m_passwordDisplayHint = passwordDisplayHint;
112+ Q_EMIT passwordDisplayHintChanged();
113+ }
114+}
115+
100116void AccountsService::propertiesChanged(const QString &user, const QString &interface, const QStringList &changed)
101117{
102118 if (m_user != user) {
@@ -111,6 +127,10 @@ void AccountsService::propertiesChanged(const QString &user, const QString &inte
111127 if (changed.contains("StatsWelcomeScreen")) {
112128 updateStatsWelcomeScreen();
113129 }
130+ } else if (interface == "com.ubuntu.AccountsService.SecurityPrivacy") {
131+ if (changed.contains("PasswordDisplayHint")) {
132+ updatePasswordDisplayHint();
133+ }
114134 }
115135}
116136
plugins/AccountsService/AccountsService.h+13
@@ -27,6 +27,7 @@ class AccountsServiceDBusAdaptor;
2727class AccountsService: public QObject
2828{
2929 Q_OBJECT
30+ Q_ENUMS(PasswordDisplayHint)
3031 Q_PROPERTY (QString user
3132 READ user
3233 WRITE setUser
@@ -41,8 +42,16 @@ class AccountsService: public QObject
4142 Q_PROPERTY (bool statsWelcomeScreen
4243 READ statsWelcomeScreen
4344 NOTIFY statsWelcomeScreenChanged)
45+ Q_PROPERTY (PasswordDisplayHint passwordDisplayHint
46+ READ passwordDisplayHint
47+ NOTIFY passwordDisplayHintChanged)
4448
4549public:
50+ enum PasswordDisplayHint {
51+ Keyboard,
52+ Numeric,
53+ };
54+
4655 explicit AccountsService(QObject *parent = 0);
4756
4857 QString user() const;
@@ -51,12 +60,14 @@ public:
5160 void setDemoEdges(bool demoEdges);
5261 QString backgroundFile() const;
5362 bool statsWelcomeScreen() const;
63+ PasswordDisplayHint passwordDisplayHint() const;
5464
5565Q_SIGNALS:
5666 void userChanged();
5767 void demoEdgesChanged();
5868 void backgroundFileChanged();
5969 void statsWelcomeScreenChanged();
70+ void passwordDisplayHintChanged();
6071
6172private Q_SLOTS:
6273 void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed);
@@ -66,12 +77,14 @@ private:
6677 void updateDemoEdges();
6778 void updateBackgroundFile();
6879 void updateStatsWelcomeScreen();
80+ void updatePasswordDisplayHint();
6981
7082 AccountsServiceDBusAdaptor *m_service;
7183 QString m_user;
7284 bool m_demoEdges;
7385 QString m_backgroundFile;
7486 bool m_statsWelcomeScreen;
87+ PasswordDisplayHint m_passwordDisplayHint;
7588};
7689
7790#endif
plugins/AccountsService/plugin.cpp+1
@@ -33,5 +33,6 @@ void AccountsServicePlugin::registerTypes(const char *uri)
3333{
3434 Q_ASSERT(uri == QLatin1String("AccountsService"));
3535 qDBusRegisterMetaType<QList<QVariantMap>>();
36+ qRegisterMetaType<AccountsService::PasswordDisplayHint>("AccountsService::PasswordDisplayHint");
3637 qmlRegisterSingletonType<AccountsService>(uri, 0, 1, "AccountsService", service_provider);
3738}
plugins/Dash/CardAttributes.qmlnew file+65
@@ -0,0 +1,65 @@
1+/*
2+ * Copyright 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+
17+import QtQuick 2.2
18+import QtQuick.Layouts 1.1
19+import Ubuntu.Components 1.1
20+import Ubuntu.Settings.Components 0.1
21+
22+GridLayout {
23+ id: grid
24+ anchors {
25+ left: parent.left;
26+ right: parent.right;
27+ }
28+ columns: 2 + repeater.count % 2
29+ property alias model: repeater.model
30+ property var color
31+
32+ Repeater {
33+ id: repeater
34+ delegate: Row {
35+ spacing: units.gu(0.5)
36+ readonly property int column: index % grid.columns;
37+ Layout.alignment: {
38+ if (column == 0) return Qt.AlignLeft;
39+ if (column == grid.columns - 1 || index == repeater.count - 1) return Qt.AlignRight;
40+ if (column == 1) return Qt.AlignHCenter;
41+ }
42+ Layout.columnSpan: index == repeater.count - 1 && grid.columns == 3 && column == 1 ? 2 : 1
43+ Layout.maximumWidth: Math.max(icon.width, label.x + label.implicitWidth)
44+ Layout.fillWidth: true
45+ StatusIcon {
46+ id: icon
47+ height: units.gu(2)
48+ sets: ["actions", "status", "apps"]
49+ source: "icon" in modelData ? modelData["icon"] : ""
50+ }
51+ Label {
52+ id: label
53+ width: parent.width - x
54+ anchors.verticalCenter: parent.verticalCenter
55+ text: "value" in modelData ? modelData["value"] : "";
56+ elide: Text.ElideRight
57+ maximumLineCount: 1
58+ font.weight: "style" in modelData && modelData["style"] == "highlighted" ? Font.DemiBold : Font.Light
59+ fontSize: "small"
60+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
61+ color: grid.color
62+ }
63+ }
64+ }
65+}
plugins/Dash/CardCreator.js+76−7
@@ -193,6 +193,21 @@ var kHeaderColumnCode = 'Column { \n\
193193 ] \n\
194194 }\n';
195195
196+// multiple column version of kHeaderColumnCode.
197+function kHeaderColumnCodeGenerator() {
198+ var headerColumnCodeTemplate = 'Column { \n\
199+ anchors.verticalCenter: parent.verticalCenter; \n\
200+ spacing: units.dp(2); \n\
201+ width: parent.width - x;\n\
202+ data: [ \n\
203+ %1 \n\
204+ ]\n\
205+ }\n';
206+ var args = Array.prototype.slice.call(arguments);
207+ var code = headerColumnCodeTemplate.arg(args.join(',\n'));
208+ return code;
209+}
210+
196211// %1 is used as anchors of mascotShapeLoader
197212var kMascotShapeLoaderCode = 'Loader { \n\
198213 id: mascotShapeLoader; \n\
@@ -224,7 +239,7 @@ var kMascotImageCode = 'Image { \n\
224239 }\n';
225240
226241// %1 is used as anchors of titleLabel
227−// %1 is used as color of titleLabel
242+// %2 is used as color of titleLabel
228243// %3 is used as extra condition for visible of titleLabel
229244var kTitleLabelCode = 'Label { \n\
230245 id: titleLabel; \n\
@@ -258,6 +273,15 @@ var kSubtitleLabelCode = 'Label { \n\
258273 horizontalAlignment: root.headerAlignment; \n\
259274 }\n';
260275
276+// %1 is used as anchors of attributesRow
277+var kAttributesRowCode = 'CardAttributes { \n\
278+ id: attributesRow; \n\
279+ objectName: "attributesRow"; \n\
280+ anchors { %1 } \n\
281+ color: %2; \n\
282+ model: cardData && cardData["attributes"] || undefined; \n\
283+ }\n';
284+
261285// %1 is used as top anchor of summary
262286// %2 is used as topMargin anchor of summary
263287// %3 is used as color of summary
@@ -308,6 +332,7 @@ function cardString(template, components) {
308332 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
309333 var hasSubtitle = hasTitle && components["subtitle"] || false;
310334 var hasHeaderRow = hasMascot && hasTitle;
335+ var hasAttributes = hasTitle && components["attributes"] || false;
311336
312337 if (hasBackground) {
313338 code += kBackgroundLoaderCode;
@@ -377,6 +402,14 @@ function cardString(template, components) {
377402 code += 'readonly property int headerHeight: row.height;\n'
378403 } else if (hasMascot) {
379404 code += 'readonly property int headerHeight: mascotImage.height;\n'
405+ } else if (hasAttributes) {
406+ if (hasTitle && hasSubtitle) {
407+ code += 'readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin + attributesRow.height + attributesRow.anchors.topMargin;\n'
408+ } else if (hasTitle) {
409+ code += 'readonly property int headerHeight: titleLabel.height + attributesRow.height + attributesRow.anchors.topMargin;\n'
410+ } else {
411+ code += 'readonly property int headerHeight: attributesRow.height;\n'
412+ }
380413 } else if (hasSubtitle) {
381414 code += 'readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;\n'
382415 } else if (hasTitle) {
@@ -425,10 +458,12 @@ function cardString(template, components) {
425458
426459 var titleAnchors;
427460 var subtitleAnchors;
428− if (hasMascot && hasSubtitle) {
461+ var attributesAnchors;
462+ if (hasMascot && (hasSubtitle || hasAttributes)) {
429463 // Using row + column
430464 titleAnchors = 'left: parent.left; right: parent.right';
431465 subtitleAnchors = titleAnchors;
466+ attributesAnchors = subtitleAnchors;
432467 } else if (hasMascot) {
433468 // Using row + label
434469 titleAnchors = 'verticalCenter: parent.verticalCenter;\n'
@@ -438,11 +473,13 @@ function cardString(template, components) {
438473 titleAnchors = 'left: parent.left; \n\
439474 leftMargin: units.gu(1); \n\
440475 right: parent.right; \n\
476+ rightMargin: units.gu(1); \n\
441477 top: overlayLoader.top; \n\
442478 topMargin: units.gu(1);\n';
443479 } else {
444480 // Using anchors to the mascot/parent
445− titleAnchors = "right: parent.right;";
481+ titleAnchors = "right: parent.right;\n";
482+ titleAnchors += "rightMargin: units.gu(1);\n";
446483 titleAnchors += headerLeftAnchor;
447484 titleAnchors += headerVerticalAnchors;
448485 if (!headerLeftAnchorHasMargin) {
@@ -452,8 +489,19 @@ function cardString(template, components) {
452489 subtitleAnchors = 'left: titleLabel.left; \n\
453490 leftMargin: titleLabel.leftMargin; \n\
454491 right: titleLabel.right; \n\
492+ rightMargin: titleLabel.rightMargin; \n\
455493 top: titleLabel.bottom; \n\
456494 topMargin: units.dp(2);\n';
495+ if (hasSubtitle) {
496+ attributesAnchors = 'left: subtitleLabel.left; \n\
497+ leftMargin: subtitleLabel.leftMargin; \n\
498+ right: subtitleLabel.right; \n\
499+ rightMargin: subtitleLabel.rightMargin; \n\
500+ top: subtitleLabel.bottom; \n\
501+ topMargin: units.dp(2);\n';
502+ } else {
503+ attributesAnchors = subtitleAnchors;
504+ }
457505 }
458506
459507 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
@@ -463,11 +511,27 @@ function cardString(template, components) {
463511 subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);
464512 }
465513
466− if (hasMascot && hasSubtitle) {
514+ if (hasMascot && (hasSubtitle || hasAttributes)) {
467515 // If using row + column wrap the code in the column
468516 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
517+ if (hasSubtitle && hasAttributes) {
518+ var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
519+ titleSubtitleCode = kHeaderColumnCodeGenerator(titleCode, subtitleCode, attributesCode);
520+ } else if (hasSubtitle) {
521+ titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
522+ } else if (hasAttributes) {
523+ var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
524+ titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(attributesCode);
525+ }
469526 } else {
470− titleSubtitleCode = titleCode + subtitleCode;
527+ titleSubtitleCode = titleCode;
528+ if (hasSubtitle) {
529+ titleSubtitleCode = titleSubtitleCode + subtitleCode;
530+ }
531+ if (hasAttributes) {
532+ var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
533+ titleSubtitleCode = titleSubtitleCode + attributesCode;
534+ }
471535 }
472536 }
473537
@@ -487,6 +551,7 @@ function cardString(template, components) {
487551 else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
488552 else if (hasHeaderRow) summaryTopAnchor = "row.bottom";
489553 else if (hasMascot) summaryTopAnchor = "mascotImage.bottom";
554+ else if (hasAttributes) summaryTopAnchor = "attributesRow.bottom";
490555 else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom";
491556 else if (hasTitle) summaryTopAnchor = "titleLabel.bottom";
492557 else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom";
@@ -499,7 +564,7 @@ function cardString(template, components) {
499564 color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
500565 }
501566
502− var summaryTopMargin = (hasMascot || hasSubtitle ? 'anchors.margins' : '0');
567+ var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0');
503568
504569 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);
505570 }
@@ -510,6 +575,8 @@ function cardString(template, components) {
510575 code += 'implicitHeight: row.y + row.height + units.gu(1);\n';
511576 } else if (hasMascot) {
512577 code += 'implicitHeight: mascotImage.y + mascotImage.height;\n';
578+ } else if (hasAttributes) {
579+ code += 'implicitHeight: attributesRow.y + attributesRow.height + units.gu(1);\n';
513580 } else if (hasSubtitle) {
514581 code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
515582 } else if (hasTitle) {
@@ -526,8 +593,10 @@ function cardString(template, components) {
526593function createCardComponent(parent, template, components) {
527594 var imports = 'import QtQuick 2.2; \n\
528595 import Ubuntu.Components 0.1; \n\
529− import Ubuntu.Thumbnailer 0.1;\n';
596+ import Ubuntu.Thumbnailer 0.1;\n\
597+ import Dash 0.1;\n';
530598 var card = cardString(template, components);
531599 var code = imports + 'Component {\n' + card + '}\n';
600+
532601 return Qt.createQmlObject(code, parent, "createCardComponent");
533602}
plugins/Dash/qmldir+1
@@ -3,3 +3,4 @@ plugin Dash-qml
33typeinfo Dash.qmltypes
44singleton CardCreatorCache 0.1 CardCreatorCache.qml
55ScopeStyle 0.1 ScopeStyle.qml
6+CardAttributes 0.1 CardAttributes.qml
plugins/LightDM/plugin.cpp+2
@@ -69,6 +69,8 @@ void LightDMPlugin::registerTypes(const char *uri)
6969 qmlRegisterType<UserMetricsOutput::ColorTheme>();
7070
7171 Q_ASSERT(uri == QLatin1String("LightDM"));
72+ qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
73+ qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
7274 qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
7375 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
7476 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
plugins/Unity/CMakeLists.txt+1
@@ -1,3 +1,4 @@
11add_subdirectory(Indicators)
22add_subdirectory(Launcher)
33add_subdirectory(Session)
4+add_subdirectory(DashCommunicator)
plugins/Unity/DashCommunicator/CMakeLists.txtnew file+19
@@ -0,0 +1,19 @@
1+include_directories(
2+ ${CMAKE_CURRENT_SOURCE_DIR}
3+)
4+
5+set(QMLDASHCOMMUNICATORPLUGIN_SRC
6+ plugin.cpp
7+ dbusdashcommunicatorservice.cpp
8+ dashcommunicatorservice.cpp
9+ dashcommunicator.cpp
10+ )
11+
12+add_library(DashCommunicator-qml MODULE
13+ ${QMLDASHCOMMUNICATORPLUGIN_SRC}
14+ )
15+
16+qt5_use_modules(DashCommunicator-qml DBus Qml)
17+
18+# export the qmldir and qmltypes files
19+add_unity8_plugin(Unity.DashCommunicator 0.1 Unity/DashCommunicator TARGETS DashCommunicator-qml)
plugins/Unity/DashCommunicator/dashcommunicator.cppnew file+43
@@ -0,0 +1,43 @@
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+#include "dashcommunicator.h"
18+
19+#include <QObject>
20+#include <QDBusConnection>
21+#include <QDBusInterface>
22+#include <QDebug>
23+
24+DashCommunicator::DashCommunicator(QObject *parent):
25+ QObject(parent)
26+{
27+}
28+
29+DashCommunicator::~DashCommunicator()
30+{
31+}
32+
33+
34+void DashCommunicator::setCurrentScope(const QString &scopeId, bool animate, bool reset)
35+{
36+ QDBusConnection connection = QDBusConnection::sessionBus();
37+ QDBusInterface dashIface ("com.canonical.UnityDash",
38+ "/com/canonical/UnityDash",
39+ "",
40+ connection);
41+
42+ dashIface.call("SetCurrentScope", scopeId, animate, reset);
43+}
plugins/Unity/DashCommunicator/dashcommunicator.hnew file+35
@@ -0,0 +1,35 @@
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 DASHCOMMUNICATOR_H
18+#define DASHCOMMUNICATOR_H
19+
20+#include <QObject>
21+
22+class DashCommunicator: public QObject
23+{
24+ Q_OBJECT
25+ Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.DashCommunicator")
26+
27+public:
28+ DashCommunicator(QObject *parent = 0);
29+ ~DashCommunicator();
30+
31+public Q_SLOTS:
32+ void setCurrentScope(const QString &scopeId, bool animate, bool reset);
33+};
34+
35+#endif
plugins/Unity/DashCommunicator/dashcommunicatorservice.cppnew file+30
@@ -0,0 +1,30 @@
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+#include "dashcommunicatorservice.h"
18+
19+DashCommunicatorService::DashCommunicatorService(QObject *parent):
20+ QObject(parent),
21+ m_dbusService(new DBusDashCommunicatorService(this))
22+{
23+ connect(m_dbusService, &DBusDashCommunicatorService::setCurrentScopeRequested, this, &DashCommunicatorService::setCurrentScopeRequested);
24+}
25+
26+
27+DashCommunicatorService::~DashCommunicatorService()
28+{
29+
30+}
plugins/Unity/DashCommunicator/dashcommunicatorservice.hnew file+38
@@ -0,0 +1,38 @@
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 DASHCOMMUNICATORSERVICE_H
18+#define DASHCOMMUNICATORSERVICE_H
19+
20+#include "dbusdashcommunicatorservice.h"
21+
22+#include <QObject>
23+
24+class DashCommunicatorService: public QObject
25+{
26+ Q_OBJECT
27+public:
28+ DashCommunicatorService(QObject *parent = 0);
29+ ~DashCommunicatorService();
30+
31+Q_SIGNALS:
32+ void setCurrentScopeRequested(const QString &scopeId, bool animate, bool reset);
33+
34+private:
35+ DBusDashCommunicatorService *m_dbusService;
36+};
37+
38+#endif // DBUSUNITYSESSIONSERVICE_H
plugins/Unity/DashCommunicator/dbusdashcommunicatorservice.cppnew file+39
@@ -0,0 +1,39 @@
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+#include "dbusdashcommunicatorservice.h"
18+
19+#include <QDBusConnection>
20+#include <QDBusInterface>
21+#include <QDebug>
22+
23+DBusDashCommunicatorService::DBusDashCommunicatorService(QObject *parent):
24+ QObject(parent)
25+{
26+ QDBusConnection connection = QDBusConnection::sessionBus();
27+
28+ connection.registerService("com.canonical.UnityDash");
29+ connection.registerObject("/com/canonical/UnityDash", this, QDBusConnection::ExportScriptableSlots);
30+}
31+
32+DBusDashCommunicatorService::~DBusDashCommunicatorService()
33+{
34+}
35+
36+void DBusDashCommunicatorService::SetCurrentScope(const QString &scopeId, bool animate, bool reset)
37+{
38+ Q_EMIT setCurrentScopeRequested(scopeId, animate, reset);
39+}
plugins/Unity/DashCommunicator/dbusdashcommunicatorservice.hnew file+39
@@ -0,0 +1,39 @@
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 DBUSDASHCOMMUNICATORSERVICE_H
18+#define DBUSDASHCOMMUNICATORSERVICE_H
19+
20+#include <QObject>
21+
22+class DBusDashCommunicatorService: public QObject
23+{
24+ Q_OBJECT
25+ Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.DashCommunicator")
26+
27+public:
28+ DBusDashCommunicatorService(QObject *parent = 0);
29+ ~DBusDashCommunicatorService();
30+
31+Q_SIGNALS:
32+ void setCurrentScopeRequested(const QString &scopeId, bool animate, bool reset);
33+
34+public Q_SLOTS:
35+ Q_SCRIPTABLE void SetCurrentScope(const QString &scopeId, bool animate, bool reset);
36+
37+};
38+
39+#endif // DBUSUNITYSESSIONSERVICE_H
plugins/Unity/DashCommunicator/plugin.cppnew file+31
@@ -0,0 +1,31 @@
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: Michael Zanetti <michael.zanetti@canonical.com>
17+ */
18+
19+#include "plugin.h"
20+#include "dashcommunicator.h"
21+#include "dashcommunicatorservice.h"
22+
23+#include <QDBusConnection>
24+#include <QtQml/qqml.h>
25+
26+void DashCommunicatorPlugin::registerTypes(const char *uri)
27+{
28+ Q_ASSERT(uri == QStringLiteral("Unity.DashCommunicator"));
29+ qmlRegisterType<DashCommunicatorService>(uri, 0, 1, "DashCommunicatorService");
30+ qmlRegisterType<DashCommunicator>(uri, 0, 1, "DashCommunicator");
31+}
plugins/Unity/DashCommunicator/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: Michael Zanetti <michael.zanetti@canonical.com>
17+ */
18+
19+#ifndef DASHCOMMUNICATOR_PLUGIN_H
20+#define DASHCOMMUNICATOR_PLUGIN_H
21+
22+#include <QtQml/QQmlEngine>
23+#include <QtQml/QQmlExtensionPlugin>
24+
25+class DashCommunicatorPlugin : 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/DashCommunicator/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Unity.DashCommunicator
2+plugin DashCommunicator-qml
3+typeinfo DashCommunicator.qmltypes
plugins/Unity/Launcher/launchermodel.cpp+5
@@ -317,6 +317,11 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
317317 return;
318318 }
319319
320+ if (app->appId() == "unity8-dash") {
321+ // Not adding the dash app
322+ return;
323+ }
324+
320325 bool found = false;
321326 Q_FOREACH(LauncherItem *item, m_list) {
322327 if (app->appId() == item->appId()) {
po/am.po+10−10
@@ -8,14 +8,14 @@ msgstr ""
88"Project-Id-Version: unity8\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-07-27 01:25+0000\n"
11+"PO-Revision-Date: 2014-08-04 16:30+0000\n"
1212"Last-Translator: samson <Unknown>\n"
1313"Language-Team: Amharic <am@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-07-28 06:44+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-05 06:45+0000\n"
18+"X-Generator: Launchpad (build 17147)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -36,7 +36,7 @@ msgstr "የቀኝ ጠርዝ"
3636
3737#: qml/Components/EdgeDemo.qml:114
3838msgid "Try swiping from the right edge to unlock the phone"
39−msgstr ""
39+msgstr "ስልኩን ለመክፈት ከ ቀኝ ጠርዝ በኩል ወደ ግራ ይጥረጉ"
4040
4141#: qml/Components/EdgeDemo.qml:145
4242msgid "Top edge"
@@ -44,7 +44,7 @@ msgstr "የላይ ጠርዝ"
4444
4545#: qml/Components/EdgeDemo.qml:146
4646msgid "Try swiping from the top edge to access the indicators"
47−msgstr ""
47+msgstr "ጠቋሚዎች ጋር ለመድረስ ከ ላይ ጠርዝ በኩል ወደ ታች ይጥረጉ"
4848
4949#: qml/Components/EdgeDemo.qml:171
5050msgid "Close"
@@ -52,7 +52,7 @@ msgstr "መዝጊያ"
5252
5353#: qml/Components/EdgeDemo.qml:172
5454msgid "Swipe up again to close the settings screen"
55−msgstr ""
55+msgstr "የማሰናጃውን መመልከቻ ለመዝጋት እንደገና ወደ ላይ ይጥረጉ"
5656
5757#: qml/Components/EdgeDemo.qml:199
5858msgid "Left edge"
@@ -60,11 +60,11 @@ msgstr "የግራ ጠርዝ"
6060
6161#: qml/Components/EdgeDemo.qml:200
6262msgid "Swipe from the left to reveal the launcher for quick access to apps"
63−msgstr ""
63+msgstr "ከ ግራ በኩል ወደ ቀኝ ይጥረጉ በፍጥነት መተግበሪያዎች ጋር ለመድረስ እና ለማስጀመር"
6464
6565#: qml/Components/EdgeDemo.qml:227
6666msgid "Well done"
67−msgstr ""
67+msgstr "ጥሩ አድረገዋል"
6868
6969#: qml/Components/EdgeDemo.qml:228
7070msgid ""
@@ -123,7 +123,7 @@ msgstr "አነስተኛ..."
123123
124124#: qml/Dash/Previews/PreviewRatingInput.qml:81
125125msgid "Rate this"
126−msgstr ""
126+msgstr "ለዚህ ደረጃ ይስጡ"
127127
128128#: qml/Dash/Previews/PreviewRatingInput.qml:126
129129msgid "Add a review"
@@ -135,7 +135,7 @@ msgstr "መላኪያ"
135135
136136#: qml/Greeter/Greeter.qml:157
137137msgid "Swipe to unlock"
138−msgstr ""
138+msgstr "ለመክፈት ይጥረጉ"
139139
140140#: qml/Hud/HudParametrizedActionsPage.qml:132
141141msgid "Confirm"
po/da.po+7−7
@@ -9,13 +9,13 @@ msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1111"POT-Creation-Date: 2014-07-11 14:59+0200\n"
12−"PO-Revision-Date: 2014-07-22 15:46+0000\n"
13−"Last-Translator: Kenneth Ramsussen <kentora@kentora.dk>\n"
12+"PO-Revision-Date: 2014-07-30 12:37+0000\n"
13+"Last-Translator: Ask Hjorth Larsen <asklarsen@gmail.com>\n"
1414"Language-Team: Danish <dansk@dansk-gruppen.dk>\n"
1515"MIME-Version: 1.0\n"
1616"Content-Type: text/plain; charset=UTF-8\n"
1717"Content-Transfer-Encoding: 8bit\n"
18−"X-Launchpad-Export-Date: 2014-07-26 07:16+0000\n"
18+"X-Launchpad-Export-Date: 2014-07-31 07:15+0000\n"
1919"X-Generator: Launchpad (build 17131)\n"
2020
2121#: plugins/Unity/Launcher/launcheritem.cpp:43
@@ -72,7 +72,7 @@ msgid ""
7272"You have now mastered the edge gestures and can start using the "
7373"phone<br><br>Tap on the screen to start"
7474msgstr ""
75−"Du mestrer nu kantgestusserne og kan begynde at bruge telefonen<br><br>Tryk "
75+"Du mestrer nu kantbevægelserne og kan begynde at bruge telefonen<br><br>Tryk "
7676"på skærmen for at starte"
7777
7878#: qml/Components/Lockscreen.qml:214
@@ -114,7 +114,7 @@ msgstr "Seneste"
114114
115115#: qml/Dash/GenericScopeView.qml:330
116116msgid "See all"
117−msgstr ""
117+msgstr "Se alle"
118118
119119#: qml/Dash/Previews/PreviewActionCombo.qml:34
120120msgid "More..."
@@ -170,11 +170,11 @@ msgstr "Indtast venligst PIN for SIM"
170170
171171#: qml/Panel/ActiveCallHint.qml:77
172172msgid "Tap to return to call..."
173−msgstr ""
173+msgstr "Tryk for at besvare opkaldet..."
174174
175175#: qml/Panel/ActiveCallHint.qml:90
176176msgid "Conference"
177−msgstr ""
177+msgstr "Konference"
178178
179179#: qml/Panel/Indicators/MenuItemFactory.qml:583
180180msgid "In queue…"
po/el.po+6−6
@@ -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-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-07-28 16:06+0000\n"
12−"Last-Translator: Chris Taklis (aka Kailor) <ctaklis@gmail.com>\n"
11+"PO-Revision-Date: 2014-08-04 18:44+0000\n"
12+"Last-Translator: madvinegar <madvinegar@hotmail.com>\n"
1313"Language-Team: Greek <el@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-07-29 06:54+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-05 06:45+0000\n"
18+"X-Generator: Launchpad (build 17147)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -171,7 +171,7 @@ msgstr "Παρακαλώ εισάγετε το PIN της κάρτας SIM"
171171
172172#: qml/Panel/ActiveCallHint.qml:77
173173msgid "Tap to return to call..."
174−msgstr ""
174+msgstr "Πατήστε για να γυρίσετε στην κλήση..."
175175
176176#: qml/Panel/ActiveCallHint.qml:90
177177msgid "Conference"
@@ -199,7 +199,7 @@ msgstr "Ολοκληρώθηκε"
199199
200200#: qml/Panel/Indicators/MenuItemFactory.qml:595
201201msgid "Failed, tap to retry"
202−msgstr ""
202+msgstr "Αποτυχία, πατήστε για να ξαναπροσπαθήσετε"
203203
204204#: qml/Panel/SearchIndicator.qml:27
205205msgid "Search"
po/fa.po+51−49
@@ -8,200 +8,202 @@ msgstr ""
88"Project-Id-Version: unity8\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2013-10-31 19:02+0000\n"
12−"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11+"PO-Revision-Date: 2014-08-03 13:00+0000\n"
12+"Last-Translator: Arash Badie Modiri <arashbm@gmail.com>\n"
1313"Language-Team: Persian <fa@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-07-26 07:17+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-04 06:32+0000\n"
18+"X-Generator: Launchpad (build 17147)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
2222msgid "Pin shortcut"
23−msgstr ""
23+msgstr "سنجاق کردن میانبر"
2424
2525#: plugins/Unity/Launcher/launcheritem.cpp:73
2626msgid "Unpin shortcut"
27−msgstr ""
27+msgstr "برداشتن سنجاق میانبر"
2828
2929#: qml/Components/EdgeDemoOverlay.qml:151
3030msgid "Skip intro"
31−msgstr ""
31+msgstr "پرش از مقدّمه"
3232
3333#: qml/Components/EdgeDemo.qml:113
3434msgid "Right edge"
35−msgstr ""
35+msgstr "لبه‌ی راست"
3636
3737#: qml/Components/EdgeDemo.qml:114
3838msgid "Try swiping from the right edge to unlock the phone"
39−msgstr ""
39+msgstr "برای باز کردن قفل تلفن، از لبه‌ی راست بکشید"
4040
4141#: qml/Components/EdgeDemo.qml:145
4242msgid "Top edge"
43−msgstr ""
43+msgstr "لبه‌ی بالا"
4444
4545#: qml/Components/EdgeDemo.qml:146
4646msgid "Try swiping from the top edge to access the indicators"
47−msgstr ""
47+msgstr "برای دست‌رسی به نشانگرها، از لبه‌ی بالا بکشید"
4848
4949#: qml/Components/EdgeDemo.qml:171
5050msgid "Close"
51−msgstr ""
51+msgstr "بستن"
5252
5353#: qml/Components/EdgeDemo.qml:172
5454msgid "Swipe up again to close the settings screen"
55−msgstr ""
55+msgstr "برای بستن صفحه‌ی تنظیمات، دوباره به بالا بکشپد"
5656
5757#: qml/Components/EdgeDemo.qml:199
5858msgid "Left edge"
59−msgstr ""
59+msgstr "لبه‌ی چپ"
6060
6161#: qml/Components/EdgeDemo.qml:200
6262msgid "Swipe from the left to reveal the launcher for quick access to apps"
63−msgstr ""
63+msgstr "برای آشکار شدن اجراگر به منظور دست‌رسی سریع به اپ‌ها از سمت چپ بکشید"
6464
6565#: qml/Components/EdgeDemo.qml:227
6666msgid "Well done"
67−msgstr ""
67+msgstr "عالی بود"
6868
6969#: qml/Components/EdgeDemo.qml:228
7070msgid ""
7171"You have now mastered the edge gestures and can start using the "
7272"phone<br><br>Tap on the screen to start"
7373msgstr ""
74+"هم اکنون در استفاده از ژست های حرکتی مهارت لازم را دارید و می‌توانید استفاده "
75+"از تلفن را آغاز کنید<br><br>برای شروع صفحه را لمس کنید"
7476
7577#: qml/Components/Lockscreen.qml:214
7678msgid "Emergency Call"
77−msgstr ""
79+msgstr "تماس اضطراری"
7880
7981#: qml/Components/Lockscreen.qml:231
8082msgid "OK"
81−msgstr ""
83+msgstr "قبول"
8284
8385#: qml/Components/PassphraseLockscreen.qml:60
8486#, qt-format
8587msgid "Hello %1"
86−msgstr ""
88+msgstr "سلام %1"
8789
8890#: qml/Components/PassphraseLockscreen.qml:60
8991msgid "Hello"
90−msgstr ""
92+msgstr "سلام"
9193
9294#: qml/Components/PinLockscreen.qml:198
9395msgid "CANCEL"
94−msgstr ""
96+msgstr "لغو"
9597
9698#: qml/Components/PinLockscreen.qml:216
9799msgid "DONE"
98−msgstr ""
100+msgstr "انجام شد"
99101
100102#: qml/Components/SeeMore.qml:35
101103msgid "See more"
102−msgstr ""
104+msgstr "بیش‌تر ببینید"
103105
104106#: qml/Components/SeeMore.qml:58 qml/Dash/GenericScopeView.qml:330
105107msgid "See less"
106−msgstr ""
108+msgstr "کم‌تر ببینید"
107109
108110#: qml/Dash/DashApps.qml:37
109111msgid "Recent"
110−msgstr ""
112+msgstr "موارد اخیر"
111113
112114#: qml/Dash/GenericScopeView.qml:330
113115msgid "See all"
114−msgstr ""
116+msgstr "دیدن همه"
115117
116118#: qml/Dash/Previews/PreviewActionCombo.qml:34
117119msgid "More..."
118−msgstr ""
120+msgstr "بیش‌تر…"
119121
120122#: qml/Dash/Previews/PreviewActionCombo.qml:34
121123msgid "Less..."
122−msgstr ""
124+msgstr "کم‌تر…"
123125
124126#: qml/Dash/Previews/PreviewRatingInput.qml:81
125127msgid "Rate this"
126−msgstr ""
128+msgstr "امتیاز دادن"
127129
128130#: qml/Dash/Previews/PreviewRatingInput.qml:126
129131msgid "Add a review"
130−msgstr ""
132+msgstr "افزودن یک بازبینی"
131133
132134#: qml/Dash/Previews/PreviewRatingInput.qml:166
133135msgid "Send"
134−msgstr ""
136+msgstr "ارسال"
135137
136138#: qml/Greeter/Greeter.qml:157
137139msgid "Swipe to unlock"
138−msgstr ""
140+msgstr "برای باز کردن قفل بکشد"
139141
140142#: qml/Hud/HudParametrizedActionsPage.qml:132
141143msgid "Confirm"
142−msgstr ""
144+msgstr "تأیید"
143145
144146#: qml/Hud/Hud.qml:61 qml/Hud/Hud.qml:99 qml/Hud/Hud.qml:372
145147msgid "Type or say a command"
146−msgstr ""
148+msgstr "دستوری را بنویسید یا بگویید"
147149
148150#: qml/Hud/Hud.qml:84
149151msgid "Loading. Please Wait..."
150−msgstr ""
152+msgstr "در حال بار کردن. لطفاً صبر کنید…"
151153
152154#: qml/Hud/Hud.qml:89
153155msgid "Speak Now..."
154−msgstr ""
156+msgstr "اکنون صحبت کنید…"
155157
156158#: qml/Hud/Hud.qml:94
157159msgid "Speaking..."
158−msgstr ""
160+msgstr "در حال صحبت کردن…"
159161
160162#: qml/Notifications/NotificationMenuItemFactory.qml:91
161163msgid "Show password"
162−msgstr ""
164+msgstr "نمایش گذرواژه"
163165
164166#: qml/Notifications/NotificationMenuItemFactory.qml:103
165167msgid "Please enter SIM PIN"
166−msgstr ""
168+msgstr "لطفاً PIN سیم‌کارت را وارد کنید"
167169
168170#: qml/Panel/ActiveCallHint.qml:77
169171msgid "Tap to return to call..."
170−msgstr ""
172+msgstr "برای بازگشت به تماس ضربه بزنید…"
171173
172174#: qml/Panel/ActiveCallHint.qml:90
173175msgid "Conference"
174−msgstr ""
176+msgstr "کنفرانس"
175177
176178#: qml/Panel/Indicators/MenuItemFactory.qml:583
177179msgid "In queue…"
178−msgstr ""
180+msgstr "در صف…"
179181
180182#: qml/Panel/Indicators/MenuItemFactory.qml:587
181183msgid "Downloading"
182−msgstr ""
184+msgstr "در حال بارگیری"
183185
184186#: qml/Panel/Indicators/MenuItemFactory.qml:589
185187msgid "Paused, tap to resume"
186−msgstr ""
188+msgstr "مکث شد، برای از سر گیری ضربه بزنید"
187189
188190#: qml/Panel/Indicators/MenuItemFactory.qml:591
189191msgid "Canceled"
190−msgstr ""
192+msgstr "لغو شد"
191193
192194#: qml/Panel/Indicators/MenuItemFactory.qml:593
193195msgid "Finished"
194−msgstr ""
196+msgstr "پایان یافت"
195197
196198#: qml/Panel/Indicators/MenuItemFactory.qml:595
197199msgid "Failed, tap to retry"
198−msgstr ""
200+msgstr "شکست خورد، برای تلاش دوباره ضربه بزنید"
199201
200202#: qml/Panel/SearchIndicator.qml:27
201203msgid "Search"
202−msgstr ""
204+msgstr "جست‌وجو"
203205
204206#: qml/Shell.qml:359
205207#, qt-format
206208msgid "Please enter %1"
207−msgstr ""
209+msgstr "لطفا %1 را وارد کنید"
po/hu.po+8−8
@@ -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-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-07-27 15:04+0000\n"
11+"PO-Revision-Date: 2014-08-04 09:10+0000\n"
1212"Last-Translator: Richard Somlói <ricsipontaz@gmail.com>\n"
1313"Language-Team: Hungarian <hu@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-07-28 06:44+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-05 06:45+0000\n"
18+"X-Generator: Launchpad (build 17147)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -44,7 +44,7 @@ msgstr "Felső szél"
4444
4545#: qml/Components/EdgeDemo.qml:146
4646msgid "Try swiping from the top edge to access the indicators"
47−msgstr "A jelzők eléréséhez csúsztassa ujját a felső szélről"
47+msgstr "Az állapotmenük eléréséhez csúsztassa ujját a felső szélről"
4848
4949#: qml/Components/EdgeDemo.qml:171
5050msgid "Close"
@@ -82,16 +82,16 @@ msgstr "Vészhívás"
8282
8383#: qml/Components/Lockscreen.qml:231
8484msgid "OK"
85−msgstr "OK"
85+msgstr "Ok"
8686
8787#: qml/Components/PassphraseLockscreen.qml:60
8888#, qt-format
8989msgid "Hello %1"
90−msgstr "Szia %1"
90+msgstr "Üdv %1"
9191
9292#: qml/Components/PassphraseLockscreen.qml:60
9393msgid "Hello"
94−msgstr "Szia"
94+msgstr "Üdv"
9595
9696#: qml/Components/PinLockscreen.qml:198
9797msgid "CANCEL"
@@ -127,7 +127,7 @@ msgstr "Kevesebb…"
127127
128128#: qml/Dash/Previews/PreviewRatingInput.qml:81
129129msgid "Rate this"
130−msgstr "Osztályzás"
130+msgstr "Értékelje"
131131
132132#: qml/Dash/Previews/PreviewRatingInput.qml:126
133133msgid "Add a review"
po/is.po+6−6
@@ -10,14 +10,14 @@ msgstr ""
1010"Project-Id-Version: po_unity8-is\n"
1111"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1212"POT-Creation-Date: 2014-07-11 14:59+0200\n"
13−"PO-Revision-Date: 2014-07-23 05:57+0000\n"
13+"PO-Revision-Date: 2014-07-31 16:10+0000\n"
1414"Last-Translator: Sveinn í Felli <sv1@fellsnet.is>\n"
1515"Language-Team: Icelandic <translation-team-is@lists.sourceforge.net>\n"
1616"MIME-Version: 1.0\n"
1717"Content-Type: text/plain; charset=UTF-8\n"
1818"Content-Transfer-Encoding: 8bit\n"
19−"X-Launchpad-Export-Date: 2014-07-26 07:16+0000\n"
20−"X-Generator: Launchpad (build 17131)\n"
19+"X-Launchpad-Export-Date: 2014-08-01 07:14+0000\n"
20+"X-Generator: Launchpad (build 17141)\n"
2121"Language: is\n"
2222
2323#: plugins/Unity/Launcher/launcheritem.cpp:43
@@ -117,7 +117,7 @@ msgstr "Nýlegt"
117117
118118#: qml/Dash/GenericScopeView.qml:330
119119msgid "See all"
120−msgstr ""
120+msgstr "Sjá allt"
121121
122122#: qml/Dash/Previews/PreviewActionCombo.qml:34
123123msgid "More..."
@@ -173,11 +173,11 @@ msgstr "Settu inn PIN fyrir SIM"
173173
174174#: qml/Panel/ActiveCallHint.qml:77
175175msgid "Tap to return to call..."
176−msgstr ""
176+msgstr "Slá til að svara símtali..."
177177
178178#: qml/Panel/ActiveCallHint.qml:90
179179msgid "Conference"
180−msgstr ""
180+msgstr "Ráðstefna"
181181
182182#: qml/Panel/Indicators/MenuItemFactory.qml:583
183183msgid "In queue…"
po/km.po+7−7
@@ -8,14 +8,14 @@ msgstr ""
88"Project-Id-Version: unity8\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-07-16 01:37+0000\n"
12−"Last-Translator: Khoem Sokhem <khoemsokhem@khmeros.info>\n"
11+"PO-Revision-Date: 2014-08-01 04:02+0000\n"
12+"Last-Translator: Sok Sophea <sksophea@gmail.com>\n"
1313"Language-Team: Khmer <km@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-07-26 07:16+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-02 06:39+0000\n"
18+"X-Generator: Launchpad (build 17147)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -115,7 +115,7 @@ msgstr "បច្ចុប្បន្ន"
115115
116116#: qml/Dash/GenericScopeView.qml:330
117117msgid "See all"
118−msgstr ""
118+msgstr "មើល​ទាំងអស់"
119119
120120#: qml/Dash/Previews/PreviewActionCombo.qml:34
121121msgid "More..."
@@ -171,11 +171,11 @@ msgstr "បញ្ចូល​កូដ PIN របស់​ស៊ីមកាត"
171171
172172#: qml/Panel/ActiveCallHint.qml:77
173173msgid "Tap to return to call..."
174−msgstr ""
174+msgstr "ប៉ះ​ដើម្បី​ត្រឡប់​ទៅ​ការ​ហៅ..."
175175
176176#: qml/Panel/ActiveCallHint.qml:90
177177msgid "Conference"
178−msgstr ""
178+msgstr "សន្និសីទ"
179179
180180#: qml/Panel/Indicators/MenuItemFactory.qml:583
181181msgid "In queue…"
po/pl.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-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-07-19 14:10+0000\n"
12−"Last-Translator: GTriderXC <gtriderxc@yahoo.com>\n"
11+"PO-Revision-Date: 2014-07-31 13:51+0000\n"
12+"Last-Translator: Michał Radwański <radwanski.michal@outlook.com>\n"
1313"Language-Team: Polish <pl@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-07-26 07:17+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-01 07:14+0000\n"
18+"X-Generator: Launchpad (build 17141)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -115,7 +115,7 @@ msgstr "Ostatnio używane"
115115
116116#: qml/Dash/GenericScopeView.qml:330
117117msgid "See all"
118−msgstr ""
118+msgstr "Zobacz wszystko"
119119
120120#: qml/Dash/Previews/PreviewActionCombo.qml:34
121121msgid "More..."
@@ -171,11 +171,11 @@ msgstr "Wprowadź kod PIN karty SIM"
171171
172172#: qml/Panel/ActiveCallHint.qml:77
173173msgid "Tap to return to call..."
174−msgstr ""
174+msgstr "Dotknij aby powrócić do połączenia..."
175175
176176#: qml/Panel/ActiveCallHint.qml:90
177177msgid "Conference"
178−msgstr ""
178+msgstr "Konferencja"
179179
180180#: qml/Panel/Indicators/MenuItemFactory.qml:583
181181msgid "In queue…"
po/pt_BR.po+11−11
@@ -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-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-07-17 05:46+0000\n"
12−"Last-Translator: Tiago Hillebrandt <tiagohillebrandt@gmail.com>\n"
11+"PO-Revision-Date: 2014-08-04 18:33+0000\n"
12+"Last-Translator: Rafael Neri <Unknown>\n"
1313"Language-Team: Brazilian Portuguese <pt_BR@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-07-26 07:17+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-05 06:45+0000\n"
18+"X-Generator: Launchpad (build 17147)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -99,7 +99,7 @@ msgstr "CANCELAR"
9999
100100#: qml/Components/PinLockscreen.qml:216
101101msgid "DONE"
102−msgstr ""
102+msgstr "FEITO"
103103
104104#: qml/Components/SeeMore.qml:35
105105msgid "See more"
@@ -115,7 +115,7 @@ msgstr "Recentes"
115115
116116#: qml/Dash/GenericScopeView.qml:330
117117msgid "See all"
118−msgstr ""
118+msgstr "Ver todos"
119119
120120#: qml/Dash/Previews/PreviewActionCombo.qml:34
121121msgid "More..."
@@ -171,11 +171,11 @@ msgstr "Por favor, digite o PIN do cartão SIM"
171171
172172#: qml/Panel/ActiveCallHint.qml:77
173173msgid "Tap to return to call..."
174−msgstr ""
174+msgstr "Toque para retornar para a chamada..."
175175
176176#: qml/Panel/ActiveCallHint.qml:90
177177msgid "Conference"
178−msgstr ""
178+msgstr "Conferência"
179179
180180#: qml/Panel/Indicators/MenuItemFactory.qml:583
181181msgid "In queue…"
@@ -187,7 +187,7 @@ msgstr "Baixando"
187187
188188#: qml/Panel/Indicators/MenuItemFactory.qml:589
189189msgid "Paused, tap to resume"
190−msgstr ""
190+msgstr "Em pausa, toque para continuar"
191191
192192#: qml/Panel/Indicators/MenuItemFactory.qml:591
193193msgid "Canceled"
@@ -195,11 +195,11 @@ msgstr "Cancelado"
195195
196196#: qml/Panel/Indicators/MenuItemFactory.qml:593
197197msgid "Finished"
198−msgstr ""
198+msgstr "Finalizado"
199199
200200#: qml/Panel/Indicators/MenuItemFactory.qml:595
201201msgid "Failed, tap to retry"
202−msgstr ""
202+msgstr "Falhou, toque para tentar novamente"
203203
204204#: qml/Panel/SearchIndicator.qml:27
205205msgid "Search"
po/ru.po+18−18
@@ -8,23 +8,23 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-05-15 12:57+0000\n"
12−"Last-Translator: Zonov Roman <Unknown>\n"
11+"PO-Revision-Date: 2014-07-31 09:39+0000\n"
12+"Last-Translator: Jay ZDLin <Unknown>\n"
1313"Language-Team: Russian <ru@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-07-26 07:17+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-01 07:14+0000\n"
18+"X-Generator: Launchpad (build 17141)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
2121#: plugins/Unity/Launcher/launcheritem.cpp:73
2222msgid "Pin shortcut"
23−msgstr ""
23+msgstr "Закрепить ярлык"
2424
2525#: plugins/Unity/Launcher/launcheritem.cpp:73
2626msgid "Unpin shortcut"
27−msgstr ""
27+msgstr "Изъять ярлык"
2828
2929#: qml/Components/EdgeDemoOverlay.qml:151
3030msgid "Skip intro"
@@ -85,7 +85,7 @@ msgstr "Экстренный вызов"
8585
8686#: qml/Components/Lockscreen.qml:231
8787msgid "OK"
88−msgstr ""
88+msgstr "ОК"
8989
9090#: qml/Components/PassphraseLockscreen.qml:60
9191#, qt-format
@@ -98,11 +98,11 @@ msgstr "Привет"
9898
9999#: qml/Components/PinLockscreen.qml:198
100100msgid "CANCEL"
101−msgstr ""
101+msgstr "ОТМЕНИТЬ"
102102
103103#: qml/Components/PinLockscreen.qml:216
104104msgid "DONE"
105−msgstr ""
105+msgstr "ГОТОВО"
106106
107107#: qml/Components/SeeMore.qml:35
108108msgid "See more"
@@ -118,7 +118,7 @@ msgstr "Недавние"
118118
119119#: qml/Dash/GenericScopeView.qml:330
120120msgid "See all"
121−msgstr ""
121+msgstr "Показать всё"
122122
123123#: qml/Dash/Previews/PreviewActionCombo.qml:34
124124msgid "More..."
@@ -174,35 +174,35 @@ msgstr "Введите PIN код"
174174
175175#: qml/Panel/ActiveCallHint.qml:77
176176msgid "Tap to return to call..."
177−msgstr ""
177+msgstr "Коснитесь для возврата к вызову..."
178178
179179#: qml/Panel/ActiveCallHint.qml:90
180180msgid "Conference"
181−msgstr ""
181+msgstr "Конференция"
182182
183183#: qml/Panel/Indicators/MenuItemFactory.qml:583
184184msgid "In queue…"
185−msgstr ""
185+msgstr "В очереди..."
186186
187187#: qml/Panel/Indicators/MenuItemFactory.qml:587
188188msgid "Downloading"
189−msgstr ""
189+msgstr "Загрузка"
190190
191191#: qml/Panel/Indicators/MenuItemFactory.qml:589
192192msgid "Paused, tap to resume"
193−msgstr ""
193+msgstr "Приостановлено, коснитесь для возобновления"
194194
195195#: qml/Panel/Indicators/MenuItemFactory.qml:591
196196msgid "Canceled"
197−msgstr ""
197+msgstr "Отменено"
198198
199199#: qml/Panel/Indicators/MenuItemFactory.qml:593
200200msgid "Finished"
201−msgstr ""
201+msgstr "Завершено"
202202
203203#: qml/Panel/Indicators/MenuItemFactory.qml:595
204204msgid "Failed, tap to retry"
205−msgstr ""
205+msgstr "Сбой, коснитесь для повтора"
206206
207207#: qml/Panel/SearchIndicator.qml:27
208208msgid "Search"
po/sv.po+6−6
@@ -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-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-07-25 14:27+0000\n"
12−"Last-Translator: Josef Andersson <Unknown>\n"
11+"PO-Revision-Date: 2014-07-31 08:10+0000\n"
12+"Last-Translator: Peter Hultqvist <phq@silentorbit.com>\n"
1313"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\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-07-26 07:17+0000\n"
18−"X-Generator: Launchpad (build 17131)\n"
17+"X-Launchpad-Export-Date: 2014-08-01 07:14+0000\n"
18+"X-Generator: Launchpad (build 17141)\n"
1919"Language: sv\n"
2020
2121#: plugins/Unity/Launcher/launcheritem.cpp:43
@@ -102,11 +102,11 @@ msgstr "KLAR"
102102
103103#: qml/Components/SeeMore.qml:35
104104msgid "See more"
105−msgstr "Se mer"
105+msgstr "Visa mer"
106106
107107#: qml/Components/SeeMore.qml:58 qml/Dash/GenericScopeView.qml:330
108108msgid "See less"
109−msgstr "Se mindre"
109+msgstr "Visa mindre"
110110
111111#: qml/Dash/DashApps.qml:37
112112msgid "Recent"
po/ug.po+1−1
@@ -14,7 +14,7 @@ msgstr ""
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-07-29 06:54+0000\n"
17+"X-Launchpad-Export-Date: 2014-07-31 07:15+0000\n"
1818"X-Generator: Launchpad (build 17131)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
po/uk.po+4−4
@@ -8,13 +8,13 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-07-11 14:59+0200\n"
11−"PO-Revision-Date: 2014-07-28 21:35+0000\n"
12−"Last-Translator: Ярослав Смук <Smuk.Slavko@yandex.ua>\n"
11+"PO-Revision-Date: 2014-07-29 07:53+0000\n"
12+"Last-Translator: Yuri Chornoivan <yurchor@gmail.com>\n"
1313"Language-Team: Ukrainian <uk@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-07-29 06:54+0000\n"
17+"X-Launchpad-Export-Date: 2014-07-31 07:15+0000\n"
1818"X-Generator: Launchpad (build 17131)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
@@ -172,7 +172,7 @@ msgstr "Введіть PIN-код SIM-картки"
172172
173173#: qml/Panel/ActiveCallHint.qml:77
174174msgid "Tap to return to call..."
175−msgstr ""
175+msgstr "Торкніться, щоб повернутися до дзвінка…"
176176
177177#: qml/Panel/ActiveCallHint.qml:90
178178msgid "Conference"
po/zh_CN.po+1−1
@@ -14,7 +14,7 @@ msgstr ""
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-07-29 06:54+0000\n"
17+"X-Launchpad-Export-Date: 2014-07-31 07:15+0000\n"
1818"X-Generator: Launchpad (build 17131)\n"
1919
2020#: plugins/Unity/Launcher/launcheritem.cpp:43
qml/Components/EdgeDemo.qml+5−6
@@ -22,7 +22,6 @@ Item {
2222 id: demo
2323
2424 property Item greeter
25− property Item dash
2625 property Item launcher
2726 property Item indicators
2827 property Item underlay
@@ -144,7 +143,7 @@ Item {
144143 "edge": "top",
145144 "title": i18n.tr("Top edge"),
146145 "text": i18n.tr("Try swiping from the top edge to access the indicators"),
147− "anchors.fill": demo.dash,
146+ "anchors.fill": demo.underlay,
148147 });
149148 }
150149 if (d.topEdgeDemo) {
@@ -193,12 +192,12 @@ Item {
193192 function startLeftEdgeDemo() {
194193 demo.panelEnabled = false;
195194 demo.launcherEnabled = true;
196− if (demo.dash && demo.underlay) {
195+ if (demo.underlay) {
197196 d.leftEdgeDemo = d.overlay.createObject(demo.underlay, {
198197 "edge": "left",
199198 "title": i18n.tr("Left edge"),
200199 "text": i18n.tr("Swipe from the left to reveal the launcher for quick access to apps"),
201− "anchors.fill": demo.dash,
200+ "anchors.fill": demo.underlay,
202201 });
203202 }
204203 if (d.leftEdgeDemo) {
@@ -221,12 +220,12 @@ Item {
221220
222221 function startFinalEdgeDemo() {
223222 demo.launcherEnabled = false;
224− if (demo.dash && demo.underlay) {
223+ if (demo.underlay) {
225224 d.finalEdgeDemo = d.overlay.createObject(demo.underlay, {
226225 "edge": "none",
227226 "title": i18n.tr("Well done"),
228227 "text": i18n.tr("You have now mastered the edge gestures and can start using the phone<br><br>Tap on the screen to start"),
229− "anchors.fill": demo.dash,
228+ "anchors.fill": demo.underlay,
230229 "showSkip": false,
231230 });
232231 }
qml/Components/PageHeader.qml+24−7
@@ -43,6 +43,12 @@ Item {
4343 signal backClicked()
4444
4545 onScopeStyleChanged: refreshLogo()
46+ onSearchQueryChanged: {
47+ // Make sure we are at the search page if the search query changes behind our feet
48+ if (searchQuery) {
49+ headerContainer.showSearch = true;
50+ }
51+ }
4652
4753 function triggerSearch() {
4854 if (searchEntryEnabled) {
@@ -51,6 +57,12 @@ Item {
5157 }
5258 }
5359
60+ function closePopup() {
61+ if (headerContainer.popover != null) {
62+ PopupUtils.close(headerContainer.popover);
63+ }
64+ }
65+
5466 function resetSearch(keepFocus) {
5567 if (searchHistory) {
5668 searchHistory.addQuery(searchTextField.text);
@@ -59,9 +71,7 @@ Item {
5971 unfocus();
6072 }
6173 searchTextField.text = "";
62− if (headerContainer.popover != null) {
63− PopupUtils.close(headerContainer.popover);
64− }
74+ closePopup();
6575 }
6676
6777 function unfocus() {
@@ -102,9 +112,7 @@ Item {
102112 anchors { fill: parent; margins: units.gu(1); bottomMargin: units.gu(3) + bottomContainer.height }
103113 visible: headerContainer.showSearch
104114 onPressed: {
105− if (headerContainer.popover) {
106− PopupUtils.close(headerContainer.popover);
107− }
115+ closePopup();
108116 if (!searchTextField.text) {
109117 headerContainer.showSearch = false;
110118 }
@@ -171,6 +179,7 @@ Item {
171179 property var contents: TextField {
172180 id: searchTextField
173181 objectName: "searchTextField"
182+ inputMethodHints: Qt.ImhNoPredictiveText
174183 hasClearButton: false
175184 anchors {
176185 fill: parent
@@ -208,6 +217,12 @@ Item {
208217 root.openSearchHistory();
209218 }
210219 }
220+
221+ onTextChanged: {
222+ if (text != "") {
223+ closePopup();
224+ }
225+ }
211226 }
212227 }
213228
@@ -285,6 +300,7 @@ Item {
285300
286301 Repeater {
287302 id: recentSearches
303+ objectName: "recentSearches"
288304 model: searchHistory
289305
290306 delegate: Standard {
@@ -293,7 +309,8 @@ Item {
293309 onClicked: {
294310 searchHistory.addQuery(text);
295311 searchTextField.text = text;
296− PopupUtils.close(popover);
312+ closePopup();
313+ unfocus();
297314 }
298315 }
299316 }
qml/Components/PassphraseLockscreen.qml+3
@@ -31,8 +31,10 @@ Item {
3131
3232 function clear(playAnimation) {
3333 pinentryField.text = "";
34+ pinentryField.enabled = true
3435 if (playAnimation) {
3536 wrongPasswordAnimation.start();
37+ pinentryField.forceActiveFocus();
3638 } else {
3739 pinentryField.focus = false
3840 }
@@ -78,6 +80,7 @@ Item {
7880
7981 onAccepted: {
8082 if (pinentryField.text) {
83+ pinentryField.enabled = false;
8184 root.entered(pinentryField.text);
8285 }
8386 }
qml/Dash/Apps/CloseIcon.qmldeleted−62
@@ -1,62 +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−Item {
20− id: root
21−
22− Image {
23− id: closeIcon
24− anchors.centerIn: parent
25− source: "graphics/close_btn.png"
26−
27− state: (root.enabled) ? "shown" : "hidden"
28−
29− states: [
30− State {
31− name: "shown"
32− PropertyChanges {
33− target: closeIcon
34− height: root.height
35− width: root.width
36− }
37− },
38− State {
39− name: "hidden"
40− PropertyChanges {
41− target: closeIcon
42− height: 0
43− width: 0
44− }
45− }
46−
47− ]
48− transitions: [
49− Transition {
50− to: "shown"
51− NumberAnimation {
52− properties: "width, height"; duration: 300
53− easing { type: Easing.OutBack; overshoot: 5 }
54− }
55− },
56− Transition {
57− to: "hidden"
58− NumberAnimation { properties: "width, height"; duration: 250; }
59− }
60− ]
61− }
62−}
qml/Dash/Apps/RunningApplicationTile.qmldeleted−136
@@ -1,136 +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−import Ubuntu.Components 0.1
19−import Unity.Application 0.1
20−import "../../Components/"
21−import "../../Components/ListItems"
22−
23−AbstractButton {
24− id: root
25− property var application
26−
27− signal requestedApplicationActivation(var application)
28− signal requestedApplicationTermination(var application)
29− signal requestedActivationMode()
30− signal requestedTerminationMode()
31−
32− width: thumbnail.width
33− height: thumbnail.height + labelContainer.height
34−
35− property bool terminationModeEnabled: false
36−
37− onClicked: {
38− if (!terminationModeEnabled)
39− requestedApplicationActivation(application)
40− }
41−
42− onPressAndHold: {
43− if (terminationModeEnabled) {
44− requestedActivationMode()
45− } else {
46− requestedTerminationMode()
47− }
48− }
49−
50− Item {
51− id: thumbnail
52−
53− width: shapedApplicationImage.width
54− height: shapedApplicationImage.height
55−
56− UbuntuShape {
57− id: shapedApplicationImage
58− x: 0
59− y: 0
60− height: applicationImage.height
61− width: applicationImage.width
62− radius: "medium"
63−
64− image: Image {
65− id: applicationImage
66− source: application.screenshot
67− // height : width = ss.height : ss.width
68−
69− property bool isLandscape: sourceSize.width > sourceSize.height
70− property real maxDimension: units.gu(17)
71−
72− width: isLandscape ? Math.min(sourceSize.width, maxDimension) : height * (sourceSize.width / sourceSize.height)
73− height: isLandscape ? width * (sourceSize.height / sourceSize.width) : Math.min(sourceSize.height, maxDimension)
74− fillMode: Image.Stretch
75− }
76−
77− }
78−
79− UbuntuShape {
80− id: borderPressed
81−
82− anchors.fill: shapedApplicationImage
83− radius: "medium"
84− borderSource: "radius_pressed.sci"
85− opacity: root.pressed ? 1.0 : 0.0
86− Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
87− }
88− }
89−
90− // FIXME: label code duplicated with Tile
91− Item {
92− id: labelContainer
93− anchors {
94− left: thumbnail.left
95− right: thumbnail.right
96− top: thumbnail.bottom
97− }
98− height: units.gu(2)
99−
100− Label {
101− id: label
102− anchors {
103− baseline: parent.bottom
104− left: parent.left
105− right: parent.right
106− }
107− text: (application) ? application.name : ""
108−
109− // TODO karni: Update Ubuntu.Components.Themes.Palette and use theme color instead
110− color: "grey"
111− opacity: 0.9
112− fontSize: "small"
113− elide: Text.ElideMiddle
114− horizontalAlignment: Text.AlignHCenter
115− }
116− }
117−
118− CloseIcon {
119− objectName: "closeIcon " + model.name
120− anchors {
121− left: thumbnail.left
122− leftMargin: -units.gu(1)
123− top: thumbnail.top
124− topMargin: -units.gu(1)
125− }
126− height: units.gu(6)
127− width: units.gu(6)
128− id: closeIcon
129− enabled: root.terminationModeEnabled
130−
131− MouseArea {
132− anchors { fill: parent; margins: -units.gu(1) }
133− onClicked: requestedApplicationTermination(application)
134− }
135− }
136−}
qml/Dash/Apps/RunningApplicationsGrid.qmldeleted−105
@@ -1,105 +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−import "../../Components"
19−
20−import Ubuntu.Gestures 0.1
21−import Unity.Application 0.1
22−
23−ResponsiveFlowView {
24− id: root
25− clip: true
26−
27− signal updateScreenshots
28− property alias enableHeightBehavior: heightBehaviour.enabled
29− property bool enableHeightBehaviorOnNextCreation: model.count === 0
30−
31− Behavior on height {
32− id: heightBehaviour
33− enabled: false
34− NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
35− }
36−
37− Connections {
38− target: root.model
39− onCountChanged: {
40− heightBehaviour.enabled = true;
41− }
42− }
43−
44− property bool canEnableTerminationMode: true
45−
46− onCanEnableTerminationModeChanged: {
47− if (!canEnableTerminationMode)
48− terminationModeEnabled = false
49− }
50−
51− // when false, it means it's on activation mode
52− property bool terminationModeEnabled: false
53−
54− maximumNumberOfColumns: 10
55− minimumHorizontalSpacing: units.gu(2)
56− referenceDelegateWidth: units.gu(11)
57− verticalSpacing: units.gu(2)
58−
59− delegate: Item {
60− width: runningAppTile.width + root.horizontalSpacing
61− height: runningAppTile.height + root.verticalSpacing
62−
63− RunningApplicationTile {
64− id: runningAppTile
65− objectName: "runningAppTile " + model.name
66− anchors {
67− top: parent.top
68− horizontalCenter: parent.horizontalCenter
69− }
70− application: model
71− onRequestedActivationMode: { root.terminationModeEnabled = false }
72− onRequestedTerminationMode: {
73− if (canEnableTerminationMode)
74− root.terminationModeEnabled = true
75− }
76− onRequestedApplicationTermination: {
77− ApplicationManager.stopApplication(model.appId)
78− }
79− onRequestedApplicationActivation: {
80− ApplicationManager.requestFocusApplication(model.appId)
81− }
82−
83− terminationModeEnabled: root.terminationModeEnabled
84− }
85− }
86−
87− move: Transition {
88− NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutCubic }
89− }
90−
91− MouseArea {
92− anchors.fill: parent
93− z: -1 // behind all RunningApplicationTiles
94− enabled: root.terminationModeEnabled
95− onPressed: { root.terminationModeEnabled = false; }
96− }
97−
98− PressedOutsideNotifier {
99− anchors.fill: parent
100− enabled: root.terminationModeEnabled
101− onPressedOutside: {
102− root.terminationModeEnabled = false;
103− }
104− }
105−}
qml/Dash/Apps/graphics/close_btn@9.pngdeleted

Binary file not shown.

qml/Dash/CardTool.qml+27−2
@@ -165,15 +165,40 @@ Item {
165165 }
166166 }
167167
168+ Item {
169+ id: attributesModel
170+ property int numOfAttributes: 0
171+ property var model: []
172+ property bool hasAttributes: {
173+ var attributes = components["attributes"];
174+ var hasAttributesFlag = (attributes != undefined) && attributes["field"];
175+
176+ if (hasAttributesFlag) {
177+ if (attributes["max-count"]) {
178+ numOfAttributes = attributes["max-count"];
179+ }
180+ }
181+ return hasAttributesFlag
182+ }
183+
184+ onNumOfAttributesChanged: {
185+ model = []
186+ for (var i = 0; i < numOfAttributes; i++) {
187+ model.push( {"value":"text"+(i+1), "icon":"image://theme/ok" } );
188+ }
189+ }
190+ }
191+
168192 Loader {
169193 id: cardLoader
170− property var fields: ["art", "mascot", "title", "subtitle", "summary"]
194+ property var fields: ["art", "mascot", "title", "subtitle", "summary", "attributes"]
171195 property var maxData: {
172196 "art": Qt.resolvedUrl("graphics/checkers.png"),
173197 "mascot": Qt.resolvedUrl("graphics/checkers.png"),
174198 "title": "—\n—",
175199 "subtitle": "—",
176− "summary": "—\n—\n—\n—\n—"
200+ "summary": "—\n—\n—\n—\n—",
201+ "attributes": attributesModel.model
177202 }
178203 sourceComponent: cardTool.cardComponent
179204 onLoaded: {
qml/Dash/Dash.qml+8
@@ -18,6 +18,7 @@ import QtQuick 2.2
1818import Ubuntu.Components 0.1
1919import Unity 0.2
2020import Utils 0.1
21+import Unity.DashCommunicator 0.1
2122import "../Components"
2223
2324Showable {
@@ -29,6 +30,13 @@ Showable {
2930 property string showScopeOnLoaded: "clickscope"
3031 property real contentScale: 1.0
3132
33+ DashCommunicatorService {
34+ objectName: "dashCommunicatorService"
35+ onSetCurrentScopeRequested: {
36+ dash.setCurrentScope(scopeId, animate, reset)
37+ }
38+ }
39+
3240 function setCurrentScope(scopeId, animate, reset) {
3341 var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
3442
qml/Dash/DashApplication.qmlnew file+29
@@ -0,0 +1,29 @@
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+
17+import QtQuick 2.2
18+import Ubuntu.Components 1.0
19+
20+MainView {
21+ width: units.gu(40)
22+ height: units.gu(71)
23+
24+ useDeprecatedToolbar: false
25+
26+ Dash {
27+ anchors.fill: parent
28+ }
29+}
qml/Dash/DashApps.qmldeleted−40
@@ -1,40 +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−import Ubuntu.Components 0.1
19−import Utils 0.1
20−import Unity.Application 0.1
21−import "../Components"
22−import "../Components/ListItems"
23−import "Apps"
24−
25−GenericScopeView {
26− id: scopeView
27− objectName: "DashApps"
28−
29− property var runningApps: ApplicationManager
30−
31− QtObject {
32− id: countObject
33− property int count: scopeView.scope.searchQuery.length == 0 ? scopeView.runningApps.count : 0
34− }
35−
36− onScopeChanged: {
37− scopeView.scope.categories.addSpecialCategory("running.apps.category", i18n.tr("Recent"), "", "{ \"template\": { \"category-layout\": \"running-apps\" } }", countObject);
38− enableHeightBehaviorOnNextCreation = scopeView.runningApps.count === 0
39− }
40−}
qml/Dash/DashContent.qml+1−3
@@ -128,9 +128,7 @@ Item {
128128 return (xPositionRelativetoView > -width && xPositionRelativetoView < width) ? 1 : 0
129129 }
130130 asynchronous: true
131− // TODO This if will eventually go away since we're killing DashApps.qml
132− // once we move app closing to the spread
133− source: (scope.id == "clickscope") ? "DashApps.qml" : "GenericScopeView.qml"
131+ source: "GenericScopeView.qml"
134132 objectName: scope.id + " loader"
135133
136134 readonly property bool moving: item ? item.moving : false
qml/Dash/GenericScopeView.qml+2−11
@@ -18,7 +18,6 @@ import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import Utils 0.1
2020import Unity 0.2
21−import Unity.Application 0.1
2221import Dash 0.1
2322import "../Components"
2423import "../Components/ListItems" as ListItems
@@ -49,7 +48,7 @@ FocusScope {
4948 }
5049
5150 function activateApp(appId) {
52− shell.activateApplication(appId);
51+ Qt.openUrlExternally(appId);
5352 }
5453
5554 function positionAtBeginning() {
@@ -196,7 +195,6 @@ FocusScope {
196195 switch (cardTool.categoryLayout) {
197196 case "carousel": return "CardCarousel.qml";
198197 case "vertical-journal": return "CardVerticalJournal.qml";
199− case "running-apps": return "Apps/RunningApplicationsGrid.qml";
200198 case "grid":
201199 default: return "CardGrid.qml";
202200 }
@@ -207,14 +205,7 @@ FocusScope {
207205 item.enableHeightBehavior = scopeView.enableHeightBehaviorOnNextCreation;
208206 scopeView.enableHeightBehaviorOnNextCreation = false;
209207 }
210− if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
211− // TODO: this is still a kludge :D Ideally add some kind of hook so that we
212− // can do this from DashApps.qml or think a better way that needs no special casing
213− item.model = Qt.binding(function() { return runningApps; })
214− item.canEnableTerminationMode = Qt.binding(function() { return scopeView.isCurrent })
215− } else {
216− item.model = Qt.binding(function() { return results })
217− }
208+ item.model = Qt.binding(function() { return results })
218209 item.objectName = Qt.binding(function() { return categoryId })
219210 item.scopeStyle = scopeView.scopeStyle;
220211 if (baseItem.expandable) {
qml/Dash/ScopeListView.qml−5
@@ -20,9 +20,4 @@ import Dash 0.1
2020ListViewWithPageHeader {
2121 maximumFlickVelocity: height * 10
2222 flickDeceleration: height * 2
23−
24− Connections {
25− target: greeter
26− onShownChanged: if (greeter.shown) showHeader()
27− }
2823}
qml/Dash/graphics/phone/screenshots/unity8-dash@12.pngnew file

Binary file not shown.

qml/Launcher/Launcher.qml+2−3
@@ -29,8 +29,7 @@ Item {
2929 property int dragAreaWidth: units.gu(1)
3030 property int minimizeDistance: units.gu(26)
3131 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
32− (width * (dragArea.touchX-panelWidth) / (width - panelWidth)) :
33− (dragArea.dragging ? 0.001 : 0)
32+ (width * (dragArea.touchX-panelWidth) / (width - panelWidth)) : 0
3433
3534 readonly property bool shown: panel.x > -panel.width
3635
@@ -245,7 +244,7 @@ Item {
245244 if (!dragging) {
246245 if (distance > panel.width / 2) {
247246 if (distance > minimizeDistance) {
248− root.dash()
247+ root.dash();
249248 } else {
250249 root.switchToNextState("visible")
251250 }
qml/Launcher/LauncherDelegate.qml+9−6
@@ -70,28 +70,31 @@ Item {
7070 height: root.itemHeight - units.gu(1)
7171 }
7272
73− BorderImage {
73+ UbuntuShape {
7474 objectName: "countEmblem"
7575 anchors {
7676 right: parent.right
7777 top: parent.top
7878 margins: units.dp(3)
7979 }
80− width: Math.min(root.itemWidth, Math.max(units.gu(3), countLabel.implicitWidth + units.gu(2.5)))
81− height: units.gu(3)
82− source: "graphics/notification.sci"
80+ width: Math.min(root.itemWidth, Math.max(units.gu(2), countLabel.implicitWidth + units.gu(1)))
81+ height: units.gu(2)
82+ color: UbuntuColors.orange
8383 visible: root.count > 0
84+ borderSource: "none"
8485
8586 Label {
8687 id: countLabel
8788 text: root.count
8889 anchors.centerIn: parent
90+ // FIXME: verticalCenter seems to be off wee bit and QML doesn't have a centerLine
91+ // property for Text: https://bugreports.qt-project.org/browse/QTBUG-40479
92+ anchors.verticalCenterOffset: -units.dp(.5)
8993 width: root.itemWidth - units.gu(1)
9094 horizontalAlignment: Text.AlignHCenter
9195 elide: Text.ElideRight
9296 color: "white"
93− fontSize: "small"
94− font.bold: true
97+ fontSize: "x-small"
9598 }
9699 }
97100
qml/Launcher/graphics/notification@30.pngdeleted

Binary file not shown.

qml/Launcher/graphics/notification@30.scideleted−5
@@ -1,5 +0,0 @@
1−border.left: 36
2−border.top: 36
3−border.bottom: 36
4−border.right: 36
5−source: notification@30.png
qml/Panel/Indicators/DefaultIndicatorPage.qml+1−1
@@ -126,7 +126,7 @@ IndicatorBase {
126126 id: loader
127127 objectName: "menuItem" + index
128128 asynchronous: false
129− visible: height > 0
129+ visible: status == Loader.Ready
130130
131131 property int modelIndex: index
132132
qml/Shell.qml+53−153
@@ -25,7 +25,6 @@ import Utils 0.1
2525import LightDM 0.1 as LightDM
2626import Powerd 0.1
2727import SessionBroadcast 0.1
28−import "Dash"
2928import "Greeter"
3029import "Launcher"
3130import "Panel"
@@ -34,6 +33,7 @@ import "Notifications"
3433import "Stages"
3534import Unity.Notifications 1.0 as NotificationBackend
3635import Unity.Session 0.1
36+import Unity.DashCommunicator 0.1
3737
3838Item {
3939 id: shell
@@ -48,8 +48,6 @@ Item {
4848 property url background
4949 readonly property real panelHeight: panel.panelHeight
5050
51− property bool dashShown: dash.shown && dash.available && underlay.visible
52−
5351 property bool sideStageEnabled: shell.width >= units.gu(100)
5452 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
5553
@@ -59,7 +57,6 @@ Item {
5957 } else {
6058 var execFlags = shell.sideStageEnabled ? ApplicationManager.NoFlag : ApplicationManager.ForceMainStage;
6159 ApplicationManager.startApplication(appId, execFlags);
62− stages.show();
6360 }
6461 }
6562
@@ -86,6 +83,11 @@ Item {
8683 id: volumeControl
8784 }
8885
86+ DashCommunicator {
87+ id: dash
88+ objectName: "dashCommunicator"
89+ }
90+
8991 WindowKeysFilter {
9092 // Handle but do not filter out volume keys
9193 Keys.onVolumeUpPressed: { volumeControl.volumeUp(); event.accepted = false; }
@@ -121,64 +123,12 @@ Item {
121123 visible: !fullyCovered
122124
123125 Image {
124− anchors.fill: dash
126+ anchors.fill: underlay
125127 source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
126128 fillMode: Image.PreserveAspectCrop
127129 horizontalAlignment: Image.AlignRight
128130 verticalAlignment: Image.AlignTop
129131 }
130−
131− Dash {
132− id: dash
133− objectName: "dash"
134−
135− available: !LightDM.Greeter.active
136− hides: [stages, launcher, panel.indicators]
137− shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0 &&
138− !(panel.indicators.fullyOpened && !sideStageEnabled)
139− enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
140−
141− anchors {
142− fill: parent
143− topMargin: panel.panelHeight
144− }
145−
146− contentScale: 1.0 - 0.2 * disappearingAnimationProgress
147− opacity: 1.0 - disappearingAnimationProgress
148− property real disappearingAnimationProgress: stages.showProgress
149−
150− // FIXME: only necessary because stages.showProgress is not animated
151− Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
152− }
153− }
154−
155− EdgeDragArea {
156− id: stagesDragArea
157− direction: Direction.Leftwards
158−
159− anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
160− width: shell.edgeSize
161−
162− property real progress: stages.width
163−
164− onTouchXChanged: {
165− if (status == DirectionalDragArea.Recognized) {
166− if (ApplicationManager.empty) {
167− progress = Math.max(stages.width - stagesDragArea.width + touchX, stages.width * .3);
168− } else {
169− progress = stages.width - stagesDragArea.width + touchX;
170− }
171− }
172− }
173−
174− onDraggingChanged: {
175− if (!dragging) {
176− if (!ApplicationManager.empty && progress < stages.width - units.gu(10)) {
177− stages.show();
178− }
179− stagesDragArea.progress = Qt.binding(function () { return stages.width; });
180− }
181− }
182132 }
183133
184134 Item {
@@ -186,55 +136,7 @@ Item {
186136 objectName: "stages"
187137 width: parent.width
188138 height: parent.height
189−
190− visible: !fullyHidden && !ApplicationManager.empty
191−
192− x: {
193− if (shown) {
194− if (locked || greeter.fakeActiveForApp !== "") {
195− return 0;
196− }
197− return launcher.progress;
198− } else {
199− return stagesDragArea.progress
200− }
201− }
202− Behavior on x { SmoothedAnimation { velocity: 600; duration: UbuntuAnimation.FastDuration } }
203−
204− property bool shown: false
205− onShownChanged: {
206− if (shown) {
207− if (ApplicationManager.count > 0) {
208− ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
209− }
210− } else {
211− if (ApplicationManager.focusedApplicationId) {
212− ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
213− ApplicationManager.unfocusCurrentApplication();
214− }
215− }
216− }
217−
218− // Avoid a silent "divide by zero -> NaN" situation during init as shell.width will be
219− // zero. That breaks the property binding and the function won't be reevaluated once
220− // shell.width is set, with the NaN result staying there for good.
221− property real showProgress: shell.width ? MathUtils.clamp(1 - x / shell.width, 0, 1) : 0
222−
223− property bool fullyShown: x == 0
224− property bool fullyHidden: x == width
225−
226− property bool locked: applicationsDisplayLoader.item ? applicationsDisplayLoader.item.locked : false
227−
228− // It might technically not be fullyShown but visually it just looks so.
229− property bool roughlyFullyShown: x >= 0 && x <= units.gu(1)
230−
231− function show() {
232− shown = true;
233− }
234−
235− function hide() {
236− shown = false;
237− }
139+ visible: !ApplicationManager.empty
238140
239141 Connections {
240142 target: ApplicationManager
@@ -243,7 +145,6 @@ Item {
243145 lockscreen.show();
244146 }
245147 greeter.hide();
246− stages.show();
247148 }
248149
249150 onFocusedApplicationIdChanged: {
@@ -254,18 +155,9 @@ Item {
254155 }
255156
256157 onApplicationAdded: {
257− if (greeter.shown) {
158+ if (greeter.shown && appId != "unity8-dash") {
258159 greeter.hide();
259160 }
260− if (!stages.shown) {
261− stages.show();
262− }
263− }
264−
265− onEmptyChanged: {
266− if (ApplicationManager.empty) {
267− stages.hide();
268− }
269161 }
270162 }
271163
@@ -294,14 +186,18 @@ Item {
294186 Binding {
295187 target: applicationsDisplayLoader.item
296188 property: "interactive"
297− value: stages.roughlyFullyShown && !greeter.shown && !lockscreen.shown
298− && panel.indicators.fullyClosed
189+ value: !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0
299190 }
300191 Binding {
301192 target: applicationsDisplayLoader.item
302193 property: "spreadEnabled"
303194 value: greeter.fakeActiveForApp === "" // to support emergency dialer hack
304195 }
196+ Binding {
197+ target: applicationsDisplayLoader.item
198+ property: "inverseProgress"
199+ value: launcher.progress
200+ }
305201 }
306202 }
307203
@@ -348,6 +244,7 @@ Item {
348244 width: parent.width
349245 height: parent.height - panel.panelHeight
350246 background: shell.background
247+ alphaNumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
351248 minPinLength: 4
352249 maxPinLength: 4
353250
@@ -362,7 +259,7 @@ Item {
362259 onShownChanged: if (shown) greeter.fakeActiveForApp = ""
363260
364261 Component.onCompleted: {
365− if (LightDM.Users.count == 1) {
262+ if (greeter.narrowMode) {
366263 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
367264 }
368265 }
@@ -374,14 +271,17 @@ Item {
374271 onShowGreeter: greeter.show()
375272
376273 onShowPrompt: {
377− if (LightDM.Users.count == 1) {
378− // TODO: There's no better way for now to determine if its a PIN or a passphrase.
379− if (text == "PIN") {
380− lockscreen.alphaNumeric = false
381− } else {
382− lockscreen.alphaNumeric = true
383− }
384− lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
274+ if (greeter.narrowMode) {
275+ lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text.toLowerCase());
276+ lockscreen.show();
277+ }
278+ }
279+
280+ onPromptlessChanged: {
281+ if (LightDM.Greeter.promptless) {
282+ lockscreen.hide()
283+ } else {
284+ lockscreen.reset();
385285 lockscreen.show();
386286 }
387287 }
@@ -395,6 +295,9 @@ Item {
395295 greeter.login();
396296 } else {
397297 lockscreen.clear(true);
298+ if (greeter.narrowMode) {
299+ LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
300+ }
398301 }
399302 }
400303 }
@@ -449,25 +352,24 @@ Item {
449352
450353 function login() {
451354 enabled = false;
452− LightDM.Greeter.startSessionSync();
453− sessionStarted();
454− greeter.hide();
455− lockscreen.hide();
456− launcher.hide();
355+ if (LightDM.Greeter.startSessionSync()) {
356+ sessionStarted();
357+ greeter.hide();
358+ lockscreen.hide();
359+ launcher.hide();
360+ }
457361 enabled = true;
458362 }
459363
460364 onShownChanged: {
461365 if (shown) {
462− lockscreen.reset();
463− if (!LightDM.Greeter.promptless) {
464− lockscreen.show();
465− }
466− // If there is only one user, we start authenticating with that one here.
467− // If there are more users, the Greeter will handle that
468− if (LightDM.Users.count == 1) {
366+ if (greeter.narrowMode) {
469367 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
470368 }
369+ if (!LightDM.Greeter.promptless) {
370+ lockscreen.reset();
371+ lockscreen.show();
372+ }
471373 greeter.fakeActiveForApp = "";
472374 greeter.forceActiveFocus();
473375 }
@@ -525,25 +427,20 @@ Item {
525427
526428 var animate = !LightDM.Greeter.active && !stages.shown
527429 dash.setCurrentScope("clickscope", animate, false)
528− stages.hide()
430+ ApplicationManager.requestFocusApplication("unity8-dash")
529431 }
530432
531433 function showDash() {
532434 if (LightDM.Greeter.active && !LightDM.Greeter.promptless) {
533435 return;
534436 }
535−
536− if (!stages.locked) {
537− stages.hide();
538− launcher.fadeOut();
539− } else {
540− launcher.switchToNextState("visible");
541− }
542−
543437 if (greeter.shown) {
544438 greeter.hideRight();
545439 launcher.fadeOut();
546440 }
441+
442+ ApplicationManager.requestFocusApplication("unity8-dash")
443+ launcher.fadeOut();
547444 }
548445
549446 Item {
@@ -568,8 +465,8 @@ Item {
568465 ApplicationManager.focusedApplicationId &&
569466 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
570467
571− fullscreenMode: (stages.roughlyFullyShown && topmostApplicationIsFullscreen
572− && !LightDM.Greeter.active) || greeter.fakeActiveForApp !== ""
468+ fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
469+ || greeter.fakeActiveForApp !== ""
573470 }
574471
575472 Launcher {
@@ -586,7 +483,11 @@ Item {
586483
587484 onShowDashHome: showHome()
588485 onDash: showDash()
589− onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
486+ onDashSwipeChanged: {
487+ if (dashSwipe && ApplicationManager.focusedApplicationId !== "unity8-dash") {
488+ dash.setCurrentScope("clickscope", false, true)
489+ }
490+ }
590491 onLauncherApplicationSelected: {
591492 if (greeter.fakeActiveForApp !== "") {
592493 lockscreen.show()
@@ -678,7 +579,6 @@ Item {
678579 z: alphaDisclaimerLabel.z + 10
679580 greeter: greeter
680581 launcher: launcher
681− dash: dash
682582 indicators: panel.indicators
683583 underlay: underlay
684584 }
qml/Stages/PhoneStage.qml+59−26
@@ -21,7 +21,7 @@ import Unity.Application 0.1
2121import Utils 0.1
2222import "../Components"
2323
24−Item {
24+Rectangle {
2525 id: root
2626
2727 // Controls to be set from outside
@@ -29,9 +29,9 @@ Item {
2929 property real maximizedAppTopMargin
3030 property bool interactive
3131 property bool spreadEnabled: true // If false, animations and right edge will be disabled
32+ property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
3233
33− // State information propagated to the outside
34− readonly property bool locked: spreadView.phase == 2
34+ color: "black"
3535
3636 function select(appId) {
3737 spreadView.snapTo(priv.indexOf(appId));
@@ -43,6 +43,16 @@ Item {
4343 spreadView.contentX = -spreadView.shift;
4444 }
4545
46+ onInverseProgressChanged: {
47+ if (inverseProgress == 0 && priv.oldInverseProgress > 0) {
48+ // left edge drag released. Minimum distance is given by design.
49+ if (priv.oldInverseProgress > units.gu(22)) {
50+ ApplicationManager.focusApplication("unity8-dash");
51+ }
52+ }
53+ priv.oldInverseProgress = inverseProgress;
54+ }
55+
4656 Connections {
4757 target: ApplicationManager
4858
@@ -50,7 +60,7 @@ Item {
5060 if (spreadView.phase > 0) {
5161 spreadView.snapTo(priv.indexOf(appId));
5262 } else {
53− priv.switchToApp(appId);
63+ ApplicationManager.focusApplication(appId);
5464 }
5565 }
5666
@@ -60,7 +70,7 @@ Item {
6070 } else {
6171 spreadView.phase = 0;
6272 spreadView.contentX = -spreadView.shift;
63− priv.switchToApp(appId);
73+ ApplicationManager.focusApplication(appId);
6474 }
6575 }
6676
@@ -79,15 +89,11 @@ Item {
7989
8090 property string focusedAppId: ApplicationManager.focusedApplicationId
8191 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
92+ property var focusedAppDelegate: null
8293
83− function switchToApp(appId) {
84− if (priv.focusedAppId) {
85− spreadView.focusChanging = true;
86− ApplicationManager.focusApplication(appId);
87− } else {
88− ApplicationManager.focusApplication(appId);
89− }
90− }
94+ property real oldInverseProgress: 0
95+
96+ onFocusedAppIdChanged: focusedAppDelegate = spreadRepeater.itemAt(0);
9197
9298 function indexOf(appId) {
9399 for (var i = 0; i < ApplicationManager.count; i++) {
@@ -100,14 +106,6 @@ Item {
100106
101107 }
102108
103− Rectangle {
104− id: coverFlipBackground
105− anchors.fill: parent
106− color: "black"
107− visible: spreadView.visible
108− }
109−
110−
111109 Flickable {
112110 id: spreadView
113111 objectName: "spreadView"
@@ -116,6 +114,10 @@ Item {
116114 contentWidth: spreadRow.width - shift
117115 contentX: -shift
118116
117+ // This indicates when the spreadView is active. That means, all the animations
118+ // are activated and tiles need to line up for the spread.
119+ readonly property bool active: shiftedContentX > 0 || spreadDragArea.dragging
120+
119121 // The flickable needs to fill the screen in order to get touch events all over.
120122 // However, we don't want to the user to be able to scroll back all the way. For
121123 // that, the beginning of the gesture starts with a negative value for contentX
@@ -198,6 +200,12 @@ Item {
198200 snapAnimation.start();
199201 }
200202
203+ // In case the ApplicationManager already holds an app when starting up we're missing animations
204+ // Make sure we end up in the same state
205+ Component.onCompleted: {
206+ spreadView.contentX = -spreadView.shift
207+ }
208+
201209 SequentialAnimation {
202210 id: snapAnimation
203211 property int targetContentX: -spreadView.shift
@@ -260,14 +268,33 @@ Item {
260268 && spreadView.shiftedContentX === 0 && root.interactive && index === 0
261269 swipeToCloseEnabled: spreadView.interactive
262270 maximizedAppTopMargin: root.maximizedAppTopMargin
263− dropShadow: spreadView.shiftedContentX > 0 || spreadDragArea.status == DirectionalDragArea.Undecided
271+ dropShadow: spreadView.active ||
272+ priv.focusedAppDelegate.x !== 0
273+
274+ readonly property bool isDash: model.appId == "unity8-dash"
275+
276+ z: isDash && !spreadView.active ? -1 : behavioredIndex
264277
265− z: behavioredIndex
266− x: index == 0 ? 0 : spreadView.width + (index - 1) * spreadView.tileDistance
278+ x: {
279+ // focused app is always positioned at 0 except when following left edge drag
280+ if (index == 0) {
281+ if (!isDash && root.inverseProgress > 0) {
282+ return root.inverseProgress;
283+ }
284+ return 0;
285+ }
286+ if (isDash && !spreadView.active && !spreadDragArea.dragging) {
287+ return 0;
288+ }
289+
290+ // Otherwise line up for the spread
291+ return spreadView.width + (index - 1) * spreadView.tileDistance;
292+ }
267293 property real behavioredIndex: index
268294 Behavior on behavioredIndex {
269295 enabled: spreadView.closingIndex >= 0
270296 UbuntuNumberAnimation {
297+ id: appXAnimation
271298 onRunningChanged: {
272299 if (!running) {
273300 spreadView.closingIndex = -1;
@@ -277,11 +304,13 @@ Item {
277304 }
278305
279306 Behavior on x {
280− enabled: spreadView.focusChanging && index == 0 && root.spreadEnabled
307+ enabled: root.spreadEnabled &&
308+ !spreadView.active &&
309+ !snapAnimation.running
281310 UbuntuNumberAnimation {
282311 duration: UbuntuAnimation.FastDuration
283312 onRunningChanged: {
284− if (!running) {
313+ if (!running && root.inverseProgress == 0) {
285314 spreadView.focusChanging = false;
286315 }
287316 }
@@ -322,6 +351,10 @@ Item {
322351 return progress;
323352 }
324353
354+ // Hiding tiles when their progress is negative or reached the maximum
355+ visible: (progress >= 0 && progress < 1.7) ||
356+ (isDash && priv.focusedAppDelegate.x !== 0)
357+
325358 EasingCurve {
326359 id: snappingCurve
327360 type: EasingCurve.Linear
qml/Stages/SpreadDelegate.qml+6
@@ -37,6 +37,7 @@ Item {
3737
3838 SurfaceContainer {
3939 id: surfaceContainer
40+ objectName: "surfaceContainer"
4041 anchors.fill: parent
4142 surface: model.surface
4243 property bool appHasCreatedASurface: false
@@ -172,6 +173,11 @@ Item {
172173 }
173174
174175 onDragEnd: {
176+ if (model.appId == "unity8-dash") {
177+ animation.animate("center")
178+ return;
179+ }
180+
175181 // velocity and distance values specified by design prototype
176182 if ((dragVelocity < -units.gu(40) && distance < -units.gu(8)) || distance < -root.height / 2) {
177183 animation.animate("up")
qml/Stages/TabletStage.qml+85−41
@@ -21,10 +21,11 @@ import Unity.Application 0.1
2121import Utils 0.1
2222import "../Components"
2323
24−Item {
24+Rectangle {
2525 id: root
2626 objectName: "stages"
2727 anchors.fill: parent
28+ color: "black"
2829
2930 // Controls to be set from outside
3031 property bool shown: false
@@ -32,9 +33,17 @@ Item {
3233 property int dragAreaWidth
3334 property real maximizedAppTopMargin
3435 property bool interactive
36+ property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
3537
36− // State information propagated to the outside
37− readonly property bool locked: spreadView.phase == 2
38+ onInverseProgressChanged: {
39+ if (inverseProgress == 0 && priv.oldInverseProgress > 0) {
40+ // left edge drag released. Minimum distance is given by design.
41+ if (priv.oldInverseProgress > units.gu(22)) {
42+ ApplicationManager.focusApplication("unity8-dash");
43+ }
44+ }
45+ priv.oldInverseProgress = inverseProgress;
46+ }
3847
3948 QtObject {
4049 id: priv
@@ -49,6 +58,8 @@ Item {
4958 property string appId0
5059 property string appId1
5160
61+ property int oldInverseProgress: 0
62+
5263 onFocusedAppIdChanged: {
5364 if (priv.focusedAppId.length > 0) {
5465 var focusedApp = ApplicationManager.findApplication(focusedAppId);
@@ -107,16 +118,26 @@ Item {
107118 }
108119 }
109120
121+ onApplicationAdded: {
122+ if (spreadView.phase == 2) {
123+ spreadView.snapTo(ApplicationManager.count - 1);
124+ } else {
125+ spreadView.phase = 0;
126+ spreadView.contentX = -spreadView.shift;
127+ ApplicationManager.focusApplication(appId);
128+ }
129+ }
130+
110131 onApplicationRemoved: {
111132 if (priv.mainStageAppId == appId) {
112− priv.mainStageAppId = "";
133+ ApplicationManager.focusApplication("unity8-dash")
113134 }
114135 if (priv.sideStageAppId == appId) {
115136 priv.sideStageAppId = "";
116137 }
117138 if (ApplicationManager.count == 0) {
118139 spreadView.phase = 0;
119− spreadView.contentX = 0;
140+ spreadView.contentX = -spreadView.shift;
120141 }
121142 }
122143 }
@@ -124,13 +145,26 @@ Item {
124145 Flickable {
125146 id: spreadView
126147 anchors.fill: parent
127− contentWidth: spreadRow.width
128148 interactive: (spreadDragArea.status == DirectionalDragArea.Recognized || phase > 1) && draggedIndex == -1
149+ contentWidth: spreadRow.width - shift
150+ contentX: -shift
129151
130152 property int tileDistance: units.gu(20)
131153 property int sideStageWidth: units.gu(40)
132154 property bool sideStageVisible: priv.sideStageAppId
133155
156+ // This indicates when the spreadView is active. That means, all the animations
157+ // are activated and tiles need to line up for the spread.
158+ readonly property bool active: shiftedContentX > 0 || spreadDragArea.dragging
159+
160+ // The flickable needs to fill the screen in order to get touch events all over.
161+ // However, we don't want to the user to be able to scroll back all the way. For
162+ // that, the beginning of the gesture starts with a negative value for contentX
163+ // so the flickable wants to pull it into the view already. "shift" tunes the
164+ // distance where to "lock" the content.
165+ readonly property real shift: width / 2
166+ readonly property real shiftedContentX: contentX + shift
167+
134168 // Phase of the animation:
135169 // 0: Starting from right edge, a new app (index 1) comes in from the right
136170 // 1: The app has reached the first snap position.
@@ -168,6 +202,12 @@ Item {
168202 }
169203 }
170204
205+ // In case the ApplicationManager already holds an app when starting up we're missing animations
206+ // Make sure we end up in the same state
207+ Component.onCompleted: {
208+ spreadView.contentX = -spreadView.shift
209+ }
210+
171211 property int nextInStack: {
172212 switch (state) {
173213 case "main":
@@ -224,31 +264,31 @@ Item {
224264 return "empty";
225265 }
226266
227− onContentXChanged: {
228− if (spreadView.phase == 0 && spreadView.contentX > spreadView.width * spreadView.positionMarker2) {
267+ onShiftedContentXChanged: {
268+ if (spreadView.phase == 0 && spreadView.shiftedContentX > spreadView.width * spreadView.positionMarker2) {
229269 spreadView.phase = 1;
230− } else if (spreadView.phase == 1 && spreadView.contentX > spreadView.width * spreadView.positionMarker4) {
270+ } else if (spreadView.phase == 1 && spreadView.shiftedContentX > spreadView.width * spreadView.positionMarker4) {
231271 spreadView.phase = 2;
232− } else if (spreadView.phase == 1 && spreadView.contentX < spreadView.width * spreadView.positionMarker2) {
272+ } else if (spreadView.phase == 1 && spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker2) {
233273 spreadView.phase = 0;
234274 }
235275 }
236276
237277 function snap() {
238− if (contentX < phase0Width) {
239− snapAnimation.targetContentX = 0;
278+ if (shiftedContentX < phase0Width) {
279+ snapAnimation.targetContentX = -shift;
240280 snapAnimation.start();
241− } else if (contentX < phase1Width) {
281+ } else if (shiftedContentX < phase1Width) {
242282 snapTo(1);
243283 } else {
244284 // Add 1 pixel to make sure we definitely hit positionMarker4 even with rounding errors of the animation.
245− snapAnimation.targetContentX = spreadView.width * spreadView.positionMarker4 + 1;
285+ snapAnimation.targetContentX = spreadView.width * spreadView.positionMarker4 + 1 - shift;
246286 snapAnimation.start();
247287 }
248288 }
249289 function snapTo(index) {
250290 spreadView.selectedIndex = index;
251− snapAnimation.targetContentX = 0;
291+ snapAnimation.targetContentX = -shift;
252292 snapAnimation.start();
253293 }
254294
@@ -261,12 +301,12 @@ Item {
261301 return index;
262302 }
263303
264− var isActive = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
265− if (isActive && app.stage == ApplicationInfoInterface.MainStage) {
304+ var active = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
305+ if (active && app.stage == ApplicationInfoInterface.MainStage) {
266306 // if this app is active, and its the MainStage, always put it to index 0
267307 return 0;
268308 }
269− if (isActive && app.stage == ApplicationInfoInterface.SideStage) {
309+ if (active && app.stage == ApplicationInfoInterface.SideStage) {
270310 if (!priv.mainStageAppId) {
271311 // Only have SS apps running. Put the active one at 0
272312 return 0;
@@ -309,7 +349,7 @@ Item {
309349
310350 SequentialAnimation {
311351 id: snapAnimation
312− property int targetContentX: 0
352+ property int targetContentX: -spreadView.shift
313353
314354 UbuntuNumberAnimation {
315355 target: spreadView
@@ -325,15 +365,14 @@ Item {
325365 spreadView.selectedIndex = -1;
326366 ApplicationManager.focusApplication(ApplicationManager.get(newIndex).appId);
327367 spreadView.phase = 0;
328− spreadView.contentX = 0;
368+ spreadView.contentX = -spreadView.shift;
329369 }
330370 }
331371 }
332372 }
333373
334− Rectangle {
374+ Item {
335375 id: spreadRow
336− color: "black"
337376 x: spreadView.contentX
338377 height: root.height
339378 width: spreadView.width + Math.max(spreadView.width, ApplicationManager.count * spreadView.tileDistance)
@@ -380,7 +419,7 @@ Item {
380419 MouseArea {
381420 id: sideStageDragHandleMouseArea
382421 anchors.fill: parent
383− enabled: spreadView.contentX == 0
422+ enabled: spreadView.shiftedContentX == 0
384423 property int startX
385424 property var gesturePoints: new Array()
386425
@@ -413,7 +452,7 @@ Item {
413452
414453 onRunningChanged: {
415454 if (!running) {
416− sideStageDragHandle.dragging = false;;
455+ sideStageDragHandle.dragging = false;
417456 }
418457 }
419458 }
@@ -427,17 +466,26 @@ Item {
427466 id: spreadTile
428467 height: spreadView.height
429468 width: model.stage == ApplicationInfoInterface.MainStage ? spreadView.width : spreadView.sideStageWidth
430− x: spreadView.width
431− z: spreadView.indexToZIndex(index)
432469 active: model.appId == priv.mainStageAppId || model.appId == priv.sideStageAppId
433− zIndex: z
470+ zIndex: spreadView.indexToZIndex(index)
434471 selected: spreadView.selectedIndex == index
435472 otherSelected: spreadView.selectedIndex >= 0 && !selected
436473 isInSideStage: priv.sideStageAppId == model.appId
437474 interactive: !spreadView.interactive && spreadView.phase === 0 && root.interactive
438475 swipeToCloseEnabled: spreadView.interactive
439476 maximizedAppTopMargin: root.maximizedAppTopMargin
440− dropShadow: spreadView.contentX > 0 || spreadDragArea.status == DirectionalDragArea.Undecided
477+ dragOffset: !isDash && model.appId == priv.mainStageAppId && root.inverseProgress > 0 ? root.inverseProgress : 0
478+
479+ readonly property bool isDash: model.appId == "unity8-dash"
480+
481+ // FIXME: A regular binding doesn't update any more after closing an app.
482+ // Using a Binding for now.
483+ Binding {
484+ target: spreadTile
485+ property: "z"
486+ value: (!spreadView.active && isDash && !active) ? -1 : spreadTile.zIndex
487+ }
488+ x: spreadView.width
441489
442490 property real behavioredZIndex: zIndex
443491 Behavior on behavioredZIndex {
@@ -458,7 +506,7 @@ Item {
458506 }
459507
460508 progress: {
461− var tileProgress = (spreadView.contentX - behavioredZIndex * spreadView.tileDistance) / spreadView.width;
509+ var tileProgress = (spreadView.shiftedContentX - behavioredZIndex * spreadView.tileDistance) / spreadView.width;
462510 // Some tiles (nextInStack, active) need to move directly from the beginning, normalize progress to immediately start at 0
463511 if ((index == spreadView.nextInStack && spreadView.phase < 2) || (active && spreadView.phase < 1)) {
464512 tileProgress += behavioredZIndex * spreadView.tileDistance / spreadView.width;
@@ -481,11 +529,7 @@ Item {
481529
482530 onClicked: {
483531 if (spreadView.phase == 2) {
484− if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
485− spreadView.snapTo(index);
486− } else {
487− ApplicationManager.requestFocusApplication(ApplicationManager.get(index).appId);
488− }
532+ spreadView.snapTo(index);
489533 }
490534 }
491535
@@ -518,12 +562,12 @@ Item {
518562 onTouchXChanged: {
519563 if (!dragging) {
520564 spreadView.phase = 0;
521− spreadView.contentX = 0;
565+ spreadView.contentX = -spreadView.shift;
522566 }
523567
524− if (attachedToView) {
525− spreadView.contentX = -touchX + spreadDragArea.width;
526− if (spreadView.contentX > spreadView.phase0Width + spreadView.phase1Width / 2) {
568+ if (dragging && attachedToView) {
569+ spreadView.contentX = -touchX + spreadDragArea.width - spreadView.shift;
570+ if (spreadView.shiftedContentX > spreadView.phase0Width + spreadView.phase1Width / 2) {
527571 attachedToView = false;
528572 spreadView.snap();
529573 }
@@ -548,14 +592,14 @@ Item {
548592 var oneWayFlick = priv.evaluateOneWayFlick(gesturePoints);
549593 gesturePoints = [];
550594
551− if (oneWayFlick && spreadView.contentX < spreadView.positionMarker1 * spreadView.width) {
595+ if (oneWayFlick && spreadView.shiftedContentX < spreadView.positionMarker1 * spreadView.width) {
552596 // If it was a short one-way movement, do the Alt+Tab switch
553597 // no matter if we didn't cross positionMarker1 yet.
554598 spreadView.snapTo(spreadView.nextInStack);
555599 } else if (!dragging && attachedToView) {
556− if (spreadView.contentX < spreadView.width * spreadView.positionMarker1) {
600+ if (spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker1) {
557601 spreadView.snap();
558− } else if (spreadView.contentX < spreadView.width * spreadView.positionMarker2) {
602+ } else if (spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker2) {
559603 spreadView.snapTo(spreadView.nextInStack);
560604 } else {
561605 // otherwise snap to the closest snap position we can find
qml/Stages/TransformedSpreadDelegate.qml+6−5
@@ -46,9 +46,6 @@ SpreadDelegate {
4646 property real startDistance: units.gu(5)
4747 property real endDistance: units.gu(.5)
4848
49− // Hiding tiles when their progress is negative or reached the maximum
50− visible: progress >= 0 && progress < 1.7
51−
5249 onSelectedChanged: {
5350 if (selected) {
5451 priv.snapshot();
@@ -132,6 +129,10 @@ SpreadDelegate {
132129 // the selected tile, which is animated from the snapshotted position to be fullscreen.
133130
134131 readonly property real xTranslate: {
132+ if (!spreadView.active) {
133+ return 0;
134+ }
135+
135136 if (otherSelected) {
136137 if (spreadView.phase < 2 && index == 0) {
137138 return linearAnimation(selectedProgress, 0, selectedXTranslate,
@@ -183,7 +184,7 @@ SpreadDelegate {
183184 }
184185
185186 readonly property real angle: {
186− if (spreadView.focusChanging) {
187+ if (!spreadView.active) {
187188 return 0;
188189 }
189190
@@ -216,7 +217,7 @@ SpreadDelegate {
216217 }
217218
218219 readonly property real scale: {
219− if (spreadView.focusChanging) {
220+ if (!spreadView.active) {
220221 return 1;
221222 }
222223 if (priv.otherSelected) {
qml/Stages/TransformedTabletSpreadDelegate.qml+28
@@ -47,6 +47,11 @@ SpreadDelegate {
4747
4848 property bool isInSideStage: false
4949
50+ property int dragOffset: 0
51+
52+ dropShadow: spreadView.active ||
53+ (active && model.stage == ApplicationInfoInterface.MainStage && priv.xTranslate != 0)
54+
5055 onSelectedChanged: {
5156 if (selected) {
5257 priv.snapshot();
@@ -129,6 +134,16 @@ SpreadDelegate {
129134 return helperEasingCurve.value * (endValue - startValue) + startValue;
130135 }
131136
137+ Behavior on xTranslate {
138+ enabled: !spreadView.active &&
139+ !snapAnimation.running &&
140+ model.appId !== "unity8-dash" &&
141+ !spreadView.sideStageDragging
142+ UbuntuNumberAnimation {
143+ duration: UbuntuAnimation.FastDuration
144+ }
145+ }
146+
132147 property real xTranslate: {
133148 var newTranslate = 0;
134149
@@ -155,7 +170,12 @@ SpreadDelegate {
155170 if (spreadView.phase == 0 && shouldMoveAway) {
156171 newTranslate += linearAnimation(0, spreadView.positionMarker2, 0, -units.gu(4), root.animatedProgress);
157172 }
173+ newTranslate += root.dragOffset;
174+ }
175+ if (!spreadView.active && model.appId == "unity8-dash" && !root.active) {
176+ newTranslate -= root.width;
158177 }
178+
159179 if (nextInStack && spreadView.phase == 0) {
160180 if (model.stage == ApplicationInfoInterface.MainStage) {
161181 if (spreadView.sideStageVisible && root.progress > 0) {
@@ -205,6 +225,10 @@ SpreadDelegate {
205225 }
206226
207227 property real scale: {
228+ if (!spreadView.active) {
229+ return 1;
230+ }
231+
208232 if (otherSelected) {
209233 return selectedScale;
210234 }
@@ -249,6 +273,10 @@ SpreadDelegate {
249273 }
250274
251275 property real angle: {
276+ if (!spreadView.active) {
277+ return 0;
278+ }
279+
252280 if (otherSelected) {
253281 return selectedAngle;
254282 }
run.sh+15−6
@@ -8,6 +8,7 @@ GDB=false
88FAKE=false
99PINLOCK=false
1010KEYLOCK=false
11+USE_MOCKS=false
1112MOUSE_TOUCH=true
1213
1314usage() {
@@ -31,9 +32,9 @@ eval set -- "$ARGS"
3132while [ $# -gt 0 ]
3233do
3334 case "$1" in
34− -f|--fake) FAKE=true;;
35− -p|--pinlock) PINLOCK=true;;
36− -k|--keylock) KEYLOCK=true;;
35+ -f|--fake) FAKE=true; USE_MOCKS=true;;
36+ -p|--pinlock) PINLOCK=true; USE_MOCKS=true;;
37+ -k|--keylock) KEYLOCK=true; USE_MOCKS=true;;
3738 -g|--gdb) GDB=true;;
3839 -h|--help) usage;;
3940 -m|--nomousetouch) MOUSE_TOUCH=false;;
@@ -43,20 +44,28 @@ do
4344done
4445
4546if $FAKE; then
46− export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
4747 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single
4848fi
4949
5050if $PINLOCK; then
51− export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
5251 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-pin
5352fi
5453
5554if $KEYLOCK; then
56− export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
5755 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-passphrase
5856fi
5957
58+if $USE_MOCKS; then
59+ rm -f $PWD/builddir/nonmirplugins/LightDM # undo symlink (from below) for cleanliness
60+ export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
61+else
62+ # Still fake no-login user for convenience (it's annoying to be prompted for your password when testing)
63+ # And in particular, just link our LightDM mock into the nonmirplugins folder. We don't want the rest of
64+ # our plugins to be used.
65+ ln -s $PWD/builddir/tests/mocks/LightDM $PWD/builddir/nonmirplugins/
66+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/single
67+fi
68+
6069QML_PHONE_SHELL_ARGS=""
6170if $MOUSE_TOUCH; then
6271 QML_PHONE_SHELL_ARGS="$QML_PHONE_SHELL_ARGS -mousetouch"
src/CMakeLists.txt+1
@@ -35,3 +35,4 @@ install(TARGETS ${SHELL_APP}
3535 )
3636
3737add_subdirectory(Panel)
38+add_subdirectory(Dash)
src/Dash/CMakeLists.txtnew file+12
@@ -0,0 +1,12 @@
1+set(DASH_SRCS
2+ main.cpp
3+)
4+
5+add_executable(unity8-dash ${DASH_SRCS})
6+
7+qt5_use_modules(unity8-dash Gui Qml Quick Test)
8+
9+# install binaries
10+install(TARGETS ${DASH_APP}
11+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
12+)
src/Dash/main.cppnew file+74
@@ -0,0 +1,74 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * Authors:
5+ * Michael Zanetti <michael.zanetti@canonical.com>
6+ *
7+ * This program is free software; you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License as published by
9+ * the Free Software Foundation; version 3.
10+ *
11+ * This program is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU General Public License
17+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+ */
19+
20+#include <QtQuick/QQuickView>
21+#include <QtGui/QGuiApplication>
22+#include <QtQml/QQmlEngine>
23+#include <QtQml/QQmlContext>
24+#include <QDebug>
25+#include <QCommandLineParser>
26+#include <QLibrary>
27+
28+#include <paths.h>
29+
30+int main(int argc, const char *argv[])
31+{
32+ QGuiApplication *application = new QGuiApplication(argc, (char**)argv);
33+
34+ QCommandLineParser parser;
35+ parser.setApplicationDescription("Description: Unity 8 Shell Dash");
36+ parser.addHelpOption();
37+
38+ QCommandLineOption testabilityOption("testability",
39+ "Load the testability driver (Alternatively export QT_LOAD_TESTABILITY");
40+ parser.addOption(testabilityOption);
41+
42+ if (parser.isSet(testabilityOption) || getenv("QT_LOAD_TESTABILITY")) {
43+ QLibrary testLib(QLatin1String("qttestability"));
44+ if (testLib.load()) {
45+ typedef void (*TasInitialize)(void);
46+ TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
47+ if (initFunction) {
48+ initFunction();
49+ } else {
50+ qCritical("Library qttestability resolve failed!");
51+ }
52+ } else {
53+ qCritical("Library qttestability load failed!");
54+ }
55+ }
56+
57+ QQuickView* view = new QQuickView();
58+ view->setResizeMode(QQuickView::SizeRootObjectToView);
59+ view->setTitle("Unity Dash");
60+
61+ QUrl source(::qmlDirectory()+"Dash/DashApplication.qml");
62+ prependImportPaths(view->engine(), ::overrideImportPaths());
63+ appendImportPaths(view->engine(), ::fallbackImportPaths());
64+
65+ view->setSource(source);
66+ view->show();
67+
68+ int result = application->exec();
69+
70+ delete view;
71+ delete application;
72+
73+ return result;
74+}
src/main.cpp+7
@@ -25,6 +25,7 @@
2525#include <QtQml/QQmlContext>
2626#include <QLibrary>
2727#include <QDebug>
28+#include <csignal>
2829#include <libintl.h>
2930
3031// local
@@ -140,6 +141,12 @@ Load the testability driver");
140141 view->setSource(source);
141142 QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));
142143
144+ if (!isMirServer && qEnvironmentVariableIsSet("UNITY_MIR_EMITS_SIGSTOP")) {
145+ // Emit SIGSTOP as expected by upstart, under Mir it's qtmir that will raise it.
146+ // see http://upstart.ubuntu.com/cookbook/#expect-stop
147+ raise(SIGSTOP);
148+ }
149+
143150 if (isMirServer || parser.isSet(fullscreenOption)) {
144151 view->showFullScreen();
145152 } else {
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+1−1
@@ -106,7 +106,7 @@ class ApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
106106 self.assert_current_focused_application(application_name)
107107
108108 self.main_window.show_dash_swiping()
109− self.assert_current_focused_application('')
109+ self.assert_current_focused_application('unity8-dash')
110110
111111 process_helpers.lock_unity()
112112 greeter = self.main_window.get_greeter()
tests/autopilot/unity8/application_lifecycle/tests/test_url_dispatcher.py+3−2
@@ -39,7 +39,8 @@ class URLDispatcherTestCase(tests.ApplicationLifeCycleTestCase):
3939 desktop_file_name = os.path.basename(desktop_file_path)
4040 application_name, _ = os.path.splitext(desktop_file_name)
4141
42− self.assertEqual('', self.main_window.get_current_focused_app_id())
42+ self.assertEqual(
43+ 'unity8-dash', self.main_window.get_current_focused_app_id())
4344 self.addCleanup(os.system, 'pkill qmlscene')
4445
4546 subprocess.check_call(
@@ -47,4 +48,4 @@ class URLDispatcherTestCase(tests.ApplicationLifeCycleTestCase):
4748 self.assert_current_focused_application(application_name)
4849
4950 self.main_window.show_dash_swiping()
50− self.assert_current_focused_application('')
51+ self.assert_current_focused_application('unity8-dash')
tests/autopilot/unity8/fixture_setup.pynew file+64
@@ -0,0 +1,64 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity Autopilot Test Suite
4+# Copyright (C) 2014 Canonical
5+#
6+# This program is free software: you can redistribute it and/or modify
7+# it under the terms of the GNU General Public License as published by
8+# the Free Software Foundation, either version 3 of the License, or
9+# (at your option) any later version.
10+#
11+# This program is distributed in the hope that it will be useful,
12+# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+# GNU General Public License for more details.
15+#
16+# You should have received a copy of the GNU General Public License
17+# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+#
19+
20+import fixtures
21+from autopilot import introspection
22+
23+from unity8 import process_helpers
24+from unity8.shell import emulators
25+
26+
27+class LaunchDashApp(fixtures.Fixture):
28+
29+ """Fixture to launch the Dash app."""
30+
31+ def __init__(self, binary_path, variables):
32+ """Initialize an instance.
33+
34+ :param str binary_path: The path to the Dash app binary.
35+ :param variables: The variables to use when launching the app.
36+ :type variables: A dictionary.
37+
38+ """
39+ super(LaunchDashApp, self).__init__()
40+ self.binary_path = binary_path
41+ self.variables = variables
42+
43+ def setUp(self):
44+ """Launch the dash app when the fixture is used."""
45+ super(LaunchDashApp, self).setUp()
46+ self.addCleanup(self.stop_application)
47+ self.application_proxy = self.launch_application()
48+
49+ def launch_application(self):
50+ binary_arg = 'BINARY={}'.format(self.binary_path)
51+ testability_arg = 'QT_LOAD_TESTABILITY={}'.format(1)
52+ env_args = [
53+ '{}={}'.format(key, value) for key, value in self.variables.items()
54+ ]
55+ all_args = [binary_arg, testability_arg] + env_args
56+
57+ pid = process_helpers.start_job('unity8-dash', *all_args)
58+ return introspection.get_proxy_object_for_existing_process(
59+ pid=pid,
60+ emulator_base=emulators.UnityEmulatorBase,
61+ )
62+
63+ def stop_application(self):
64+ process_helpers.stop_job('unity8-dash')
tests/autopilot/unity8/process_helpers.py+89−20
@@ -36,6 +36,10 @@ from unity8.shell.emulators import main_window as main_window_emulator
3636logger = logging.getLogger(__name__)
3737
3838
39+class JobError(Exception):
40+ pass
41+
42+
3943class CannotAccessUnity(Exception):
4044 pass
4145
@@ -134,48 +138,113 @@ def restart_unity(*args):
134138 """
135139 status = _get_unity_status()
136140 if "start/" in status:
137− try:
138− output = subprocess.check_output(
139− ['/sbin/initctl', 'stop', 'unity8'])
140− logger.info(output)
141− except subprocess.CalledProcessError as e:
142− e.args += (
143− "Failed to stop running instance of unity8: %s" % e.output,
144− )
145− raise
141+ stop_job('unity8')
142+
143+ pid = start_job('unity8', *args)
144+ return _get_unity_proxy_object(pid)
146145
146+
147+def start_job(name, *args):
148+ """Start a job.
149+
150+ :param str name: The name of the job.
151+ :param args: The arguments to be used when starting the job.
152+ :return: The process id of the started job.
153+ :raises CalledProcessError: if the job failed to start.
154+
155+ """
156+ logger.info('Starting job {} with arguments {}.'.format(name, args))
157+ command = ['/sbin/initctl', 'start', name] + list(args)
147158 try:
148− command = ['/sbin/initctl', 'start', 'unity8'] + list(args)
149159 output = subprocess.check_output(
150160 command,
151161 stderr=subprocess.STDOUT,
152162 universal_newlines=True,
153163 )
154164 logger.info(output)
155− pid = _get_unity_pid()
165+ pid = get_job_pid(name)
156166 except subprocess.CalledProcessError as e:
157− e.args += ("Failed to start unity8: %s" % e.output,)
167+ e.args += ('Failed to start {}: {}.'.format(name, e.output),)
158168 raise
159169 else:
160− return _get_unity_proxy_object(pid)
170+ return pid
161171
162172
163−def _get_unity_status():
173+def get_job_pid(name):
174+ """Return the process id of a running job.
175+
176+ :param str name: The name of the job.
177+ :raises JobError: if the job is not running.
178+
179+ """
180+ status = get_job_status(name)
181+ if "start/" not in status:
182+ raise JobError('{} is not in the running state.'.format(name))
183+ return int(status.split()[-1])
184+
185+
186+def get_job_status(name):
187+ """Return the status of a job.
188+
189+ :param str name: The name of the job.
190+ :raises JobError: if it's not possible to get the status of the job.
191+
192+ """
164193 try:
165194 return subprocess.check_output([
166195 '/sbin/initctl',
167196 'status',
168− 'unity8'
197+ name
169198 ], universal_newlines=True)
199+ except subprocess.CalledProcessError as error:
200+ raise JobError(
201+ "Unable to get {}'s status: {}".format(name, error)
202+ )
203+
204+
205+def stop_job(name):
206+ """Stop a job.
207+
208+ :param str name: The name of the job.
209+ :raises CalledProcessError: if the job failed to stop.
210+
211+ """
212+ logger.info('Stoping job {}.'.format(name))
213+ command = ['/sbin/initctl', 'stop', name]
214+ try:
215+ output = subprocess.check_output(
216+ command,
217+ stderr=subprocess.STDOUT,
218+ universal_newlines=True,
219+ )
220+ logger.info(output)
170221 except subprocess.CalledProcessError as e:
171− raise CannotAccessUnity("Unable to get unity's status: %s" % str(e))
222+ e.args += ('Failed to stop {}: {}.'.format(name, e.output),)
223+ raise
224+
225+
226+def is_job_running(name):
227+ """Return True if the job is running. Otherwise, False.
228+
229+ :param str name: The name of the job.
230+ :raises JobError: if it's not possible to get the status of the job.
231+
232+ """
233+ return 'start/' in get_job_status(name)
234+
235+
236+def _get_unity_status():
237+ try:
238+ return get_job_status('unity8')
239+ except JobError as error:
240+ raise CannotAccessUnity(str(error))
172241
173242
174243def _get_unity_pid():
175− status = _get_unity_status()
176− if "start/" not in status:
177− raise CannotAccessUnity("Unity is not in the running state.")
178− return int(status.split()[-1])
244+ try:
245+ return get_job_pid('unity8')
246+ except JobError as error:
247+ raise CannotAccessUnity(str(error))
179248
180249
181250def _get_unity_proxy_object(pid):
tests/autopilot/unity8/shell/emulators/dash.py+21−12
@@ -31,6 +31,17 @@ from ubuntuuitoolkit import emulators as toolkit_emulators
3131logger = logging.getLogger(__name__)
3232
3333
34+class DashApp(object):
35+
36+ """Autopilot helper for the Dash app."""
37+
38+ def __init__(self, app_proxy):
39+ self.app_proxy = app_proxy
40+ self.main_view = self.app_proxy.select_single(
41+ toolkit_emulators.MainView)
42+ self.dash = self.main_view.select_single(Dash)
43+
44+
3445class Dash(emulators.UnityEmulatorBase):
3546 """An emulator that understands the Dash."""
3647
@@ -109,20 +120,22 @@ class Dash(emulators.UnityEmulatorBase):
109120 @autopilot_logging.log_action(logger.info)
110121 def _scroll_to_left_scope(self):
111122 original_index = self.dash_content_list.currentIndex
112− dashContent = self.select_single(objectName="dashContent")
113− start_x = dashContent.width / 3
114− stop_x = dashContent.width / 3 * 2
115− start_y = stop_y = dashContent.globalRect.y + 1
123+ dash_content = self.select_single(objectName="dashContent")
124+ x, y, width, height = dash_content.globalRect
125+ start_x = x + width / 3
126+ stop_x = x + width / 3 * 2
127+ start_y = stop_y = y + 1
116128 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
117129 self.dash_content_list.currentIndex.wait_for(original_index - 1)
118130
119131 @autopilot_logging.log_action(logger.info)
120132 def _scroll_to_right_scope(self):
121133 original_index = self.dash_content_list.currentIndex
122− dashContent = self.select_single(objectName="dashContent")
123− start_x = dashContent.width / 3 * 2
124− stop_x = dashContent.width / 3
125− start_y = stop_y = dashContent.globalRect.y + 1
134+ dash_content = self.select_single(objectName="dashContent")
135+ x, y, width, height = dash_content.globalRect
136+ start_x = x + width / 3 * 2
137+ stop_x = x + width / 3
138+ start_y = stop_y = y + 1
126139 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
127140 self.dash_content_list.currentIndex.wait_for(original_index + 1)
128141
@@ -188,10 +201,6 @@ class GenericScopeView(emulators.UnityEmulatorBase):
188201 raise emulators.UnityEmulatorException(
189202 'No category found with name {}'.format(category))
190203
191−
192−class DashApps(GenericScopeView):
193− """Autopilot emulator for the applications scope."""
194−
195204 def get_applications(self, category):
196205 """Return the list of applications on a category.
197206
tests/autopilot/unity8/shell/emulators/greeter.py+4−1
@@ -17,6 +17,8 @@
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818#
1919
20+import ubuntuuitoolkit
21+
2022from unity8.shell.emulators import UnityEmulatorBase
2123
2224
@@ -37,4 +39,5 @@ class Greeter(UnityEmulatorBase):
3739 self.created.wait_for(False)
3840
3941 def get_prompt(self):
40− return self.select_single("TextField", objectName="passwordInput")
42+ return self.select_single(
43+ ubuntuuitoolkit.TextField, objectName='passwordInput')
tests/autopilot/unity8/shell/emulators/main_window.py+34−20
@@ -25,7 +25,6 @@ from autopilot import input
2525from unity8.shell import emulators
2626from unity8.shell.emulators.greeter import Greeter
2727from unity8.shell.emulators.hud import Hud
28−from unity8.shell.emulators.dash import Dash
2928from unity8.shell.emulators.launcher import Launcher
3029
3130logger = logging.getLogger(__name__)
@@ -61,9 +60,6 @@ class QQuickView(emulators.UnityEmulatorBase):
6160 def get_hud_edge_drag_area(self):
6261 return self.select_single(objectName="hudDragArea")
6362
64− def get_dash(self):
65− return self.select_single(Dash)
66−
6763 def get_bottombar(self):
6864 return self.select_single("Bottombar")
6965
@@ -76,12 +72,6 @@ class QQuickView(emulators.UnityEmulatorBase):
7672 objectName="pinPadLoader"
7773 )
7874
79− def get_pinPadButton(self, buttonId):
80− return self.select_single(
81− "PinPadButton",
82− objectName="pinPadButton%i" % buttonId
83− )
84−
8575 def get_lockscreen(self):
8676 return self.select_single("Lockscreen")
8777
@@ -117,20 +107,44 @@ class QQuickView(emulators.UnityEmulatorBase):
117107 @autopilot_logging.log_action(logger.info)
118108 def show_dash_swiping(self):
119109 """Show the dash swiping from the left."""
120− width = self.width
121− height = self.height
122− start_x = 0
123− start_y = height // 2
124− end_x = width
125− end_y = start_y
110+ x, y, width, height = self._get_shell().globalRect
111+ start_x = x
112+ end_x = x + width
113+ start_y = end_y = y + height // 2
126114
127115 self.pointing_device.drag(start_x, start_y, end_x, end_y)
128− return self.get_dash()
116+
117+ def _get_shell(self):
118+ return self.select_single('Shell')
129119
130120 def get_current_focused_app_id(self):
131121 """Return the id of the focused application."""
132− return self.select_single('Shell').focusedApplicationId
122+ return self._get_shell().focusedApplicationId
133123
134124 @autopilot_logging.log_action(logger.info)
135− def search(self, query):
136− self.get_dash().enter_search_query(query)
125+ def enter_pin_code(self, code):
126+ """Enter code 'code' into the single-pin lightdm pincode entry screen.
127+
128+ :param code: must be a string of numeric characters.
129+ :raises: TypeError if code is not a string.
130+ :raises: ValueError if code contains non-numeric characters.
131+
132+ """
133+ if not isinstance(code, str):
134+ raise TypeError(
135+ "'code' parameter must be a string, not %r."
136+ % type(code)
137+ )
138+ for num in code:
139+ if not num.isdigit():
140+ raise ValueError(
141+ "'code' parameter contains non-numeric characters."
142+ )
143+ self.pointing_device.click_object(
144+ self._get_pinpad_button(int(num)))
145+
146+ def _get_pinpad_button(self, button_id):
147+ return self.select_single(
148+ 'PinPadButton',
149+ objectName='pinPadButton{}'.format(button_id)
150+ )
tests/autopilot/unity8/shell/tests/__init__.py+141−48
@@ -24,6 +24,7 @@ try:
2424except ImportError:
2525 Gio = None
2626
27+from autopilot import introspection
2728from autopilot.platform import model
2829from autopilot.testcase import AutopilotTestCase
2930from autopilot.matchers import Eventually
@@ -34,6 +35,10 @@ import os.path
3435import subprocess
3536import sys
3637from testtools.matchers import Equals
38+from ubuntuuitoolkit import (
39+ fixture_setup as toolkit_fixtures,
40+ ubuntu_scenarios
41+)
3742
3843from unity8 import (
3944 get_lib_path,
@@ -42,9 +47,15 @@ from unity8 import (
4247 get_default_extra_mock_libraries,
4348 get_data_dirs
4449)
45−from unity8.process_helpers import restart_unity_with_testability
46−from unity8.shell.emulators import main_window as main_window_emulator
47−from unity8.shell.emulators.dash import Dash
50+from unity8 import (
51+ fixture_setup,
52+ process_helpers
53+)
54+from unity8.shell import emulators
55+from unity8.shell.emulators import (
56+ dash as dash_helpers,
57+ main_window as main_window_emulator,
58+)
4859
4960
5061logger = logging.getLogger(__name__)
@@ -78,6 +89,26 @@ def _get_device_emulation_scenarios(devices='All'):
7889 return [native]
7990
8091
92+def is_unity7_running():
93+ """Return True if Unity7 is running. Otherwise, return False."""
94+ return (
95+ Gio is not None and
96+ UNITYSHELL_GSETTINGS_SCHEMA in
97+ Gio.Settings.list_relocatable_schemas()
98+ )
99+
100+
101+def get_qml_import_path_with_mock():
102+ """Return the QML2_IMPORT_PATH value with the mock path prepended."""
103+ qml_import_path = [get_mocks_library_path()]
104+ if os.getenv('QML2_IMPORT_PATH') is not None:
105+ qml_import_path.append(os.getenv('QML2_IMPORT_PATH'))
106+
107+ qml_import_path = ':'.join(qml_import_path)
108+ logger.info("New QML2 import path: %s", qml_import_path)
109+ return qml_import_path
110+
111+
81112class UnityTestCase(AutopilotTestCase):
82113
83114 """A test case base class for the Unity shell tests."""
@@ -118,23 +149,8 @@ class UnityTestCase(AutopilotTestCase):
118149
119150 def setUp(self):
120151 super(UnityTestCase, self).setUp()
121− if (Gio is not None and
122− UNITYSHELL_GSETTINGS_SCHEMA in
123− Gio.Settings.list_relocatable_schemas()):
124−
125− # Hide Unity launcher
126− self._unityshell_schema = Gio.Settings.new_with_path(
127− UNITYSHELL_GSETTINGS_SCHEMA,
128− UNITYSHELL_GSETTINGS_PATH,
129− )
130− self._launcher_hide_mode = self._unityshell_schema.get_int(
131− UNITYSHELL_LAUNCHER_KEY,
132− )
133− self._unityshell_schema.set_int(
134− UNITYSHELL_LAUNCHER_KEY,
135− UNITYSHELL_LAUNCHER_MODE,
136− )
137− self.addCleanup(self._reset_launcher)
152+ if is_unity7_running():
153+ self.useFixture(toolkit_fixtures.HideUnity7Launcher())
138154
139155 self._proxy = None
140156 self._lightdm_mock_type = None
@@ -151,13 +167,6 @@ class UnityTestCase(AutopilotTestCase):
151167 self.touch = Touch.create()
152168 self._setup_display_details()
153169
154− def _reset_launcher(self):
155− """Reset Unity launcher hide mode"""
156− self._unityshell_schema.set_int(
157− UNITYSHELL_LAUNCHER_KEY,
158− self._launcher_hide_mode,
159− )
160−
161170 def _setup_display_details(self):
162171 scale_divisor = self._determine_geometry()
163172 self._setup_grid_size(scale_divisor)
@@ -263,7 +272,9 @@ class UnityTestCase(AutopilotTestCase):
263272 self.patch_lightdm_mock()
264273
265274 if self._qml_mock_enabled:
266− self._setup_extra_mock_environment_patch()
275+ self._environment['QML2_IMPORT_PATH'] = (
276+ get_qml_import_path_with_mock()
277+ )
267278
268279 if self._data_dirs_mock_enabled:
269280 self._patch_data_dirs()
@@ -292,9 +303,14 @@ class UnityTestCase(AutopilotTestCase):
292303
293304 # Ensure that the dash is visible before we return:
294305 logger.debug("Unity started, waiting for it to be ready.")
295− self.assertUnityReady()
306+ self.wait_for_unity()
296307 logger.debug("Unity loaded and ready.")
297308
309+ if model() == 'Desktop':
310+ # On desktop, close the dash because it's opened in a separate
311+ # window and it gets in the way.
312+ process_helpers.stop_job('unity8-dash')
313+
298314 return app_proxy
299315
300316 def _launch_unity_with_upstart(self, binary_path, args):
@@ -308,7 +324,7 @@ class UnityTestCase(AutopilotTestCase):
308324
309325 self.addCleanup(self._cleanup_launching_upstart_unity)
310326
311− return restart_unity_with_testability(*all_args)
327+ return process_helpers.restart_unity_with_testability(*all_args)
312328
313329 def _cleanup_launching_upstart_unity(self):
314330 logger.info("Stopping unity")
@@ -353,15 +369,6 @@ class UnityTestCase(AutopilotTestCase):
353369 )
354370 return lightdm_mock_path
355371
356− def _setup_extra_mock_environment_patch(self):
357− qml_import_path = [get_mocks_library_path()]
358− if os.getenv('QML2_IMPORT_PATH') is not None:
359− qml_import_path.append(os.getenv('QML2_IMPORT_PATH'))
360−
361− qml_import_path = ':'.join(qml_import_path)
362− logger.info("New QML2 import path: %s", qml_import_path)
363− self._environment['QML2_IMPORT_PATH'] = qml_import_path
364−
365372 def _set_proxy(self, proxy):
366373 """Keep a copy of the proxy object, so we can use it to get common
367374 parts of the shell later on.
@@ -373,10 +380,80 @@ class UnityTestCase(AutopilotTestCase):
373380 def _clear_proxy(self):
374381 self._proxy = None
375382
376− def assertUnityReady(self):
377− dash = self.get_dash()
378− home_scope = dash.get_scope('clickscope')
383+ def wait_for_unity(self):
384+ greeter_content_loader = self.main_window.wait_select_single(
385+ objectName='greeterContentLoader')
386+ greeter_content_loader.progress.wait_for(1)
387+
388+ def get_dash(self):
389+ pid = process_helpers.get_job_pid('unity8-dash')
390+ dash_proxy = introspection.get_proxy_object_for_existing_process(
391+ pid=pid,
392+ emulator_base=emulators.UnityEmulatorBase,
393+ )
394+ dash_app = dash_helpers.DashApp(dash_proxy)
395+ return dash_app.dash
396+
397+ @property
398+ def main_window(self):
399+ return self._proxy.select_single(main_window_emulator.QQuickView)
379400
401+
402+class DashBaseTestCase(AutopilotTestCase):
403+
404+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
405+ qml_mock_enabled = True
406+ environment = {}
407+
408+ def setUp(self):
409+ super(DashBaseTestCase, self).setUp()
410+
411+ if is_unity7_running():
412+ self.useFixture(toolkit_fixtures.HideUnity7Launcher())
413+
414+ if model() != 'Desktop':
415+ # On the phone, we need unity to be running and unlocked.
416+ self.addCleanup(process_helpers.stop_job, 'unity8')
417+ process_helpers.restart_unity_with_testability()
418+ process_helpers.unlock_unity()
419+
420+ self.ensure_dash_not_running()
421+
422+ if self.qml_mock_enabled:
423+ self.environment['QML2_IMPORT_PATH'] = (
424+ get_qml_import_path_with_mock()
425+ )
426+
427+ if self.should_simulate_device():
428+ # This sets the grid units, so it should be called before launching
429+ # the app.
430+ self.simulate_device()
431+
432+ binary_path = get_binary_path('unity8-dash')
433+ dash_proxy = self.launch_dash(binary_path, self.environment)
434+
435+ if self.should_simulate_device():
436+ # XXX Currently we have no way to launch the application with a
437+ # specific size, so we must resize it after it's launched.
438+ # --elopio - 2014-06-25
439+ self.resize_window()
440+
441+ self.dash_app = dash_helpers.DashApp(dash_proxy)
442+ self.dash = self.dash_app.dash
443+ self.wait_for_dash()
444+
445+ def ensure_dash_not_running(self):
446+ if process_helpers.is_job_running('unity8-dash'):
447+ process_helpers.stop_job('unity8-dash')
448+
449+ def launch_dash(self, binary_path, variables):
450+ launch_dash_app_fixture = fixture_setup.LaunchDashApp(
451+ binary_path, variables)
452+ self.useFixture(launch_dash_app_fixture)
453+ return launch_dash_app_fixture.application_proxy
454+
455+ def wait_for_dash(self):
456+ home_scope = self.dash.get_scope('clickscope')
380457 # FIXME! There is a huge timeout here for when we're doing CI on
381458 # VMs. See lp:1203715
382459 self.assertThat(
@@ -385,10 +462,26 @@ class UnityTestCase(AutopilotTestCase):
385462 )
386463 self.assertThat(home_scope.isCurrent, Eventually(Equals(True)))
387464
388− def get_dash(self):
389− dash = self._proxy.wait_select_single(Dash)
390− return dash
465+ def should_simulate_device(self):
466+ return (hasattr(self, 'app_width') and hasattr(self, 'app_height') and
467+ hasattr(self, 'grid_unit_px'))
391468
392− @property
393− def main_window(self):
394− return self._proxy.select_single(main_window_emulator.QQuickView)
469+ def simulate_device(self):
470+ simulate_device_fixture = self.useFixture(
471+ toolkit_fixtures.SimulateDevice(
472+ self.app_width, self.app_height, self.grid_unit_px))
473+ self.app_width = simulate_device_fixture.app_width
474+ self.app_height = simulate_device_fixture.app_height
475+
476+ def resize_window(self):
477+ application = self.process_manager.get_running_applications()[0]
478+ window = application.get_windows()[0]
479+ window.resize(self.app_width, self.app_height)
480+
481+ def get_window_size():
482+ _, _, window_width, window_height = window.geometry
483+ return window_width, window_height
484+
485+ self.assertThat(
486+ get_window_size,
487+ Eventually(Equals((self.app_width, self.app_height))))
tests/autopilot/unity8/shell/tests/test_emulators.py+8−19
@@ -47,24 +47,13 @@ class MainWindowTestCase(tests.UnityTestCase):
4747 unity_proxy = self.launch_unity()
4848 process_helpers.unlock_unity(unity_proxy)
4949
50− def test_search(self):
51− self.main_window.search('Test')
52− text_field = self.main_window.get_dash()._get_search_text_field()
53− self.assertEqual(text_field.text, 'Test')
5450
51+class DashEmulatorTestCase(tests.DashBaseTestCase):
5552
56−class DashBaseTestCase(tests.UnityTestCase):
57−
58− scenarios = tests._get_device_emulation_scenarios()
59−
60− def setUp(self):
61− super(DashBaseTestCase, self).setUp()
62− unity_proxy = self.launch_unity()
63− process_helpers.unlock_unity(unity_proxy)
64− self.dash = self.main_window.get_dash()
65−
66−
67−class DashEmulatorTestCase(DashBaseTestCase):
53+ def test_search(self):
54+ self.dash.enter_search_query('Test')
55+ text_field = self.dash._get_search_text_field()
56+ self.assertEqual(text_field.text, 'Test')
6857
6958 def test_open_unexisting_scope(self):
7059 scope_name = 'unexisting'
@@ -142,10 +131,10 @@ class DashEmulatorTestCase(DashBaseTestCase):
142131 scope_id = 'clickscope'
143132 scope = self.dash.open_scope(scope_id)
144133 self._assert_scope_is_opened(scope, scope_id)
145− self.assertIsInstance(scope, dash_emulators.DashApps)
134+ self.assertIsInstance(scope, dash_emulators.GenericScopeView)
146135
147136
148−class GenericScopeViewEmulatorTestCase(DashBaseTestCase):
137+class GenericScopeViewEmulatorTestCase(tests.DashBaseTestCase):
149138
150139 def setUp(self):
151140 # Set up the fake scopes before launching unity.
@@ -159,7 +148,7 @@ class GenericScopeViewEmulatorTestCase(DashBaseTestCase):
159148 self.assertTrue(preview.isCurrent)
160149
161150
162−class DashAppsEmulatorTestCase(DashBaseTestCase):
151+class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
163152
164153 available_applications = [
165154 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4',
tests/autopilot/unity8/shell/tests/test_lock_screen.py+7−47
@@ -51,7 +51,7 @@ class TestLockscreen(UnityTestCase):
5151 if greeter.narrowMode:
5252 unlock_unity(unity_proxy)
5353 lockscreen = self._wait_for_lockscreen()
54− self._enter_pincode("1234")
54+ self.main_window.enter_pin_code("1234")
5555 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
5656 else:
5757 self._enter_prompt_passphrase("1234")
@@ -81,7 +81,7 @@ class TestLockscreen(UnityTestCase):
8181 if greeter.narrowMode:
8282 unlock_unity(unity_proxy)
8383 lockscreen = self._wait_for_lockscreen()
84− self._enter_pincode("4321")
84+ self.main_window.enter_pin_code("4321")
8585 pinentryField = self.main_window.get_pinentryField()
8686 self.assertThat(pinentryField.text, Eventually(Equals("")))
8787 self.assertThat(lockscreen.shown, Eventually(Equals(True)))
@@ -118,28 +118,6 @@ class TestLockscreen(UnityTestCase):
118118 self.assertThat(lockscreen.shown, Eventually(Equals(True)))
119119 return lockscreen
120120
121− def _enter_pincode(self, code):
122− """Enter code 'code' into the single-pin lightdm pincode entry
123− screen.
124−
125− :param code: must be a string of numeric characters.
126− :raises: TypeError if code is not a string.
127− :raises: ValueError if code contains non-numeric characters.
128−
129− """
130−
131− if not isinstance(code, basestring):
132− raise TypeError(
133− "'code' parameter must be a string, not %r."
134− % type(code)
135− )
136− for num in code:
137− if not num.isdigit():
138− raise ValueError(
139− "'code' parameter contains non-numeric characters."
140− )
141− self.touch.tap_object(self.main_window.get_pinPadButton(int(num)))
142−
143121 def _enter_pin_passphrase(self, passphrase):
144122 """Enter the password specified in 'passphrase' into the password entry
145123 field of the pin lock screen.
@@ -148,18 +126,15 @@ class TestLockscreen(UnityTestCase):
148126 :raises: TypeError if passphrase is not a string.
149127
150128 """
151− if not isinstance(passphrase, basestring):
129+ if not isinstance(passphrase, str):
152130 raise TypeError(
153131 "'passphrase' parameter must be a string, not %r."
154132 % type(passphrase)
155133 )
156134
157− pinentryField = self.main_window.get_pinentryField()
158− self.touch.tap_object(pinentryField)
159− self.assertThat(pinentryField.activeFocus, Eventually(Equals(True)))
160− for character in passphrase:
161− self._type_character(character, pinentryField)
162− logger.debug("Typed passphrase: %s", pinentryField.text)
135+ pin_entry_field = self.main_window.get_pinentryField()
136+ pin_entry_field.write(passphrase)
137+ logger.debug("Typed passphrase: %s", pin_entry_field.text)
163138 self.keyboard.type("\n")
164139
165140 def _enter_prompt_passphrase(self, passphrase):
@@ -177,21 +152,6 @@ class TestLockscreen(UnityTestCase):
177152 )
178153
179154 prompt = self.main_window.get_greeter().get_prompt()
180− self.touch.tap_object(prompt)
181− self.assertThat(prompt.activeFocus, Eventually(Equals(True)))
182− for character in passphrase:
183− self._type_character(character, prompt)
155+ prompt.write(passphrase)
184156 logger.debug("Typed passphrase: %s", prompt.text)
185157 self.keyboard.type("\n")
186−
187− def _type_character(self, character, prompt, retries=5):
188− current_text = prompt.text
189− self.keyboard.type(character)
190− try:
191− self.assertThat(
192− prompt.text, Eventually(Equals(current_text + character)))
193− except AssertionError:
194− if retries > 0:
195− self._type_character(character, prompt, retries-1)
196− else:
197− raise
tests/autopilot/unity8/shell/tests/test_notifications.py+12−7
@@ -154,7 +154,7 @@ class InteractiveNotificationBase(NotificationsBase):
154154 'Notification', objectName='notification1')
155155 notification = get_notification()
156156
157− self.touch.tap_object(
157+ notification.pointing_device.click_object(
158158 notification.select_single(objectName="interactiveArea")
159159 )
160160
@@ -201,11 +201,14 @@ class InteractiveNotificationBase(NotificationsBase):
201201 'Notification', objectName='notification1')
202202 notification = get_notification()
203203 self._assert_notification(notification, summary, body, True, True, 1.0)
204− initial_height = notification.height
205− self.touch.tap_object(notification.select_single(objectName="combobutton_dropdown"))
206− self.assertThat(notification.select_single(objectName="button2").expanded, Eventually(Equals(True)))
204+ notification.pointing_device.click_object(
205+ notification.select_single(objectName="combobutton_dropdown"))
206+ self.assertThat(
207+ notification.select_single(objectName="button2").expanded,
208+ Eventually(Equals(True)))
207209 time.sleep(2)
208− self.touch.tap_object(notification.select_single(objectName="button4"))
210+ notification.pointing_device.click_object(
211+ notification.select_single(objectName="button4"))
209212 self.assert_notification_action_id_was_called("action_decline_4")
210213
211214 def test_modal_sd_without_greeter(self):
@@ -249,7 +252,8 @@ class InteractiveNotificationBase(NotificationsBase):
249252 notification = get_notification()
250253 self._assert_notification(
251254 notification, summary, body, True, False, 1.0)
252− self.touch.tap_object(notification.select_single(objectName="button0"))
255+ notification.pointing_device.click_object(
256+ notification.select_single(objectName="button0"))
253257 self.assert_notification_action_id_was_called("action_accept")
254258
255259 def test_modal_sd_with_greeter(self):
@@ -291,7 +295,8 @@ class InteractiveNotificationBase(NotificationsBase):
291295 notification = get_notification()
292296 self._assert_notification(
293297 notification, summary, body, True, False, 1.0)
294− self.touch.tap_object(notification.select_single(objectName="button0"))
298+ notification.pointing_device.click_object(
299+ notification.select_single(objectName="button0"))
295300 self.assert_notification_action_id_was_called("action_accept")
296301
297302 def _create_interactive_notification(
tests/autopilot/unity8/shell/tests/test_upstart.py+20−5
@@ -25,7 +25,8 @@ import signal
2525import subprocess
2626import time
2727
28−from testtools.matchers._basic import Equals
28+import fixtures
29+from testtools.matchers import Equals, MismatchError
2930from autopilot.matchers import Eventually
3031from autopilot.introspection import get_proxy_object_for_existing_process
3132
@@ -100,16 +101,30 @@ class UpstartIntegrationTests(UnityTestCase):
100101 emulator_base=UnityEmulatorBase,))
101102
102103 def test_no_sigstop(self):
103− self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "")
104+ self.useFixture(
105+ fixtures.EnvironmentVariable(
106+ 'UNITY_MIR_EMITS_SIGSTOP', newvalue=None))
104107 self._launch_unity()
108+
109+ try:
110+ self.assertThat(
111+ lambda: os.WIFSTOPPED(self._get_status()),
112+ Eventually(Equals(True)))
113+ except MismatchError:
114+ pass
115+ else:
116+ self.process.send_signal(signal.SIGCONT)
117+ self.fail('Unity8 raised SIGSTOP')
118+
105119 self._set_proxy()
106120
107121 logger.debug("Unity started, waiting for it to be ready.")
108− self.assertUnityReady()
122+ self.wait_for_unity()
109123 logger.debug("Unity loaded and ready.")
110124
111125 def test_expect_sigstop(self):
112− self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "1")
126+ self.useFixture(
127+ fixtures.EnvironmentVariable('UNITY_MIR_EMITS_SIGSTOP', '1'))
113128 self._launch_unity()
114129 self.assertThat(
115130 lambda: os.WIFSTOPPED(self._get_status()),
@@ -122,5 +137,5 @@ class UpstartIntegrationTests(UnityTestCase):
122137
123138 logger.debug("Unity started, waiting for it to be ready.")
124139 self._set_proxy()
125− self.assertUnityReady()
140+ self.wait_for_unity()
126141 logger.debug("Unity loaded and ready.")
tests/mocks/AccountsService/AccountsService.cpp+12−2
@@ -29,12 +29,14 @@ AccountsService::AccountsService(QObject* parent)
2929
3030QString AccountsService::user() const
3131{
32− return "testuser";
32+ return m_user;
3333}
3434
3535void AccountsService::setUser(const QString &user)
3636{
37− Q_UNUSED(user)
37+ m_user = user;
38+ Q_EMIT userChanged();
39+ Q_EMIT passwordDisplayHintChanged();
3840}
3941
4042bool AccountsService::demoEdges() const
@@ -68,3 +70,11 @@ void AccountsService::setStatsWelcomeScreen(bool statsWelcomeScreen)
6870 m_statsWelcomeScreen = statsWelcomeScreen;
6971 statsWelcomeScreenChanged();
7072}
73+
74+AccountsService::PasswordDisplayHint AccountsService::passwordDisplayHint() const
75+{
76+ if (m_user == "has-pin")
77+ return PasswordDisplayHint::Numeric;
78+ else
79+ return PasswordDisplayHint::Keyboard;
80+}
tests/mocks/AccountsService/AccountsService.h+12
@@ -27,6 +27,7 @@
2727class AccountsService: public QObject
2828{
2929 Q_OBJECT
30+ Q_ENUMS(PasswordDisplayHint)
3031 Q_PROPERTY (QString user
3132 READ user
3233 WRITE setUser
@@ -43,8 +44,16 @@ class AccountsService: public QObject
4344 READ statsWelcomeScreen
4445 WRITE setStatsWelcomeScreen // only available in mock
4546 NOTIFY statsWelcomeScreenChanged)
47+ Q_PROPERTY (PasswordDisplayHint passwordDisplayHint
48+ READ passwordDisplayHint
49+ NOTIFY passwordDisplayHintChanged)
4650
4751public:
52+ enum PasswordDisplayHint {
53+ Keyboard,
54+ Numeric,
55+ };
56+
4857 explicit AccountsService(QObject *parent = 0);
4958
5059 QString user() const;
@@ -55,15 +64,18 @@ public:
5564 void setBackgroundFile(const QString &backgroundFile);
5665 bool statsWelcomeScreen() const;
5766 void setStatsWelcomeScreen(bool statsWelcomeScreen);
67+ PasswordDisplayHint passwordDisplayHint() const;
5868
5969Q_SIGNALS:
6070 void userChanged();
6171 void demoEdgesChanged();
6272 void backgroundFileChanged();
6373 void statsWelcomeScreenChanged();
74+ void passwordDisplayHintChanged();
6475
6576private:
6677 QString m_backgroundFile;
78+ QString m_user;
6779 bool m_statsWelcomeScreen;
6880};
6981
tests/mocks/AccountsService/CMakeLists.txt+4−1
@@ -5,4 +5,7 @@ add_library(MockAccountsService-qml MODULE
55
66qt5_use_modules(MockAccountsService-qml DBus Qml)
77
8−add_unity8_mock(AccountsService 0.1 AccountsService TARGETS MockAccountsService-qml)
8+add_unity8_mock(AccountsService 0.1 AccountsService
9+ PREFIX mocks
10+ TARGETS MockAccountsService-qml
11+ )
tests/mocks/AccountsService/plugin.cpp+1
@@ -32,5 +32,6 @@ static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
3232void AccountsServicePlugin::registerTypes(const char *uri)
3333{
3434 Q_ASSERT(uri == QLatin1String("AccountsService"));
35+ qRegisterMetaType<AccountsService::PasswordDisplayHint>("AccountsService::PasswordDisplayHint");
3536 qmlRegisterSingletonType<AccountsService>(uri, 0, 1, "AccountsService", service_provider);
3637}
tests/mocks/LightDM/GreeterPrivate.h+2
@@ -24,6 +24,7 @@
2424namespace QLightDM
2525{
2626class Greeter;
27+class GreeterImpl;
2728
2829class GreeterPrivate
2930{
@@ -40,6 +41,7 @@ public:
4041 void handleRespond(const QString &response);
4142
4243protected:
44+ GreeterImpl *m_impl; // if the backend needs more private data
4345 Greeter * const q_ptr;
4446
4547private:
tests/mocks/LightDM/demo/CMakeLists.txt+4−2
@@ -11,11 +11,13 @@ set(LibLightDM_SOURCES
1111add_library(MockLightDM-demo STATIC ${LibLightDM_SOURCES})
1212
1313include_directories(
14+ ${CMAKE_CURRENT_BINARY_DIR}
1415 ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
1516)
1617
1718target_link_libraries(MockLightDM-demo
1819 ${LIBUSERMETRICSOUTPUT_LDFLAGS}
19− )
20+ -lpam
21+)
2022
21−qt5_use_modules(MockLightDM-demo Gui)
23+qt5_use_modules(MockLightDM-demo Concurrent Gui)
tests/mocks/LightDM/demo/GreeterPrivate.cpp+202−30
@@ -18,53 +18,225 @@
1818
1919#include "../Greeter.h"
2020#include "../GreeterPrivate.h"
21−#include <QtCore/QDir>
22−#include <QtCore/QSettings>
21+#include <QFuture>
22+#include <QFutureInterface>
23+#include <QFutureWatcher>
24+#include <QQueue>
25+#include <QtConcurrent>
26+#include <QVector>
27+#include <security/pam_appl.h>
2328
2429namespace QLightDM
2530{
2631
32+class GreeterImpl : public QObject
33+{
34+ Q_OBJECT
35+
36+ typedef QFutureInterface<QString> ResponseFuture;
37+
38+public:
39+ explicit GreeterImpl(Greeter *parent, GreeterPrivate *greeterPrivate)
40+ : QObject(parent),
41+ greeter(parent),
42+ greeterPrivate(greeterPrivate),
43+ pamHandle(NULL)
44+ {
45+ qRegisterMetaType<QLightDM::GreeterImpl::ResponseFuture>("QLightDM::GreeterImpl::ResponseFuture");
46+
47+ connect(&futureWatcher, SIGNAL(finished()),
48+ this, SLOT(finishPam()));
49+ connect(this, SIGNAL(showMessage(QString, QLightDM::Greeter::MessageType)),
50+ greeter, SIGNAL(showMessage(QString, QLightDM::Greeter::MessageType)));
51+ // This next connect is how we pass ResponseFutures between threads
52+ connect(this, SIGNAL(showPrompt(QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)),
53+ this, SLOT(handlePrompt(QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)));
54+ }
55+
56+ void start(QString username)
57+ {
58+ // Clear out any existing PAM interactions first (we can't simply
59+ // cancel our QFuture because QtConcurrent::run doesn't support cancel)
60+ if (pamHandle != NULL) {
61+ pam_handle *handle = pamHandle;
62+ pamHandle = NULL; // to disable normal finishPam() handling
63+ while (respond(QString())); // clear our local queue of QFutures
64+ pam_end(handle, PAM_CONV_ERR);
65+ }
66+
67+ // Now actually start a new conversation with PAM
68+ pam_conv conversation;
69+ conversation.conv = converseWithPam;
70+ conversation.appdata_ptr = static_cast<void*>(this);
71+
72+ if (pam_start("lightdm", username.toUtf8(), &conversation, &pamHandle) == PAM_SUCCESS) {
73+ futureWatcher.setFuture(QtConcurrent::run(authenticateWithPam, pamHandle));
74+ } else {
75+ greeterPrivate->authenticated = false;
76+ Q_EMIT greeter->showMessage("Internal error: could not start PAM authentication", QLightDM::Greeter::MessageTypeError);
77+ Q_EMIT greeter->authenticationComplete();
78+ }
79+ }
80+
81+ static int authenticateWithPam(pam_handle* pamHandle)
82+ {
83+ int pamStatus = pam_authenticate(pamHandle, 0);
84+ if (pamStatus == PAM_SUCCESS) {
85+ pamStatus = pam_acct_mgmt(pamHandle, 0);
86+ }
87+ if (pamStatus == PAM_NEW_AUTHTOK_REQD) {
88+ pamStatus = pam_chauthtok(pamHandle, PAM_CHANGE_EXPIRED_AUTHTOK);
89+ }
90+ if (pamStatus == PAM_SUCCESS) {
91+ pam_setcred(pamHandle, PAM_REINITIALIZE_CRED);
92+ }
93+ return pamStatus;
94+ }
95+
96+ static int converseWithPam(int num_msg, const pam_message** msg,
97+ pam_response** resp, void* appdata_ptr)
98+ {
99+ if (num_msg <= 0)
100+ return PAM_CONV_ERR;
101+
102+ auto* tmp_response = static_cast<pam_response*>(calloc(num_msg, sizeof(pam_response)));
103+ if (!tmp_response)
104+ return PAM_CONV_ERR;
105+
106+ GreeterImpl* impl = static_cast<GreeterImpl*>(appdata_ptr);
107+
108+ int count;
109+ QVector<ResponseFuture> responses;
110+
111+ for (count = 0; count < num_msg; ++count)
112+ {
113+ switch (msg[count]->msg_style)
114+ {
115+ case PAM_PROMPT_ECHO_ON:
116+ {
117+ QString message(msg[count]->msg);
118+ responses.append(ResponseFuture());
119+ responses.last().reportStarted();
120+ Q_EMIT impl->showPrompt(message, Greeter::PromptTypeQuestion, responses.last());
121+ break;
122+ }
123+ case PAM_PROMPT_ECHO_OFF:
124+ {
125+ QString message(msg[count]->msg);
126+ responses.append(ResponseFuture());
127+ responses.last().reportStarted();
128+ Q_EMIT impl->showPrompt(message, Greeter::PromptTypeSecret, responses.last());
129+ break;
130+ }
131+ case PAM_TEXT_INFO:
132+ {
133+ QString message(msg[count]->msg);
134+ Q_EMIT impl->showMessage(message, Greeter::MessageTypeInfo);
135+ break;
136+ }
137+ default:
138+ {
139+ QString message(msg[count]->msg);
140+ Q_EMIT impl->showMessage(message, Greeter::MessageTypeError);
141+ break;
142+ }
143+ }
144+ }
145+
146+ int i = 0;
147+ bool raise_error = false;
148+
149+ for (auto &response : responses)
150+ {
151+ pam_response* resp_item = &tmp_response[i++];
152+ resp_item->resp_retcode = 0;
153+ resp_item->resp = strdup(response.future().result().toUtf8());
154+
155+ if (!resp_item->resp)
156+ {
157+ raise_error = true;
158+ break;
159+ }
160+ }
161+
162+ if (raise_error)
163+ {
164+ for (int i = 0; i < count; ++i)
165+ free(tmp_response[i].resp);
166+
167+ free(tmp_response);
168+ return PAM_CONV_ERR;
169+ }
170+ else
171+ {
172+ *resp = tmp_response;
173+ return PAM_SUCCESS;
174+ }
175+ }
176+
177+public Q_SLOTS:
178+ bool respond(QString response)
179+ {
180+ if (!futures.isEmpty()) {
181+ futures.dequeue().reportFinished(&response);
182+ return true;
183+ } else {
184+ return false;
185+ }
186+ }
187+
188+Q_SIGNALS:
189+ void showMessage(QString text, QLightDM::Greeter::MessageType type);
190+ void showPrompt(QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture response);
191+
192+private Q_SLOTS:
193+ void finishPam()
194+ {
195+ if (pamHandle == NULL) {
196+ return;
197+ }
198+
199+ int pamStatus = futureWatcher.result();
200+
201+ pam_end(pamHandle, pamStatus);
202+ pamHandle = NULL;
203+
204+ greeterPrivate->authenticated = (pamStatus == PAM_SUCCESS);
205+ Q_EMIT greeter->authenticationComplete();
206+ }
207+
208+ void handlePrompt(QString text, QLightDM::Greeter::PromptType type, QLightDM::GreeterImpl::ResponseFuture future)
209+ {
210+ futures.enqueue(future);
211+ Q_EMIT greeter->showPrompt(text, type);
212+ }
213+
214+private:
215+ Greeter *greeter;
216+ GreeterPrivate *greeterPrivate;
217+ pam_handle* pamHandle;
218+ QFutureWatcher<int> futureWatcher;
219+ QQueue<ResponseFuture> futures;
220+};
221+
27222GreeterPrivate::GreeterPrivate(Greeter* parent)
28223 : authenticated(false),
29224 authenticationUser(),
225+ m_impl(new GreeterImpl(parent, this)),
30226 q_ptr(parent)
31227{
32228}
33229
34230void GreeterPrivate::handleAuthenticate()
35231{
36− Q_Q(Greeter);
37−
38− QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
39− settings.beginGroup(authenticationUser);
40− QVariant password = settings.value("password", "none");
41−
42− if (password == "pin") {
43− Q_EMIT q->showPrompt("PIN", Greeter::PromptTypeSecret);
44− } else if (password == "keyboard") {
45− Q_EMIT q->showPrompt("Password", Greeter::PromptTypeSecret);
46− } else {
47− authenticated = true;
48− Q_EMIT q->authenticationComplete();
49− }
232+ m_impl->start(authenticationUser);
50233}
51234
52235void GreeterPrivate::handleRespond(const QString &response)
53236{
54− Q_Q(Greeter);
55−
56− QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
57− settings.beginGroup(authenticationUser);
58− QVariant password = settings.value("password", "none");
59−
60− QString passwordValue;
61− if (password == "pin") {
62− passwordValue = settings.value("passwordValue", "1234").toString();
63− } else {
64− passwordValue = settings.value("passwordValue", "password").toString();
65− }
66− authenticated = (response == passwordValue);
67− Q_EMIT q->authenticationComplete();
237+ m_impl->respond(response);
68238}
69239
70240}
241+
242+#include "GreeterPrivate.moc"
tests/mocks/LightDM/demo/UsersModelPrivate.cpp+1−1
@@ -29,7 +29,7 @@ UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
2929 : q_ptr(parent)
3030{
3131 QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
32− QStringList users = settings.value("users", QStringList() << "phablet").toStringList();
32+ QStringList users = settings.value("users", QStringList() << qgetenv("USER")).toStringList();
3333
3434 Q_FOREACH(const QString &user, users)
3535 {
tests/mocks/LightDM/full/GreeterPrivate.cpp+1−1
@@ -54,7 +54,7 @@ void GreeterPrivate::handleAuthenticate()
5454 authenticated = true;
5555 Q_EMIT q->authenticationComplete();
5656 } else if (authenticationUser == "has-pin"){
57− Q_EMIT q->showPrompt("PIN", Greeter::PromptTypeSecret);
57+ Q_EMIT q->showPrompt("Password:", Greeter::PromptTypeSecret);
5858 } else if (authenticationUser == "auth-error") {
5959 authenticated = false;
6060 Q_EMIT q->authenticationComplete();
tests/mocks/LightDM/single-pin/GreeterPrivate.cpp+1−1
@@ -32,7 +32,7 @@ GreeterPrivate::GreeterPrivate(Greeter* parent)
3232void GreeterPrivate::handleAuthenticate()
3333{
3434 Q_Q(Greeter);
35− Q_EMIT q->showPrompt("PIN", Greeter::PromptTypeSecret);
35+ Q_EMIT q->showPrompt("Password:", Greeter::PromptTypeSecret);
3636}
3737
3838void GreeterPrivate::handleRespond(const QString &response)
tests/mocks/LightDM/single-pin/UsersModelPrivate.cpp+1−1
@@ -26,7 +26,7 @@ UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
2626{
2727 entries =
2828 {
29− { "single", "Has PIN", 0, 0, false, false, 0, 0 },
29+ { "has-pin", "Has PIN", 0, 0, false, false, 0, 0 },
3030 };
3131}
3232
tests/mocks/Unity/Application/ApplicationInfo.cpp−62
@@ -31,8 +31,6 @@ ApplicationInfo::ApplicationInfo(const QString &appId, QObject *parent)
3131 , m_state(Starting)
3232 , m_focused(false)
3333 , m_fullscreen(false)
34− , m_windowItem(0)
35− , m_windowComponent(0)
3634 , m_parentItem(0)
3735 , m_surface(0)
3836{
@@ -45,8 +43,6 @@ ApplicationInfo::ApplicationInfo(QObject *parent)
4543 , m_state(Starting)
4644 , m_focused(false)
4745 , m_fullscreen(false)
48− , m_windowItem(0)
49− , m_windowComponent(0)
5046 , m_parentItem(0)
5147 , m_surface(0)
5248{
@@ -61,12 +57,6 @@ ApplicationInfo::~ApplicationInfo()
6157 }
6258}
6359
64−void ApplicationInfo::onWindowComponentStatusChanged(QQmlComponent::Status status)
65−{
66− if (status == QQmlComponent::Ready && !m_windowItem)
67− doCreateWindowItem();
68−}
69−
7060void ApplicationInfo::onStateChanged(State state)
7161{
7262 if (state == ApplicationInfo::Running) {
@@ -108,55 +98,3 @@ void ApplicationInfo::setSurface(MirSurfaceItem* surface)
10898 Q_EMIT surfaceChanged(m_surface);
10999 SurfaceManager::singleton()->registerSurface(m_surface);
110100}
111−
112−void ApplicationInfo::createWindowComponent()
113−{
114− // The assumptions I make here really should hold.
115− QQuickView *quickView =
116− qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
117−
118− QQmlEngine *engine = quickView->engine();
119−
120− m_windowComponent = new QQmlComponent(engine, this);
121− m_windowComponent->setData(m_windowQml.toLatin1(), QUrl());
122−}
123−
124−void ApplicationInfo::doCreateWindowItem()
125−{
126− m_windowItem = qobject_cast<QQuickItem *>(m_windowComponent->create());
127− m_windowItem->setParentItem(m_parentItem);
128−}
129−
130−void ApplicationInfo::createWindowItem()
131−{
132− if (!m_windowComponent)
133− createWindowComponent();
134−
135− // only create the windowItem once the component is ready
136− if (!m_windowComponent->isReady()) {
137− connect(m_windowComponent, &QQmlComponent::statusChanged,
138− this, &ApplicationInfo::onWindowComponentStatusChanged);
139− } else {
140− doCreateWindowItem();
141− }
142−}
143−
144−void ApplicationInfo::showWindow(QQuickItem *parent)
145−{
146− m_parentItem = parent;
147−
148− if (!m_windowItem)
149− createWindowItem();
150−
151− if (m_windowItem) {
152− m_windowItem->setVisible(true);
153− }
154−}
155−
156−void ApplicationInfo::hideWindow()
157−{
158− if (!m_windowItem)
159− return;
160−
161− m_windowItem->setVisible(false);
162−}
tests/mocks/Unity/Application/ApplicationInfo.h−10
@@ -88,22 +88,12 @@ public:
8888Q_SIGNALS:
8989 void surfaceChanged(MirSurfaceItem*);
9090
91−public:
92− void showWindow(QQuickItem *parent);
93− void hideWindow();
94−
9591private Q_SLOTS:
96− void onWindowComponentStatusChanged(QQmlComponent::Status status);
9792 void onStateChanged(State state);
9893
9994 void createSurface();
10095
10196private:
102− void createWindowItem();
103− void doCreateWindowItem();
104− void createWindowComponent();
105− QQuickItem *m_windowItem;
106− QQmlComponent *m_windowComponent;
10797 QQuickItem *m_parentItem;
10898 MirSurfaceItem* m_surface;
10999};
tests/mocks/Unity/Application/ApplicationManager.cpp+17−147
@@ -48,16 +48,14 @@ ApplicationManager *ApplicationManager::singleton()
4848ApplicationManager::ApplicationManager(QObject *parent)
4949 : ApplicationManagerInterface(parent)
5050 , m_suspended(false)
51− , m_mainStageComponent(0)
52− , m_mainStage(0)
53− , m_sideStageComponent(0)
54− , m_sideStage(0)
55− , m_rightMargin(0)
5651{
5752 m_roleNames.insert(RoleSurface, "surface");
5853 m_roleNames.insert(RoleFullscreen, "fullscreen");
5954
6055 buildListOfAvailableApplications();
56+
57+ startApplication("unity8-dash");
58+ focusApplication("unity8-dash");
6159}
6260
6361ApplicationManager::~ApplicationManager()
@@ -136,7 +134,6 @@ void ApplicationManager::add(ApplicationInfo *application) {
136134 Q_EMIT applicationAdded(application->appId());
137135 Q_EMIT countChanged();
138136 if (count() == 1) Q_EMIT emptyChanged(isEmpty()); // was empty but not anymore
139− Q_EMIT focusRequested(application->appId());
140137
141138 connect(application, &ApplicationInfo::surfaceChanged, this, [application, this]() {
142139 QModelIndex appIndex = findIndex(application);
@@ -222,6 +219,10 @@ ApplicationInfo* ApplicationManager::startApplication(const QString &appId,
222219
223220bool ApplicationManager::stopApplication(const QString &appId)
224221{
222+ if (appId == "unity8-dash") {
223+ return false;
224+ }
225+
225226 ApplicationInfo *application = findApplication(appId);
226227 if (application == nullptr)
227228 return false;
@@ -294,39 +295,25 @@ bool ApplicationManager::focusApplication(const QString &appId)
294295 for (ApplicationInfo *app : m_runningApplications) {
295296 if (app->focused() && app->stage() == ApplicationInfo::MainStage) {
296297 app->setFocused(false);
297− app->hideWindow();
298298 app->setState(ApplicationInfo::Suspended);
299299 }
300300 }
301301
302302 // focus this app
303303 application->setFocused(true);
304− if (!m_mainStage)
305− createMainStage();
306304 application->setState(ApplicationInfo::Running);
307− application->showWindow(m_mainStage);
308− m_mainStage->setZ(-1000);
309− if (m_sideStage)
310− m_sideStage->setZ(-2000);
311305 } else if (application->stage() == ApplicationInfo::SideStage) {
312306 // unfocus currently focused sidestage app
313307 for (ApplicationInfo *app : m_runningApplications) {
314308 if (app->focused() && app->stage() == ApplicationInfo::SideStage) {
315309 app->setFocused(false);
316− app->hideWindow();
317310 app->setState(ApplicationInfo::Suspended);
318311 }
319312 }
320313
321314 // focus this app
322315 application->setFocused(true);
323− if (!m_sideStage)
324− createSideStage();
325316 application->setState(ApplicationInfo::Running);
326− application->showWindow(m_sideStage);
327− m_sideStage->setZ(-1000);
328− if (m_mainStage)
329− m_mainStage->setZ(-2000);
330317 }
331318
332319 // move app to top of stack
@@ -337,18 +324,14 @@ bool ApplicationManager::focusApplication(const QString &appId)
337324
338325bool ApplicationManager::requestFocusApplication(const QString &appId)
339326{
340− if (appId != focusedApplicationId()) {
341− QMetaObject::invokeMethod(this, "focusRequested", Qt::QueuedConnection, Q_ARG(QString, appId));
342− return true;
343− }
344− return false;
327+ QMetaObject::invokeMethod(this, "focusRequested", Qt::QueuedConnection, Q_ARG(QString, appId));
328+ return true;
345329}
346330
347331void ApplicationManager::unfocusCurrentApplication()
348332{
349333 for (ApplicationInfo *app : m_runningApplications) {
350334 if (app->focused()) {
351− app->hideWindow();
352335 app->setFocused(false);
353336 }
354337 }
@@ -357,42 +340,6 @@ void ApplicationManager::unfocusCurrentApplication()
357340
358341void ApplicationManager::generateQmlStrings(ApplicationInfo *application)
359342{
360− // TODO: Is there a better way of solving this fullscreen vs. regular
361− // application height?
362− QString topMargin;
363− if (application->fullscreen()) {
364− topMargin.append("0");
365− } else {
366− // Taken from Panel.panelHeight
367− topMargin.append("units.gu(3) + units.dp(2)");
368− }
369−
370− QString windowQml = QString(
371− "import QtQuick 2.0\n"
372− "Image {\n"
373− " anchors.fill: parent\n"
374− " anchors.topMargin: %1\n"
375− " anchors.rightMargin: %2\n"
376− " source: \"file://%3/Dash/graphics/phone/screenshots/%4.png\"\n"
377− " smooth: true\n"
378− " fillMode: Image.PreserveAspectCrop\n"
379− "}").arg(topMargin)
380− .arg(m_rightMargin)
381− .arg(qmlDirectory())
382− .arg(application->icon().toString());
383− application->setWindowQml(windowQml);
384−
385− QString imageQml = QString(
386− "import QtQuick 2.0\n"
387− "Image {\n"
388− " anchors.fill: parent\n"
389− " source: \"file://%1/Dash/graphics/phone/screenshots/%2.png\"\n"
390− " smooth: true\n"
391− " fillMode: Image.PreserveAspectCrop\n"
392− "}").arg(qmlDirectory())
393− .arg(application->icon().toString());
394− application->setImageQml(imageQml);
395−
396343 application->setScreenshot(QString("file://%1/Dash/graphics/phone/screenshots/%2@12.png").arg(qmlDirectory())
397344 .arg(application->icon().toString()));
398345}
@@ -401,6 +348,14 @@ void ApplicationManager::buildListOfAvailableApplications()
401348{
402349 ApplicationInfo *application;
403350
351+ application = new ApplicationInfo(this);
352+ application->setAppId("unity8-dash");
353+ application->setName("Unity 8 Mock Dash");
354+ application->setIcon(QUrl("unity8-dash"));
355+ application->setStage(ApplicationInfo::MainStage);
356+ generateQmlStrings(application);
357+ m_availableApplications.append(application);
358+
404359 application = new ApplicationInfo(this);
405360 application->setAppId("dialer-app");
406361 application->setName("Dialer");
@@ -521,78 +476,6 @@ void ApplicationManager::buildListOfAvailableApplications()
521476 m_availableApplications.append(application);
522477}
523478
524−void ApplicationManager::createMainStageComponent()
525−{
526− // The assumptions I make here really should hold.
527− QQuickView *quickView =
528− qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
529−
530− QQmlEngine *engine = quickView->engine();
531−
532− m_mainStageComponent = new QQmlComponent(engine, this);
533− QString mainStageQml =
534− "import QtQuick 2.0\n"
535− "Rectangle {\n"
536− " anchors.fill: parent\n"
537− " color: 'black'\n"
538− " z: -2000\n"
539− "}\n";
540− m_mainStageComponent->setData(mainStageQml.toLatin1(), QUrl());
541−}
542−
543−void ApplicationManager::createMainStage()
544−{
545− if (!m_mainStageComponent)
546− createMainStageComponent();
547−
548− // The assumptions I make here really should hold.
549− QQuickView *quickView =
550− qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
551−
552− QQuickItem *shell = quickView->rootObject();
553−
554− m_mainStage = qobject_cast<QQuickItem *>(m_mainStageComponent->create());
555− m_mainStage->setParentItem(shell);
556−}
557−
558−void ApplicationManager::createSideStageComponent()
559−{
560− // The assumptions I make here really should hold.
561− QQuickView *quickView =
562− qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
563−
564− QQmlEngine *engine = quickView->engine();
565−
566− m_sideStageComponent = new QQmlComponent(engine, this);
567− QString sideStageQml =
568− "import QtQuick 2.0\n"
569− "import Ubuntu.Components 0.1\n"
570− "Item {\n"
571− " width: units.gu(40)\n" // from SideStage in Shell.qml
572− " anchors.top: parent.top\n"
573− " anchors.bottom: parent.bottom\n"
574− " anchors.right: parent.right\n"
575− " z: -1000\n"
576− "}\n";
577− m_sideStageComponent->setData(sideStageQml.toLatin1(), QUrl());
578−}
579−
580−void ApplicationManager::createSideStage()
581−{
582− if (!m_sideStageComponent)
583− createSideStageComponent();
584−
585− // The assumptions I make here really should hold.
586− QQuickView *quickView =
587− qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
588−
589− QQuickItem *shell = quickView->rootObject();
590−
591− m_sideStage = qobject_cast<QQuickItem *>(m_sideStageComponent->create());
592− m_sideStage->setParentItem(shell);
593− m_sideStage->setFlag(QQuickItem::ItemHasContents, false);
594−}
595−
596479QStringList ApplicationManager::availableApplications()
597480{
598481 QStringList appIds;
@@ -602,19 +485,6 @@ QStringList ApplicationManager::availableApplications()
602485 return appIds;
603486}
604487
605−int ApplicationManager::rightMargin() const
606−{
607− return m_rightMargin;
608−}
609−
610−void ApplicationManager::setRightMargin(int rightMargin)
611−{
612− m_rightMargin = rightMargin;
613− Q_FOREACH(ApplicationInfo *app, m_availableApplications) {
614− generateQmlStrings(app);
615− }
616−}
617−
618488bool ApplicationManager::isEmpty() const
619489{
620490 return m_runningApplications.isEmpty();
tests/mocks/Unity/Application/ApplicationManager.h−16
@@ -44,10 +44,6 @@ class ApplicationManager : public ApplicationManagerInterface {
4444
4545 Q_PROPERTY(bool fake READ fake CONSTANT)
4646
47− // Only for testing
48− // This can be used to place some controls to right, like make tryPhoneStage for example
49− Q_PROPERTY(int rightMargin READ rightMargin WRITE setRightMargin)
50−
5147 public:
5248 ApplicationManager(QObject *parent = NULL);
5349 virtual ~ApplicationManager();
@@ -108,8 +104,6 @@ class ApplicationManager : public ApplicationManagerInterface {
108104
109105 // Only for testing
110106 Q_INVOKABLE QStringList availableApplications();
111− int rightMargin() const;
112− void setRightMargin(int rightMargin);
113107
114108 QModelIndex findIndex(ApplicationInfo* application);
115109
@@ -126,19 +120,9 @@ class ApplicationManager : public ApplicationManagerInterface {
126120 void showApplicationWindow(ApplicationInfo *application);
127121 void buildListOfAvailableApplications();
128122 void generateQmlStrings(ApplicationInfo *application);
129− void createMainStageComponent();
130− void createMainStage();
131− void createSideStageComponent();
132− void createSideStage();
133123 bool m_suspended;
134124 QList<ApplicationInfo*> m_runningApplications;
135125 QList<ApplicationInfo*> m_availableApplications;
136− QQmlComponent *m_mainStageComponent;
137− QQuickItem *m_mainStage;
138− QQmlComponent *m_sideStageComponent;
139− QQuickItem *m_sideStage;
140−
141− int m_rightMargin;
142126
143127 static ApplicationManager *the_application_manager;
144128};
tests/mocks/Unity/Application/ApplicationScreenshotProvider.cpp+1−1
@@ -64,7 +64,7 @@ QImage ApplicationScreenshotProvider::requestImage(const QString &imageId, QSize
6464 Q_FOREACH (QWindow *win, unity->allWindows()) {
6565 QQuickWindow *quickWin = qobject_cast<QQuickWindow*>(win);
6666 if (quickWin) {
67− image = image.scaledToWidth(quickWin->width() - m_appManager->rightMargin());
67+ image = image.scaledToWidth(quickWin->width());
6868 break;
6969 }
7070 }
tests/mocks/Unity/CMakeLists.txt+2−1
@@ -2,11 +2,12 @@ add_subdirectory(Application)
22add_subdirectory(Indicators)
33add_subdirectory(Launcher)
44add_subdirectory(Notifications)
5+add_subdirectory(DashCommunicator)
56
67pkg_search_module(DEE dee-1.0 REQUIRED)
78pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
89pkg_search_module(DEEQT libdee-qt5 REQUIRED)
9−pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=2)
10+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=3)
1011
1112include_directories(
1213 ${CMAKE_CURRENT_BINARY_DIR}
tests/mocks/Unity/DashCommunicator/CMakeLists.txtnew file+18
@@ -0,0 +1,18 @@
1+include_directories(
2+ ${CMAKE_CURRENT_SOURCE_DIR}
3+)
4+
5+set(QMLDASHCOMMUNICATORPLUGIN_SRC
6+ plugin.cpp
7+ dashcommunicatorservice.cpp
8+ dashcommunicator.cpp
9+ )
10+
11+add_library(MockDashCommunicator-qml MODULE
12+ ${QMLDASHCOMMUNICATORPLUGIN_SRC}
13+ )
14+
15+qt5_use_modules(MockDashCommunicator-qml DBus Qml)
16+
17+# export the qmldir and qmltypes files
18+add_unity8_mock(Unity.DashCommunicator 0.1 Unity/DashCommunicator TARGETS MockDashCommunicator-qml)
tests/mocks/Unity/DashCommunicator/dashcommunicator.cppnew file+37
@@ -0,0 +1,37 @@
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+#include "dashcommunicator.h"
18+
19+#include <QObject>
20+#include <QDBusConnection>
21+#include <QDBusInterface>
22+#include <QDebug>
23+
24+DashCommunicator::DashCommunicator(QObject *parent):
25+ QObject(parent)
26+{
27+}
28+
29+DashCommunicator::~DashCommunicator()
30+{
31+}
32+
33+
34+void DashCommunicator::setCurrentScope(const QString &scopeId, bool animate, bool reset)
35+{
36+ Q_EMIT setCurrentScopeCalled(scopeId, animate, reset);
37+}
tests/mocks/Unity/DashCommunicator/dashcommunicator.hnew file+39
@@ -0,0 +1,39 @@
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 DASHCOMMUNICATOR_H
18+#define DASHCOMMUNICATOR_H
19+
20+#include <QObject>
21+
22+class DashCommunicator: public QObject
23+{
24+ Q_OBJECT
25+ Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.DashCommunicator")
26+
27+public:
28+ DashCommunicator(QObject *parent = 0);
29+ ~DashCommunicator();
30+
31+public Q_SLOTS:
32+ void setCurrentScope(const QString &scopeId, bool animate, bool reset);
33+
34+Q_SIGNALS:
35+ // This mock just emits calls back to the QML api for the plugin to verify calls
36+ void setCurrentScopeCalled(const QString &scopeId, bool animate, bool reset);
37+};
38+
39+#endif
tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.cppnew file+33
@@ -0,0 +1,33 @@
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+#include "dashcommunicatorservice.h"
18+
19+DashCommunicatorService::DashCommunicatorService(QObject *parent):
20+ QObject(parent)
21+{
22+}
23+
24+
25+DashCommunicatorService::~DashCommunicatorService()
26+{
27+
28+}
29+
30+void DashCommunicatorService::mockSetCurrentScope(const QString &scopeId, bool animate, bool reset)
31+{
32+ Q_EMIT setCurrentScopeRequested(scopeId, animate, reset);
33+}
tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.hnew file+36
@@ -0,0 +1,36 @@
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 DASHCOMMUNICATORSERVICE_H
18+#define DASHCOMMUNICATORSERVICE_H
19+
20+#include <QObject>
21+
22+class DashCommunicatorService: public QObject
23+{
24+ Q_OBJECT
25+public:
26+ DashCommunicatorService(QObject *parent = 0);
27+ ~DashCommunicatorService();
28+
29+Q_SIGNALS:
30+ void setCurrentScopeRequested(const QString &scopeId, bool animate, bool reset);
31+
32+public Q_SLOTS:
33+ void mockSetCurrentScope(const QString &scopeId, bool animate, bool reset);
34+};
35+
36+#endif // DBUSUNITYSESSIONSERVICE_H
tests/mocks/Unity/DashCommunicator/plugin.cppnew file+31
@@ -0,0 +1,31 @@
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: Michael Zanetti <michael.zanetti@canonical.com>
17+ */
18+
19+#include "plugin.h"
20+#include "dashcommunicator.h"
21+#include "dashcommunicatorservice.h"
22+
23+#include <QDBusConnection>
24+#include <QtQml/qqml.h>
25+
26+void DashCommunicatorPlugin::registerTypes(const char *uri)
27+{
28+ Q_ASSERT(uri == QStringLiteral("Unity.DashCommunicator"));
29+ qmlRegisterType<DashCommunicatorService>(uri, 0, 1, "DashCommunicatorService");
30+ qmlRegisterType<DashCommunicator>(uri, 0, 1, "DashCommunicator");
31+}
tests/mocks/Unity/DashCommunicator/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: Michael Zanetti <michael.zanetti@canonical.com>
17+ */
18+
19+#ifndef DASHCOMMUNICATOR_PLUGIN_H
20+#define DASHCOMMUNICATOR_PLUGIN_H
21+
22+#include <QtQml/QQmlEngine>
23+#include <QtQml/QQmlExtensionPlugin>
24+
25+class DashCommunicatorPlugin : 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
tests/mocks/Unity/DashCommunicator/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Unity.DashCommunicator
2+plugin MockDashCommunicator-qml
3+typeinfo DashCommunicator.qmltypes
tests/mocks/Unity/fake_scopes.cpp+5
@@ -125,6 +125,11 @@ bool Scopes::loaded() const
125125 return m_loaded;
126126}
127127
128+unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
129+{
130+ return nullptr;
131+}
132+
128133void Scopes::addScope(Scope* scope)
129134{
130135 int index = rowCount();
tests/mocks/Unity/fake_scopes.h+1
@@ -50,6 +50,7 @@ public:
5050 QModelIndex parent ( const QModelIndex & index ) const;
5151
5252 bool loaded() const override;
53+ unity::shell::scopes::ScopeInterface* overviewScope() const override;
5354
5455private Q_SLOTS:
5556 void updateScopes();
tests/plugins/Dash/CMakeLists.txt+1
@@ -79,3 +79,4 @@ set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
7979set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C")
8080add_qml_test(. ScopeStyle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
8181add_qml_test(. ListViewWithPageHeaderQML IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
82+add_qml_test(. CardAttributes IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
tests/plugins/Dash/cardcreator/1.res+63−61
@@ -5,8 +5,8 @@ AbstractButton {
55 property var cardData;
66 property var artShapeBorderSource: undefined;
77 property real fontScale: 1.0;
8− property var scopeStyle: null;
9− property int headerAlignment: Text.AlignLeft;
8+ property var scopeStyle: null;
9+ property int headerAlignment: Text.AlignLeft;
1010 property int fixedHeaderHeight: -1;
1111 property size fixedArtShapeSize: Qt.size(-1, -1);
1212 readonly property string title: cardData && cardData["title"] || "";
@@ -16,71 +16,73 @@ AbstractButton {
1616onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
1717readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1818Item {
19− id: artShapeHolder;
20− height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21− width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22− anchors { horizontalCenter: parent.horizontalCenter; }
23− Loader {
24− id: artShapeLoader;
25− objectName: "artShapeLoader";
26− active: cardData && cardData["art"] || false;
27− asynchronous: root.asynchronous;
28− visible: status == Loader.Ready;
29− sourceComponent: UbuntuShape {
30− id: artShape;
31− objectName: "artShape";
32− radius: "medium";
33− visible: image.status == Image.Ready;
34− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36− readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38− onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39− Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40− function updateWidthHeightBindings() {
41− if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42− width = root.fixedArtShapeSize.width;
43− height = root.fixedArtShapeSize.height;
44− } else if (aspectSmallerThanImageAspect) {
45− width = Qt.binding(function() { return !visible ? 0 : image.width });
46− height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47− } else {
48− width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49− height = Qt.binding(function() { return !visible ? 0 : image.height });
50− }
51− }
52− image: Image {
53− objectName: "artImage";
54− source: cardData && cardData["art"] || "";
55− cache: true;
19+ id: artShapeHolder;
20+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22+ anchors { horizontalCenter: parent.horizontalCenter; }
23+ Loader {
24+ id: artShapeLoader;
25+ objectName: "artShapeLoader";
26+ active: cardData && cardData["art"] || false;
5627 asynchronous: root.asynchronous;
57− fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58− readonly property real aspect: implicitWidth / implicitHeight;
59− width: root.width;
60− height: width / artShape.aspect;
28+ visible: status == Loader.Ready;
29+ sourceComponent: UbuntuShape {
30+ id: artShape;
31+ objectName: "artShape";
32+ radius: "medium";
33+ visible: image.status == Image.Ready;
34+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36+ readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38+ onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40+ function updateWidthHeightBindings() {
41+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42+ width = root.fixedArtShapeSize.width;
43+ height = root.fixedArtShapeSize.height;
44+ } else if (aspectSmallerThanImageAspect) {
45+ width = Qt.binding(function() { return !visible ? 0 : image.width });
46+ height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47+ } else {
48+ width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49+ height = Qt.binding(function() { return !visible ? 0 : image.height });
50+ }
51+ }
52+ image: Image {
53+ objectName: "artImage";
54+ source: cardData && cardData["art"] || "";
55+ cache: true;
56+ asynchronous: root.asynchronous;
57+ fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58+ readonly property real aspect: implicitWidth / implicitHeight;
59+ width: root.width;
60+ height: width / artShape.aspect;
61+ }
62+ }
6163 }
62− }
63− }
64− }
64+ }
6565readonly property int headerHeight: titleLabel.height;
6666Label {
67− id: titleLabel;
68− objectName: "titleLabel";
69− anchors { right: parent.right;left: parent.left;
67+ id: titleLabel;
68+ objectName: "titleLabel";
69+ anchors { right: parent.right;
70+rightMargin: units.gu(1);
71+left: parent.left;
7072top: artShapeHolder.bottom;
7173 topMargin: units.gu(1);
7274leftMargin: units.gu(1);
73− }
74− elide: Text.ElideRight;
75− fontSize: "small";
76− wrapMode: Text.Wrap;
77− maximumLineCount: 2;
78− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
79− color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
80− visible: showHeader ;
81− text: root.title;
82− font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
83− horizontalAlignment: root.headerAlignment;
84− }
75+ }
76+ elide: Text.ElideRight;
77+ fontSize: "small";
78+ wrapMode: Text.Wrap;
79+ maximumLineCount: 2;
80+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
81+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
82+ visible: showHeader ;
83+ text: root.title;
84+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
85+ horizontalAlignment: root.headerAlignment;
86+ }
8587implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
8688}
tests/plugins/Dash/cardcreator/2.res+94−91
@@ -5,8 +5,8 @@ AbstractButton {
55 property var cardData;
66 property var artShapeBorderSource: undefined;
77 property real fontScale: 1.0;
8− property var scopeStyle: null;
9− property int headerAlignment: Text.AlignLeft;
8+ property var scopeStyle: null;
9+ property int headerAlignment: Text.AlignLeft;
1010 property int fixedHeaderHeight: -1;
1111 property size fixedArtShapeSize: Qt.size(-1, -1);
1212 readonly property string title: cardData && cardData["title"] || "";
@@ -14,104 +14,107 @@ AbstractButton {
1414 property bool showHeader: true;
1515 implicitWidth: childrenRect.width;
1616Loader {
17− id: backgroundLoader;
18− objectName: "backgroundLoader";
19− anchors.fill: parent;
20− asynchronous: root.asynchronous;
21− visible: status == Loader.Ready;
22− sourceComponent: UbuntuShape {
23− objectName: "background";
24− radius: "medium";
25− color: getColor(0) || "white";
26− gradientColor: getColor(1) || color;
27− anchors.fill: parent;
28− image: backgroundImage.source ? backgroundImage : null;
29− property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
30− property Image backgroundImage: Image {
31− objectName: "backgroundImage";
32− source: {
33− if (cardData && typeof cardData["background"] === "string") return cardData["background"];
34− else if (template && typeof template["card-background"] === "string") return template["card-background"];
35− else return "";
36− }
37− }
38− function getColor(index) {
39− if (cardData && typeof cardData["background"] === "object"
40− && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
41− return cardData["background"]["elements"][index];
42− } else if (template && typeof template["card-background"] === "object"
43− && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
44− return template["card-background"]["elements"][index];
45− } else return undefined;
46− }
47− }
48− }
17+ id: backgroundLoader;
18+ objectName: "backgroundLoader";
19+ anchors.fill: parent;
20+ asynchronous: root.asynchronous;
21+ visible: status == Loader.Ready;
22+ sourceComponent: UbuntuShape {
23+ objectName: "background";
24+ radius: "medium";
25+ color: getColor(0) || "white";
26+ gradientColor: getColor(1) || color;
27+ anchors.fill: parent;
28+ image: backgroundImage.source ? backgroundImage : null;
29+ property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
30+ property Image backgroundImage: Image {
31+ objectName: "backgroundImage";
32+ source: {
33+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
34+ else if (template && typeof template["card-background"] === "string") return template["card-background"];
35+ else return "";
36+ }
37+ }
38+ function getColor(index) {
39+ if (cardData && typeof cardData["background"] === "object"
40+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
41+ return cardData["background"]["elements"][index];
42+ } else if (template && typeof template["card-background"] === "object"
43+ && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
44+ return template["card-background"]["elements"][index];
45+ } else return undefined;
46+ }
47+ }
48+ }
4949readonly property size artShapeSize: Qt.size(-1, -1);
5050readonly property int headerHeight: row.height;
5151Row {
52− id: row;
53− objectName: "outerRow";
54− property real margins: units.gu(1);
55− spacing: margins;
56− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57− anchors { top: parent.top;
52+ id: row;
53+ objectName: "outerRow";
54+ property real margins: units.gu(1);
55+ spacing: margins;
56+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57+ anchors { top: parent.top;
5858 topMargin: units.gu(1);
59− left: parent.left;
60−}
61− anchors.right: parent.right;
62− anchors.margins: margins;
63−data: [ Image {
64− id: mascotImage;
65− objectName: "mascotImage";
66− anchors { verticalCenter: parent.verticalCenter; }
67− readonly property int maxSize: Math.max(width, height) * 4;
68− source: cardData && cardData["mascot"];
69− width: units.gu(6);
70− height: units.gu(5.625);
71− sourceSize { width: maxSize; height: maxSize }
72− fillMode: Image.PreserveAspectCrop;
73− horizontalAlignment: Image.AlignHCenter;
74− verticalAlignment: Image.AlignVCenter;
75− visible: showHeader;
76− }
77−,
78−Column {
79− anchors.verticalCenter: parent.verticalCenter;
80− spacing: units.dp(2);
81− width: parent.width - x;
82− data: [ Label {
83− id: titleLabel;
84− objectName: "titleLabel";
85− anchors { left: parent.left; right: parent.right }
86− elide: Text.ElideRight;
87− fontSize: "small";
88− wrapMode: Text.Wrap;
89− maximumLineCount: 2;
90− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
91− color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
92− visible: showHeader ;
93− text: root.title;
94− font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
95− horizontalAlignment: root.headerAlignment;
96− }
97−,
98−Label {
99− id: subtitleLabel;
100− objectName: "subtitleLabel";
101− anchors { left: parent.left; right: parent.right }
59+left: parent.left;
60+ }
61+ anchors.right: parent.right;
62+ anchors.margins: margins;
63+ data: [ Image {
64+ id: mascotImage;
65+ objectName: "mascotImage";
66+ anchors { verticalCenter: parent.verticalCenter; }
67+ readonly property int maxSize: Math.max(width, height) * 4;
68+ source: cardData && cardData["mascot"];
69+ width: units.gu(6);
70+ height: units.gu(5.625);
71+ sourceSize { width: maxSize; height: maxSize }
72+ fillMode: Image.PreserveAspectCrop;
73+ horizontalAlignment: Image.AlignHCenter;
74+ verticalAlignment: Image.AlignVCenter;
75+ visible: showHeader;
76+ }
10277
78+ ,
79+ Column {
80+ anchors.verticalCenter: parent.verticalCenter;
81+ spacing: units.dp(2);
82+ width: parent.width - x;
83+ data: [ Label {
84+ id: titleLabel;
85+ objectName: "titleLabel";
86+ anchors { left: parent.left; right: parent.right }
10387 elide: Text.ElideRight;
10488 fontSize: "small";
89+ wrapMode: Text.Wrap;
90+ maximumLineCount: 2;
10591 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
106− color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
107− visible: titleLabel.visible && titleLabel.text;
108− text: cardData && cardData["subtitle"] || "";
109− font.weight: Font.Light;
92+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
93+ visible: showHeader ;
94+ text: root.title;
95+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
11096 horizontalAlignment: root.headerAlignment;
11197 }
112−]
113−}
114−]
115−}
98+
99+ ,
100+ Label {
101+ id: subtitleLabel;
102+ objectName: "subtitleLabel";
103+ anchors { left: parent.left; right: parent.right }
104+ elide: Text.ElideRight;
105+ fontSize: "small";
106+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
107+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
108+ visible: titleLabel.visible && titleLabel.text;
109+ text: cardData && cardData["subtitle"] || "";
110+ font.weight: Font.Light;
111+ horizontalAlignment: root.headerAlignment;
112+ }
113+
114+ ]
115+ }
116+
117+ ]
118+ }
116119implicitHeight: row.y + row.height + units.gu(1);
117120}
tests/plugins/Dash/cardcreator/3.res+77−74
@@ -5,8 +5,8 @@ AbstractButton {
55 property var cardData;
66 property var artShapeBorderSource: undefined;
77 property real fontScale: 1.0;
8− property var scopeStyle: null;
9− property int headerAlignment: Text.AlignLeft;
8+ property var scopeStyle: null;
9+ property int headerAlignment: Text.AlignLeft;
1010 property int fixedHeaderHeight: -1;
1111 property size fixedArtShapeSize: Qt.size(-1, -1);
1212 readonly property string title: cardData && cardData["title"] || "";
@@ -16,89 +16,92 @@ AbstractButton {
1616onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
1717readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1818Item {
19− id: artShapeHolder;
20− height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21− width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22− anchors { horizontalCenter: parent.horizontalCenter; }
23− Loader {
24− id: artShapeLoader;
25− objectName: "artShapeLoader";
26− active: cardData && cardData["art"] || false;
27− asynchronous: root.asynchronous;
28− visible: status == Loader.Ready;
29− sourceComponent: UbuntuShape {
30− id: artShape;
31− objectName: "artShape";
32− radius: "medium";
33− visible: image.status == Image.Ready;
34− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36− readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38− onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39− Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40− function updateWidthHeightBindings() {
41− if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42− width = root.fixedArtShapeSize.width;
43− height = root.fixedArtShapeSize.height;
44− } else if (aspectSmallerThanImageAspect) {
45− width = Qt.binding(function() { return !visible ? 0 : image.width });
46− height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47− } else {
48− width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49− height = Qt.binding(function() { return !visible ? 0 : image.height });
50− }
51− }
52− image: Image {
53− objectName: "artImage";
54− source: cardData && cardData["art"] || "";
55− cache: true;
19+ id: artShapeHolder;
20+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22+ anchors { horizontalCenter: parent.horizontalCenter; }
23+ Loader {
24+ id: artShapeLoader;
25+ objectName: "artShapeLoader";
26+ active: cardData && cardData["art"] || false;
5627 asynchronous: root.asynchronous;
57− fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58− readonly property real aspect: implicitWidth / implicitHeight;
59− width: root.width;
60− height: width / artShape.aspect;
28+ visible: status == Loader.Ready;
29+ sourceComponent: UbuntuShape {
30+ id: artShape;
31+ objectName: "artShape";
32+ radius: "medium";
33+ visible: image.status == Image.Ready;
34+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36+ readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38+ onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40+ function updateWidthHeightBindings() {
41+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42+ width = root.fixedArtShapeSize.width;
43+ height = root.fixedArtShapeSize.height;
44+ } else if (aspectSmallerThanImageAspect) {
45+ width = Qt.binding(function() { return !visible ? 0 : image.width });
46+ height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47+ } else {
48+ width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49+ height = Qt.binding(function() { return !visible ? 0 : image.height });
50+ }
51+ }
52+ image: Image {
53+ objectName: "artImage";
54+ source: cardData && cardData["art"] || "";
55+ cache: true;
56+ asynchronous: root.asynchronous;
57+ fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58+ readonly property real aspect: implicitWidth / implicitHeight;
59+ width: root.width;
60+ height: width / artShape.aspect;
61+ }
62+ }
6163 }
62− }
63− }
64− }
64+ }
6565readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
6666Label {
67− id: titleLabel;
68− objectName: "titleLabel";
69− anchors { right: parent.right;left: parent.left;
67+ id: titleLabel;
68+ objectName: "titleLabel";
69+ anchors { right: parent.right;
70+rightMargin: units.gu(1);
71+left: parent.left;
7072top: artShapeHolder.bottom;
7173 topMargin: units.gu(1);
7274leftMargin: units.gu(1);
73−}
74− elide: Text.ElideRight;
75− fontSize: "small";
76− wrapMode: Text.Wrap;
77− maximumLineCount: 2;
78− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
79− color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
80− visible: showHeader ;
81− text: root.title;
82− font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
83− horizontalAlignment: root.headerAlignment;
84− }
85−Label {
86− id: subtitleLabel;
87− objectName: "subtitleLabel";
88− anchors { left: titleLabel.left;
89− leftMargin: titleLabel.leftMargin;
90− right: titleLabel.right;
91− top: titleLabel.bottom;
92− topMargin: units.dp(2);
93− }
75+ }
9476 elide: Text.ElideRight;
9577 fontSize: "small";
78+ wrapMode: Text.Wrap;
79+ maximumLineCount: 2;
9680 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
97− color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
98− visible: titleLabel.visible && titleLabel.text;
99− text: cardData && cardData["subtitle"] || "";
100− font.weight: Font.Light;
81+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
82+ visible: showHeader ;
83+ text: root.title;
84+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
10185 horizontalAlignment: root.headerAlignment;
10286 }
87+Label {
88+ id: subtitleLabel;
89+ objectName: "subtitleLabel";
90+ anchors { left: titleLabel.left;
91+ leftMargin: titleLabel.leftMargin;
92+ right: titleLabel.right;
93+ rightMargin: titleLabel.rightMargin;
94+ top: titleLabel.bottom;
95+ topMargin: units.dp(2);
96+ }
97+ elide: Text.ElideRight;
98+ fontSize: "small";
99+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
100+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey";
101+ visible: titleLabel.visible && titleLabel.text;
102+ text: cardData && cardData["subtitle"] || "";
103+ font.weight: Font.Light;
104+ horizontalAlignment: root.headerAlignment;
105+ }
103106implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
104107}
tests/plugins/Dash/cardcreator/5.res+119−117
@@ -4,9 +4,9 @@ AbstractButton {
44 property var components;
55 property var cardData;
66 property var artShapeBorderSource: undefined;
7− property real fontScale: 1.0;
8− property var scopeStyle: null;
9− property int headerAlignment: Text.AlignLeft;
7+ property real fontScale: 1.0;
8+ property var scopeStyle: null;
9+ property int headerAlignment: Text.AlignLeft;
1010 property int fixedHeaderHeight: -1;
1111 property size fixedArtShapeSize: Qt.size(-1, -1);
1212 readonly property string title: cardData && cardData["title"] || "";
@@ -16,130 +16,132 @@ AbstractButton {
1616onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
1717readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
1818Item {
19− id: artShapeHolder;
20− height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21− width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22− anchors { horizontalCenter: parent.horizontalCenter; }
23− Loader {
24− id: artShapeLoader;
25− objectName: "artShapeLoader";
26− active: cardData && cardData["art"] || false;
27− asynchronous: root.asynchronous;
28− visible: status == Loader.Ready;
29− sourceComponent: UbuntuShape {
30− id: artShape;
31− objectName: "artShape";
32− radius: "medium";
33− visible: image.status == Image.Ready;
34− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36− readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38− onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39− Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40− function updateWidthHeightBindings() {
41− if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42− width = root.fixedArtShapeSize.width;
43− height = root.fixedArtShapeSize.height;
44− } else if (aspectSmallerThanImageAspect) {
45− width = Qt.binding(function() { return !visible ? 0 : image.width });
46− height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47− } else {
48− width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49− height = Qt.binding(function() { return !visible ? 0 : image.height });
50− }
51− }
52− image: Image {
53− objectName: "artImage";
54− source: cardData && cardData["art"] || "";
55− cache: true;
19+ id: artShapeHolder;
20+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
21+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
22+ anchors { horizontalCenter: parent.horizontalCenter; }
23+ Loader {
24+ id: artShapeLoader;
25+ objectName: "artShapeLoader";
26+ active: cardData && cardData["art"] || false;
5627 asynchronous: root.asynchronous;
57− fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58− readonly property real aspect: implicitWidth / implicitHeight;
59− width: root.width;
60− height: width / artShape.aspect;
28+ visible: status == Loader.Ready;
29+ sourceComponent: UbuntuShape {
30+ id: artShape;
31+ objectName: "artShape";
32+ radius: "medium";
33+ visible: image.status == Image.Ready;
34+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
35+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36+ readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
37+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
38+ onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
39+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
40+ function updateWidthHeightBindings() {
41+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
42+ width = root.fixedArtShapeSize.width;
43+ height = root.fixedArtShapeSize.height;
44+ } else if (aspectSmallerThanImageAspect) {
45+ width = Qt.binding(function() { return !visible ? 0 : image.width });
46+ height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
47+ } else {
48+ width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
49+ height = Qt.binding(function() { return !visible ? 0 : image.height });
50+ }
51+ }
52+ image: Image {
53+ objectName: "artImage";
54+ source: cardData && cardData["art"] || "";
55+ cache: true;
56+ asynchronous: root.asynchronous;
57+ fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop;
58+ readonly property real aspect: implicitWidth / implicitHeight;
59+ width: root.width;
60+ height: width / artShape.aspect;
61+ }
62+ }
6163 }
62− }
63− }
64− }
64+ }
6565Loader {
66− id: overlayLoader;
67− anchors {
68− left: artShapeHolder.left;
69− right: artShapeHolder.right;
70− bottom: artShapeHolder.bottom;
71− }
72− active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
73− asynchronous: root.asynchronous;
74− visible: showHeader && status == Loader.Ready;
75− sourceComponent: ShaderEffect {
76− id: overlay;
77− height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
78− opacity: 0.6;
79− property var source: ShaderEffectSource {
80− id: shaderSource;
81− sourceItem: artShapeLoader.item;
82− onVisibleChanged: if (visible) scheduleUpdate();
83− live: false;
84− sourceRect: Qt.rect(0, artShapeLoader.height - overlay.height, artShapeLoader.width, overlay.height);
85− }
86− vertexShader: "
87− uniform highp mat4 qt_Matrix;
88− attribute highp vec4 qt_Vertex;
89− attribute highp vec2 qt_MultiTexCoord0;
90− varying highp vec2 coord;
91− void main() {
92− coord = qt_MultiTexCoord0;
93− gl_Position = qt_Matrix * qt_Vertex;
94− }";
95− fragmentShader: "
96− varying highp vec2 coord;
97− uniform sampler2D source;
98− uniform lowp float qt_Opacity;
99− void main() {
100− lowp vec4 tex = texture2D(source, coord);
101− gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity;
102− }";
103− }
104− }
66+ id: overlayLoader;
67+ anchors {
68+ left: artShapeHolder.left;
69+ right: artShapeHolder.right;
70+ bottom: artShapeHolder.bottom;
71+ }
72+ active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
73+ asynchronous: root.asynchronous;
74+ visible: showHeader && status == Loader.Ready;
75+ sourceComponent: ShaderEffect {
76+ id: overlay;
77+ height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
78+ opacity: 0.6;
79+ property var source: ShaderEffectSource {
80+ id: shaderSource;
81+ sourceItem: artShapeLoader.item;
82+ onVisibleChanged: if (visible) scheduleUpdate();
83+ live: false;
84+ sourceRect: Qt.rect(0, artShapeLoader.height - overlay.height, artShapeLoader.width, overlay.height);
85+ }
86+ vertexShader: "
87+ uniform highp mat4 qt_Matrix;
88+ attribute highp vec4 qt_Vertex;
89+ attribute highp vec2 qt_MultiTexCoord0;
90+ varying highp vec2 coord;
91+ void main() {
92+ coord = qt_MultiTexCoord0;
93+ gl_Position = qt_Matrix * qt_Vertex;
94+ }";
95+ fragmentShader: "
96+ varying highp vec2 coord;
97+ uniform sampler2D source;
98+ uniform lowp float qt_Opacity;
99+ void main() {
100+ lowp vec4 tex = texture2D(source, coord);
101+ gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity;
102+ }";
103+ }
104+ }
105105readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
106106Label {
107− id: titleLabel;
108− objectName: "titleLabel";
109− anchors { left: parent.left;
110− leftMargin: units.gu(1);
111− right: parent.right;
112− top: overlayLoader.top;
113− topMargin: units.gu(1);
114−}
115− elide: Text.ElideRight;
116− fontSize: "small";
117− wrapMode: Text.Wrap;
118− maximumLineCount: 2;
119− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
120− color: "white";
121− visible: showHeader && overlayLoader.active;
122− text: root.title;
123− font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
124− horizontalAlignment: root.headerAlignment;
125− }
126−Label {
127− id: subtitleLabel;
128− objectName: "subtitleLabel";
129− anchors { left: titleLabel.left;
130− leftMargin: titleLabel.leftMargin;
131− right: titleLabel.right;
132− top: titleLabel.bottom;
133− topMargin: units.dp(2);
134− }
107+ id: titleLabel;
108+ objectName: "titleLabel";
109+ anchors { left: parent.left;
110+ leftMargin: units.gu(1);
111+ right: parent.right;
112+ rightMargin: units.gu(1);
113+ top: overlayLoader.top;
114+ topMargin: units.gu(1);
115+ }
135116 elide: Text.ElideRight;
136117 fontSize: "small";
118+ wrapMode: Text.Wrap;
119+ maximumLineCount: 2;
137120 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
138121 color: "white";
139− visible: titleLabel.visible && titleLabel.text;
140− text: cardData && cardData["subtitle"] || "";
141− font.weight: Font.Light;
122+ visible: showHeader && overlayLoader.active;
123+ text: root.title;
124+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
142125 horizontalAlignment: root.headerAlignment;
143126 }
127+Label {
128+ id: subtitleLabel;
129+ objectName: "subtitleLabel";
130+ anchors { left: titleLabel.left;
131+ leftMargin: titleLabel.leftMargin;
132+ right: titleLabel.right;
133+ rightMargin: titleLabel.rightMargin;
134+ top: titleLabel.bottom;
135+ topMargin: units.dp(2);
136+ }
137+ elide: Text.ElideRight;
138+ fontSize: "small";
139+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
140+ color: "white";
141+ visible: titleLabel.visible && titleLabel.text;
142+ text: cardData && cardData["subtitle"] || "";
143+ font.weight: Font.Light;
144+ horizontalAlignment: root.headerAlignment;
145+ }
144146implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
145147}
tests/plugins/Dash/cardcreator/7.resnew file+128
@@ -0,0 +1,128 @@
1+AbstractButton {
2+ id: root;
3+ property var template;
4+ property var components;
5+ property var cardData;
6+ property var artShapeBorderSource: undefined;
7+ property real fontScale: 1.0;
8+ property var scopeStyle: null;
9+ property int headerAlignment: Text.AlignLeft;
10+ property int fixedHeaderHeight: -1;
11+ property size fixedArtShapeSize: Qt.size(-1, -1);
12+ readonly property string title: cardData && cardData["title"] || "";
13+ property bool asynchronous: true;
14+ property bool showHeader: true;
15+ implicitWidth: childrenRect.width;
16+Loader {
17+ id: backgroundLoader;
18+ objectName: "backgroundLoader";
19+ anchors.fill: parent;
20+ asynchronous: root.asynchronous;
21+ visible: status == Loader.Ready;
22+ sourceComponent: UbuntuShape {
23+ objectName: "background";
24+ radius: "medium";
25+ color: getColor(0) || "white";
26+ gradientColor: getColor(1) || color;
27+ anchors.fill: parent;
28+ image: backgroundImage.source ? backgroundImage : null;
29+ property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
30+ property Image backgroundImage: Image {
31+ objectName: "backgroundImage";
32+ source: {
33+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
34+ else if (template && typeof template["card-background"] === "string") return template["card-background"];
35+ else return "";
36+ }
37+ }
38+ function getColor(index) {
39+ if (cardData && typeof cardData["background"] === "object"
40+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
41+ return cardData["background"]["elements"][index];
42+ } else if (template && typeof template["card-background"] === "object"
43+ && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
44+ return template["card-background"]["elements"][index];
45+ } else return undefined;
46+ }
47+ }
48+ }
49+readonly property size artShapeSize: Qt.size(-1, -1);
50+readonly property int headerHeight: row.height;
51+Row {
52+ id: row;
53+ objectName: "outerRow";
54+ property real margins: units.gu(1);
55+ spacing: margins;
56+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57+ anchors { top: parent.top;
58+ topMargin: units.gu(1);
59+left: parent.left;
60+ }
61+ anchors.right: parent.right;
62+ anchors.margins: margins;
63+ data: [ Image {
64+ id: mascotImage;
65+ objectName: "mascotImage";
66+ anchors { verticalCenter: parent.verticalCenter; }
67+ readonly property int maxSize: Math.max(width, height) * 4;
68+ source: cardData && cardData["mascot"];
69+ width: units.gu(6);
70+ height: units.gu(5.625);
71+ sourceSize { width: maxSize; height: maxSize }
72+ fillMode: Image.PreserveAspectCrop;
73+ horizontalAlignment: Image.AlignHCenter;
74+ verticalAlignment: Image.AlignVCenter;
75+ visible: showHeader;
76+ }
77+
78+ ,
79+ Column {
80+ anchors.verticalCenter: parent.verticalCenter;
81+ spacing: units.dp(2);
82+ width: parent.width - x;
83+ data: [
84+ Label {
85+ id: titleLabel;
86+ objectName: "titleLabel";
87+ anchors { left: parent.left; right: parent.right }
88+ elide: Text.ElideRight;
89+ fontSize: "small";
90+ wrapMode: Text.Wrap;
91+ maximumLineCount: 2;
92+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
93+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
94+ visible: showHeader ;
95+ text: root.title;
96+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
97+ horizontalAlignment: root.headerAlignment;
98+ }
99+,
100+Label {
101+ id: subtitleLabel;
102+ objectName: "subtitleLabel";
103+ anchors { left: parent.left; right: parent.right }
104+ elide: Text.ElideRight;
105+ fontSize: "small";
106+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
107+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
108+ visible: titleLabel.visible && titleLabel.text;
109+ text: cardData && cardData["subtitle"] || "";
110+ font.weight: Font.Light;
111+ horizontalAlignment: root.headerAlignment;
112+ }
113+,
114+CardAttributes {
115+ id: attributesRow;
116+ objectName: "attributesRow";
117+ anchors { left: parent.left; right: parent.right }
118+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
119+ model: cardData["attributes"]
120+ }
121+
122+ ]
123+ }
124+
125+ ]
126+ }
127+implicitHeight: row.y + row.height + units.gu(1);
128+}
tests/plugins/Dash/cardcreator/7.tstnew file+3
@@ -0,0 +1,3 @@
1+template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2+components: {"art":{"aspect-ratio":1,"fill-mode":"crop"},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}}
3+result: 7.res
tests/plugins/Dash/cardcreatortest.cpp+9−1
@@ -19,6 +19,7 @@
1919#include <QQuickItem>
2020#include <QQuickView>
2121#include <QtTestGui>
22+#include <QTemporaryFile>
2223
2324class CardCreatorTest : public QObject
2425{
@@ -74,7 +75,14 @@ private Q_SLOTS:
7475 QVERIFY(testResultFile.open(QIODevice::ReadOnly));
7576 QTextStream ts2(&testResultFile);
7677 const QString expectedResult = ts2.readAll();
77− QCOMPARE(cardStringResult.toString().simplified(), expectedResult.simplified());
78+ const QString executedResult = cardStringResult.toString();
79+ // Record failed results to /tmp
80+ QTemporaryFile tmpFile(QDir::tempPath() + QDir::separator() + "testCardCreatorFailedResultXXXXXX");
81+ tmpFile.open();
82+ tmpFile.setAutoRemove(false);
83+ tmpFile.write(executedResult.toUtf8().constData());
84+ QCOMPARE(executedResult.simplified(), expectedResult.simplified());
85+ tmpFile.setAutoRemove(true); // Remove the result if it passed
7886
7987 QVariant createCardComponentResult;
8088 QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON));
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp−1
@@ -40,7 +40,6 @@ private:
4040 QTRY_COMPARE(lvwph->m_visibleItems[visibleIndex]->height(), height);
4141 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_item)->culled, culled);
4242 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->sectionItem()), sectionHeader);
43− QTRY_COMPARE(hasSectionHeaderProperty(lvwph->m_visibleItems[visibleIndex]->m_item), !sectionHeader.isNull());
4443 if (!sectionHeader.isNull()) {
4544 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->sectionItem())->culled, sectionHeaderCulled);
4645 QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->sectionItem()), lvwph->m_firstVisibleIndex + visibleIndex);
tests/plugins/Dash/tst_CardAttributes.qmlnew file+54
@@ -0,0 +1,54 @@
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 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+import QtTest 1.0
19+import Dash 0.1
20+
21+Item {
22+ width: units.gu(40)
23+ height: units.gu(4.5)
24+
25+ property var testData: [
26+ [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}],
27+ [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"},{"value":"text3"}],
28+ [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"},{"value":"text3"},{"value":"text4"}],
29+ [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"},{"value":"text3","style":"highlighted"},{"value":"text4","icon":"image://theme/close","style":"highlighted"},{"value":"text5"}]
30+ ]
31+
32+ CardAttributes {
33+ id: cardAttributes
34+ model: testData[3]
35+ clip: true
36+ }
37+
38+ TestCase {
39+ name: "CardAttributesTest"
40+ when: windowShown
41+
42+ function init() {
43+ }
44+
45+ function test_columns_data() {
46+ return testData;
47+ }
48+
49+ function test_columns(data) {
50+ cardAttributes.model = data;
51+ compare(cardAttributes.columns, 2 + data.length % 2);
52+ }
53+ }
54+}
tests/qmltests/CMakeLists.txt−1
@@ -40,7 +40,6 @@ add_qml_test(Dash Card)
4040add_qml_benchmark(Dash CardBenchmark 1000)
4141add_qml_test(Dash CardTool)
4242add_qml_test(Dash GenericScopeView)
43−add_qml_test(Dash/Apps RunningApplicationsGrid)
4443add_qml_test(Dash/Previews Preview)
4544add_qml_test(Dash/Previews PreviewActions)
4645add_qml_test(Dash/Previews PreviewAudioPlayback)
tests/qmltests/Components/tst_PageHeader.qml+36−6
@@ -36,6 +36,16 @@ Item {
3636
3737 function init() {
3838 searchEnabled = true;
39+
40+ // Reset to initial state
41+ pageHeader.searchQuery = "";
42+ pageHeader.closePopup();
43+ pageHeader.searchHistory.clear();
44+
45+ // Check initial state
46+ var headerContainer = findChild(pageHeader, "headerContainer");
47+ tryCompareFunction(function() { return headerContainer.popover === null; }, true);
48+ compare(pageHeader.searchHistory.count, 0);
3949 }
4050
4151 function test_search_disabled() {
@@ -80,9 +90,6 @@ Item {
8090 }
8191
8292 function test_history() {
83− pageHeader.searchHistory.clear()
84− compare(pageHeader.searchHistory.count, 0)
85−
8693 pageHeader.triggerSearch()
8794 typeString("humppa1")
8895 pageHeader.resetSearch()
@@ -143,16 +150,26 @@ Item {
143150 tryCompareFunction(function() { return headerContainer.popover !== null; }, true);
144151
145152 tryCompare(headerContainer.popover, "visible", true);
153+
154+ var searchTextField = findChild(pageHeader, "searchTextField");
155+ compare(searchTextField.focus, true);
156+
157+ var recentSearches = findChild(headerContainer.popover, "recentSearches");
158+ mouseClick(recentSearches.itemAt(0), 0, 0);
159+
160+ compare(pageHeader.searchQuery, "Search2");
161+ tryCompareFunction(function() { return headerContainer.popover === null; }, true);
162+ compare(searchTextField.focus, false);
146163 }
147164
148− function test_tap_outside_closes_popup_data() {
165+ function test_popup_closing_data() {
149166 return [
150167 { tag: "with search text", searchText: "foobar", hideSearch: false },
151168 { tag: "without search text", searchText: "", hideSearch: true }
152169 ];
153170 }
154171
155− function test_tap_outside_closes_popup(data) {
172+ function test_popup_closing(data) {
156173 searchEnabled = true;
157174 pageHeader.searchHistory.clear();
158175
@@ -168,13 +185,26 @@ Item {
168185
169186 pageHeader.searchQuery = data.searchText;
170187
171− mouseClick(root, root.width / 2, root.height - 1);
188+ if (data.searchText == "") {
189+ // When the text is empty the user can also close the
190+ // popup by clicking outside the header instead of by starting a search
191+ mouseClick(root, root.width / 2, root.height - 1);
192+ }
172193
173194 tryCompare(headerContainer, "showSearch", !data.hideSearch);
174195 tryCompareFunction(function() { return headerContainer.popover === null; }, true);
175196
176197 pageHeader.resetSearch();
177198 }
199+
200+ function test_search_change_shows_search() {
201+ var headerContainer = findChild(pageHeader, "headerContainer");
202+ compare(headerContainer.showSearch, false);
203+ compare(searchQuery, "");
204+
205+ searchQuery = "H";
206+ compare(headerContainer.showSearch, true);
207+ }
178208 }
179209
180210 Column {
tests/qmltests/Dash/Apps/tst_RunningApplicationsGrid.qmldeleted−217
@@ -1,217 +0,0 @@
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 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−import QtTest 1.0
19−import "../../../../qml/Dash/Apps"
20−import Unity.Test 0.1 as UT
21−import Unity.Application 0.1
22−import Ubuntu.Components 1.1
23−
24−// Using Rectangle to have an opaque surface because AppManager paints app surfaces behind it.
25−Rectangle {
26− width: units.gu(70)
27− height: units.gu(40)
28−
29− function resetRunningApplications() {
30− while (ApplicationManager.count > 0) {
31− ApplicationManager.stopApplication(ApplicationManager.get(0).appId)
32− }
33−
34− ApplicationManager.startApplication("dialer-app");
35− ApplicationManager.startApplication("webbrowser-app");
36− }
37−
38− Component.onCompleted: {
39− resetRunningApplications()
40− }
41−
42− // The component under test
43− RunningApplicationsGrid {
44− id: runningApplicationsGrid
45− orientationAngle: orientationAngleSelector.selectedIndex * 90
46− anchors.left: parent.left
47− anchors.right: controlPanel.left
48− anchors.top: parent.top
49− anchors.bottom: parent.bottom
50− model: ApplicationManager
51− }
52−
53− Rectangle {
54− id: controlPanel
55− anchors.right: parent.right
56− anchors.top: parent.top
57− anchors.bottom: parent.bottom
58− width: units.gu(20)
59− color: "black"
60−
61− OptionSelector {
62− id: orientationAngleSelector
63− model: ["0","90","180","270"]
64− text: "Orientation Angle"
65− width: parent.width
66− }
67− }
68−
69− UT.UnityTestCase {
70− name: "RunningApplicationsGrid"
71− when: windowShown
72−
73− function init() {
74− runningApplicationsGrid.terminationModeEnabled = false
75− resetRunningApplications()
76− }
77−
78− property var browserTile
79− property var phoneTile
80−
81− property var isBrowserLongPressed: false
82− function onBrowserLongPressed() {isBrowserLongPressed = true}
83−
84− property var isPhoneLongPressed: false
85− function onPhoneLongPressed() {isPhoneLongPressed = true}
86−
87− // Tiles should go to termination mode when any one of them is long-pressed.
88− // Long-pressing when they're in termination mode brings them back to activation mode
89− function test_enterTerminationMode() {
90− browserTile = findChild(runningApplicationsGrid, "runningAppTile Browser")
91− verify(browserTile != undefined)
92− browserTile.onPressAndHold.connect(onBrowserLongPressed)
93−
94− phoneTile = findChild(runningApplicationsGrid, "runningAppTile Dialer")
95− verify(phoneTile != undefined)
96− phoneTile.onPressAndHold.connect(onPhoneLongPressed)
97−
98− compare(browserTile.terminationModeEnabled, false)
99− compare(phoneTile.terminationModeEnabled, false)
100− compare(runningApplicationsGrid.terminationModeEnabled, false)
101−
102− isBrowserLongPressed = false
103− mousePress(browserTile, browserTile.width/2, browserTile.height/2)
104− tryCompareFunction(checkSwitchToTerminationModeAfterLongPress, true)
105−
106− mouseRelease(browserTile, browserTile.width/2, browserTile.height/2)
107−
108− compare(browserTile.terminationModeEnabled, true)
109− compare(phoneTile.terminationModeEnabled, true)
110− compare(runningApplicationsGrid.terminationModeEnabled, true)
111−
112− isPhoneLongPressed = false
113− mousePress(phoneTile, phoneTile.width/2, phoneTile.height/2)
114− tryCompareFunction(checkSwitchToActivationModeAfterLongPress, true)
115−
116− mouseRelease(phoneTile, phoneTile.width/2, phoneTile.height/2)
117−
118− compare(browserTile.terminationModeEnabled, false)
119− compare(phoneTile.terminationModeEnabled, false)
120− compare(runningApplicationsGrid.terminationModeEnabled, false)
121−
122− browserTile.onPressAndHold.disconnect(onBrowserLongPressed)
123− phoneTile.onPressAndHold.disconnect(onPhoneLongPressed)
124− }
125−
126− // Checks that components swicth to termination mode after (and only after) a long
127− // press happens on Browser tile.
128− function checkSwitchToTerminationModeAfterLongPress() {
129− compare(browserTile.terminationModeEnabled, isBrowserLongPressed)
130− compare(phoneTile.terminationModeEnabled, isBrowserLongPressed)
131− compare(runningApplicationsGrid.terminationModeEnabled, isBrowserLongPressed)
132−
133− return isBrowserLongPressed &&
134− browserTile.terminationModeEnabled &&
135− phoneTile.terminationModeEnabled &&
136− runningApplicationsGrid.terminationModeEnabled
137− }
138−
139− // Checks that components swicth to activation mode after (and only after) a long
140− // press happens on Phone tile.
141− function checkSwitchToActivationModeAfterLongPress() {
142− compare(browserTile.terminationModeEnabled, !isPhoneLongPressed)
143− compare(phoneTile.terminationModeEnabled, !isPhoneLongPressed)
144− compare(runningApplicationsGrid.terminationModeEnabled, !isPhoneLongPressed)
145−
146− return isPhoneLongPressed &&
147− !browserTile.terminationModeEnabled &&
148− !phoneTile.terminationModeEnabled &&
149− !runningApplicationsGrid.terminationModeEnabled
150− }
151−
152− // While on termination mode, clicking a running application tile, outside of
153− // the close icon should do nothing
154− function test_clickTileNotClose() {
155− runningApplicationsGrid.terminationModeEnabled = true
156−
157− var browserTile = findChild(runningApplicationsGrid, "runningAppTile Browser")
158− verify(browserTile != undefined)
159−
160− verify(ApplicationManager.findApplication("webbrowser-app") !== null)
161−
162− mouseClick(browserTile, browserTile.width/2, browserTile.height/2)
163−
164− verify(ApplicationManager.findApplication("webbrowser-app") !== null)
165−
166− // The tile for the Browser app should stay there
167− tryCompareFunction(checkBrowserTileExists, true)
168− }
169−
170− // While in termination mode, clicking on a running application tile's close icon
171− // causes the corresponding application to be terminated
172− function test_clickCloseIconToTerminateApp() {
173− runningApplicationsGrid.terminationModeEnabled = true
174−
175− var browserTile = findChild(runningApplicationsGrid, "runningAppTile Browser")
176− var browserTileCloseButton = findChild(runningApplicationsGrid, "closeIcon Browser")
177−
178− verify(browserTile != undefined)
179− verify(browserTileCloseButton != undefined)
180− verify(ApplicationManager.findApplication("webbrowser-app") !== 0)
181−
182− mouseClick(browserTileCloseButton, browserTileCloseButton.width/2, browserTileCloseButton.height/2)
183− wait(0) // spin event loop to start any pending animation
184−
185− verify(ApplicationManager.findApplication("webbrowser-app") === null)
186−
187− // The tile for the Browser app should eventually vanish since the
188− // application has been terminated.
189− tryCompareFunction(checkBrowserTileExists, false)
190− }
191−
192− function checkBrowserTileExists() {
193− return findChild(runningApplicationsGrid, "runningAppTile Browser")
194− != undefined
195− }
196−
197− // While in termination mode, if you click outside any of the tiles, the
198− // termination mode is disabled (i.e. we switch back to activation mode).
199− function test_clickOutsideTilesDisablesTerminationMode() {
200− runningApplicationsGrid.terminationModeEnabled = true
201−
202− var browserTile = findChild(runningApplicationsGrid, "runningAppTile Browser")
203− verify(browserTile != undefined)
204−
205− verify(runningApplicationsGrid.terminationModeEnabled);
206−
207− // Click on the bottom right corner of the grid, where there's no
208− // RunningApplicationTile lying around
209− mouseClick(runningApplicationsGrid,
210− runningApplicationsGrid.width - 1, runningApplicationsGrid.height - 1);
211−
212− wait(0) // spin event loop to ensure that any pending signal emission went through
213−
214− verify(!runningApplicationsGrid.terminationModeEnabled);
215− }
216− }
217−}
tests/qmltests/Dash/CardHelpers.js+5−3
@@ -16,7 +16,7 @@
1616
1717.pragma library
1818
19−var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary"]
19+var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary", "attributes"]
2020
2121var defaultLayout = ' \
2222{ \
@@ -48,7 +48,8 @@ var defaultLayout = ' \
4848 "empty": "image://theme/rating-star-empty" \
4949 }, \
5050 "alt-rating": null, \
51− "summary": null \
51+ "summary": null, \
52+ "attributes": { "max-count": 2 } \
5253 }, \
5354 "resources": {} \
5455}'
@@ -59,7 +60,8 @@ var fullMapping = ' \
5960 "art": "art", \
6061 "subtitle": "subtitle", \
6162 "mascot": "mascot", \
62− "summary": "summary" \
63+ "summary": "summary", \
64+ "attributes": "attributes" \
6365}'
6466
6567
tests/qmltests/Dash/tst_Card.qml+4−2
@@ -33,7 +33,8 @@ Rectangle {
3333 "mascot": "../../../tests/qmltests/Dash/artwork/avatar.png",
3434 "title": "foo",
3535 "subtitle": "bar",
36− "summary": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
36+ "summary": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
37+ "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}]
3738 }'
3839
3940 property var cardsModel: [
@@ -110,6 +111,7 @@ Rectangle {
110111 anchors { top: parent.top; left: parent.left; margins: units.gu(1) }
111112
112113 sourceComponent: cardTool.cardComponent
114+ clip: true
113115 onLoaded: {
114116 item.template = Qt.binding(function() { return cardTool.template; });
115117 item.components = Qt.binding(function() { return cardTool.components; });
@@ -359,7 +361,7 @@ Rectangle {
359361
360362 waitForRendering(card);
361363
362− tryCompareFunction(function() { return testCase.summary.y === data.top() }, true);
364+ tryCompareFunction(function() { return art.height > 0 && testCase.summary.y === data.top() }, true);
363365 }
364366
365367 function test_art_visibility() {
tests/qmltests/Dash/tst_Dash.qml+19
@@ -55,6 +55,7 @@ Item {
5555 verify(dashContentList != undefined);
5656 tryCompare(dashContentList, "count", 0);
5757 scopes.load();
58+ tryCompare(dashContentList, "currentIndex", 0);
5859 }
5960
6061 function get_scope_data() {
@@ -88,6 +89,24 @@ Item {
8889 tryCompare(dashContentList, "currentIndex", data.visualIndex);
8990 }
9091
92+ function test_setCurrentScope() {
93+ var dashContentList = findChild(dash, "dashContentList");
94+ var startX = dash.width - units.gu(1);
95+ var startY = dash.height / 2;
96+ var stopX = units.gu(1)
97+ var stopY = startY;
98+ var retry = 0;
99+ while (dashContentList.currentIndex != 2 && retry <= 5) {
100+ mouseFlick(dash, startX, startY, stopX, stopY)
101+ waitForRendering(dashContentList)
102+ retry++;
103+ }
104+ compare(dashContentList.currentIndex, 2);
105+ var dashCommunicatorService = findInvisibleChild(dash, "dashCommunicatorService");
106+ dashCommunicatorService.mockSetCurrentScope("clickscope", true, true);
107+ tryCompare(dashContentList, "currentIndex", 1)
108+ }
109+
91110 function test_processing_indicator() {
92111 tryCompare(scopes, "loaded", true);
93112
tests/qmltests/Greeter/tst_Lockscreen.qml+11−5
@@ -18,8 +18,9 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import ".."
2020import "../../../qml/Components"
21−import Ubuntu.Components 0.1
21+import AccountsService 0.1
2222import LightDM 0.1 as LightDM
23+import Ubuntu.Components 0.1
2324import Unity.Test 0.1 as UT
2425
2526Rectangle {
@@ -53,11 +54,16 @@ Rectangle {
5354 }
5455 }
5556
57+ function setUser(username) {
58+ AccountsService.user = username
59+ LightDM.Greeter.authenticate(username)
60+ }
61+
5662 Connections {
5763 target: LightDM.Greeter
5864
5965 onShowPrompt: {
60− if (text === "PIN") {
66+ if (AccountsService.passwordDisplayHint === AccountsService.Numeric) {
6167 pinPadCheckBox.checked = false
6268 } else {
6369 pinPadCheckBox.checked = true
@@ -139,12 +145,12 @@ Rectangle {
139145 Button {
140146 text: "start auth (1234)"
141147 width: parent.width
142− onClicked: LightDM.Greeter.authenticate("has-pin")
148+ onClicked: setUser("has-pin")
143149 }
144150 Button {
145151 text: "start auth (password)"
146152 width: parent.width
147− onClicked: LightDM.Greeter.authenticate("has-password")
153+ onClicked: setUser("has-password")
148154 }
149155
150156 TextField {
@@ -255,7 +261,7 @@ Rectangle {
255261 enteredLabel.text = ""
256262 minPinLengthTextField.text = data.minPinLength
257263 maxPinLengthTextField.text = data.maxPinLength
258− LightDM.Greeter.authenticate(data.username)
264+ setUser(data.username)
259265 waitForLockscreenReady();
260266
261267 var inputField = findChild(lockscreen, "pinentryField")
tests/qmltests/Stages/tst_PhoneStage.qml+3−2
@@ -231,9 +231,10 @@ Item {
231231 }
232232
233233 function cleanup() {
234− while (ApplicationManager.count > 0) {
234+ while (ApplicationManager.count > 1) {
235235 var oldCount = ApplicationManager.count;
236− ApplicationManager.stopApplication(ApplicationManager.get(0).appId)
236+ var closingIndex = ApplicationManager.focusedApplicationId == "unity8-dash" ? 1 : 0
237+ ApplicationManager.stopApplication(ApplicationManager.get(closingIndex).appId)
237238 tryCompare(ApplicationManager, "count", oldCount - 1)
238239 }
239240 }
tests/qmltests/tst_Shell.qml+63−280
@@ -56,49 +56,20 @@ Item {
5656 signalName: "sessionStarted"
5757 }
5858
59+ SignalSpy {
60+ id: dashCommunicatorSpy
61+ signalName: "setCurrentScopeCalled"
62+ }
63+
5964 UT.UnityTestCase {
6065 name: "Shell"
6166 when: windowShown
6267
6368 function initTestCase() {
64− var ok = false;
65− var attempts = 0;
66− var maxAttempts = 1000;
67−
68− // Qt loads a qml scene asynchronously. So early on, some findChild() calls made in
69− // tests may fail because the desired child item wasn't loaded yet.
70− // Thus here we try to ensure the scene has been fully loaded before proceeding with the tests.
71− // As I couldn't find an API in QQuickView & friends to tell me that the scene is 100% loaded
72− // (all items instantiated, etc), I resort to checking the existence of some key items until
73− // repeatedly until they're all there.
74− do {
75− var dashContentList = findChild(shell, "dashContentList");
76− waitForRendering(dashContentList);
77− var homeLoader = findChild(dashContentList, "clickscope loader");
78− ok = homeLoader !== null
79− && homeLoader.item !== undefined;
80−
81− var greeter = findChild(shell, "greeter");
82− ok &= greeter !== null;
83−
84− var launcherPanel = findChild(shell, "launcherPanel");
85− ok &= launcherPanel !== null;
86−
87− attempts++;
88− if (!ok) {
89− console.log("Attempt " + attempts + " failed. Waiting a bit before trying again.");
90− // wait a bit before retrying
91− wait(100);
92− } else {
93− console.log("All seem fine after " + attempts + " attempts.");
94− }
95− } while (!ok && attempts <= maxAttempts);
96−
97− verify(ok);
98−
9969 swipeAwayGreeter();
10070
10171 sessionSpy.target = findChild(shell, "greeter")
72+ dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
10273 }
10374
10475 function cleanup() {
@@ -111,56 +82,16 @@ Item {
11182 // kill all (fake) running apps
11283 killApps(ApplicationManager);
11384
114− var dashContent = findChild(shell, "dashContent");
115− dashContent.closePreview();
116−
117− var dashHome = findChild(shell, "clickscope loader");
118− swipeUntilScopeViewIsReached(dashHome);
119−
85+ waitForUIToSettle();
12086 hideIndicators();
12187 }
12288
123− function killApps(apps) {
124− if (!apps) return;
125− while (apps.count > 0) {
126− ApplicationManager.stopApplication(apps.get(0).appId);
89+ function killApps() {
90+ while (ApplicationManager.count > 1) {
91+ var appIndex = ApplicationManager.get(0).appId == "unity8-dash" ? 1 : 0
92+ ApplicationManager.stopApplication(ApplicationManager.get(appIndex).appId);
12793 }
128− compare(ApplicationManager.count, 0)
129− }
130−
131− /*
132− Test the effect of a right-edge drag on the dash in 3 situations:
133− 1 - when no application has been launched yet
134− 2 - when there's a minimized application
135− 3 - after the last running application has been closed/stopped
136−
137− The behavior of Dash on 3 should be the same as on 1.
138− */
139− function test_rightEdgeDrag() {
140− checkRightEdgeDragWithNoRunningApps();
141−
142− dragLauncherIntoView();
143−
144− // Launch an app from the launcher
145− tapOnAppIconInLauncher();
146− waitUntilApplicationWindowIsFullyVisible();
147−
148− // Minimize the application we just launched
149− swipeFromLeftEdge(units.gu(27));
150−
151− waitForUIToSettle();
152−
153− checkRightEdgeDragWithMinimizedApp();
154−
155− // Minimize that application once again
156− swipeFromLeftEdge(units.gu(27));
157−
158− // Right edge behavior should now be the same as before that app,
159− // was launched. Manually cleanup beforehand to get to initial
160− // state.
161− cleanup();
162− waitForUIToSettle();
163− checkRightEdgeDragWithNoRunningApps();
94+ compare(ApplicationManager.count, 1)
16495 }
16596
16697 function test_leftEdgeDrag_data() {
@@ -183,7 +114,7 @@ Item {
183114
184115 swipeFromLeftEdge(data.swipeLength);
185116 if (data.appHides)
186− waitUntilApplicationWindowIsFullyHidden();
117+ waitUntilDashIsFocused();
187118 else
188119 waitUntilApplicationWindowIsFullyVisible();
189120 }
@@ -239,100 +170,18 @@ Item {
239170 waitForRendering(greeter);
240171 }
241172
242− /*
243− Perform a right-edge drag when the Dash is being show and there are
244− no running/minimized apps to be restored.
245−
246− The expected behavior is that an animation should be played to hint the
247− user that his right-edge drag gesture has been successfully recognized
248− but there is no application to be brought to foreground.
249− */
250− function checkRightEdgeDragWithNoRunningApps() {
251− var touchX = shell.width - (shell.edgeSize / 2);
252− var touchY = shell.height / 2;
253−
254− var dash = findChild(shell, "dash");
255− // check that dash has normal scale and opacity
256− tryCompare(dash, "contentScale", 1.0);
257− tryCompare(dash, "opacity", 1.0);
258−
259− touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY,
260− true /* beginTouch */, false /* endTouch */, units.gu(10), 50);
261−
262− // check that Dash has been scaled down and had its opacity reduced
263− tryCompareFunction(function() { return dash.contentScale <= 0.9; }, true);
264− tryCompareFunction(function() { return dash.opacity <= 0.5; }, true);
265−
266− touchRelease(shell, shell.width * 0.1, touchY);
267−
268− // and now everything should have gone back to normal
269− tryCompare(dash, "contentScale", 1.0);
270− tryCompare(dash, "opacity", 1.0);
271− }
272−
273− /*
274− Perform a right-edge drag when the Dash is being show and there is
275− a running/minimized app to be restored.
276−
277− The expected behavior is that the dash should fade away and ultimately be
278− made invisible once the gesture is finished as the restored app will now
279− be on foreground.
280− */
281− function checkRightEdgeDragWithMinimizedApp() {
282− var touchX = shell.width - (shell.edgeSize / 2);
283− var touchY = shell.height / 2;
284−
285− var dash = findChild(shell, "dash");
286− // check that dash has normal scale and opacity
287− tryCompare(dash, "contentScale", 1.0);
288− tryCompare(dash, "opacity", 1.0);
289−
290− touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY,
291− true /* beginTouch */, false /* endTouch */, units.gu(10), 50);
292−
293− // check that Dash has been scaled down and had its opacity reduced
294− tryCompareFunction(function() { return dash.contentScale <= 0.9; }, true);
295− tryCompareFunction(function() { return dash.opacity <= 0.5; }, true);
296−
297− touchRelease(shell, shell.width * 0.1, touchY);
298−
299− // dash should have gone away, now that the app is on foreground
300− tryCompare(dash, "visible", false);
301− }
302−
303173 /*
304174 Regression test for bug https://bugs.launchpad.net/touch-preview-images/+bug/1193419
305175
306− When the user minimizes an application (left-edge swipe) he should always end up in the "Running Apps"
307− category of the "Applications" scope view.
176+ When the user minimizes an application (left-edge swipe) he should always end up in the
177+ "Applications" scope view.
308178
309179 Steps:
310− - go to apps lens
311− - scroll to the bottom
312− - reveal launcher and launch an app
180+ - reveal launcher and launch an app that covers the dash
313181 - perform long left edge swipe to go minimize the app and go back to the dash.
314−
315− Expected Results
316− - apps lens shown and Running Apps visible on screen
182+ - verify the setCurrentScope() D-Bus call to the dash has been called for the correct scope id.
317183 */
318− function test_minimizingAppTakesToRunningApps() {
319− var dashApps = findChild(shell, "clickscope");
320− swipeUntilScopeViewIsReached(dashApps);
321−
322− // swipe finger up until the running/recent apps section (which we assume
323− // it's the first one) is as far from view as possible.
324− // We also assume that DashApps is tall enough that it's scrollable
325− var appsCategoryListView = findChild(dashApps, "categoryListView");
326− while (!appsCategoryListView.atYEnd) {
327− swipeUpFromCenter();
328− tryCompare(appsCategoryListView, "moving", false);
329− }
330−
331− // Switch away from the Applications scope.
332− swipeRightFromCenter();
333− waitUntilItemStopsMoving(dashApps);
334− verify(!itemIsOnScreen(dashApps));
335−
184+ function test_minimizingAppTakesToDashApps() {
336185 dragLauncherIntoView();
337186
338187 // Launch an app from the launcher
@@ -340,23 +189,16 @@ Item {
340189
341190 waitUntilApplicationWindowIsFullyVisible();
342191
343− // Dragging launcher into view with a little bit of gap (units.gu(1)) should switch to Apps scope
344− dragLauncherIntoView();
345− verify(itemIsOnScreen(dashApps));
192+ verify(ApplicationManager.focusedApplicationId !== "unity8-dash")
346193
194+ dashCommunicatorSpy.clear();
347195 // Minimize the application we just launched
348196 swipeFromLeftEdge(units.gu(27));
349197
350− // Wait for the whole UI to settle down
351− waitUntilApplicationWindowIsFullyHidden();
352− waitUntilItemStopsMoving(dashApps);
353− tryCompare(appsCategoryListView, "moving", false);
198+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
354199
355− verify(itemIsOnScreen(dashApps));
356−
357− var runningApplicationsGrid = findChild(appsCategoryListView, "running.apps.category");
358− verify(runningApplicationsGrid);
359− verify(itemIsOnScreen(runningApplicationsGrid));
200+ compare(dashCommunicatorSpy.count, 1);
201+ compare(dashCommunicatorSpy.signalArguments[0][0], "clickscope");
360202 }
361203
362204 function test_showInputMethod() {
@@ -413,9 +255,14 @@ Item {
413255
414256 // Wait for the whole UI to settle down
415257 function waitForUIToSettle() {
416− waitUntilApplicationWindowIsFullyHidden();
417− var dashContentList = findChild(shell, "dashContentList");
418− tryCompare(dashContentList, "moving", false);
258+ var launcher = findChild(shell, "launcherPanel")
259+ tryCompareFunction(function() {return launcher.x === 0 || launcher.x === -launcher.width;}, true);
260+ if (launcher.x === 0) {
261+ mouseClick(shell, shell.width / 2, shell.height / 2)
262+ }
263+ tryCompare(launcher, "x", -launcher.width)
264+
265+ waitForRendering(shell)
419266 }
420267
421268 function dragToCloseIndicatorsPanel() {
@@ -472,24 +319,13 @@ Item {
472319 }
473320
474321 function waitUntilApplicationWindowIsFullyVisible() {
475− var underlay = findChild(shell, "underlay");
476− tryCompare(underlay, "visible", false);
477− }
478−
479− function waitUntilApplicationWindowIsFullyHidden() {
480− var stages = findChild(shell, "stages");
481− tryCompare(stages, "fullyHidden", true);
322+ var appDelegate = findChild(shell, "appDelegate0")
323+ var surfaceContainer = findChild(appDelegate, "surfaceContainer");
324+ tryCompareFunction(function() { return surfaceContainer.surface !== null; }, true);
482325 }
483326
484− function swipeUntilScopeViewIsReached(scopeView) {
485− while (!itemIsOnScreen(scopeView)) {
486− if (itemIsToLeftOfScreen(scopeView)) {
487− swipeRightFromCenter();
488− } else {
489− swipeLeftFromCenter();
490− }
491− waitUntilItemStopsMoving(scopeView);
492− }
327+ function waitUntilDashIsFocused() {
328+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
493329 }
494330
495331 function swipeFromLeftEdge(swipeLength) {
@@ -498,24 +334,6 @@ Item {
498334 touchFlick(shell, touchStartX, touchStartY, swipeLength, touchStartY);
499335 }
500336
501− function swipeLeftFromCenter() {
502− var touchStartX = shell.width * 3 / 4;
503− var touchStartY = shell.height / 2;
504− touchFlick(shell, touchStartX, touchStartY, 0, touchStartY);
505− }
506−
507− function swipeRightFromCenter() {
508− var touchStartX = shell.width * 3 / 4;
509− var touchStartY = shell.height / 2;
510− touchFlick(shell, touchStartX, touchStartY, shell.width, touchStartY);
511− }
512−
513− function swipeUpFromCenter() {
514− var touchStartX = shell.width / 2;
515− var touchStartY = shell.height / 2;
516− touchFlick(shell, touchStartX, touchStartY, touchStartX, 0);
517− }
518−
519337 function itemIsOnScreen(item) {
520338 var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
521339
@@ -525,64 +343,6 @@ Item {
525343 && itemRectInShell.y + itemRectInShell.height <= shell.height;
526344 }
527345
528− function itemIsToLeftOfScreen(item) {
529− var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
530− return itemRectInShell.x < 0;
531− }
532−
533− function waitUntilItemStopsMoving(item) {
534− var itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
535− var previousX = itemRectInShell.x;
536− var previousY = itemRectInShell.y;
537− var isStill = false;
538−
539− do {
540− wait(100);
541− itemRectInShell = item.mapToItem(shell, 0, 0, item.width, item.height);
542− if (itemRectInShell.x == previousX && itemRectInShell.y == previousY) {
543− isStill = true;
544− } else {
545− previousX = itemRectInShell.x;
546− previousY = itemRectInShell.y;
547− }
548− } while (!isStill);
549− }
550−
551− function test_DashShown_data() {
552− return [
553− {tag: "in focus", greeter: false, app: false, launcher: false, indicators: false, expectedShown: true},
554− {tag: "under greeter", greeter: true, app: false, launcher: false, indicators: false, expectedShown: false},
555− {tag: "under app", greeter: false, app: true, launcher: false, indicators: false, expectedShown: false},
556− {tag: "under launcher", greeter: false, app: false, launcher: true, indicators: false, expectedShown: true},
557− {tag: "under indicators", greeter: false, app: false, launcher: false, indicators: true, expectedShown: false},
558− ]
559− }
560−
561− function test_DashShown(data) {
562− if (data.greeter) {
563− // Swipe the greeter in
564− var greeter = findChild(shell, "greeter");
565− Powerd.displayPowerStateChange(Powerd.Off, 0);
566− tryCompare(greeter, "showProgress", 1);
567− }
568−
569− if (data.app) {
570− dragLauncherIntoView();
571− tapOnAppIconInLauncher();
572− }
573−
574− if (data.launcher) {
575− dragLauncherIntoView();
576− }
577−
578− if (data.indicators) {
579− showIndicators();
580− }
581−
582− var dash = findChild(shell, "dash");
583− tryCompare(dash, "shown", data.expectedShown);
584− }
585−
586346 function test_focusRequestedHidesGreeter() {
587347 var greeter = findChild(shell, "greeter");
588348
@@ -591,10 +351,9 @@ Item {
591351 tryCompareFunction(function() { return app.surface != null }, true);
592352
593353 // Minimize the application we just launched
594− swipeFromLeftEdge(units.gu(27));
354+ swipeFromLeftEdge(units.gu(26) + 1);
595355
596− // Wait for the whole UI to settle down
597− waitUntilApplicationWindowIsFullyHidden();
356+ waitUntilDashIsFocused();
598357
599358 greeter.show();
600359 tryCompare(greeter, "showProgress", 1);
@@ -610,8 +369,9 @@ Item {
610369
611370 showIndicators();
612371
372+ var oldCount = ApplicationManager.count;
613373 ApplicationManager.startApplication("camera-app");
614− tryCompare(ApplicationManager, "count", 1);
374+ tryCompare(ApplicationManager, "count", oldCount + 1);
615375
616376 tryCompare(indicators, "fullyClosed", true);
617377 }
@@ -620,6 +380,7 @@ Item {
620380 function test_showGreeterDBusCall() {
621381 var greeter = findChild(shell, "greeter")
622382 tryCompare(greeter, "showProgress", 0)
383+ waitForRendering(greeter);
623384 LightDM.Greeter.showGreeter()
624385 tryCompare(greeter, "showProgress", 1)
625386 }
@@ -628,6 +389,7 @@ Item {
628389 sessionSpy.clear()
629390
630391 var greeter = findChild(shell, "greeter")
392+ waitForRendering(greeter)
631393 greeter.show()
632394 tryCompare(greeter, "showProgress", 1)
633395
@@ -648,5 +410,26 @@ Item {
648410 ApplicationManager.requestFocusApplication("gallery-app");
649411 tryCompare(panel, "fullscreenMode", false);
650412 }
413+
414+ function test_leftEdgeDragFullscreen() {
415+ var panel = findChild(shell, "panel");
416+ tryCompare(panel, "fullscreenMode", false)
417+
418+ ApplicationManager.startApplication("camera-app");
419+ tryCompare(panel, "fullscreenMode", true)
420+
421+ var touchStartX = 2;
422+ var touchStartY = shell.height / 2;
423+
424+ touchFlick(shell, touchStartX, touchStartY, units.gu(2), touchStartY, true, false);
425+
426+ compare(panel.fullscreenMode, true);
427+
428+ touchFlick(shell, units.gu(2), touchStartY, units.gu(10), touchStartY, false, false);
429+
430+ tryCompare(panel, "fullscreenMode", false);
431+
432+ touchRelease(shell);
433+ }
651434 }
652435}
tests/qmltests/tst_ShellWithPin.qml+4−37
@@ -58,40 +58,6 @@ Item {
5858 when: windowShown
5959
6060 function initTestCase() {
61− var ok = false;
62− var attempts = 0;
63− var maxAttempts = 1000;
64−
65− // Qt loads a qml scene asynchronously. So early on, some findChild() calls made in
66− // tests may fail because the desired child item wasn't loaded yet.
67− // Thus here we try to ensure the scene has been fully loaded before proceeding with the tests.
68− // As I couldn't find an API in QQuickView & friends to tell me that the scene is 100% loaded
69− // (all items instantiated, etc), I resort to checking the existence of some key items until
70− // repeatedly until they're all there.
71− do {
72− var dashContentList = findChild(shell, "dashContentList");
73− waitForRendering(dashContentList);
74− var homeLoader = findChild(dashContentList, "clickscope loader");
75− ok = homeLoader !== null
76− && homeLoader.item !== undefined;
77−
78− var greeter = findChild(shell, "greeter");
79− ok &= greeter !== null;
80−
81− var launcherPanel = findChild(shell, "launcherPanel");
82− ok &= launcherPanel !== null;
83−
84− attempts++;
85− if (!ok) {
86− console.log("Attempt " + attempts + " failed. Waiting a bit before trying again.");
87− // wait a bit before retrying
88− wait(100);
89− } else {
90− console.log("All seem fine after " + attempts + " attempts.");
91− }
92− } while (!ok && attempts <= maxAttempts);
93−
94− verify(ok);
9561
9662 sessionSpy.target = findChild(shell, "greeter")
9763 }
@@ -110,10 +76,11 @@ Item {
11076 }
11177
11278 function killApps() {
113− while (ApplicationManager.count > 0) {
114− ApplicationManager.stopApplication(ApplicationManager.get(0).appId)
79+ while (ApplicationManager.count > 1) {
80+ var appIndex = ApplicationManager.get(0).appId == "unity8-dash" ? 1 : 0
81+ ApplicationManager.stopApplication(ApplicationManager.get(appIndex).appId);
11582 }
116− compare(ApplicationManager.count, 0)
83+ compare(ApplicationManager.count, 1)
11784 }
11885
11986 function swipeAwayGreeter() {