Merge lp:~zsombi/ubuntu-ui-toolkit/staging-rollback-1350 into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Merged at revision: 1353
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/staging-rollback-1350
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 1566 lines (+24/-1300)
30 files modified
components.api (+0/-12)
examples/customtheme/customtheme.apparmor (+0/-8)
examples/customtheme/customtheme.desktop (+0/-8)
examples/customtheme/customtheme.qmlproject (+0/-59)
examples/customtheme/main.qml (+0/-103)
examples/customtheme/manifest.json (+0/-15)
examples/customtheme/theme/Palette.qml (+0/-24)
examples/customtheme/theme/parent_theme (+0/-1)
modules/Ubuntu/Components/AbstractButton.qml (+1/-1)
modules/Ubuntu/Components/MainView.qml (+0/-16)
modules/Ubuntu/Components/Themes/Ambiance/MainViewStyle.qml (+17/-0)
modules/Ubuntu/Components/plugin/adapters/dbuspropertywatcher_p.cpp (+0/-226)
modules/Ubuntu/Components/plugin/adapters/dbuspropertywatcher_p.h (+0/-55)
modules/Ubuntu/Components/plugin/plugin.cpp (+0/-2)
modules/Ubuntu/Components/plugin/plugin.pro (+2/-7)
modules/Ubuntu/Components/plugin/ucserviceproperties.cpp (+0/-317)
modules/Ubuntu/Components/plugin/ucserviceproperties.h (+0/-83)
modules/Ubuntu/Components/plugin/ucserviceproperties_p.h (+0/-53)
modules/Ubuntu/Components/plugin/uctheme.cpp (+1/-3)
tests/unit_x11/tst_serviceproperties/IncomingCallVibrateWatcher.qml (+0/-31)
tests/unit_x11/tst_serviceproperties/InvalidPropertyWatcher.qml (+0/-31)
tests/unit_x11/tst_serviceproperties/InvalidPropertyWatcher2.qml (+0/-32)
tests/unit_x11/tst_serviceproperties/tst_serviceproperties.cpp (+0/-132)
tests/unit_x11/tst_serviceproperties/tst_serviceproperties.pro (+0/-8)
tests/unit_x11/tst_theme_engine/AppTheme/Palette.qml (+0/-24)
tests/unit_x11/tst_theme_engine/AppTheme/parent_theme (+0/-1)
tests/unit_x11/tst_theme_engine/TestApp.qml (+0/-29)
tests/unit_x11/tst_theme_engine/tst_theme_engine.pro (+1/-3)
tests/unit_x11/tst_theme_engine/tst_theme_enginetest.cpp (+1/-14)
tests/unit_x11/unit_x11.pro (+1/-2)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/staging-rollback-1350
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+243483@code.launchpad.net

Commit message

Rollback to revision 1350.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2014-11-28 08:19:13 +0000
3+++ components.api 2014-12-03 06:01:02 +0000
4@@ -912,18 +912,6 @@
5 Property { name: "source"; type: "QUrl" }
6 Signal { name: "extendedSourceChanged" }
7 Signal { name: "extendedSourceChanged" }
8- name: "UCServiceProperties"
9- prototype: "QObject"
10- exports: ["ServiceProperties 1.1"]
11- name: "ServiceType"
12- name: "Status"
13- Property { name: "type"; revision: 1; type: "ServiceType" }
14- Property { name: "service"; revision: 1; type: "string" }
15- Property { name: "path"; revision: 1; type: "string" }
16- Property { name: "serviceInterface"; revision: 1; type: "string" }
17- Property { name: "adaptorInterface"; revision: 1; type: "string" }
18- Property { name: "error"; revision: 1; type: "string"; isReadonly: true }
19- Property { name: "status"; revision: 1; type: "Status"; isReadonly: true }
20 name: "UCStateSaver"
21 prototype: "QObject"
22 exports: ["StateSaver 0.1", "StateSaver 1.0"]
23
24=== removed directory 'examples/customtheme'
25=== removed file 'examples/customtheme/customtheme.apparmor'
26--- examples/customtheme/customtheme.apparmor 2014-11-28 09:06:48 +0000
27+++ examples/customtheme/customtheme.apparmor 1970-01-01 00:00:00 +0000
28@@ -1,8 +0,0 @@
29-{
30- "policy_groups": [
31- "networking"
32- ],
33- "policy_version": 1.2
34-}
35-
36-
37
38=== removed file 'examples/customtheme/customtheme.desktop'
39--- examples/customtheme/customtheme.desktop 2014-11-28 09:06:48 +0000
40+++ examples/customtheme/customtheme.desktop 1970-01-01 00:00:00 +0000
41@@ -1,8 +0,0 @@
42-[Desktop Entry]
43-Name=customtheme
44-Exec=qmlscene $@ main.qml
45-Icon=customtheme.png
46-Terminal=false
47-Type=Application
48-X-Ubuntu-Touch=true
49-
50
51=== removed file 'examples/customtheme/customtheme.qmlproject'
52--- examples/customtheme/customtheme.qmlproject 2014-11-28 09:06:48 +0000
53+++ examples/customtheme/customtheme.qmlproject 1970-01-01 00:00:00 +0000
54@@ -1,59 +0,0 @@
55-import QmlProject 1.1
56-
57-Project {
58- mainFile: "main.qml"
59-
60- /* Include .qml, .js, and image files from current directory and subdirectories */
61- QmlFiles {
62- directory: "."
63- }
64- JavaScriptFiles {
65- directory: "."
66- }
67- ImageFiles {
68- directory: "."
69- }
70- Files {
71- filter: "*.desktop"
72- }
73- Files {
74- filter: "www/*.html"
75- }
76- Files {
77- filter: "Makefile"
78- }
79- Files {
80- filter: "*.apparmor"
81- }
82- Files {
83- directory: "."
84- paths: ["manifest.json",".excludes"]
85- }
86- Files {
87- directory: "www"
88- filter: "*"
89- }
90- Files {
91- directory: "www/img/"
92- filter: "*"
93- }
94- Files {
95- directory: "www/css/"
96- filter: "*"
97- }
98- Files {
99- directory: "www/js/"
100- filter: "*"
101- }
102- Files {
103- directory: "tests/"
104- filter: "*"
105- }
106- Files {
107- directory: "debian"
108- filter: "*"
109- }
110- /* List of plugin directories passed to QML runtime */
111- importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ]
112-}
113-
114
115=== removed file 'examples/customtheme/main.qml'
116--- examples/customtheme/main.qml 2014-11-28 09:06:48 +0000
117+++ examples/customtheme/main.qml 1970-01-01 00:00:00 +0000
118@@ -1,103 +0,0 @@
119-/*
120- * Copyright 2014 Canonical Ltd.
121- *
122- * This program is free software; you can redistribute it and/or modify
123- * it under the terms of the GNU Lesser General Public License as published by
124- * the Free Software Foundation; version 3.
125- *
126- * This program is distributed in the hope that it will be useful,
127- * but WITHOUT ANY WARRANTY; without even the implied warranty of
128- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129- * GNU Lesser General Public License for more details.
130- *
131- * You should have received a copy of the GNU Lesser General Public License
132- * along with this program. If not, see <http://www.gnu.org/licenses/>.
133- */
134-
135-import QtQuick 2.0
136-import Ubuntu.Components 1.1
137-
138-/*!
139- \brief MainView with a Label and Button elements.
140-*/
141-
142-MainView {
143- id: mainView
144- // objectName for functional testing purposes (autopilot-qt5)
145- objectName: "mainView"
146-
147- // Note! applicationName needs to match the "name" field of the click manifest
148- applicationName: "customtheme"
149-
150- /*
151- This property enables the application to change orientation
152- when the device is rotated. The default is false.
153- */
154- //automaticOrientation: true
155-
156- // Removes the old toolbar and enables new features of the new header.
157- useDeprecatedToolbar: false
158-
159- width: units.gu(100)
160- height: units.gu(75)
161-
162- Component.onCompleted: Theme.name = "theme"
163-
164- Page {
165- title: i18n.tr("Theme sample")
166-
167- Column {
168- spacing: units.gu(1)
169- anchors {
170- margins: units.gu(2)
171- fill: parent
172- }
173-
174- Label {
175- text: i18n.tr("Theme.name:") + " " + Theme.name
176- }
177-
178- Button {
179- width: parent.width
180- text: i18n.tr("Light background")
181-
182- onClicked: {
183- mainView.backgroundColor = "white";
184- }
185- }
186- Button {
187- width: parent.width
188- text: i18n.tr("Dark background")
189-
190- onClicked: {
191- mainView.backgroundColor = "blue";
192- }
193- }
194- Button {
195- width: parent.width
196- text: i18n.tr("Set Ambiance theme")
197-
198- onClicked: {
199- Theme.name = "Ubuntu.Components.Themes.Ambiance";
200- }
201- }
202- Button {
203- width: parent.width
204- text: i18n.tr("Set SuruDark theme")
205-
206- onClicked: {
207- Theme.name = "Ubuntu.Components.Themes.SuruDark";
208- }
209- }
210- Button {
211- width: parent.width
212- text: i18n.tr("Application theme")
213-
214- onClicked: {
215- Theme.name = "theme";
216- }
217- }
218- }
219- }
220-}
221-
222
223=== removed file 'examples/customtheme/manifest.json'
224--- examples/customtheme/manifest.json 2014-11-28 09:06:48 +0000
225+++ examples/customtheme/manifest.json 1970-01-01 00:00:00 +0000
226@@ -1,15 +0,0 @@
227-{
228- "architecture": "all",
229- "description": "description of customtheme",
230- "framework": "ubuntu-sdk-14.10-dev2",
231- "hooks": {
232- "customtheme": {
233- "apparmor": "customtheme.apparmor",
234- "desktop": "customtheme.desktop"
235- }
236- },
237- "maintainer": "Zsombor Egri <zsombor.egri@canonical.com>",
238- "name": "customtheme",
239- "title": "customtheme",
240- "version": "0.1"
241-}
242
243=== removed directory 'examples/customtheme/theme'
244=== removed file 'examples/customtheme/theme/Palette.qml'
245--- examples/customtheme/theme/Palette.qml 2014-11-28 09:06:48 +0000
246+++ examples/customtheme/theme/Palette.qml 1970-01-01 00:00:00 +0000
247@@ -1,24 +0,0 @@
248-/*
249- * Copyright 2014 Canonical Ltd.
250- *
251- * This program is free software; you can redistribute it and/or modify
252- * it under the terms of the GNU Lesser General Public License as published by
253- * the Free Software Foundation; version 3.
254- *
255- * This program is distributed in the hope that it will be useful,
256- * but WITHOUT ANY WARRANTY; without even the implied warranty of
257- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
258- * GNU Lesser General Public License for more details.
259- *
260- * You should have received a copy of the GNU Lesser General Public License
261- * along with this program. If not, see <http://www.gnu.org/licenses/>.
262- */
263-
264-import QtQuick 2.0
265-import Ubuntu.Components 1.1
266-import Ubuntu.Components.Themes.SuruDark 1.1 as Suru
267-
268-Suru.Palette {
269- normal.background: "#A21E1C"
270- selected.backgroundText: "lightblue"
271-}
272
273=== removed file 'examples/customtheme/theme/parent_theme'
274--- examples/customtheme/theme/parent_theme 2014-11-28 09:06:48 +0000
275+++ examples/customtheme/theme/parent_theme 1970-01-01 00:00:00 +0000
276@@ -1,1 +0,0 @@
277-Ubuntu.Components.Themes.SuruDark
278
279=== modified file 'modules/Ubuntu/Components/AbstractButton.qml'
280--- modules/Ubuntu/Components/AbstractButton.qml 2014-11-28 08:19:13 +0000
281+++ modules/Ubuntu/Components/AbstractButton.qml 2014-12-03 06:01:02 +0000
282@@ -102,7 +102,7 @@
283
284 onClicked: {
285 if (button.__acceptEvents) {
286- pressEffect.start();
287+ pressEffect.start()
288 button.clicked()
289 }
290 }
291
292=== modified file 'modules/Ubuntu/Components/MainView.qml'
293--- modules/Ubuntu/Components/MainView.qml 2014-11-28 09:06:48 +0000
294+++ modules/Ubuntu/Components/MainView.qml 2014-12-03 06:01:02 +0000
295@@ -205,22 +205,6 @@
296 property color headerColor: backgroundColor
297 property color backgroundColor: Theme.palette.normal.background
298 property color footerColor: backgroundColor
299-
300- /*
301- As we don't know the order the property bindings and onXXXChanged signals are evaluated
302- we should rely only on one property when changing the theme to avoid intermediate
303- theme changes due to properties being evaluated separately.
304-
305- Qt bug: https://bugreports.qt-project.org/browse/QTBUG-11712
306- */
307- property string theme: (ColorUtils.luminance(backgroundColor) >= 0.85) ?
308- "Ambiance" : "SuruDark"
309- onThemeChanged: {
310- // only change the theme if the current one is a system one.
311- if (theme !== "" && (Theme.name.search("Ubuntu.Components.Themes") >= 0)) {
312- Theme.name = "Ubuntu.Components.Themes.%1".arg(theme);
313- }
314- }
315 }
316
317 /*!
318
319=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/MainViewStyle.qml'
320--- modules/Ubuntu/Components/Themes/Ambiance/MainViewStyle.qml 2014-11-28 09:06:48 +0000
321+++ modules/Ubuntu/Components/Themes/Ambiance/MainViewStyle.qml 2014-12-03 06:01:02 +0000
322@@ -55,5 +55,22 @@
323 id: internals
324 property bool isGradient: styledItem.backgroundColor != styledItem.headerColor ||
325 styledItem.backgroundColor != styledItem.footerColor
326+ /*
327+ As we don't know the order the property bindings and onXXXChanged signals are evaluated
328+ we should rely only on one property when changing the theme to avoid intermediate
329+ theme changes due to properties being evaluated separately.
330+
331+ Qt bug: https://bugreports.qt-project.org/browse/QTBUG-11712
332+ */
333+ property string theme: (ColorUtils.luminance(styledItem.backgroundColor) >= 0.85) ? "Ambiance" :
334+ (isGradient ? "SuruGradient" : "SuruDark")
335+ }
336+
337+ // automatically select the appropriate theme depending on the background colors
338+ Binding {
339+ target: Theme
340+ property: "name"
341+ value: "Ubuntu.Components.Themes.%1".arg(internals.theme)
342+ when: internals.theme !== ""
343 }
344 }
345
346=== removed file 'modules/Ubuntu/Components/plugin/adapters/dbuspropertywatcher_p.cpp'
347--- modules/Ubuntu/Components/plugin/adapters/dbuspropertywatcher_p.cpp 2014-11-28 08:19:13 +0000
348+++ modules/Ubuntu/Components/plugin/adapters/dbuspropertywatcher_p.cpp 1970-01-01 00:00:00 +0000
349@@ -1,226 +0,0 @@
350-/*
351- * Copyright 2014 Canonical Ltd.
352- *
353- * This program is free software; you can redistribute it and/or modify
354- * it under the terms of the GNU Lesser General Public License as published by
355- * the Free Software Foundation; version 3.
356- *
357- * This program is distributed in the hope that it will be useful,
358- * but WITHOUT ANY WARRANTY; without even the implied warranty of
359- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
360- * GNU Lesser General Public License for more details.
361- *
362- * You should have received a copy of the GNU Lesser General Public License
363- * along with this program. If not, see <http://www.gnu.org/licenses/>.
364- */
365-
366-#include "dbuspropertywatcher_p.h"
367-#include <QtDBus/QDBusReply>
368-#include <unistd.h>
369-#include <sys/types.h>
370-#include "i18n.h"
371-#include <QtQml/QQmlInfo>
372-
373-#define DYNAMIC_PROPERTY "__q_property"
374-
375-UCServicePropertiesPrivate *createServicePropertiesAdapter(UCServiceProperties *owner)
376-{
377- return new DBusServiceProperties(owner);
378-}
379-
380-DBusServiceProperties::DBusServiceProperties(UCServiceProperties *qq)
381- : UCServicePropertiesPrivate(qq)
382- , connection("")
383- , watcher(0)
384- , iface(0)
385-{
386-}
387-
388-bool DBusServiceProperties::init()
389-{
390- // crear previous connections
391- setStatus(UCServiceProperties::Inactive);
392- delete iface;
393- iface = 0;
394- delete watcher;
395- watcher = 0;
396- setError(QString());
397-
398- if (service.isEmpty() || path.isEmpty()) {
399- setStatus(UCServiceProperties::ConnectionError);
400- setError(UbuntuI18n::instance().tr("No service/path specified"));
401- return false;
402- }
403-
404- switch (type) {
405- case UCServiceProperties::System:
406- {
407- connection = QDBusConnection::systemBus();
408- break;
409- }
410- case UCServiceProperties::Session:
411- {
412- connection = QDBusConnection::sessionBus();
413- break;
414- }
415- default:
416- {
417- setStatus(UCServiceProperties::ConnectionError);
418- setError(UbuntuI18n::instance().tr("Invalid bus type: %1.").arg(type));
419- return false;
420- }
421- }
422-
423- Q_Q(UCServiceProperties);
424- // connect dbus watcher to catch OwnerChanged
425- watcher = new QDBusServiceWatcher(service, connection, QDBusServiceWatcher::WatchForOwnerChange, q);
426- // connect interface
427- iface = new QDBusInterface(service, path, interface, connection, q);
428- if (!iface->isValid()) {
429- setStatus(UCServiceProperties::ConnectionError);
430- setError(iface->lastError().message());
431- return false;
432- }
433- // connect watcher to get owner changes
434- QObject::connect(watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
435- this, SLOT(changeServiceOwner(QString,QString,QString)));
436- return setupInterface();
437-}
438-
439-/*
440- * Connect dbus signal identified by (service, path, iface, name) quaduple to a
441- * slot to receive property changes.
442- */
443-bool DBusServiceProperties::setupInterface()
444-{
445- QDBusReply<QDBusObjectPath> dbusObjectPath = iface->call("FindUserById", qlonglong(getuid()));
446- if (dbusObjectPath.isValid()) {
447- objectPath = dbusObjectPath.value().path();
448- iface->connection().connect(
449- service,
450- objectPath,
451- "org.freedesktop.DBus.Properties",
452- "PropertiesChanged",
453- this,
454- SLOT(updateProperties(QString,QVariantMap,QStringList)));
455- return true;
456- }
457-
458- setStatus(UCServiceProperties::ConnectionError);
459- setError(dbusObjectPath.error().message());
460- return false;
461-}
462-
463-bool DBusServiceProperties::fetchPropertyValues()
464-{
465- scannedProperties = properties;
466- Q_FOREACH(QString property, properties) {
467- readProperty(property);
468- }
469- return true;
470-}
471-
472-/*
473- * Reads a property value from the adaptorInterface asynchronously.
474- */
475-bool DBusServiceProperties::readProperty(const QString &property)
476-{
477- if ((status < UCServiceProperties::Synchronizing) || objectPath.isEmpty()) {
478- return false;
479- }
480- Q_Q(UCServiceProperties);
481- QDBusInterface readIFace(iface->interface(), objectPath, "org.freedesktop.DBus.Properties", connection);
482- if (!readIFace.isValid()) {
483- // report invalid interface only if the property's first letter was with capital one!
484- if (property[0].isUpper()) {
485- qmlInfo(q) << readIFace.lastError().message();
486- }
487- return false;
488- }
489- QDBusPendingCall pending = readIFace.asyncCall("Get", adaptor, property);
490- if (pending.isError()) {
491- qmlInfo(q) << pending.error().message();
492- return false;
493- }
494- QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(pending, q);
495- QObject::connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
496- this, SLOT(readFinished(QDBusPendingCallWatcher*)));
497-
498- // set a dynamic property so we know which property are we reading
499- callWatcher->setProperty(DYNAMIC_PROPERTY, property);
500- return true;
501-}
502-
503-/*
504- * Writes a property value to theadaptorInterface synchronously. It is for pure testing purposes.
505- */
506-bool DBusServiceProperties::testProperty(const QString &property, const QVariant &value)
507-{
508- if (objectPath.isEmpty()) {
509- return false;
510- }
511- QDBusInterface writeIFace(iface->interface(), objectPath, "org.freedesktop.DBus.Properties", connection);
512- if (!writeIFace.isValid()) {
513- // invalid interface
514- return false;
515- }
516- QDBusMessage msg = writeIFace.call("Set", adaptor, property, QVariant::fromValue(QDBusVariant(value)));
517- return msg.type() == QDBusMessage::ReplyMessage;
518-}
519-
520-/*
521- * Slot called when the async read operation finishes.
522- */
523-void DBusServiceProperties::readFinished(QDBusPendingCallWatcher *call)
524-{
525- Q_Q(UCServiceProperties);
526- QDBusPendingReply<QVariant> reply = *call;
527- QString property = call->property(DYNAMIC_PROPERTY).toString();
528- scannedProperties.removeAll(property);
529- if (reply.isError()) {
530- // remove the property from being watched, as it has no property like that
531- properties.removeAll(property);
532- if (property[0].isUpper()) {
533- // report error!
534- qmlInfo(q) << reply.error().message();
535- }
536- } else {
537- // update watched property value
538- // make sure we have lower case when the property value is updated
539- property[0] = property[0].toLower();
540- q->setProperty(property.toLocal8Bit().constData(), reply.value());
541- }
542-
543- if ((status == UCServiceProperties::Synchronizing) && scannedProperties.isEmpty()) {
544- // set status to active
545- setStatus(UCServiceProperties::Active);
546- }
547-
548- // delete watcher
549- call->deleteLater();
550-}
551-
552-/*
553- * Slot called when service owner is changed.
554- */
555-void DBusServiceProperties::changeServiceOwner(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
556-{
557- Q_UNUSED(oldOwner);
558- Q_UNUSED(newOwner);
559- if (serviceName != service) {
560- return;
561- }
562- setupInterface();
563-}
564-
565-/*
566- * Slot called when the properties are changed in the service.
567- */
568-void DBusServiceProperties::updateProperties(const QString &onInterface, const QVariantMap &map, const QStringList &invalidated)
569-{
570- Q_UNUSED(onInterface);
571- Q_UNUSED(map);
572- Q_FOREACH(const QString &property, invalidated) {
573- readProperty(property);
574- }
575-}
576
577=== removed file 'modules/Ubuntu/Components/plugin/adapters/dbuspropertywatcher_p.h'
578--- modules/Ubuntu/Components/plugin/adapters/dbuspropertywatcher_p.h 2014-11-28 08:19:13 +0000
579+++ modules/Ubuntu/Components/plugin/adapters/dbuspropertywatcher_p.h 1970-01-01 00:00:00 +0000
580@@ -1,55 +0,0 @@
581-/*
582- * Copyright 2014 Canonical Ltd.
583- *
584- * This program is free software; you can redistribute it and/or modify
585- * it under the terms of the GNU Lesser General Public License as published by
586- * the Free Software Foundation; version 3.
587- *
588- * This program is distributed in the hope that it will be useful,
589- * but WITHOUT ANY WARRANTY; without even the implied warranty of
590- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
591- * GNU Lesser General Public License for more details.
592- *
593- * You should have received a copy of the GNU Lesser General Public License
594- * along with this program. If not, see <http://www.gnu.org/licenses/>.
595- */
596-
597-#ifndef DBUSPROPERTYWATCHER_P_H
598-#define DBUSPROPERTYWATCHER_P_H
599-
600-#include <QtCore/QObject>
601-#include <QtDBus/QDBusConnection>
602-#include <QtDBus/QDBusServiceWatcher>
603-#include <QtDBus/QDBusInterface>
604-
605-#include "ucserviceproperties_p.h"
606-
607-class QDBusPendingCallWatcher;
608-class DBusServiceProperties : public QObject, public UCServicePropertiesPrivate
609-{
610- Q_OBJECT
611- Q_DECLARE_PUBLIC(UCServiceProperties)
612-public:
613- DBusServiceProperties(UCServiceProperties *qq);
614-
615- bool init();
616- bool fetchPropertyValues();
617- bool readProperty(const QString &property);
618- // for testing purposes only!!!
619- bool testProperty(const QString &property, const QVariant &value);
620-
621- QStringList scannedProperties;
622- QDBusConnection connection;
623- QDBusServiceWatcher *watcher;
624- QDBusInterface *iface;
625- QString objectPath;
626-
627- bool setupInterface();
628-
629-public Q_SLOTS:
630- void readFinished(QDBusPendingCallWatcher *watcher);
631- void changeServiceOwner(const QString &serviceName, const QString &oldOwner, const QString &newOwner);
632- void updateProperties(const QString &iface, const QVariantMap &map, const QStringList &invalidated);
633-};
634-
635-#endif // DBUSPROPERTYWATCHER_P_H
636
637=== modified file 'modules/Ubuntu/Components/plugin/plugin.cpp'
638--- modules/Ubuntu/Components/plugin/plugin.cpp 2014-11-28 08:19:13 +0000
639+++ modules/Ubuntu/Components/plugin/plugin.cpp 2014-12-03 06:01:02 +0000
640@@ -52,7 +52,6 @@
641 #include "ucaction.h"
642 #include "ucactioncontext.h"
643 #include "ucactionmanager.h"
644-#include "ucserviceproperties.h"
645
646 #include <sys/types.h>
647 #include <unistd.h>
648@@ -163,7 +162,6 @@
649 qmlRegisterType<QSortFilterProxyModelQML>(uri, 1, 1, "SortFilterModel");
650 qmlRegisterUncreatableType<FilterBehavior>(uri, 1, 1, "FilterBehavior", "Not instantiable");
651 qmlRegisterUncreatableType<SortBehavior>(uri, 1, 1, "SortBehavior", "Not instantiable");
652- qmlRegisterType<UCServiceProperties, 1>(uri, 1, 1, "ServiceProperties");
653 }
654
655 void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
656
657=== modified file 'modules/Ubuntu/Components/plugin/plugin.pro'
658--- modules/Ubuntu/Components/plugin/plugin.pro 2014-11-28 08:19:13 +0000
659+++ modules/Ubuntu/Components/plugin/plugin.pro 2014-12-03 06:01:02 +0000
660@@ -66,10 +66,7 @@
661 ucaction.h \
662 ucactioncontext.h \
663 ucactionmanager.h \
664- adapters/actionsproxy_p.h \
665- adapters/dbuspropertywatcher_p.h \
666- ucserviceproperties.h \
667- ucserviceproperties_p.h
668+ adapters/actionsproxy_p.h
669
670 SOURCES += plugin.cpp \
671 uctheme.cpp \
672@@ -105,9 +102,7 @@
673 ucaction.cpp \
674 ucactioncontext.cpp \
675 ucactionmanager.cpp \
676- adapters/actionsproxy_p.cpp \
677- adapters/dbuspropertywatcher_p.cpp \
678- ucserviceproperties.cpp
679+ adapters/actionsproxy_p.cpp
680
681 # adapters
682 SOURCES += adapters/alarmsadapter_organizer.cpp
683
684=== removed file 'modules/Ubuntu/Components/plugin/ucserviceproperties.cpp'
685--- modules/Ubuntu/Components/plugin/ucserviceproperties.cpp 2014-11-28 08:19:13 +0000
686+++ modules/Ubuntu/Components/plugin/ucserviceproperties.cpp 1970-01-01 00:00:00 +0000
687@@ -1,317 +0,0 @@
688-/*
689- * Copyright 2014 Canonical Ltd.
690- *
691- * This program is free software; you can redistribute it and/or modify
692- * it under the terms of the GNU Lesser General Public License as published by
693- * the Free Software Foundation; version 3.
694- *
695- * This program is distributed in the hope that it will be useful,
696- * but WITHOUT ANY WARRANTY; without even the implied warranty of
697- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
698- * GNU Lesser General Public License for more details.
699- *
700- * You should have received a copy of the GNU Lesser General Public License
701- * along with this program. If not, see <http://www.gnu.org/licenses/>.
702- */
703-
704-#include "ucserviceproperties.h"
705-#include "ucserviceproperties_p.h"
706-#include "i18n.h"
707-#include <QtQml/QQmlInfo>
708-#include <QtCore/QMetaProperty>
709-#include <QtQml/QQmlProperty>
710-#include <QtQml/private/qqmlproperty_p.h>
711-
712-UCServicePropertiesPrivate::UCServicePropertiesPrivate(UCServiceProperties *qq)
713- : q_ptr(qq)
714- , ready(false)
715- , status(UCServiceProperties::Inactive)
716- , type(UCServiceProperties::System)
717-{
718-}
719-
720-UCServicePropertiesPrivate::~UCServicePropertiesPrivate()
721-{
722-}
723-
724-UCServicePropertiesPrivate *UCServicePropertiesPrivate::get(UCServiceProperties *service)
725-{
726- return service->d_func();
727-}
728-
729-void UCServicePropertiesPrivate::setError(const QString &msg)
730-{
731- if (error == msg) {
732- return;
733- }
734- error = msg;
735- Q_EMIT q_ptr->errorChanged();
736-}
737-
738-void UCServicePropertiesPrivate::setStatus(UCServiceProperties::Status status)
739-{
740- if (this->status == status) {
741- return;
742- }
743- this->status = status;
744- Q_EMIT q_ptr->statusChanged();
745-}
746-
747-void printLocked(UCServiceProperties *owner)
748-{
749- qmlInfo(owner) << UbuntuI18n::instance().tr("Changing connection parameters forbidden.");
750-}
751-
752-/*!
753- * \qmltype ServiceProperties
754- * \instantiates UCServiceProperties
755- * \inqmlmodule Ubuntu.Components 1.1
756- * \since Ubuntu.Components 1.1
757- * \ingroup ubuntu-services
758- * \brief The component enables accessing service properties from QML.
759- *
760- * The services accessed by the component are ones providing their interfaces
761- * through DBus. The component is specialized to read properties exposed by these
762- * services, andf to keep these property values up to date. It is not meant to
763- * access signals or slots exposed, nor to change the values of the properties
764- * watched.
765- *
766- * Properties watched should be declared within the body of the component like
767- * any other QML property, preferably defining a default value for them. The component
768- * will enumerate these properties and will ask the service to provide values for
769- * those. When enumerating properties, each property will be checked twice, with
770- * the case specified as well as with the first letter capitalized.
771- * \qml
772- * import QtQuick 2.3
773- * import Ubuntu.Components 1.1
774- *
775- * ServiceProperties {
776- * service: "org.freenode.AccountsService"
777- * path: "/org/freenode/AccountsService"
778- * serviceInterface: "org.freenode.AccountsService"
779- * adaptorInterface: "com.ubuntu.touch.Accounts.Sound"
780- * // listing properties to watch
781- * // each property name existence will be checked against the current case
782- * // as well as with first character capitalized
783- * property bool incomingCallVibrate: true
784- * }
785- * \endqml
786- *
787- * Note that there are few properties which must be set in order the component
788- * to work. These are \l service, \l path and \l adaptorInterface. Also, once
789- * specified, \l service, \l serviceInterface and \l adaptorInterface values
790- * should not be changed as it cannot be guaranteed that properties watched will
791- * be available on those service. Therefore any change on these properties after
792- * the component completion will be ignored. Property bindings on properties
793- * watched will be ignored as well, as service will report changes in these property
794- * values.
795- *
796- * The service is connected once the component gets completed (Component.onCompleted).
797- * The \l error property specifies any error occured during connection, and the
798- * \l status property notifies whether the connection to the service is active or not.
799- *
800- * \note Pay attention when chosing the service watched, and set your application's
801- * AppArmor rights to ensure a successful service connection.
802- */
803-UCServiceProperties::UCServiceProperties(QObject *parent)
804- : QObject(parent)
805- , d_ptr(createServicePropertiesAdapter(this))
806-{
807-}
808-UCServiceProperties::~UCServiceProperties()
809-{
810- delete d_ptr;
811- d_ptr = 0;
812-}
813-
814-void UCServiceProperties::classBegin()
815-{
816-}
817-
818-void UCServiceProperties::componentComplete()
819-{
820- Q_D(UCServiceProperties);
821- d->ready = true;
822- // enumerate properties
823- const QMetaObject *mo = metaObject();
824- for (int i = mo->propertyOffset(); i < mo->propertyCount(); i++) {
825- const QMetaProperty prop = mo->property(i);
826- QString property(prop.name());
827-
828- // check the binding on the property and warn if there is one.
829- QQmlProperty qmlProperty(this, property);
830- if (QQmlPropertyPrivate::binding(qmlProperty)) {
831- qmlInfo(this) << UbuntuI18n::instance().
832- tr("Binding detected on property '%1' will be removed by the service updates.").
833- arg(property);
834- }
835- // insert both the declared and capitalized first character properties
836- d->properties << property;
837- property[0] = property[0].toUpper();
838- d->properties << property;
839- }
840- // initialize DBus
841- if (d->init()) {
842- d->setStatus(UCServiceProperties::Synchronizing);
843- d->fetchPropertyValues();
844- }
845-}
846-
847-/*!
848- * \qmlproperty enum ServiceProperties::type
849- * Specifies the DBus connection session type. It can get the following values:
850- * \list
851- * \li - \e ServiceProperties.System when system bus is used (default)
852- * \li - \e ServiceProperties.Session when session bus is used
853- * \endlist
854- */
855-UCServiceProperties::ServiceType UCServiceProperties::type() const
856-{
857- Q_D(const UCServiceProperties);
858- return d->type;
859-}
860-void UCServiceProperties::setType(ServiceType type)
861-{
862- Q_D(UCServiceProperties);
863- if (d->type == type) {
864- return;
865- }
866- if (d->ready) {
867- printLocked(this);
868- return;
869- }
870- d->type = type;
871- Q_EMIT typeChanged();
872-}
873-
874-/*!
875- * \qmlproperty string ServiceProperties::service
876- * The proeprty specifies the DBus service URI. It is mandatory to be specified.
877- */
878-QString UCServiceProperties::service() const
879-{
880- Q_D(const UCServiceProperties);
881- return d->service;
882-}
883-void UCServiceProperties::setService(const QString &value)
884-{
885- Q_D(UCServiceProperties);
886- if (d->service == value) {
887- return;
888- }
889- if (d->ready) {
890- printLocked(this);
891- return;
892- }
893- d->service = value;
894- Q_EMIT serviceChanged();
895-}
896-
897-/*!
898- * \qmlproperty string ServiceProperties::path
899- * The property specifies the DBus service connection path. It is mandatory to be
900- * specified.
901- */
902-QString UCServiceProperties::path() const
903-{
904- Q_D(const UCServiceProperties);
905- return d->path;
906-}
907-void UCServiceProperties::setPath(const QString &value)
908-{
909- Q_D(UCServiceProperties);
910- if (d->path == value) {
911- return;
912- }
913- d->path = value;
914- Q_EMIT pathChanged();
915- if (d->ready) {
916- // need to re-initialize connections
917- d->init();
918- }
919-}
920-
921-/*!
922- * \qmlproperty string ServiceProperties::serviceInterface
923- * The property specifies the service intertface. If it is an empty string, the
924- * component will refer to the merging of all interfaces found in the service.
925- */
926-QString UCServiceProperties::interface() const
927-{
928- Q_D(const UCServiceProperties);
929- return d->interface;
930-}
931-void UCServiceProperties::setInterface(const QString &value)
932-{
933- Q_D(UCServiceProperties);
934- if (d->interface == value) {
935- return;
936- }
937- if (d->ready) {
938- printLocked(this);
939- return;
940- }
941- d->interface = value;
942- Q_EMIT serviceInterfaceChanged();
943-}
944-/*!
945- * \qmlproperty string ServiceProperties::adaptorInterface
946- * The proeprty specifies the dbus adaptor interface which provides the properties
947- * watched. This can be a different interface that the one specified in \l serviceInterface,
948- * and in the same way, it can be empty, in which case all the properties from all
949- * interfaces of the service will be watched.
950- */
951-QString UCServiceProperties::adaptor() const
952-{
953- Q_D(const UCServiceProperties);
954- return d->adaptor;
955-}
956-void UCServiceProperties::setAdaptor(const QString &value)
957-{
958- Q_D(UCServiceProperties);
959- if (d->adaptor == value) {
960- return;
961- }
962- if (d->ready) {
963- printLocked(this);
964- return;
965- }
966- d->adaptor = value;
967- Q_EMIT adaptorInterfaceChanged();
968-}
969-
970-/*!
971- * \qmlproperty string ServiceProperties::error
972- * The property is set with a human readablestring each time an error occurrs
973- * during the service connection. Empty string means no error.
974- */
975-QString UCServiceProperties::error()
976-{
977- Q_D(UCServiceProperties);
978- return d->error;
979-}
980-
981-/*!
982- * \qmlproperty enum ServiceProperties::status
983- * The property presents the status of the component.
984- * \list
985- * \li - \e ServiceProperties.Inactive - the component is inactive, initial state
986- * \li - \e ServiceProperties.ConnectionError - there was a connection error, the
987- * \l error contains the error string.
988- * \li - \e ServiceProperties.Synchronizing - the connection to the service succeeded,
989- * and the properties are being synchronized;
990- * \li - \e ServiceProperties.Active - the service watcher is active and initial
991- * property synchronization completed.
992- * \endlist
993- * \note While the status is set to \e Synchronizing, the properties are checked
994- * against their existence in the service. Each proeprty will be checked as declared
995- * as well with capital first letter. If neither of these exists in the service,
996- * it will be reported in the \l error property separately.
997- */
998-UCServiceProperties::Status UCServiceProperties::status() const
999-{
1000- Q_D(const UCServiceProperties);
1001- return d->status;
1002-}
1003-
1004-#include "moc_ucserviceproperties.cpp"
1005
1006=== removed file 'modules/Ubuntu/Components/plugin/ucserviceproperties.h'
1007--- modules/Ubuntu/Components/plugin/ucserviceproperties.h 2014-11-28 08:19:13 +0000
1008+++ modules/Ubuntu/Components/plugin/ucserviceproperties.h 1970-01-01 00:00:00 +0000
1009@@ -1,83 +0,0 @@
1010-/*
1011- * Copyright 2014 Canonical Ltd.
1012- *
1013- * This program is free software; you can redistribute it and/or modify
1014- * it under the terms of the GNU Lesser General Public License as published by
1015- * the Free Software Foundation; version 3.
1016- *
1017- * This program is distributed in the hope that it will be useful,
1018- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1019- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1020- * GNU Lesser General Public License for more details.
1021- *
1022- * You should have received a copy of the GNU Lesser General Public License
1023- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1024- */
1025-
1026-#ifndef UCSERVICEPROPERTIES_H
1027-#define UCSERVICEPROPERTIES_H
1028-
1029-#include <QtCore/QObject>
1030-#include <QtQml/QQmlParserStatus>
1031-
1032-class UCServicePropertiesPrivate;
1033-class UCServiceProperties : public QObject, public QQmlParserStatus
1034-{
1035- Q_OBJECT
1036- Q_INTERFACES(QQmlParserStatus)
1037-
1038- Q_PROPERTY(ServiceType type READ type WRITE setType NOTIFY typeChanged REVISION 1)
1039- Q_PROPERTY(QString service READ service WRITE setService NOTIFY serviceChanged REVISION 1)
1040- Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged REVISION 1)
1041- Q_PROPERTY(QString serviceInterface READ interface WRITE setInterface NOTIFY serviceInterfaceChanged REVISION 1)
1042- Q_PROPERTY(QString adaptorInterface READ adaptor WRITE setAdaptor NOTIFY adaptorInterfaceChanged REVISION 1)
1043- Q_PROPERTY(QString error READ error NOTIFY errorChanged REVISION 1)
1044- Q_PROPERTY(Status status READ status NOTIFY statusChanged REVISION 1)
1045-
1046- Q_ENUMS(ServiceType Status)
1047-public:
1048- enum ServiceType {
1049- Undefined,
1050- System,
1051- Session
1052- };
1053- enum Status {
1054- Inactive,
1055- ConnectionError,
1056- Synchronizing,
1057- Active
1058- };
1059-
1060- explicit UCServiceProperties(QObject *parent = 0);
1061- ~UCServiceProperties();
1062- void classBegin();
1063- void componentComplete();
1064-
1065- ServiceType type() const;
1066- void setType(ServiceType type);
1067- QString service() const;
1068- void setService(const QString &value);
1069- QString path() const;
1070- void setPath(const QString &value);
1071- QString interface() const;
1072- void setInterface(const QString &value);
1073- QString adaptor() const;
1074- void setAdaptor(const QString &value);
1075- QString error();
1076- Status status() const;
1077-
1078-Q_SIGNALS:
1079- void typeChanged();
1080- void serviceChanged();
1081- void pathChanged();
1082- void serviceInterfaceChanged();
1083- void adaptorInterfaceChanged();
1084- void errorChanged();
1085- void statusChanged();
1086-
1087-private:
1088- UCServicePropertiesPrivate *d_ptr;
1089- Q_DECLARE_PRIVATE_D(d_ptr, UCServiceProperties)
1090-};
1091-
1092-#endif // UCSERVICEPROPERTIES_H
1093
1094=== removed file 'modules/Ubuntu/Components/plugin/ucserviceproperties_p.h'
1095--- modules/Ubuntu/Components/plugin/ucserviceproperties_p.h 2014-11-28 08:19:13 +0000
1096+++ modules/Ubuntu/Components/plugin/ucserviceproperties_p.h 1970-01-01 00:00:00 +0000
1097@@ -1,53 +0,0 @@
1098-/*
1099- * Copyright 2014 Canonical Ltd.
1100- *
1101- * This program is free software; you can redistribute it and/or modify
1102- * it under the terms of the GNU Lesser General Public License as published by
1103- * the Free Software Foundation; version 3.
1104- *
1105- * This program is distributed in the hope that it will be useful,
1106- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1107- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1108- * GNU Lesser General Public License for more details.
1109- *
1110- * You should have received a copy of the GNU Lesser General Public License
1111- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1112- */
1113-
1114-#ifndef UCSERVICEPROPERTIES_P_H
1115-#define UCSERVICEPROPERTIES_P_H
1116-
1117-#include "ucserviceproperties.h"
1118-#include <QtCore/QStringList>
1119-
1120-class UCServicePropertiesPrivate
1121-{
1122-public:
1123- UCServicePropertiesPrivate(UCServiceProperties *qq);
1124- virtual ~UCServicePropertiesPrivate();
1125-
1126- static UCServicePropertiesPrivate *get(UCServiceProperties *service);
1127- void setError(const QString &msg);
1128- void setStatus(UCServiceProperties::Status status);
1129-
1130- virtual bool init() = 0;
1131- virtual bool fetchPropertyValues() = 0;
1132- virtual bool readProperty(const QString &property) = 0;
1133- virtual bool testProperty(const QString &property, const QVariant &value) = 0;
1134-
1135- // data
1136- UCServiceProperties *q_ptr;
1137- bool ready:1;
1138- UCServiceProperties::Status status;
1139- UCServiceProperties::ServiceType type;
1140- QString service;
1141- QString path;
1142- QString interface;
1143- QString adaptor;
1144- QString error;
1145- QStringList properties;
1146-};
1147-
1148-UCServicePropertiesPrivate *createServicePropertiesAdapter(UCServiceProperties *owner);
1149-
1150-#endif // UCSERVICEPROPERTIES_P_H
1151
1152=== modified file 'modules/Ubuntu/Components/plugin/uctheme.cpp'
1153--- modules/Ubuntu/Components/plugin/uctheme.cpp 2014-11-28 09:06:48 +0000
1154+++ modules/Ubuntu/Components/plugin/uctheme.cpp 2014-12-03 06:01:02 +0000
1155@@ -99,8 +99,6 @@
1156 }
1157 pathList << QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath).split(':', QString::SkipEmptyParts);
1158
1159- // prepend current folder
1160- pathList.prepend(QDir::currentPath());
1161 // fix folders
1162 QStringList result;
1163 Q_FOREACH(const QString &path, pathList) {
1164@@ -141,7 +139,7 @@
1165
1166 QStringList paths = themeSearchPath();
1167 Q_FOREACH(const QString &path, paths) {
1168- if (QDir(path).exists() && !m_engine->importPathList().contains(path)) {
1169+ if (QDir(path).exists()) {
1170 m_engine->addImportPath(path);
1171 }
1172 }
1173
1174=== removed directory 'tests/unit_x11/tst_serviceproperties'
1175=== removed file 'tests/unit_x11/tst_serviceproperties/IncomingCallVibrateWatcher.qml'
1176--- tests/unit_x11/tst_serviceproperties/IncomingCallVibrateWatcher.qml 2014-11-28 08:19:13 +0000
1177+++ tests/unit_x11/tst_serviceproperties/IncomingCallVibrateWatcher.qml 1970-01-01 00:00:00 +0000
1178@@ -1,31 +0,0 @@
1179-/*
1180- * Copyright 2014 Canonical Ltd.
1181- *
1182- * This program is free software; you can redistribute it and/or modify
1183- * it under the terms of the GNU Lesser General Public License as published by
1184- * the Free Software Foundation; version 3.
1185- *
1186- * This program is distributed in the hope that it will be useful,
1187- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1188- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1189- * GNU Lesser General Public License for more details.
1190- *
1191- * You should have received a copy of the GNU Lesser General Public License
1192- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1193- */
1194-
1195-import QtQuick 2.3
1196-import Ubuntu.Components 1.1
1197-
1198-Item {
1199- property alias service: service
1200- ServiceProperties {
1201- id: service
1202- service: "org.freedesktop.Accounts"
1203- serviceInterface: "org.freedesktop.Accounts"
1204- path: "/org/freedesktop/Accounts"
1205- adaptorInterface: "com.ubuntu.touch.AccountsService.Sound"
1206-
1207- property bool incomingCallVibrate: true
1208- }
1209-}
1210
1211=== removed file 'tests/unit_x11/tst_serviceproperties/InvalidPropertyWatcher.qml'
1212--- tests/unit_x11/tst_serviceproperties/InvalidPropertyWatcher.qml 2014-11-28 08:19:13 +0000
1213+++ tests/unit_x11/tst_serviceproperties/InvalidPropertyWatcher.qml 1970-01-01 00:00:00 +0000
1214@@ -1,31 +0,0 @@
1215-/*
1216- * Copyright 2014 Canonical Ltd.
1217- *
1218- * This program is free software; you can redistribute it and/or modify
1219- * it under the terms of the GNU Lesser General Public License as published by
1220- * the Free Software Foundation; version 3.
1221- *
1222- * This program is distributed in the hope that it will be useful,
1223- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1224- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1225- * GNU Lesser General Public License for more details.
1226- *
1227- * You should have received a copy of the GNU Lesser General Public License
1228- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1229- */
1230-
1231-import QtQuick 2.3
1232-import Ubuntu.Components 1.1
1233-
1234-Item {
1235- property alias service: service
1236- ServiceProperties {
1237- id: service
1238- service: "org.freedesktop.Accounts"
1239- serviceInterface: "org.freedesktop.Accounts"
1240- path: "/org/freedesktop/Accounts"
1241- adaptorInterface: "com.ubuntu.touch.AccountsService.Sound"
1242-
1243- property bool thisIsAnInvalidPropertyToWatch: true
1244- }
1245-}
1246
1247=== removed file 'tests/unit_x11/tst_serviceproperties/InvalidPropertyWatcher2.qml'
1248--- tests/unit_x11/tst_serviceproperties/InvalidPropertyWatcher2.qml 2014-11-28 08:19:13 +0000
1249+++ tests/unit_x11/tst_serviceproperties/InvalidPropertyWatcher2.qml 1970-01-01 00:00:00 +0000
1250@@ -1,32 +0,0 @@
1251-/*
1252- * Copyright 2014 Canonical Ltd.
1253- *
1254- * This program is free software; you can redistribute it and/or modify
1255- * it under the terms of the GNU Lesser General Public License as published by
1256- * the Free Software Foundation; version 3.
1257- *
1258- * This program is distributed in the hope that it will be useful,
1259- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1260- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1261- * GNU Lesser General Public License for more details.
1262- *
1263- * You should have received a copy of the GNU Lesser General Public License
1264- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1265- */
1266-
1267-import QtQuick 2.3
1268-import Ubuntu.Components 1.1
1269-
1270-Item {
1271- property alias service: service
1272- ServiceProperties {
1273- id: service
1274- service: "org.freedesktop.Accounts"
1275- serviceInterface: "org.freedesktop.Accounts"
1276- path: "/org/freedesktop/Accounts"
1277- adaptorInterface: "com.ubuntu.touch.AccountsService.Sound"
1278-
1279- property bool thisIsAnInvalidPropertyToWatch: true
1280- property bool incomingCallVibrate: true
1281- }
1282-}
1283
1284=== removed file 'tests/unit_x11/tst_serviceproperties/tst_serviceproperties.cpp'
1285--- tests/unit_x11/tst_serviceproperties/tst_serviceproperties.cpp 2014-11-28 08:19:13 +0000
1286+++ tests/unit_x11/tst_serviceproperties/tst_serviceproperties.cpp 1970-01-01 00:00:00 +0000
1287@@ -1,132 +0,0 @@
1288-/*
1289- * Copyright 2014 Canonical Ltd.
1290- *
1291- * This program is free software; you can redistribute it and/or modify
1292- * it under the terms of the GNU Lesser General Public License as published by
1293- * the Free Software Foundation; version 3.
1294- *
1295- * This program is distributed in the hope that it will be useful,
1296- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1297- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1298- * GNU Lesser General Public License for more details.
1299- *
1300- * You should have received a copy of the GNU Lesser General Public License
1301- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1302- */
1303-
1304-#include "uctestcase.h"
1305-#include "ucserviceproperties.h"
1306-#include "ucserviceproperties_p.h"
1307-#include <QtCore/QString>
1308-#include <QtCore/QDebug>
1309-#include <QtTest/QTest>
1310-#include <QtTest/QSignalSpy>
1311-
1312-class tst_ServiceProperties : public QObject
1313-{
1314- Q_OBJECT
1315-
1316-public:
1317- tst_ServiceProperties() {}
1318-
1319-private:
1320-
1321- // FIXME use UbuntuTestCase::ignoreWaring in Vivid
1322- void ignoreWarning(const QString& fileName, uint line, uint column, const QString& message, uint occurences=1)
1323- {
1324- for (uint i = 0; i < occurences; i++) {
1325- QString url(QUrl::fromLocalFile(QFileInfo(fileName).absoluteFilePath()).toEncoded());
1326- QString warning(QString("%1:%2:%3: %4").arg(url).arg(line).arg(column).arg(message));
1327- QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
1328- }
1329- }
1330-
1331-private Q_SLOTS:
1332-
1333- void test_change_property()
1334- {
1335- QScopedPointer<UbuntuTestCase> test(new UbuntuTestCase("IncomingCallVibrateWatcher.qml"));
1336- UCServiceProperties *watcher = static_cast<UCServiceProperties*>(test->rootObject()->property("service").value<QObject*>());
1337- QVERIFY(watcher);
1338- if (watcher->property("status").toInt() != UCServiceProperties::Active) {
1339- QSignalSpy wait(watcher, SIGNAL(statusChanged()));
1340- wait.wait();
1341- }
1342-
1343- bool backup = watcher->property("incomingCallVibrate").toBool();
1344- UCServicePropertiesPrivate *pWatcher = UCServicePropertiesPrivate::get(watcher);
1345- QSignalSpy spy(watcher, SIGNAL(incomingCallVibrateChanged()));
1346- pWatcher->testProperty("IncomingCallVibrate", !backup);
1347- spy.wait(400);
1348- QCOMPARE(spy.count(), 1);
1349- QCOMPARE(watcher->property("incomingCallVibrate").toBool(), !backup);
1350-
1351- // restore value
1352- spy.clear();
1353- pWatcher->testProperty("IncomingCallVibrate", backup);
1354- spy.wait(400);
1355- }
1356-
1357- void test_invalid_property()
1358- {
1359- ignoreWarning("InvalidPropertyWatcher.qml", 22, 5, "QML ServiceProperties: No such property 'ThisIsAnInvalidPropertyToWatch'");
1360- QScopedPointer<UbuntuTestCase> test(new UbuntuTestCase("InvalidPropertyWatcher.qml"));
1361- UCServiceProperties *watcher = static_cast<UCServiceProperties*>(test->rootObject()->property("service").value<QObject*>());
1362- QVERIFY(watcher);
1363- if (watcher->property("status").toInt() != UCServiceProperties::Active) {
1364- QSignalSpy wait(watcher, SIGNAL(statusChanged()));
1365- wait.wait();
1366- }
1367- // error should not be set
1368- QVERIFY(watcher->property("error").toString().isEmpty());
1369- }
1370-
1371- void test_one_valid_one_invalid_property()
1372- {
1373- ignoreWarning("InvalidPropertyWatcher2.qml", 22, 5, "QML ServiceProperties: No such property 'ThisIsAnInvalidPropertyToWatch'");
1374- QScopedPointer<UbuntuTestCase> test(new UbuntuTestCase("InvalidPropertyWatcher2.qml"));
1375- UCServiceProperties *watcher = static_cast<UCServiceProperties*>(test->rootObject()->property("service").value<QObject*>());
1376- QVERIFY(watcher);
1377- if (watcher->property("status").toInt() != UCServiceProperties::Active) {
1378- QSignalSpy wait(watcher, SIGNAL(statusChanged()));
1379- wait.wait();
1380- }
1381- // error should not be set
1382- QVERIFY(watcher->property("error").toString().isEmpty());
1383- }
1384-
1385- void test_change_connection_props_data()
1386- {
1387- QTest::addColumn<QString>("property");
1388- QTest::addColumn<QString>("value");
1389-
1390- QTest::newRow("Changing servcie") << "service" << "anything.else";
1391- QTest::newRow("Changing interface") << "serviceInterface" << "anything.else";
1392- QTest::newRow("Changing adaptor") << "adaptorInterface" << "anything.else";
1393- }
1394- void test_change_connection_props()
1395- {
1396- QFETCH(QString, property);
1397- QFETCH(QString, value);
1398-
1399- ignoreWarning("IncomingCallVibrateWatcher.qml", 22, 5, "QML ServiceProperties: Changing connection parameters forbidden.");
1400- QScopedPointer<UbuntuTestCase> test(new UbuntuTestCase("IncomingCallVibrateWatcher.qml"));
1401- UCServiceProperties *watcher = static_cast<UCServiceProperties*>(test->rootObject()->property("service").value<QObject*>());
1402- QVERIFY(watcher);
1403- if (watcher->property("status").toInt() != UCServiceProperties::Active) {
1404- QSignalSpy wait(watcher, SIGNAL(statusChanged()));
1405- wait.wait();
1406- }
1407-
1408- // try to change the property
1409- QSignalSpy errorSpy(watcher, SIGNAL(errorChanged()));
1410- watcher->setProperty(property.toLocal8Bit().constData(), value);
1411- // no error should be reported
1412- QCOMPARE(errorSpy.count(), 0);
1413- }
1414-
1415-};
1416-
1417-QTEST_MAIN(tst_ServiceProperties)
1418-
1419-#include "tst_serviceproperties.moc"
1420
1421=== removed file 'tests/unit_x11/tst_serviceproperties/tst_serviceproperties.pro'
1422--- tests/unit_x11/tst_serviceproperties/tst_serviceproperties.pro 2014-11-28 08:19:13 +0000
1423+++ tests/unit_x11/tst_serviceproperties/tst_serviceproperties.pro 1970-01-01 00:00:00 +0000
1424@@ -1,8 +0,0 @@
1425-include(../test-include.pri)
1426-SOURCES += \
1427- tst_serviceproperties.cpp
1428-
1429-OTHER_FILES += \
1430- IncomingCallVibrateWatcher.qml \
1431- InvalidPropertyWatcher.qml \
1432- InvalidPropertyWatcher2.qml
1433
1434=== removed directory 'tests/unit_x11/tst_theme_engine/AppTheme'
1435=== removed file 'tests/unit_x11/tst_theme_engine/AppTheme/Palette.qml'
1436--- tests/unit_x11/tst_theme_engine/AppTheme/Palette.qml 2014-11-28 09:06:48 +0000
1437+++ tests/unit_x11/tst_theme_engine/AppTheme/Palette.qml 1970-01-01 00:00:00 +0000
1438@@ -1,24 +0,0 @@
1439-/*
1440- * Copyright 2014 Canonical Ltd.
1441- *
1442- * This program is free software; you can redistribute it and/or modify
1443- * it under the terms of the GNU Lesser General Public License as published by
1444- * the Free Software Foundation; version 3.
1445- *
1446- * This program is distributed in the hope that it will be useful,
1447- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1448- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1449- * GNU Lesser General Public License for more details.
1450- *
1451- * You should have received a copy of the GNU Lesser General Public License
1452- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1453- */
1454-
1455-import QtQuick 2.0
1456-import Ubuntu.Components 1.1
1457-import Ubuntu.Components.Themes.SuruDark 1.1 as Suru
1458-
1459-Suru.Palette {
1460- normal.background: "#A21E1C"
1461- selected.backgroundText: "lightblue"
1462-}
1463
1464=== removed file 'tests/unit_x11/tst_theme_engine/AppTheme/parent_theme'
1465--- tests/unit_x11/tst_theme_engine/AppTheme/parent_theme 2014-11-28 09:06:48 +0000
1466+++ tests/unit_x11/tst_theme_engine/AppTheme/parent_theme 1970-01-01 00:00:00 +0000
1467@@ -1,1 +0,0 @@
1468-Ubuntu.Components.Themes.SuruDark
1469
1470=== removed file 'tests/unit_x11/tst_theme_engine/TestApp.qml'
1471--- tests/unit_x11/tst_theme_engine/TestApp.qml 2014-11-28 09:06:48 +0000
1472+++ tests/unit_x11/tst_theme_engine/TestApp.qml 1970-01-01 00:00:00 +0000
1473@@ -1,29 +0,0 @@
1474-/*
1475- * Copyright 2014 Canonical Ltd.
1476- *
1477- * This program is free software; you can redistribute it and/or modify
1478- * it under the terms of the GNU Lesser General Public License as published by
1479- * the Free Software Foundation; version 3.
1480- *
1481- * This program is distributed in the hope that it will be useful,
1482- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1483- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1484- * GNU Lesser General Public License for more details.
1485- *
1486- * You should have received a copy of the GNU Lesser General Public License
1487- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1488- */
1489-
1490-import QtQuick 2.0
1491-import Ubuntu.Components 1.1
1492-
1493-MainView {
1494- width: units.gu(40)
1495- height: units.gu(71)
1496-
1497- Component.onCompleted: Theme.name = "AppTheme"
1498-
1499- Label {
1500- objectName: "test_label"
1501- }
1502-}
1503
1504=== modified file 'tests/unit_x11/tst_theme_engine/tst_theme_engine.pro'
1505--- tests/unit_x11/tst_theme_engine/tst_theme_engine.pro 2014-11-28 09:06:48 +0000
1506+++ tests/unit_x11/tst_theme_engine/tst_theme_engine.pro 2014-12-03 06:01:02 +0000
1507@@ -1,7 +1,5 @@
1508 include(../test-include.pri)
1509-QT += quick-private gui-private
1510 SOURCES += tst_theme_enginetest.cpp
1511
1512 OTHER_FILES += \
1513- TestStyle.qml \
1514- TestApp.qml
1515+ TestStyle.qml
1516
1517=== modified file 'tests/unit_x11/tst_theme_engine/tst_theme_enginetest.cpp'
1518--- tests/unit_x11/tst_theme_engine/tst_theme_enginetest.cpp 2014-11-28 09:06:48 +0000
1519+++ tests/unit_x11/tst_theme_engine/tst_theme_enginetest.cpp 2014-12-03 06:01:02 +0000
1520@@ -21,7 +21,6 @@
1521 #include <QtQml/QQmlComponent>
1522 #include "uctheme.h"
1523 #include "uctestcase.h"
1524-#include <private/qquicktext_p.h>
1525
1526 Q_DECLARE_METATYPE(QList<QQmlError>)
1527
1528@@ -47,7 +46,6 @@
1529 void testNoImportPathSet();
1530 void testBogusImportPathSet();
1531 void testMultipleImportPathsSet();
1532- void testAppTheme();
1533 };
1534
1535 void tst_UCTheme::initTestCase()
1536@@ -195,18 +193,7 @@
1537 QQmlComponent* component = theme.createStyleComponent("TestStyle.qml", parent);
1538
1539 QCOMPARE(component != NULL, true);
1540- QCOMPARE(component->status(), QQmlComponent::Ready);
1541-}
1542-
1543-void tst_UCTheme::testAppTheme()
1544-{
1545- QScopedPointer<UbuntuTestCase> test(new UbuntuTestCase("TestApp.qml"));
1546- QColor backgroundColor = test->rootObject()->property("backgroundColor").value<QColor>();
1547- QCOMPARE(backgroundColor, QColor("#A21E1C"));
1548- QQuickText *label = test->findItem<QQuickText*>("test_label");
1549- QVERIFY(label);
1550- QCOMPARE(label->color(), QColor("lightblue"));
1551-}
1552+ QCOMPARE(component->status(), QQmlComponent::Ready);}
1553
1554 void tst_UCTheme::testNoImportPathSet()
1555 {
1556
1557=== modified file 'tests/unit_x11/unit_x11.pro'
1558--- tests/unit_x11/unit_x11.pro 2014-11-28 08:19:13 +0000
1559+++ tests/unit_x11/unit_x11.pro 2014-12-03 06:01:02 +0000
1560@@ -11,5 +11,4 @@
1561 tst_orientation \
1562 tst_layouts \
1563 tst_mousefilters \
1564- tst_animator \
1565- tst_serviceproperties
1566+ tst_animator

Subscribers

People subscribed via source and target branches