on xenial help sign in
merge with prereq
commit160fa20db2c2105db9c9e42a1883f7eaf5f7cd24 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 29 Sep 2015, 15:45 (11 years ago) parent6c5ea7a436260b
86 files changed+981−537
debian/changelog+28 debian/control+1−1 include/paths.h.in+13−13 libs/UbuntuGestures/DebugHelpers.cpp+7−7 libs/UbuntuGestures/TouchRegistry.cpp+1−1 plugins/AccountsService/AccountsService.cpp+35−35 plugins/AccountsService/AccountsServiceDBusAdaptor.cpp+17−17 plugins/Dash/horizontaljournal.cpp−2 plugins/Dash/listviewwithpageheader.cpp+12−12 plugins/Dash/organicgrid.cpp−2 plugins/Dash/verticaljournal.cpp−2 plugins/Greeter/Unity/Launcher/launcheritem.cpp+2−2 plugins/Greeter/Unity/Launcher/launchermodelas.cpp+22−22 plugins/Greeter/Unity/Launcher/plugin.cpp+5−5 plugins/IntegratedLightDM/DBusGreeter.cpp+2−2 plugins/IntegratedLightDM/DBusGreeterList.cpp+3−3 plugins/IntegratedLightDM/Greeter.cpp+1−1 plugins/IntegratedLightDM/liblightdm/Greeter.cpp+5−5 plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp+1−1 plugins/IntegratedLightDM/liblightdm/UsersModel.cpp+1−1 plugins/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp+2−1 plugins/IntegratedLightDM/plugin.cpp+3−3 plugins/Powerd/Powerd.cpp+11−11 plugins/ScreenGrabber/screengrabber.cpp+4−4 plugins/SessionBroadcast/SessionBroadcast.cpp+4−4 plugins/Ubuntu/DownloadDaemonListener/interface/downloadtrackeradaptor.h+11−11 plugins/Ubuntu/SystemImage/SystemImage.cpp+4−4 plugins/Unity/Connectivity/Connectivity.cpp+4−4 plugins/Unity/DashCommunicator/dashcommunicator.cpp+3−3 plugins/Unity/DashCommunicator/dashconnection.cpp+1−1 plugins/Unity/DashCommunicator/dbusdashcommunicatorservice.cpp+1−1 plugins/Unity/Indicators/indicator.cpp+8−8 plugins/Unity/Indicators/indicatorsmanager.cpp+4−4 plugins/Unity/Indicators/indicatorsmanager.h+1−1 plugins/Unity/Indicators/modelprinter.cpp+3−3 plugins/Unity/Indicators/modelprinter.h+2−2 plugins/Unity/Indicators/plugin.cpp+6−6 plugins/Unity/Indicators/rootstateparser.cpp+16−16 plugins/Unity/Launcher/asadapter.cpp+10−9 plugins/Unity/Launcher/dbusinterface.cpp+33−33 plugins/Unity/Launcher/desktopfilehandler.cpp+17−16 plugins/Unity/Launcher/gsettings.cpp+15−12 plugins/Unity/Launcher/launcheritem.cpp+6−6 plugins/Unity/Launcher/launchermodel.cpp+6−6 plugins/Unity/Launcher/plugin.cpp+5−5 plugins/Unity/Session/dbusunitysessionservice.cpp+41−41 plugins/Utils/CMakeLists.txt+1 plugins/Utils/plugin.cpp+4−1 plugins/Utils/relativetimeformatter.cpp+4−4 plugins/Utils/timeformatter.cpp+3−3 plugins/Utils/timezoneFormatter.cpp+35 plugins/Utils/timezoneFormatter.h+32 plugins/Utils/windowstatestorage.cpp+6−6 plugins/Wizard/PageList.cpp+3−3 plugins/Wizard/System.cpp+12−12 po/unity8.pot+36−34 qml/Notifications/Notification.qml+11−7 qml/Notifications/Notifications.qml+3−1 qml/Notifications/SwipeToAct.qml+38−3 qml/OrientedShell.qml+1−1 qml/Panel/IndicatorItem.qml+1−1 qml/Panel/IndicatorPage.qml+1−1 qml/Panel/Indicators/IndicatorDelegate.qml+1−1 qml/Panel/Indicators/MenuItemFactory.qml+93−5 qml/Panel/Indicators/MessageMenuItemFactory.qml+1−1 qml/Panel/Indicators/client/IndicatorRepresentation.qml+3−1 qml/Shell.qml+3−1 qml/Stages/DesktopStage.qml−3 qml/Stages/PhoneStage.qml+15−7 qml/Stages/SpreadDelegate.qml+1−1 src/ApplicationArguments.h+2−2 src/CachingNetworkManagerFactory.cpp+1−1 src/Dash/main.cpp+10−10 src/Panel/Indicators/client/indicatorsclient.cpp+7−7 src/UnityCommandLineParser.cpp+25−24 src/libunity8-private/unitydbusobject.cpp+2−2 src/libunity8-private/unitydbusvirtualobject.cpp+2−2 src/main.cpp+4−4 tests/autopilot/unity8/indicators/tests/test_indicators.py+10−13 tests/mocks/Unity/Notifications/MockActionModel.cpp+1−1 tests/mocks/Unity/Notifications/MockNotification.cpp+1 tests/mocks/Unity/Notifications/MockNotification.h+1−1 tests/mocks/Unity/Notifications/MockNotificationModel.cpp+5−1 tests/qmltests/Notifications/tst_Notifications.qml+61−8 tests/qmltests/Notifications/tst_SwipeToAct.qml+58−14 tests/qmltests/tst_OrientedShell.qml+106−1
debian/changelog+28
@@ -1,3 +1,31 @@
1+unity8 (8.11+15.10.20150925-0ubuntu1) wily; urgency=medium
2+
3+ [ Albert Astals Cid ]
4+ * Improvements from running clazy over the code
5+
6+ [ Daniel d'Andrada ]
7+ * PhoneStage: ensure you're left in a consistent state after being
8+ reset (LP: #1476757)
9+
10+ [ Lukáš Tinkl ]
11+ * Improve the appearance and functionality of datetime and session
12+ indicators in Unity8 desktop.
13+ * Using InputInfo, determine if we need swipe or click to dismiss the
14+ notifications (e.g. incoming phone call)
15+
16+ [ Michael Zanetti ]
17+ * further development on the Desktop Spread (LP: #1488147)
18+
19+ [ Michał Sawicz ]
20+ * Bump application API version
21+ * Skip bluetooth check under wily, use expectFailure to notice when
22+ it's back
23+
24+ [ Richard Somlói ]
25+ * Fix translator comments in time formatter
26+
27+ -- Michał Sawicz <michal.sawicz@canonical.com> Fri, 25 Sep 2015 12:13:20 +0000
28+
129unity8 (8.11+15.10.20150922.1-0ubuntu1) wily; urgency=medium
230
331 [ Albert Astals Cid ]
debian/control+1−1
@@ -173,7 +173,7 @@ Pre-Depends: ${misc:Pre-Depends},
173173Depends: ${misc:Depends},
174174 ${shlibs:Depends},
175175Provides: unity-application-impl,
176− unity-application-impl-6,
176+ unity-application-impl-8,
177177Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1)
178178Description: Fake environment for running Unity 8 shell
179179 Provides fake implementations of some QML modules used by Unity 8 shell
include/paths.h.in+13−13
@@ -29,23 +29,23 @@
2929
3030inline bool isRunningInstalled() {
3131 static bool installed = (QCoreApplication::applicationDirPath() ==
32− QDir(("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath());
32+ QDir(QStringLiteral("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath());
3333 return installed;
3434}
3535
3636inline QString buildDirectory() {
3737 if (!qEnvironmentVariableIsEmpty("UNITY_BINARY_DIR")) return qgetenv("UNITY_BINARY_DIR");
38− return QString("@CMAKE_BINARY_DIR@");
38+ return QStringLiteral("@CMAKE_BINARY_DIR@");
3939}
4040
4141inline QString sourceDirectory() {
4242 if (!qEnvironmentVariableIsEmpty("UNITY_SOURCE_DIR")) return qgetenv("UNITY_SOURCE_DIR");
43− return QString("@CMAKE_SOURCE_DIR@");
43+ return QStringLiteral("@CMAKE_SOURCE_DIR@");
4444}
4545
4646inline QString translationDirectory() {
4747 if (isRunningInstalled()) {
48− return QString("@CMAKE_INSTALL_PREFIX@/share/locale");
48+ return QStringLiteral("@CMAKE_INSTALL_PREFIX@/share/locale");
4949 } else {
5050 return QString(buildDirectory() + "/po/locale");
5151 }
@@ -53,7 +53,7 @@ inline QString translationDirectory() {
5353
5454inline QString qmlDirectory() {
5555 if (isRunningInstalled()) {
56− return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
56+ return QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
5757 } else {
5858 return QString(sourceDirectory() + "/qml");
5959 }
@@ -70,7 +70,7 @@ inline QStringList overrideImportPaths() {
7070inline QStringList nonMirImportPaths() {
7171 QStringList paths;
7272 if (isRunningInstalled()) {
73− paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/nonmirplugins");
73+ paths << QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/nonmirplugins");
7474 } else {
7575 paths << QString(buildDirectory() + "/nonmirplugins");
7676 }
@@ -80,13 +80,13 @@ inline QStringList nonMirImportPaths() {
8080inline QStringList fallbackImportPaths() {
8181 QStringList paths;
8282 if (isRunningInstalled()) {
83− paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@");
84− paths << QString("@USS_PRIVATE_PLUGINDIR@");
85− paths << QString("@SHELL_PLUGINDIR@");
86− paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
83+ paths << QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@");
84+ paths << QStringLiteral("@USS_PRIVATE_PLUGINDIR@");
85+ paths << QStringLiteral("@SHELL_PLUGINDIR@");
86+ paths << QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
8787 } else {
88− paths << QString("@USS_PRIVATE_PLUGINDIR@");
89− paths << QString("@SHELL_PLUGINDIR@");
88+ paths << QStringLiteral("@USS_PRIVATE_PLUGINDIR@");
89+ paths << QStringLiteral("@SHELL_PLUGINDIR@");
9090 paths << QString(buildDirectory() + "/tests/mocks");
9191 }
9292 return paths;
@@ -94,7 +94,7 @@ inline QStringList fallbackImportPaths() {
9494
9595inline QString mockPluginsDir() {
9696 if (isRunningInstalled()) {
97− return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
97+ return QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
9898 } else {
9999 return QString(buildDirectory() + "/tests/mocks");
100100 }
libs/UbuntuGestures/DebugHelpers.cpp+7−7
@@ -22,15 +22,15 @@ QString touchPointStateToString(Qt::TouchPointState state)
2222{
2323 switch (state) {
2424 case Qt::TouchPointPressed:
25− return QString("pressed");
25+ return QStringLiteral("pressed");
2626 case Qt::TouchPointMoved:
27− return QString("moved");
27+ return QStringLiteral("moved");
2828 case Qt::TouchPointStationary:
29− return QString("stationary");
29+ return QStringLiteral("stationary");
3030 case Qt::TouchPointReleased:
31− return QString("released");
31+ return QStringLiteral("released");
3232 default:
33− return QString("INVALID_STATE");
33+ return QStringLiteral("INVALID_STATE");
3434 }
3535}
3636
@@ -57,7 +57,7 @@ QString touchEventToString(const QTouchEvent *ev)
5757
5858 foreach(const QTouchEvent::TouchPoint& touchPoint, ev->touchPoints()) {
5959 message.append(
60− QString("(id:%1, state:%2, scenePos:(%3,%4)) ")
60+ QStringLiteral("(id:%1, state:%2, scenePos:(%3,%4)) ")
6161 .arg(touchPoint.id())
6262 .arg(touchPointStateToString(touchPoint.state()))
6363 .arg(touchPoint.scenePos().x())
@@ -89,7 +89,7 @@ QString mouseEventToString(const QMouseEvent *ev)
8989 message.append("INVALID_MOUSE_EVENT_TYPE ");
9090 }
9191
92− message.append(QString("pos(%1, %2)").arg(ev->x()).arg(ev->y()));
92+ message.append(QStringLiteral("pos(%1, %2)").arg(ev->x()).arg(ev->y()));
9393
9494 return message;
9595}
libs/UbuntuGestures/TouchRegistry.cpp+1−1
@@ -105,7 +105,7 @@ void TouchRegistry::deliverTouchUpdatesToUndecidedCandidatesAndWatchers(const QT
105105 // E.g.: a QTouchEvent might have three touches but a given item might be interested in only
106106 // one of them. So he will get a UnownedTouchEvent from this QTouchEvent containing only that
107107 // touch point.
108− QMap<QQuickItem*, QList<int>> touchIdsForItems;
108+ QHash<QQuickItem*, QList<int>> touchIdsForItems;
109109
110110 // Build touchIdsForItems
111111 m_touchInfoPool.forEach([&](Pool<TouchInfo>::Iterator &touchInfo) {
plugins/AccountsService/AccountsService.cpp+35−35
@@ -74,7 +74,7 @@ void AccountsService::setDemoEdges(bool demoEdges)
7474{
7575 if (m_demoEdges != demoEdges) {
7676 m_demoEdges = demoEdges;
77− m_service->setUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges", demoEdges);
77+ m_service->setUserProperty(m_user, QStringLiteral("com.canonical.unity.AccountsService"), QStringLiteral("demo-edges"), demoEdges);
7878
7979 Q_EMIT demoEdgesChanged();
8080 }
@@ -114,7 +114,7 @@ void AccountsService::setHereEnabled(bool enabled)
114114{
115115 if (m_hereEnabled != enabled) {
116116 m_hereEnabled = enabled;
117− m_service->setUserProperty(m_user, "com.ubuntu.location.providers.here.AccountsService", "LicenseAccepted", enabled);
117+ m_service->setUserProperty(m_user, QStringLiteral("com.ubuntu.location.providers.here.AccountsService"), QStringLiteral("LicenseAccepted"), enabled);
118118
119119 Q_EMIT hereEnabledChanged();
120120 }
@@ -133,8 +133,8 @@ bool AccountsService::hereLicensePathValid() const
133133void AccountsService::updateDemoEdges(bool async)
134134{
135135 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
136− "com.canonical.unity.AccountsService",
137− "demo-edges");
136+ QStringLiteral("com.canonical.unity.AccountsService"),
137+ QStringLiteral("demo-edges"));
138138 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
139139
140140 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -162,8 +162,8 @@ void AccountsService::updateDemoEdges(bool async)
162162void AccountsService::updateEnableLauncherWhileLocked(bool async)
163163{
164164 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
165− "com.ubuntu.AccountsService.SecurityPrivacy",
166− "EnableLauncherWhileLocked");
165+ QStringLiteral("com.ubuntu.AccountsService.SecurityPrivacy"),
166+ QStringLiteral("EnableLauncherWhileLocked"));
167167 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
168168
169169 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -191,8 +191,8 @@ void AccountsService::updateEnableLauncherWhileLocked(bool async)
191191void AccountsService::updateEnableIndicatorsWhileLocked(bool async)
192192{
193193 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
194− "com.ubuntu.AccountsService.SecurityPrivacy",
195− "EnableIndicatorsWhileLocked");
194+ QStringLiteral("com.ubuntu.AccountsService.SecurityPrivacy"),
195+ QStringLiteral("EnableIndicatorsWhileLocked"));
196196 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
197197
198198 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -220,8 +220,8 @@ void AccountsService::updateEnableIndicatorsWhileLocked(bool async)
220220void AccountsService::updateBackgroundFile(bool async)
221221{
222222 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
223− "org.freedesktop.Accounts.User",
224− "BackgroundFile");
223+ QStringLiteral("org.freedesktop.Accounts.User"),
224+ QStringLiteral("BackgroundFile"));
225225 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
226226
227227 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -249,8 +249,8 @@ void AccountsService::updateBackgroundFile(bool async)
249249void AccountsService::updateStatsWelcomeScreen(bool async)
250250{
251251 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
252− "com.ubuntu.touch.AccountsService.SecurityPrivacy",
253− "StatsWelcomeScreen");
252+ QStringLiteral("com.ubuntu.touch.AccountsService.SecurityPrivacy"),
253+ QStringLiteral("StatsWelcomeScreen"));
254254 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
255255
256256 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -278,8 +278,8 @@ void AccountsService::updateStatsWelcomeScreen(bool async)
278278void AccountsService::updatePasswordDisplayHint(bool async)
279279{
280280 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
281− "com.ubuntu.AccountsService.SecurityPrivacy",
282− "PasswordDisplayHint");
281+ QStringLiteral("com.ubuntu.AccountsService.SecurityPrivacy"),
282+ QStringLiteral("PasswordDisplayHint"));
283283 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
284284
285285 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -307,8 +307,8 @@ void AccountsService::updatePasswordDisplayHint(bool async)
307307void AccountsService::updateFailedLogins(bool async)
308308{
309309 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
310− "com.canonical.unity.AccountsService.Private",
311− "FailedLogins");
310+ QStringLiteral("com.canonical.unity.AccountsService.Private"),
311+ QStringLiteral("FailedLogins"));
312312 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
313313
314314 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -336,8 +336,8 @@ void AccountsService::updateFailedLogins(bool async)
336336void AccountsService::updateHereEnabled(bool async)
337337{
338338 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
339− "com.ubuntu.location.providers.here.AccountsService",
340− "LicenseAccepted");
339+ QStringLiteral("com.ubuntu.location.providers.here.AccountsService"),
340+ QStringLiteral("LicenseAccepted"));
341341 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
342342
343343 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -365,8 +365,8 @@ void AccountsService::updateHereEnabled(bool async)
365365void AccountsService::updateHereLicensePath(bool async)
366366{
367367 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
368− "com.ubuntu.location.providers.here.AccountsService",
369− "LicenseBasePath");
368+ QStringLiteral("com.ubuntu.location.providers.here.AccountsService"),
369+ QStringLiteral("LicenseBasePath"));
370370 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
371371
372372 connect(watcher, &QDBusPendingCallWatcher::finished,
@@ -381,7 +381,7 @@ void AccountsService::updateHereLicensePath(bool async)
381381
382382 QString hereLicensePath = reply.value().toString();
383383 if (hereLicensePath.isEmpty() || !QFile::exists(hereLicensePath))
384− hereLicensePath = "";
384+ hereLicensePath = QLatin1String("");
385385
386386 if (m_hereLicensePath.isNull() || m_hereLicensePath != hereLicensePath) {
387387 m_hereLicensePath = hereLicensePath;
@@ -403,7 +403,7 @@ void AccountsService::setFailedLogins(uint failedLogins)
403403{
404404 if (m_failedLogins != failedLogins) {
405405 m_failedLogins = failedLogins;
406− m_service->setUserProperty(m_user, "com.canonical.unity.AccountsService.Private", "FailedLogins", failedLogins);
406+ m_service->setUserProperty(m_user, QStringLiteral("com.canonical.unity.AccountsService.Private"), QStringLiteral("FailedLogins"), failedLogins);
407407
408408 Q_EMIT failedLoginsChanged();
409409 }
@@ -415,33 +415,33 @@ void AccountsService::onPropertiesChanged(const QString &user, const QString &in
415415 return;
416416 }
417417
418− if (interface == "com.canonical.unity.AccountsService") {
419− if (changed.contains("demo-edges")) {
418+ if (interface == QLatin1String("com.canonical.unity.AccountsService")) {
419+ if (changed.contains(QStringLiteral("demo-edges"))) {
420420 updateDemoEdges();
421421 }
422− } else if (interface == "com.canonical.unity.AccountsService.Private") {
423− if (changed.contains("FailedLogins")) {
422+ } else if (interface == QLatin1String("com.canonical.unity.AccountsService.Private")) {
423+ if (changed.contains(QStringLiteral("FailedLogins"))) {
424424 updateFailedLogins();
425425 }
426− } else if (interface == "com.ubuntu.touch.AccountsService.SecurityPrivacy") {
427− if (changed.contains("StatsWelcomeScreen")) {
426+ } else if (interface == QLatin1String("com.ubuntu.touch.AccountsService.SecurityPrivacy")) {
427+ if (changed.contains(QStringLiteral("StatsWelcomeScreen"))) {
428428 updateStatsWelcomeScreen();
429429 }
430− } else if (interface == "com.ubuntu.AccountsService.SecurityPrivacy") {
431− if (changed.contains("PasswordDisplayHint")) {
430+ } else if (interface == QLatin1String("com.ubuntu.AccountsService.SecurityPrivacy")) {
431+ if (changed.contains(QStringLiteral("PasswordDisplayHint"))) {
432432 updatePasswordDisplayHint();
433433 }
434− if (changed.contains("EnableLauncherWhileLocked")) {
434+ if (changed.contains(QStringLiteral("EnableLauncherWhileLocked"))) {
435435 updateEnableLauncherWhileLocked();
436436 }
437− if (changed.contains("EnableIndicatorsWhileLocked")) {
437+ if (changed.contains(QStringLiteral("EnableIndicatorsWhileLocked"))) {
438438 updateEnableIndicatorsWhileLocked();
439439 }
440− } else if (interface == "com.ubuntu.location.providers.here.AccountsService") {
441− if (changed.contains("LicenseAccepted")) {
440+ } else if (interface == QLatin1String("com.ubuntu.location.providers.here.AccountsService")) {
441+ if (changed.contains(QStringLiteral("LicenseAccepted"))) {
442442 updateHereEnabled();
443443 }
444− if (changed.contains("LicenseBasePath")) {
444+ if (changed.contains(QStringLiteral("LicenseBasePath"))) {
445445 updateHereLicensePath();
446446 }
447447 }
plugins/AccountsService/AccountsServiceDBusAdaptor.cpp+17−17
@@ -30,10 +30,10 @@ AccountsServiceDBusAdaptor::AccountsServiceDBusAdaptor(QObject* parent)
3030{
3131 QDBusConnection connection = QDBusConnection::SM_BUSNAME();
3232 QDBusConnectionInterface *interface = connection.interface();
33− interface->startService("org.freedesktop.Accounts");
34− m_accountsManager = new QDBusInterface("org.freedesktop.Accounts",
35− "/org/freedesktop/Accounts",
36− "org.freedesktop.Accounts",
33+ interface->startService(QStringLiteral("org.freedesktop.Accounts"));
34+ m_accountsManager = new QDBusInterface(QStringLiteral("org.freedesktop.Accounts"),
35+ QStringLiteral("/org/freedesktop/Accounts"),
36+ QStringLiteral("org.freedesktop.Accounts"),
3737 connection, this);
3838}
3939
@@ -41,7 +41,7 @@ QVariant AccountsServiceDBusAdaptor::getUserProperty(const QString &user, const
4141{
4242 QDBusInterface *iface = getUserInterface(user);
4343 if (iface != nullptr && iface->isValid()) {
44− QDBusReply<QVariant> answer = iface->call("Get", interface, property);
44+ QDBusReply<QVariant> answer = iface->call(QStringLiteral("Get"), interface, property);
4545 if (answer.isValid()) {
4646 return answer;
4747 }
@@ -53,9 +53,9 @@ QDBusPendingReply<QVariant> AccountsServiceDBusAdaptor::getUserPropertyAsync(con
5353{
5454 QDBusInterface *iface = getUserInterface(user);
5555 if (iface != nullptr && iface->isValid()) {
56− return iface->asyncCall("Get", interface, property);
56+ return iface->asyncCall(QStringLiteral("Get"), interface, property);
5757 }
58− return QDBusPendingReply<QVariant>(QDBusMessage::createError(QDBusError::Other, "Invalid Interface"));
58+ return QDBusPendingReply<QVariant>(QDBusMessage::createError(QDBusError::Other, QStringLiteral("Invalid Interface")));
5959}
6060
6161void AccountsServiceDBusAdaptor::setUserProperty(const QString &user, const QString &interface, const QString &property, const QVariant &value)
@@ -63,7 +63,7 @@ void AccountsServiceDBusAdaptor::setUserProperty(const QString &user, const QStr
6363 QDBusInterface *iface = getUserInterface(user);
6464 if (iface != nullptr && iface->isValid()) {
6565 // The value needs to be carefully wrapped
66− iface->call("Set", interface, property, QVariant::fromValue(QDBusVariant(value)));
66+ iface->call(QStringLiteral("Set"), interface, property, QVariant::fromValue(QDBusVariant(value)));
6767 }
6868}
6969
@@ -72,9 +72,9 @@ QDBusPendingCall AccountsServiceDBusAdaptor::setUserPropertyAsync(const QString
7272 QDBusInterface *iface = getUserInterface(user);
7373 if (iface != nullptr && iface->isValid()) {
7474 // The value needs to be carefully wrapped
75− return iface->asyncCall("Set", interface, property, QVariant::fromValue(QDBusVariant(value)));
75+ return iface->asyncCall(QStringLiteral("Set"), interface, property, QVariant::fromValue(QDBusVariant(value)));
7676 }
77− return QDBusPendingCall::fromCompletedCall(QDBusMessage::createError(QDBusError::Other, "Invalid Interface"));
77+ return QDBusPendingCall::fromCompletedCall(QDBusMessage::createError(QDBusError::Other, QStringLiteral("Invalid Interface")));
7878}
7979
8080void AccountsServiceDBusAdaptor::propertiesChangedSlot(const QString &interface, const QVariantMap &changed, const QStringList &invalid)
@@ -116,13 +116,13 @@ QDBusInterface *AccountsServiceDBusAdaptor::getUserInterface(const QString &user
116116{
117117 QDBusInterface *iface = m_users.value(user);
118118 if (iface == nullptr && m_accountsManager->isValid()) {
119− QDBusReply<QDBusObjectPath> answer = m_accountsManager->asyncCall("FindUserByName", user);
119+ QDBusReply<QDBusObjectPath> answer = m_accountsManager->asyncCall(QStringLiteral("FindUserByName"), user);
120120 if (answer.isValid()) {
121121 const QString path = answer.value().path();
122122
123− iface = new QDBusInterface("org.freedesktop.Accounts",
123+ iface = new QDBusInterface(QStringLiteral("org.freedesktop.Accounts"),
124124 path,
125− "org.freedesktop.DBus.Properties",
125+ QStringLiteral("org.freedesktop.DBus.Properties"),
126126 m_accountsManager->connection(), this);
127127
128128 // With its own pre-defined properties, AccountsService is oddly
@@ -132,8 +132,8 @@ QDBusInterface *AccountsServiceDBusAdaptor::getUserInterface(const QString &user
132132 iface->connection().connect(
133133 iface->service(),
134134 path,
135− "org.freedesktop.Accounts.User",
136− "Changed",
135+ QStringLiteral("org.freedesktop.Accounts.User"),
136+ QStringLiteral("Changed"),
137137 this,
138138 SLOT(maybeChangedSlot()));
139139
@@ -142,8 +142,8 @@ QDBusInterface *AccountsServiceDBusAdaptor::getUserInterface(const QString &user
142142 iface->connection().connect(
143143 iface->service(),
144144 path,
145− "org.freedesktop.DBus.Properties",
146− "PropertiesChanged",
145+ QStringLiteral("org.freedesktop.DBus.Properties"),
146+ QStringLiteral("PropertiesChanged"),
147147 this,
148148 SLOT(propertiesChangedSlot(QString, QVariantMap, QStringList)));
149149
plugins/Dash/horizontaljournal.cpp−2
@@ -33,8 +33,6 @@
3333#include <private/qquickitem_p.h>
3434#pragma GCC diagnostic pop
3535
36−static const qreal bufferRatio = 0.5;
37−
3836HorizontalJournal::HorizontalJournal()
3937 : m_firstVisibleIndex(-1)
4038 , m_rowHeight(0)
plugins/Dash/listviewwithpageheader.cpp+12−12
@@ -164,7 +164,7 @@ ListViewWithPageHeader::ListViewWithPageHeader()
164164
165165 m_contentYAnimation = new QQuickNumberAnimation(this);
166166 m_contentYAnimation->setEasing(QEasingCurve::OutQuad);
167− m_contentYAnimation->setProperty("contentY");
167+ m_contentYAnimation->setProperty(QStringLiteral("contentY"));
168168 m_contentYAnimation->setDuration(200);
169169 m_contentYAnimation->setTargetObject(this);
170170
@@ -745,8 +745,8 @@ QQuickItem *ListViewWithPageHeader::getSectionItem(const QString &sectionText)
745745
746746 QQmlContext *creationContext = m_sectionDelegate->creationContext();
747747 QQmlContext *context = new QQmlContext(creationContext ? creationContext : qmlContext(this));
748− context->setContextProperty(QLatin1String("section"), sectionText);
749− context->setContextProperty(QLatin1String("delegateIndex"), -1);
748+ context->setContextProperty(QStringLiteral("section"), sectionText);
749+ context->setContextProperty(QStringLiteral("delegateIndex"), -1);
750750 QObject *nobj = m_sectionDelegate->beginCreate(context);
751751 if (nobj) {
752752 QQml_setParent_noEvent(context, nobj);
@@ -879,7 +879,7 @@ ListViewWithPageHeader::ListItem *ListViewWithPageHeader::createItem(int modelIn
879879 }
880880 if (listItem->sectionItem()) {
881881 QQmlContext *context = QQmlEngine::contextForObject(listItem->sectionItem())->parentContext();
882− context->setContextProperty(QLatin1String("delegateIndex"), modelIndex);
882+ context->setContextProperty(QStringLiteral("delegateIndex"), modelIndex);
883883 }
884884 adjustMinYExtent();
885885 m_contentHeightDirty = true;
@@ -904,8 +904,8 @@ void ListViewWithPageHeader::itemCreated(int modelIndex, QObject *object)
904904
905905 item->setParentItem(m_clipItem);
906906 QQmlContext *context = QQmlEngine::contextForObject(item)->parentContext();
907− context->setContextProperty(QLatin1String("ListViewWithPageHeader"), this);
908− context->setContextProperty(QLatin1String("heightToClip"), QVariant::fromValue<int>(0));
907+ context->setContextProperty(QStringLiteral("ListViewWithPageHeader"), this);
908+ context->setContextProperty(QStringLiteral("heightToClip"), QVariant::fromValue<int>(0));
909909 if (modelIndex == m_asyncRequestedIndex) {
910910 createItem(modelIndex, false);
911911 refill();
@@ -1059,7 +1059,7 @@ void ListViewWithPageHeader::onModelUpdated(const QQmlChangeSet &changeSet, bool
10591059 if (item && item->sectionItem()) {
10601060 QQmlContext *context = QQmlEngine::contextForObject(item->sectionItem())->parentContext();
10611061 const QString sectionText = m_delegateModel->stringValue(i, m_sectionProperty);
1062− context->setContextProperty(QLatin1String("section"), sectionText);
1062+ context->setContextProperty(QStringLiteral("section"), sectionText);
10631063 }
10641064 }
10651065 }
@@ -1072,7 +1072,7 @@ void ListViewWithPageHeader::onModelUpdated(const QQmlChangeSet &changeSet, bool
10721072 ListItem *item = m_visibleItems[i];
10731073 if (item->sectionItem()) {
10741074 QQmlContext *context = QQmlEngine::contextForObject(item->sectionItem())->parentContext();
1075− context->setContextProperty(QLatin1String("delegateIndex"), m_firstVisibleIndex + i);
1075+ context->setContextProperty(QStringLiteral("delegateIndex"), m_firstVisibleIndex + i);
10761076 }
10771077 }
10781078
@@ -1235,7 +1235,7 @@ void ListViewWithPageHeader::layout()
12351235 // Update the top sticky section header
12361236 const QString section = m_delegateModel->stringValue(modelIndex, m_sectionProperty);
12371237 QQmlContext *context = QQmlEngine::contextForObject(m_topSectionItem)->parentContext();
1238− context->setContextProperty(QLatin1String("section"), section);
1238+ context->setContextProperty(QStringLiteral("section"), section);
12391239
12401240 QQuickItemPrivate::get(m_topSectionItem)->setCulled(false);
12411241 m_topSectionItem->setY(topSectionStickPos);
@@ -1247,7 +1247,7 @@ void ListViewWithPageHeader::layout()
12471247 break;
12481248 delegateIndex--;
12491249 }
1250− context->setContextProperty(QLatin1String("delegateIndex"), delegateIndex);
1250+ context->setContextProperty(QStringLiteral("delegateIndex"), delegateIndex);
12511251 if (item->sectionItem()) {
12521252 QQuickItemPrivate::get(item->sectionItem())->setCulled(true);
12531253 }
@@ -1257,9 +1257,9 @@ void ListViewWithPageHeader::layout()
12571257 QQmlContext *context = QQmlEngine::contextForObject(item->m_item)->parentContext();
12581258 const qreal clipFrom = visibleFrom + (!item->sectionItem() && m_topSectionItem && !QQuickItemPrivate::get(m_topSectionItem)->culled ? m_topSectionItem->height() : 0);
12591259 if (!cull && pos < clipFrom) {
1260− context->setContextProperty(QLatin1String("heightToClip"), clipFrom - pos);
1260+ context->setContextProperty(QStringLiteral("heightToClip"), clipFrom - pos);
12611261 } else {
1262− context->setContextProperty(QLatin1String("heightToClip"), QVariant::fromValue<int>(0));
1262+ context->setContextProperty(QStringLiteral("heightToClip"), QVariant::fromValue<int>(0));
12631263 }
12641264// qDebug() << "ListViewWithPageHeader::layout" << item->m_item;
12651265 pos += item->height();
plugins/Dash/organicgrid.cpp−2
@@ -21,8 +21,6 @@
2121#include <private/qquickitem_p.h>
2222#pragma GCC diagnostic pop
2323
24−static const qreal bufferRatio = 0.5;
25−
2624OrganicGrid::OrganicGrid()
2725 : m_firstVisibleIndex(-1)
2826 , m_numberOfModulesPerRow(-1)
plugins/Dash/verticaljournal.cpp−2
@@ -32,8 +32,6 @@
3232#include <private/qquickitem_p.h>
3333#pragma GCC diagnostic pop
3434
35−static const qreal bufferRatio = 0.5;
36−
3735VerticalJournal::VerticalJournal()
3836 : m_columnWidth(0)
3937{
plugins/Greeter/Unity/Launcher/launcheritem.cpp+2−2
@@ -35,7 +35,7 @@ LauncherItem::LauncherItem(const QString &appId, const QString &name, const QStr
3535 m_quickList(new QuickListModel(this))
3636{
3737 QuickListEntry nameAction;
38− nameAction.setActionId("launch_item");
38+ nameAction.setActionId(QStringLiteral("launch_item"));
3939 nameAction.setText(m_name);
4040 m_quickList->appendAction(nameAction);
4141}
@@ -55,7 +55,7 @@ void LauncherItem::setName(const QString &name)
5555 if (m_name != name) {
5656 m_name = name;
5757 QuickListEntry entry;
58− entry.setActionId("launch_item");
58+ entry.setActionId(QStringLiteral("launch_item"));
5959 entry.setText(m_name);
6060 m_quickList->updateAction(entry);
6161 Q_EMIT nameChanged(name);
plugins/Greeter/Unity/Launcher/launchermodelas.cpp+22−22
@@ -122,7 +122,7 @@ void LauncherModel::quickListActionInvoked(const QString &appId, int actionIndex
122122 QString actionId = model->get(actionIndex).actionId();
123123
124124 // Check if this is one of the launcher actions we handle ourselves
125− if (actionId == "launch_item") {
125+ if (actionId == QLatin1String("launch_item")) {
126126 QDesktopServices::openUrl(getUrlForAppId(appId));
127127
128128 // Nope, we don't know this action, let the backend forward it to the application
@@ -147,13 +147,13 @@ QString LauncherModel::getUrlForAppId(const QString &appId) const
147147 return QString();
148148 }
149149
150− if (!appId.contains("_")) {
150+ if (!appId.contains('_')) {
151151 return "application:///" + appId + ".desktop";
152152 }
153153
154154 QStringList parts = appId.split('_');
155155 QString package = parts.value(0);
156− QString app = parts.value(1, "first-listed-app");
156+ QString app = parts.value(1, QStringLiteral("first-listed-app"));
157157 return "appid://" + package + "/" + app + "/current-user-version";
158158}
159159
@@ -200,7 +200,7 @@ void LauncherModel::refresh()
200200 QList<QVariantMap> items;
201201
202202 if (m_accounts && !m_user.isEmpty()) {
203− items = m_accounts->getUserProperty<VariantMapList>(m_user, "com.canonical.unity.AccountsService", "LauncherItems");
203+ items = m_accounts->getUserProperty<VariantMapList>(m_user, QStringLiteral("com.canonical.unity.AccountsService"), QStringLiteral("LauncherItems"));
204204 }
205205
206206 // First walk through all the existing items and see if we need to remove something
@@ -210,16 +210,16 @@ void LauncherModel::refresh()
210210 bool found = false;
211211 Q_FOREACH(const QVariant &asItem, items) {
212212 QVariantMap cachedMap = asItem.toMap();
213− if (cachedMap.value("id").toString() == item->appId()) {
213+ if (cachedMap.value(QStringLiteral("id")).toString() == item->appId()) {
214214 // Only keep and update it if we either show unpinned or it is pinned
215− if (!m_onlyPinned || cachedMap.value("pinned").toBool()) {
215+ if (!m_onlyPinned || cachedMap.value(QStringLiteral("pinned")).toBool()) {
216216 found = true;
217− item->setName(cachedMap.value("name").toString());
218− item->setIcon(cachedMap.value("icon").toString());
219− item->setCount(cachedMap.value("count").toInt());
220− item->setCountVisible(cachedMap.value("countVisible").toBool());
221− item->setProgress(cachedMap.value("progress").toInt());
222− item->setRunning(cachedMap.value("running").toBool());
217+ item->setName(cachedMap.value(QStringLiteral("name")).toString());
218+ item->setIcon(cachedMap.value(QStringLiteral("icon")).toString());
219+ item->setCount(cachedMap.value(QStringLiteral("count")).toInt());
220+ item->setCountVisible(cachedMap.value(QStringLiteral("countVisible")).toBool());
221+ item->setProgress(cachedMap.value(QStringLiteral("progress")).toInt());
222+ item->setRunning(cachedMap.value(QStringLiteral("running")).toBool());
223223
224224 int idx = m_list.indexOf(item);
225225 Q_EMIT dataChanged(index(idx), index(idx), {RoleName, RoleIcon, RoleCount, RoleCountVisible, RoleRunning, RoleProgress});
@@ -244,7 +244,7 @@ void LauncherModel::refresh()
244244 for (int asIndex = 0; asIndex < items.count(); ++asIndex) {
245245 QVariant entry = items.at(asIndex);
246246
247− if (m_onlyPinned && !entry.toMap().value("pinned").toBool()) {
247+ if (m_onlyPinned && !entry.toMap().value(QStringLiteral("pinned")).toBool()) {
248248 // Skipping it as we only show pinned and it is not
249249 skipped++;
250250 continue;
@@ -253,7 +253,7 @@ void LauncherModel::refresh()
253253
254254 int itemIndex = -1;
255255 for (int i = 0; i < m_list.count(); ++i) {
256− if (m_list.at(i)->appId() == entry.toMap().value("id").toString()) {
256+ if (m_list.at(i)->appId() == entry.toMap().value(QStringLiteral("id")).toString()) {
257257 itemIndex = i;
258258 break;
259259 }
@@ -262,15 +262,15 @@ void LauncherModel::refresh()
262262 if (itemIndex == -1) {
263263 QVariantMap cachedMap = entry.toMap();
264264 // Need to add it. Just add it into the addedIndex to keep same ordering as the list in AS.
265− LauncherItem *item = new LauncherItem(cachedMap.value("id").toString(),
266− cachedMap.value("name").toString(),
267− cachedMap.value("icon").toString(),
265+ LauncherItem *item = new LauncherItem(cachedMap.value(QStringLiteral("id")).toString(),
266+ cachedMap.value(QStringLiteral("name")).toString(),
267+ cachedMap.value(QStringLiteral("icon")).toString(),
268268 this);
269269 item->setPinned(true);
270− item->setCount(cachedMap.value("count").toInt());
271− item->setCountVisible(cachedMap.value("countVisible").toBool());
272− item->setProgress(cachedMap.value("progress").toInt());
273− item->setRunning(cachedMap.value("running").toBool());
270+ item->setCount(cachedMap.value(QStringLiteral("count")).toInt());
271+ item->setCountVisible(cachedMap.value(QStringLiteral("countVisible")).toBool());
272+ item->setProgress(cachedMap.value(QStringLiteral("progress")).toInt());
273+ item->setRunning(cachedMap.value(QStringLiteral("running")).toBool());
274274 beginInsertRows(QModelIndex(), newPosition, newPosition);
275275 m_list.insert(newPosition, item);
276276 endInsertRows();
@@ -286,7 +286,7 @@ void LauncherModel::refresh()
286286
287287void LauncherModel::propertiesChanged(const QString &user, const QString &interface, const QStringList &changed)
288288{
289− if (user != m_user || interface != "com.canonical.unity.AccountsService" || !changed.contains("LauncherItems")) {
289+ if (user != m_user || interface != QLatin1String("com.canonical.unity.AccountsService") || !changed.contains(QStringLiteral("LauncherItems"))) {
290290 return;
291291 }
292292 refresh();
plugins/Greeter/Unity/Launcher/plugin.cpp+5−5
@@ -36,11 +36,11 @@ void UnityLauncherPlugin::registerTypes(const char *uri)
3636{
3737 Q_ASSERT(uri == QLatin1String("Unity.Launcher"));
3838
39− qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Abstract Interface. Cannot be instantiated.");
40− qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Abstract Interface. Cannot be instantiated.");
41− qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListInterface", "Abstract Interface. Cannot be instantiated.");
39+ qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", QStringLiteral("Abstract Interface. Cannot be instantiated."));
40+ qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", QStringLiteral("Abstract Interface. Cannot be instantiated."));
41+ qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListInterface", QStringLiteral("Abstract Interface. Cannot be instantiated."));
4242
4343 qmlRegisterSingletonType<LauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);
44− qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
45− qmlRegisterUncreatableType<QuickListModel>(uri, 0, 1, "QuickListModel", "Can't create a QuickListModel in QML. Get them from the LauncherItems.");
44+ qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", QStringLiteral("Can't create new Launcher Items in QML. Get them from the LauncherModel."));
45+ qmlRegisterUncreatableType<QuickListModel>(uri, 0, 1, "QuickListModel", QStringLiteral("Can't create a QuickListModel in QML. Get them from the LauncherItems."));
4646}
plugins/IntegratedLightDM/DBusGreeter.cpp+2−2
@@ -21,7 +21,7 @@
2121#include <QStringList>
2222
2323DBusGreeter::DBusGreeter(Greeter *greeter, const QString &path)
24− : UnityDBusObject(path, "com.canonical.UnityGreeter", true, greeter),
24+ : UnityDBusObject(path, QStringLiteral("com.canonical.UnityGreeter"), true, greeter),
2525 m_greeter(greeter)
2626{
2727 connect(m_greeter, &Greeter::isActiveChanged, this, &DBusGreeter::isActiveChangedHandler);
@@ -44,6 +44,6 @@ void DBusGreeter::HideGreeter()
4444
4545void DBusGreeter::isActiveChangedHandler()
4646{
47− notifyPropertyChanged("IsActive", isActive());
47+ notifyPropertyChanged(QStringLiteral("IsActive"), isActive());
4848 Q_EMIT isActiveChanged();
4949}
plugins/IntegratedLightDM/DBusGreeterList.cpp+3−3
@@ -21,7 +21,7 @@
2121#include <QStringList>
2222
2323DBusGreeterList::DBusGreeterList(Greeter *greeter, const QString &path)
24− : UnityDBusObject(path, "com.canonical.UnityGreeter", true, greeter),
24+ : UnityDBusObject(path, QStringLiteral("com.canonical.UnityGreeter"), true, greeter),
2525 m_greeter(greeter)
2626{
2727 connect(m_greeter, &Greeter::authenticationUserChanged, this, &DBusGreeterList::authenticationUserChangedHandler);
@@ -45,12 +45,12 @@ bool DBusGreeterList::entryIsLocked() const
4545
4646void DBusGreeterList::authenticationUserChangedHandler(const QString &user)
4747{
48− notifyPropertyChanged("ActiveEntry", user);
48+ notifyPropertyChanged(QStringLiteral("ActiveEntry"), user);
4949 Q_EMIT EntrySelected(user);
5050}
5151
5252void DBusGreeterList::promptlessChangedHandler()
5353{
54− notifyPropertyChanged("EntryIsLocked", entryIsLocked());
54+ notifyPropertyChanged(QStringLiteral("EntryIsLocked"), entryIsLocked());
5555 Q_EMIT entryIsLockedChanged();
5656}
plugins/IntegratedLightDM/Greeter.cpp+1−1
@@ -113,7 +113,7 @@ void Greeter::showPromptFilter(const QString &text, QLightDM::Greeter::PromptTyp
113113
114114 // Strip prompt of any colons at the end
115115 QString trimmedText = text.trimmed();
116− if (trimmedText.endsWith(":") || trimmedText.endsWith(":")) {
116+ if (trimmedText.endsWith(':') || trimmedText.endsWith(QStringLiteral(":"))) {
117117 trimmedText.chop(1);
118118 }
119119
plugins/IntegratedLightDM/liblightdm/Greeter.cpp+5−5
@@ -55,12 +55,12 @@ bool Greeter::hasGuestAccountHint() const
5555QString Greeter::getHint(const QString &name) const
5656{
5757 Q_UNUSED(name)
58− return "";
58+ return QLatin1String("");
5959}
6060
6161QString Greeter::defaultSessionHint() const
6262{
63− return "ubuntu";
63+ return QStringLiteral("ubuntu");
6464}
6565
6666bool Greeter::hideUsersHint() const
@@ -85,7 +85,7 @@ bool Greeter::lockHint () const
8585
8686QString Greeter::selectUserHint() const
8787{
88− return "";
88+ return QLatin1String("");
8989}
9090
9191bool Greeter::selectGuestHint() const
@@ -95,7 +95,7 @@ bool Greeter::selectGuestHint() const
9595
9696QString Greeter::autologinUserHint() const
9797{
98− return "";
98+ return QLatin1String("");
9999}
100100
101101bool Greeter::autologinGuestHint() const
@@ -115,7 +115,7 @@ bool Greeter::inAuthentication() const
115115
116116QString Greeter::hostname() const
117117{
118− return "hostname1";
118+ return QStringLiteral("hostname1");
119119}
120120
121121bool Greeter::isAuthenticated() const
plugins/IntegratedLightDM/liblightdm/GreeterPrivate.cpp+1−1
@@ -91,7 +91,7 @@ public:
9191 } else {
9292 delete appData;
9393 greeterPrivate->authenticated = false;
94− Q_EMIT greeter->showMessage("Internal error: could not start PAM authentication", QLightDM::Greeter::MessageTypeError);
94+ Q_EMIT greeter->showMessage(QStringLiteral("Internal error: could not start PAM authentication"), QLightDM::Greeter::MessageTypeError);
9595 Q_EMIT greeter->authenticationComplete();
9696 }
9797 }
plugins/IntegratedLightDM/liblightdm/UsersModel.cpp+1−1
@@ -55,7 +55,7 @@ UsersModel::UsersModel(QObject *parent) :
5555 setRoleNames(roles);
5656
5757 // Now modify our mock user backgrounds
58− QDir bgdir = QDir("/usr/share/demo-assets/shell/backgrounds/");
58+ QDir bgdir = QDir(QStringLiteral("/usr/share/demo-assets/shell/backgrounds/"));
5959 QStringList backgrounds = bgdir.entryList(QDir::Files | QDir::NoDotAndDotDot);
6060
6161 for (int i = 0, j = 0; i < d->entries.size(); i++) {
plugins/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp+2−1
@@ -29,8 +29,9 @@ 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() << qgetenv("USER")).toStringList();
32+ QStringList users = settings.value(QStringLiteral("users"), QStringList() << qgetenv("USER")).toStringList();
3333
34+ entries.reserve(users.count());
3435 Q_FOREACH(const QString &user, users)
3536 {
3637 QString name = settings.value(user + "/name", user[0].toUpper() + user.mid(1)).toString();
plugins/IntegratedLightDM/plugin.cpp+3−3
@@ -34,8 +34,8 @@ static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
3434 Q_UNUSED(scriptEngine)
3535
3636 Greeter *greeter = new Greeter();
37− new DBusGreeter(greeter, "/");
38− new DBusGreeterList(greeter, "/list");
37+ new DBusGreeter(greeter, QStringLiteral("/"));
38+ new DBusGreeterList(greeter, QStringLiteral("/list"));
3939
4040 return greeter;
4141}
@@ -64,6 +64,6 @@ void IntegratedLightDMPlugin::registerTypes(const char *uri)
6464 qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
6565 qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
6666 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
67− qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
67+ qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", QStringLiteral("Type is not instantiable"));
6868 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
6969}
plugins/Powerd/Powerd.cpp+11−11
@@ -22,19 +22,19 @@
2222void autoBrightnessChanged(GSettings *settings, const gchar *key, QDBusInterface *unityScreen)
2323{
2424 bool value = g_settings_get_boolean(settings, key);
25− unityScreen->asyncCall("userAutobrightnessEnable", QVariant(value));
25+ unityScreen->asyncCall(QStringLiteral("userAutobrightnessEnable"), QVariant(value));
2626}
2727
2828void activityTimeoutChanged(GSettings *settings, const gchar *key, QDBusInterface *unityScreen)
2929{
3030 int value = g_settings_get_uint(settings, key);
31− unityScreen->asyncCall("setInactivityTimeouts", QVariant(value), QVariant(-1));
31+ unityScreen->asyncCall(QStringLiteral("setInactivityTimeouts"), QVariant(value), QVariant(-1));
3232}
3333
3434void dimTimeoutChanged(GSettings *settings, const gchar *key, QDBusInterface *unityScreen)
3535{
3636 int value = g_settings_get_uint(settings, key);
37− unityScreen->asyncCall("setInactivityTimeouts", QVariant(-1), QVariant(value));
37+ unityScreen->asyncCall(QStringLiteral("setInactivityTimeouts"), QVariant(-1), QVariant(value));
3838}
3939
4040Powerd::Powerd(QObject* parent)
@@ -42,15 +42,15 @@ Powerd::Powerd(QObject* parent)
4242 unityScreen(nullptr),
4343 cachedStatus(Status::On)
4444{
45− unityScreen = new QDBusInterface("com.canonical.Unity.Screen",
46− "/com/canonical/Unity/Screen",
47− "com.canonical.Unity.Screen",
45+ unityScreen = new QDBusInterface(QStringLiteral("com.canonical.Unity.Screen"),
46+ QStringLiteral("/com/canonical/Unity/Screen"),
47+ QStringLiteral("com.canonical.Unity.Screen"),
4848 QDBusConnection::SM_BUSNAME(), this);
4949
50− unityScreen->connection().connect("com.canonical.Unity.Screen",
51− "/com/canonical/Unity/Screen",
52− "com.canonical.Unity.Screen",
53− "DisplayPowerStateChange",
50+ unityScreen->connection().connect(QStringLiteral("com.canonical.Unity.Screen"),
51+ QStringLiteral("/com/canonical/Unity/Screen"),
52+ QStringLiteral("com.canonical.Unity.Screen"),
53+ QStringLiteral("DisplayPowerStateChange"),
5454 this,
5555 SLOT(handleDisplayPowerStateChange(int, int)));
5656
@@ -76,7 +76,7 @@ Powerd::Status Powerd::status() const
7676
7777void Powerd::setStatus(Powerd::Status status, DisplayStateChangeReason reason)
7878{
79− unityScreen->asyncCall("setScreenPowerMode",
79+ unityScreen->asyncCall(QStringLiteral("setScreenPowerMode"),
8080 status == Powerd::On ? "on" : "off",
8181 static_cast<qint32>(reason));
8282}
plugins/ScreenGrabber/screengrabber.cpp+4−4
@@ -50,8 +50,8 @@ ScreenGrabber::ScreenGrabber(QObject *parent)
5050 qDebug() << "Using real environment";
5151 screenshotsDir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
5252 }
53− screenshotsDir.mkpath("Screenshots");
54− screenshotsDir.cd("Screenshots");
53+ screenshotsDir.mkpath(QStringLiteral("Screenshots"));
54+ screenshotsDir.cd(QStringLiteral("Screenshots"));
5555 if (screenshotsDir.exists()) {
5656 fileNamePrefix = screenshotsDir.absolutePath();
5757 fileNamePrefix.append("/screenshot");
@@ -94,7 +94,7 @@ void ScreenGrabber::captureAndSave()
9494QString ScreenGrabber::makeFileName() const
9595{
9696 QString fileName(fileNamePrefix);
97− fileName.append(QDateTime::currentDateTime().toString("yyyyMMdd_hhmmsszzz"));
97+ fileName.append(QDateTime::currentDateTime().toString(QStringLiteral("yyyyMMdd_hhmmsszzz")));
9898 fileName.append(".");
9999 fileName.append(getFormat());
100100 return fileName;
@@ -103,5 +103,5 @@ QString ScreenGrabber::makeFileName() const
103103QString ScreenGrabber::getFormat() const
104104{
105105 //TODO: This should be configurable (perhaps through gsettings?)
106− return "png";
106+ return QStringLiteral("png");
107107}
plugins/SessionBroadcast/SessionBroadcast.cpp+4−4
@@ -24,10 +24,10 @@ SessionBroadcast::SessionBroadcast(QObject* parent)
2424{
2525 auto connection = QDBusConnection::SM_BUSNAME();
2626
27− connection.connect("com.canonical.Unity.Greeter.Broadcast",
28− "/com/canonical/Unity/Greeter/Broadcast",
29− "com.canonical.Unity.Greeter.Broadcast",
30− "ShowHome",
27+ connection.connect(QStringLiteral("com.canonical.Unity.Greeter.Broadcast"),
28+ QStringLiteral("/com/canonical/Unity/Greeter/Broadcast"),
29+ QStringLiteral("com.canonical.Unity.Greeter.Broadcast"),
30+ QStringLiteral("ShowHome"),
3131 this,
3232 SLOT(onShowHome(const QString &)));
3333}
plugins/Ubuntu/DownloadDaemonListener/interface/downloadtrackeradaptor.h+11−11
@@ -41,68 +41,68 @@ public Q_SLOTS: // METHODS
4141 {
4242 QList<QVariant> argumentList;
4343 argumentList << QVariant::fromValue(allowed);
44− return asyncCallWithArgumentList(QLatin1String("allowGSMDownload"), argumentList);
44+ return asyncCallWithArgumentList(QStringLiteral("allowGSMDownload"), argumentList);
4545 }
4646
4747 inline QDBusPendingReply<> cancel()
4848 {
4949 QList<QVariant> argumentList;
50− return asyncCallWithArgumentList(QLatin1String("cancel"), argumentList);
50+ return asyncCallWithArgumentList(QStringLiteral("cancel"), argumentList);
5151 }
5252
5353 inline QDBusPendingReply<bool> isGSMDownloadAllowed()
5454 {
5555 QList<QVariant> argumentList;
56− return asyncCallWithArgumentList(QLatin1String("isGSMDownloadAllowed"), argumentList);
56+ return asyncCallWithArgumentList(QStringLiteral("isGSMDownloadAllowed"), argumentList);
5757 }
5858
5959 inline QDBusPendingReply<QVariantMap> metadata()
6060 {
6161 QList<QVariant> argumentList;
62− return asyncCallWithArgumentList(QLatin1String("metadata"), argumentList);
62+ return asyncCallWithArgumentList(QStringLiteral("metadata"), argumentList);
6363 }
6464
6565 inline QDBusPendingReply<> pause()
6666 {
6767 QList<QVariant> argumentList;
68− return asyncCallWithArgumentList(QLatin1String("pause"), argumentList);
68+ return asyncCallWithArgumentList(QStringLiteral("pause"), argumentList);
6969 }
7070
7171 inline QDBusPendingReply<qulonglong> progress()
7272 {
7373 QList<QVariant> argumentList;
74− return asyncCallWithArgumentList(QLatin1String("progress"), argumentList);
74+ return asyncCallWithArgumentList(QStringLiteral("progress"), argumentList);
7575 }
7676
7777 inline QDBusPendingReply<> resume()
7878 {
7979 QList<QVariant> argumentList;
80− return asyncCallWithArgumentList(QLatin1String("resume"), argumentList);
80+ return asyncCallWithArgumentList(QStringLiteral("resume"), argumentList);
8181 }
8282
8383 inline QDBusPendingReply<> setThrottle(qulonglong speed)
8484 {
8585 QList<QVariant> argumentList;
8686 argumentList << QVariant::fromValue(speed);
87− return asyncCallWithArgumentList(QLatin1String("setThrottle"), argumentList);
87+ return asyncCallWithArgumentList(QStringLiteral("setThrottle"), argumentList);
8888 }
8989
9090 inline QDBusPendingReply<> start()
9191 {
9292 QList<QVariant> argumentList;
93− return asyncCallWithArgumentList(QLatin1String("start"), argumentList);
93+ return asyncCallWithArgumentList(QStringLiteral("start"), argumentList);
9494 }
9595
9696 inline QDBusPendingReply<qulonglong> throttle()
9797 {
9898 QList<QVariant> argumentList;
99− return asyncCallWithArgumentList(QLatin1String("throttle"), argumentList);
99+ return asyncCallWithArgumentList(QStringLiteral("throttle"), argumentList);
100100 }
101101
102102 inline QDBusPendingReply<qulonglong> totalSize()
103103 {
104104 QList<QVariant> argumentList;
105− return asyncCallWithArgumentList(QLatin1String("totalSize"), argumentList);
105+ return asyncCallWithArgumentList(QStringLiteral("totalSize"), argumentList);
106106 }
107107
108108Q_SIGNALS: // SIGNALS
plugins/Ubuntu/SystemImage/SystemImage.cpp+4−4
@@ -25,9 +25,9 @@ SystemImage::SystemImage(QObject *parent)
2525
2626void SystemImage::factoryReset()
2727{
28− const QDBusMessage msg = QDBusMessage::createMethodCall("com.canonical.SystemImage",
29− "/Service",
30− "com.canonical.SystemImage",
31− "FactoryReset");
28+ const QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("com.canonical.SystemImage"),
29+ QStringLiteral("/Service"),
30+ QStringLiteral("com.canonical.SystemImage"),
31+ QStringLiteral("FactoryReset"));
3232 QDBusConnection::systemBus().asyncCall(msg);
3333}
plugins/Unity/Connectivity/Connectivity.cpp+4−4
@@ -25,9 +25,9 @@ Connectivity::Connectivity(QObject *parent)
2525
2626void Connectivity::unlockAllModems()
2727{
28− const QDBusMessage msg = QDBusMessage::createMethodCall("com.ubuntu.connectivity1",
29− "/com/ubuntu/connectivity1/Private",
30− "com.ubuntu.connectivity1.Private",
31− "UnlockAllModems");
28+ const QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("com.ubuntu.connectivity1"),
29+ QStringLiteral("/com/ubuntu/connectivity1/Private"),
30+ QStringLiteral("com.ubuntu.connectivity1.Private"),
31+ QStringLiteral("UnlockAllModems"));
3232 QDBusConnection::sessionBus().asyncCall(msg);
3333}
plugins/Unity/DashCommunicator/dashcommunicator.cpp+3−3
@@ -41,9 +41,9 @@ void DashCommunicator::setCurrentScope(int index, bool animate, bool isSwipe)
4141
4242void DashCommunicator::run()
4343{
44− m_dashConnection = new DashConnection("com.canonical.UnityDash",
45− "/com/canonical/UnityDash",
46− "", this);
44+ m_dashConnection = new DashConnection(QStringLiteral("com.canonical.UnityDash"),
45+ QStringLiteral("/com/canonical/UnityDash"),
46+ QLatin1String(""), this);
4747 m_mutex.lock();
4848 m_created = true;
4949 m_mutex.unlock();
plugins/Unity/DashCommunicator/dashconnection.cpp+1−1
@@ -58,6 +58,6 @@ QDBusAbstractInterface* DashConnection::createInterface(const QString &service,
5858void DashConnection::setCurrentScope(int index, bool animate, bool isSwipe)
5959{
6060 if (dbusInterface()) {
61− dbusInterface()->asyncCall("SetCurrentScope", index, animate, isSwipe);
61+ dbusInterface()->asyncCall(QStringLiteral("SetCurrentScope"), index, animate, isSwipe);
6262 }
6363}
plugins/Unity/DashCommunicator/dbusdashcommunicatorservice.cpp+1−1
@@ -21,7 +21,7 @@
2121#include <QDebug>
2222
2323DBusDashCommunicatorService::DBusDashCommunicatorService(QObject *parent):
24− UnityDBusObject("/com/canonical/UnityDash", "com.canonical.UnityDash", false, parent)
24+ UnityDBusObject(QStringLiteral("/com/canonical/UnityDash"), QStringLiteral("com.canonical.UnityDash"), false, parent)
2525{
2626}
2727
plugins/Unity/Indicators/indicator.cpp+8−8
@@ -37,20 +37,20 @@ void Indicator::init(const QString& busName, const QSettings& settings)
3737 // that we can't just copy the object.
3838 m_settings.clear();
3939 Q_FOREACH(const QString& key, settings.allKeys()) {
40− if (key.endsWith("/Position") || key.endsWith("/ObjectPath")) {
40+ if (key.endsWith(QLatin1String("/Position")) || key.endsWith(QLatin1String("/ObjectPath"))) {
4141 m_settings.insert(key, settings.value(key));
4242 }
4343 }
4444
45− setId(settings.value("Indicator Service/Name").toString());
45+ setId(settings.value(QStringLiteral("Indicator Service/Name")).toString());
4646
47− QString actionObjectPath = settings.value("Indicator Service/ObjectPath").toString();
47+ QString actionObjectPath = settings.value(QStringLiteral("Indicator Service/ObjectPath")).toString();
4848
4949 QVariantMap properties;
5050 properties.clear();
51− properties.insert("busType", 1);
52− properties.insert("busName", busName);
53− properties.insert("actionsObjectPath", actionObjectPath);
51+ properties.insert(QStringLiteral("busType"), 1);
52+ properties.insert(QStringLiteral("busName"), busName);
53+ properties.insert(QStringLiteral("actionsObjectPath"), actionObjectPath);
5454 setIndicatorProperties(properties);
5555}
5656
@@ -84,12 +84,12 @@ void Indicator::setProfile(const QString& profile)
8484{
8585 QVariant pos = m_settings.value(profile + "/Position");
8686 if (!pos.isValid())
87− pos = m_settings.value("Indicator Service/Position", QVariant::fromValue(0));
87+ pos = m_settings.value(QStringLiteral("Indicator Service/Position"), QVariant::fromValue(0));
8888 setPosition(pos.toInt());
8989
9090 QString menuObjectPath = m_settings.value(profile + "/ObjectPath").toString();
9191 QVariantMap map = m_properties.toMap();
92− map.insert("menuObjectPath", menuObjectPath);
92+ map.insert(QStringLiteral("menuObjectPath"), menuObjectPath);
9393 setIndicatorProperties(map);
9494}
9595
plugins/Unity/Indicators/indicatorsmanager.cpp+4−4
@@ -44,7 +44,7 @@ public:
4444IndicatorsManager::IndicatorsManager(QObject* parent)
4545 : QObject(parent)
4646 , m_loaded(false)
47− , m_profile("phone")
47+ , m_profile(QStringLiteral("phone"))
4848{
4949}
5050
@@ -115,7 +115,7 @@ void IndicatorsManager::loadDir(const QDir& dir)
115115void IndicatorsManager::loadFile(const QFileInfo& file_info)
116116{
117117 QSettings indicator_settings(file_info.absoluteFilePath(), QSettings::IniFormat, this);
118− QString name = indicator_settings.value("Indicator Service/Name").toString();
118+ QString name = indicator_settings.value(QStringLiteral("Indicator Service/Name")).toString();
119119
120120 auto iter = m_indicatorsData.find(name);
121121 if (iter != m_indicatorsData.end())
@@ -286,9 +286,9 @@ Indicator::Ptr IndicatorsManager::indicator(const QString& indicator_name)
286286 return new_indicator;
287287}
288288
289−QList<Indicator::Ptr> IndicatorsManager::indicators()
289+QVector<Indicator::Ptr> IndicatorsManager::indicators()
290290{
291− QList<Indicator::Ptr> list;
291+ QVector<Indicator::Ptr> list;
292292 Q_FOREACH(IndicatorData* data, m_indicatorsData)
293293 {
294294 Indicator::Ptr ret = indicator(data->m_name);
plugins/Unity/Indicators/indicatorsmanager.h+1−1
@@ -45,7 +45,7 @@ public:
4545
4646 Indicator::Ptr indicator(const QString& indicator_name);
4747
48− QList<Indicator::Ptr> indicators();
48+ QVector<Indicator::Ptr> indicators();
4949
5050 bool isLoaded() const;
5151
plugins/Unity/Indicators/modelprinter.cpp+3−3
@@ -60,7 +60,7 @@ QString ModelPrinter::text()
6060
6161QString tabify(int level) { QString str;
6262 for (int i = 0; i < level; i++) {
63− str += " ";
63+ str += QLatin1String(" ");
6464 }
6565 return str;
6666}
@@ -68,7 +68,7 @@ QString tabify(int level) { QString str;
6868QString ModelPrinter::getModelDataString(UnityMenuModel* sourceModel, int level)
6969{
7070 if (!sourceModel)
71− return "";
71+ return QLatin1String("");
7272
7373 QString str;
7474 QTextStream stream(&str);
@@ -110,7 +110,7 @@ QString ModelPrinter::getRowSring(UnityMenuModel* sourceModel, int row, int dept
110110 return str;
111111}
112112
113−QString ModelPrinter::getVariantString(const QString& roleName, const QVariant vData ) const
113+QString ModelPrinter::getVariantString(const QString& roleName, const QVariant &vData) const
114114{
115115 QString str;
116116 QTextStream stream(&str);
plugins/Unity/Indicators/modelprinter.h+2−2
@@ -46,10 +46,10 @@ Q_SIGNALS:
4646private:
4747 QString getModelDataString(UnityMenuModel* sourceModel, int level);
4848 QString getRowSring(UnityMenuModel* sourceModel, int index, int depth) const;
49− QString getVariantString(const QString& roleName, const QVariant vData ) const;
49+ QString getVariantString(const QString& roleName, const QVariant &vData) const;
5050
5151 UnityMenuModel* m_model;
5252 QList<UnityMenuModel*> m_children;
5353};
5454
55−#endif // MODELPRINTER_H
55+#endif // MODELPRINTER_H
plugins/Unity/Indicators/plugin.cpp+6−6
@@ -58,10 +58,10 @@ void IndicatorsPlugin::registerTypes(const char *uri)
5858
5959 qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
6060
61− qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", "Can't create MenuContentState class");
62− qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", "Can't create ActionState class");
63− qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", "Can't create NetworkActionState class");
64− qmlRegisterUncreatableType<NetworkConnection>(uri, 0, 1, "NetworkConnection", "Can't create NetworkConnection class");
65− qmlRegisterUncreatableType<IndicatorsModelRole>(uri, 0, 1, "IndicatorsModelRole", "Can't create IndicatorsModelRole class");
66− qmlRegisterUncreatableType<FlatMenuProxyModelRole>(uri, 0, 1, "FlatMenuProxyModelRole", "Can't create FlatMenuProxyModelRole class");
61+ qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", QStringLiteral("Can't create MenuContentState class"));
62+ qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", QStringLiteral("Can't create ActionState class"));
63+ qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", QStringLiteral("Can't create NetworkActionState class"));
64+ qmlRegisterUncreatableType<NetworkConnection>(uri, 0, 1, "NetworkConnection", QStringLiteral("Can't create NetworkConnection class"));
65+ qmlRegisterUncreatableType<IndicatorsModelRole>(uri, 0, 1, "IndicatorsModelRole", QStringLiteral("Can't create IndicatorsModelRole class"));
66+ qmlRegisterUncreatableType<FlatMenuProxyModelRole>(uri, 0, 1, "FlatMenuProxyModelRole", QStringLiteral("Can't create FlatMenuProxyModelRole class"));
6767}
plugins/Unity/Indicators/rootstateparser.cpp+16−16
@@ -39,7 +39,7 @@ static QString iconUri(GIcon *icon)
3939 }
4040
4141 if (!iconNameList.empty()) {
42− uri = QString("image://theme/%1").arg(iconNameList.join(","));
42+ uri = QStringLiteral("image://theme/%1").arg(iconNameList.join(QStringLiteral(",")));
4343 }
4444 }
4545 else if (G_IS_FILE_ICON (icon)) {
@@ -63,7 +63,7 @@ static QString iconUri(GIcon *icon)
6363 data = g_bytes_get_data (g_bytes_icon_get_bytes (G_BYTES_ICON (icon)), &size);
6464 base64 = g_base64_encode ((const guchar *) data, size);
6565
66− uri = QString("data://");
66+ uri = QStringLiteral("data://");
6767 uri.append (base64);
6868
6969 g_free (base64);
@@ -88,7 +88,7 @@ QVariant RootStateParser::toQVariant(GVariant* state) const
8888 while (g_variant_iter_loop (&iter, "{sv}", &key, &vvalue))
8989 {
9090 QString str = QString::fromUtf8(key);
91− if (str == "icon" && !qmap.contains("icons")) {
91+ if (str == QLatin1String("icon") && !qmap.contains(QStringLiteral("icons"))) {
9292 QStringList icons;
9393
9494 // FIXME - should be sending a url.
@@ -97,9 +97,9 @@ QVariant RootStateParser::toQVariant(GVariant* state) const
9797 icons << iconUri(gicon);
9898 g_object_unref (gicon);
9999 }
100− qmap.insert("icons", icons);
100+ qmap.insert(QStringLiteral("icons"), icons);
101101
102− } else if (str == "icons") {
102+ } else if (str == QLatin1String("icons")) {
103103
104104 QStringList icons;
105105
@@ -118,7 +118,7 @@ QVariant RootStateParser::toQVariant(GVariant* state) const
118118 }
119119 }
120120 // will overwrite icon.
121− qmap.insert("icons", icons);
121+ qmap.insert(QStringLiteral("icons"), icons);
122122
123123 } else {
124124 qmap.insert(str, ActionStateParser::toQVariant(vvalue));
@@ -141,13 +141,13 @@ QVariant RootStateParser::toQVariant(GVariant* state) const
141141 &accessible_name,
142142 &visible);
143143
144− qmap["label"] = label ? QString::fromUtf8(label) : "";
145− qmap["accessible-desc"] = accessible_name ? QString::fromUtf8(accessible_name) : "";
146− qmap["visible"] = visible;
144+ qmap[QStringLiteral("label")] = label ? QString::fromUtf8(label) : QLatin1String("");
145+ qmap[QStringLiteral("accessible-desc")] = accessible_name ? QString::fromUtf8(accessible_name) : QLatin1String("");
146+ qmap[QStringLiteral("visible")] = visible;
147147
148148 gicon = g_icon_new_for_string (icon, nullptr);
149149 if (gicon) {
150− qmap["icons"] = QStringList() << iconUri(gicon);
150+ qmap[QStringLiteral("icons")] = QStringList() << iconUri(gicon);
151151 g_object_unref (gicon);
152152 }
153153
@@ -170,42 +170,42 @@ QString RootStateObject::title() const
170170{
171171 if (!valid()) return QString();
172172
173− return m_currentState.value("title", QVariant::fromValue(QString())).toString();
173+ return m_currentState.value(QStringLiteral("title"), QVariant::fromValue(QString())).toString();
174174}
175175
176176QString RootStateObject::leftLabel() const
177177{
178178 if (!valid()) return QString();
179179
180− return m_currentState.value("pre-label", QVariant::fromValue(QString())).toString();
180+ return m_currentState.value(QStringLiteral("pre-label"), QVariant::fromValue(QString())).toString();
181181}
182182
183183QString RootStateObject::rightLabel() const
184184{
185185 if (!valid()) return QString();
186186
187− return m_currentState.value("label", QVariant::fromValue(QString())).toString();
187+ return m_currentState.value(QStringLiteral("label"), QVariant::fromValue(QString())).toString();
188188}
189189
190190QStringList RootStateObject::icons() const
191191{
192192 if (!valid()) return QStringList();
193193
194− return m_currentState.value("icons", QVariant::fromValue(QStringList())).toStringList();
194+ return m_currentState.value(QStringLiteral("icons"), QVariant::fromValue(QStringList())).toStringList();
195195}
196196
197197QString RootStateObject::accessibleName() const
198198{
199199 if (!valid()) return QString();
200200
201− return m_currentState.value("accessible-desc", QVariant::fromValue(QString())).toString();
201+ return m_currentState.value(QStringLiteral("accessible-desc"), QVariant::fromValue(QString())).toString();
202202}
203203
204204bool RootStateObject::indicatorVisible() const
205205{
206206 if (!valid()) return false;
207207
208− return m_currentState.value("visible", QVariant::fromValue(true)).toBool();
208+ return m_currentState.value(QStringLiteral("visible"), QVariant::fromValue(true)).toBool();
209209}
210210
211211void RootStateObject::setCurrentState(const QVariantMap& newState)
plugins/Unity/Launcher/asadapter.cpp+10−9
@@ -38,25 +38,26 @@ void ASAdapter::syncItems(const QList<LauncherItem*> &list)
3838{
3939 if (m_accounts && !m_user.isEmpty()) {
4040 QList<QVariantMap> items;
41+ items.reserve(list.count());
4142
4243 Q_FOREACH(LauncherItem *item, list) {
4344 items << itemToVariant(item);
4445 }
4546
46− m_accounts->setUserPropertyAsync(m_user, "com.canonical.unity.AccountsService", "LauncherItems", QVariant::fromValue(items));
47+ m_accounts->setUserPropertyAsync(m_user, QStringLiteral("com.canonical.unity.AccountsService"), QStringLiteral("LauncherItems"), QVariant::fromValue(items));
4748 }
4849}
4950
5051QVariantMap ASAdapter::itemToVariant(LauncherItem *item) const
5152{
5253 QVariantMap details;
53− details.insert("id", item->appId());
54− details.insert("name", item->name());
55− details.insert("icon", item->icon());
56− details.insert("count", item->count());
57− details.insert("countVisible", item->countVisible());
58− details.insert("pinned", item->pinned());
59− details.insert("running", item->running());
60− details.insert("progress", item->progress());
54+ details.insert(QStringLiteral("id"), item->appId());
55+ details.insert(QStringLiteral("name"), item->name());
56+ details.insert(QStringLiteral("icon"), item->icon());
57+ details.insert(QStringLiteral("count"), item->count());
58+ details.insert(QStringLiteral("countVisible"), item->countVisible());
59+ details.insert(QStringLiteral("pinned"), item->pinned());
60+ details.insert(QStringLiteral("running"), item->running());
61+ details.insert(QStringLiteral("progress"), item->progress());
6162 return details;
6263}
plugins/Unity/Launcher/dbusinterface.cpp+33−33
@@ -27,7 +27,7 @@
2727#include <QDebug>
2828
2929DBusInterface::DBusInterface(LauncherModel *parent):
30− UnityDBusVirtualObject("/com/canonical/Unity/Launcher", "com.canonical.Unity.Launcher", true, parent),
30+ UnityDBusVirtualObject(QStringLiteral("/com/canonical/Unity/Launcher"), QStringLiteral("com.canonical.Unity.Launcher"), true, parent),
3131 m_launcherModel(parent)
3232{
3333}
@@ -35,13 +35,13 @@ DBusInterface::DBusInterface(LauncherModel *parent):
3535QString DBusInterface::introspect(const QString &path) const
3636{
3737 /* This case we should just list the nodes */
38− if (path == "/com/canonical/Unity/Launcher/" || path == "/com/canonical/Unity/Launcher") {
38+ if (path == QLatin1String("/com/canonical/Unity/Launcher/") || path == QLatin1String("/com/canonical/Unity/Launcher")) {
3939 QString nodes;
4040
4141 // Add Refresh to introspect
42− nodes = "<interface name=\"com.canonical.Unity.Launcher\">"
42+ nodes = QStringLiteral("<interface name=\"com.canonical.Unity.Launcher\">"
4343 "<method name=\"Refresh\"/>"
44− "</interface>";
44+ "</interface>");
4545
4646 // Add dynamic properties for launcher emblems
4747 for (int i = 0; i < m_launcherModel->rowCount(); i++) {
@@ -53,18 +53,18 @@ QString DBusInterface::introspect(const QString &path) const
5353 }
5454
5555 /* Should not happen, but let's handle it */
56− if (!path.startsWith("/com/canonical/Unity/Launcher")) {
57− return "";
56+ if (!path.startsWith(QLatin1String("/com/canonical/Unity/Launcher"))) {
57+ return QLatin1String("");
5858 }
5959
6060 /* Now we should be looking at a node */
6161 QString nodeiface =
62− "<interface name=\"com.canonical.Unity.Launcher.Item\">"
62+ QStringLiteral("<interface name=\"com.canonical.Unity.Launcher.Item\">"
6363 "<property name=\"count\" type=\"i\" access=\"readwrite\" />"
6464 "<property name=\"countVisible\" type=\"b\" access=\"readwrite\" />"
6565 "<property name=\"progress\" type=\"i\" access=\"readwrite\" />"
6666 "<method name=\"Alert\" />"
67− "</interface>";
67+ "</interface>");
6868 return nodeiface;
6969}
7070
@@ -109,7 +109,7 @@ QString DBusInterface::encodeAppId(const QString& appId)
109109 (chr >= '0' && chr <= '9'&& i != 0)) {
110110 encoded.append(chr);
111111 } else {
112− QString hexval = QString("_%1").arg(chr, 2, 16, QChar('0'));
112+ QString hexval = QStringLiteral("_%1").arg(chr, 2, 16, QChar('0'));
113113 encoded.append(hexval.toUpper());
114114 }
115115 }
@@ -127,10 +127,10 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
127127 /* Break down the path to just the app id */
128128 bool validpath = true;
129129 QString pathtemp = message.path();
130− if (!pathtemp.startsWith("/com/canonical/Unity/Launcher/")) {
130+ if (!pathtemp.startsWith(QLatin1String("/com/canonical/Unity/Launcher/"))) {
131131 validpath = false;
132132 }
133− pathtemp.remove("/com/canonical/Unity/Launcher/");
133+ pathtemp.remove(QStringLiteral("/com/canonical/Unity/Launcher/"));
134134 if (pathtemp.indexOf('/') >= 0) {
135135 validpath = false;
136136 }
@@ -139,15 +139,15 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
139139 QString appid = decodeAppId(pathtemp);
140140
141141 // First handle methods of the Launcher interface
142− if (message.interface() == "com.canonical.Unity.Launcher") {
143− if (message.member() == "Refresh") {
142+ if (message.interface() == QLatin1String("com.canonical.Unity.Launcher")) {
143+ if (message.member() == QLatin1String("Refresh")) {
144144 QDBusMessage reply = message.createReply();
145145 Q_EMIT refreshCalled();
146146 return connection.send(reply);
147147 }
148− } else if (message.interface() == "com.canonical.Unity.Launcher.Item") {
148+ } else if (message.interface() == QLatin1String("com.canonical.Unity.Launcher.Item")) {
149149 // Handle methods of the Launcher-Item interface
150− if (message.member() == "Alert" && validpath) {
150+ if (message.member() == QLatin1String("Alert") && validpath) {
151151 QDBusMessage reply = message.createReply();
152152 Q_EMIT alertCalled(appid);
153153 return connection.send(reply);
@@ -155,15 +155,15 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
155155 }
156156
157157 // Now handle dynamic properties (for launcher emblems)
158− if (message.interface() != "org.freedesktop.DBus.Properties") {
158+ if (message.interface() != QLatin1String("org.freedesktop.DBus.Properties")) {
159159 return false;
160160 }
161161
162− if (message.member() == "Get" && (message.arguments().count() != 2 || message.arguments()[0].toString() != "com.canonical.Unity.Launcher.Item")) {
162+ if (message.member() == QLatin1String("Get") && (message.arguments().count() != 2 || message.arguments()[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) {
163163 return false;
164164 }
165165
166− if (message.member() == "Set" && (message.arguments().count() != 3 || message.arguments()[0].toString() != "com.canonical.Unity.Launcher.Item")) {
166+ if (message.member() == QLatin1String("Set") && (message.arguments().count() != 3 || message.arguments()[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) {
167167 return false;
168168 }
169169
@@ -175,45 +175,45 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
175175 LauncherItem *item = static_cast<LauncherItem*>(m_launcherModel->get(index));
176176
177177 QVariantList retval;
178− if (message.member() == "Get") {
178+ if (message.member() == QLatin1String("Get")) {
179179 QString cachedString = message.arguments()[1].toString();
180180 if (!item) {
181181 return false;
182182 }
183− if (cachedString == "count") {
183+ if (cachedString == QLatin1String("count")) {
184184 retval.append(QVariant::fromValue(QDBusVariant(item->count())));
185− } else if (cachedString == "countVisible") {
185+ } else if (cachedString == QLatin1String("countVisible")) {
186186 retval.append(QVariant::fromValue(QDBusVariant(item->countVisible())));
187− } else if (cachedString == "progress") {
187+ } else if (cachedString == QLatin1String("progress")) {
188188 retval.append(QVariant::fromValue(QDBusVariant(item->progress())));
189189 }
190− } else if (message.member() == "Set") {
190+ } else if (message.member() == QLatin1String("Set")) {
191191 QString cachedString = message.arguments()[1].toString();
192− if (cachedString == "count") {
192+ if (cachedString == QLatin1String("count")) {
193193 int newCount = message.arguments()[2].value<QDBusVariant>().variant().toInt();
194194 if (!item || newCount != item->count()) {
195195 Q_EMIT countChanged(appid, newCount);
196− notifyPropertyChanged("com.canonical.Unity.Launcher.Item", encodeAppId(appid), "count", QVariant(newCount));
196+ notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("count"), QVariant(newCount));
197197 }
198− } else if (cachedString == "countVisible") {
198+ } else if (cachedString == QLatin1String("countVisible")) {
199199 bool newVisible = message.arguments()[2].value<QDBusVariant>().variant().toBool();
200200 if (!item || newVisible != item->countVisible()) {
201201 Q_EMIT countVisibleChanged(appid, newVisible);
202− notifyPropertyChanged("com.canonical.Unity.Launcher.Item", encodeAppId(appid), "countVisible", newVisible);
202+ notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("countVisible"), newVisible);
203203 }
204− } else if (cachedString == "progress") {
204+ } else if (cachedString == QLatin1String("progress")) {
205205 int newProgress = message.arguments()[2].value<QDBusVariant>().variant().toInt();
206206 if (!item || newProgress != item->progress()) {
207207 Q_EMIT progressChanged(appid, newProgress);
208− notifyPropertyChanged("com.canonical.Unity.Launcher.Item", encodeAppId(appid), "progress", QVariant(newProgress));
208+ notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("progress"), QVariant(newProgress));
209209 }
210210 }
211− } else if (message.member() == "GetAll") {
211+ } else if (message.member() == QLatin1String("GetAll")) {
212212 if (item) {
213213 QVariantMap all;
214− all.insert("count", item->count());
215− all.insert("countVisible", item->countVisible());
216− all.insert("progress", item->progress());
214+ all.insert(QStringLiteral("count"), item->count());
215+ all.insert(QStringLiteral("countVisible"), item->countVisible());
216+ all.insert(QStringLiteral("progress"), item->progress());
217217 retval.append(all);
218218 }
219219 } else {
plugins/Unity/Launcher/desktopfilehandler.cpp+17−16
@@ -70,7 +70,7 @@ void DesktopFileHandler::load()
7070
7171 QStringList searchDirs = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
7272#ifdef LAUNCHER_TESTING
73− searchDirs << ".";
73+ searchDirs << QStringLiteral(".");
7474#endif
7575
7676 QString path;
@@ -79,14 +79,15 @@ void DesktopFileHandler::load()
7979 helper.replace(dashPos, 1, '/');
8080 }
8181
82− if (helper.contains("/")) {
83− path += helper.split('/').first() + '/';
82+ if (helper.contains('/')) {
83+ path += helper.split('/').at(0) + '/';
8484 helper.remove(QRegExp("^" + path));
8585 }
8686
8787 Q_FOREACH(const QString &searchDirName, searchDirs) {
8888 QDir searchDir(searchDirName + "/" + path);
89− Q_FOREACH(const QString &desktopFile, searchDir.entryList(QStringList() << "*.desktop")) {
89+ const QString desktop = QStringLiteral("*.desktop");
90+ Q_FOREACH(const QString &desktopFile, searchDir.entryList(QStringList() << desktop)) {
9091 if (desktopFile.startsWith(helper)) {
9192 QFileInfo fileInfo(searchDir, desktopFile);
9293 m_filename = fileInfo.absoluteFilePath();
@@ -95,7 +96,7 @@ void DesktopFileHandler::load()
9596 }
9697 }
9798
98− dashPos = helper.indexOf("-");
99+ dashPos = helper.indexOf('-');
99100 } while (dashPos != -1);
100101}
101102
@@ -107,25 +108,25 @@ QString DesktopFileHandler::displayName() const
107108
108109 QSettings settings(m_filename, QSettings::IniFormat);
109110 settings.setIniCodec("UTF-8");
110− settings.beginGroup("Desktop Entry");
111+ settings.beginGroup(QStringLiteral("Desktop Entry"));
111112
112113 // First try to find Name[xx_YY] and Name[xx] in .desktop file
113114 QString locale = QLocale().name();
114115 QString shortLocale = locale.split('_').first();
115116
116− if (locale != shortLocale && settings.contains(QString("Name[%1]").arg(locale))) {
117− return settings.value(QString("Name[%1]").arg(locale)).toString();
117+ if (locale != shortLocale && settings.contains(QStringLiteral("Name[%1]").arg(locale))) {
118+ return settings.value(QStringLiteral("Name[%1]").arg(locale)).toString();
118119 }
119120
120− if (settings.contains(QString("Name[%1]").arg(shortLocale))) {
121− return settings.value(QString("Name[%1]").arg(shortLocale)).toString();
121+ if (settings.contains(QStringLiteral("Name[%1]").arg(shortLocale))) {
122+ return settings.value(QStringLiteral("Name[%1]").arg(shortLocale)).toString();
122123 }
123124
124125 // No translation found in desktop file. Get the untranslated one and have a go with gettext.
125− QString displayName = settings.value("Name").toString();
126+ QString displayName = settings.value(QStringLiteral("Name")).toString();
126127
127− if (settings.contains("X-Ubuntu-Gettext-Domain")) {
128− const QString domain = settings.value("X-Ubuntu-Gettext-Domain").toString();
128+ if (settings.contains(QStringLiteral("X-Ubuntu-Gettext-Domain"))) {
129+ const QString domain = settings.value(QStringLiteral("X-Ubuntu-Gettext-Domain")).toString();
129130 return dgettext(domain.toUtf8().constData(), displayName.toUtf8().constData());
130131 }
131132
@@ -140,9 +141,9 @@ QString DesktopFileHandler::icon() const
140141
141142 QSettings settings(m_filename, QSettings::IniFormat);
142143 settings.setIniCodec("UTF-8");
143− settings.beginGroup("Desktop Entry");
144− QString iconString = settings.value("Icon").toString();
145− QString pathString = settings.value("Path").toString();
144+ settings.beginGroup(QStringLiteral("Desktop Entry"));
145+ QString iconString = settings.value(QStringLiteral("Icon")).toString();
146+ QString pathString = settings.value(QStringLiteral("Path")).toString();
146147
147148 if (QFileInfo(iconString).exists()) {
148149 return QFileInfo(iconString).absoluteFilePath();
plugins/Unity/Launcher/gsettings.cpp+15−12
@@ -32,20 +32,22 @@ QStringList GSettings::storedApplications() const
3232{
3333 QStringList storedApps;
3434
35− Q_FOREACH(const QString &entry, m_gSettings->get("items").toStringList()) {
36− if (entry.startsWith("application:///")) {
35+ const QString items = QStringLiteral("items");
36+ Q_FOREACH(const QString &entry, m_gSettings->get(items).toStringList()) {
37+ if (entry.startsWith(QLatin1String("application:///"))) {
3738 // convert legacy entries to new world appids
3839 QString appId = entry;
3940 // Transform "application://foobar.desktop" to "foobar"
40− appId.remove(QRegExp("^application:///"));
41− appId.remove(QRegExp(".desktop$"));
41+ appId.remove(QRegExp(QStringLiteral("^application:///")));
42+ appId.remove(QRegExp(QStringLiteral(".desktop$")));
4243 storedApps << appId;
43− } else if (entry.startsWith("appid://")) {
44+ } else if (entry.startsWith(QLatin1String("appid://"))) {
4445 QString appId = entry;
45− appId.remove("appid://");
46− if (appId.split('/').count() == 3) {
46+ appId.remove(QStringLiteral("appid://"));
47+ const QStringList splittedAppId = appId.split('/');
48+ if (splittedAppId.count() == 3) {
4749 // Strip current-user-version in case its there
48− appId = appId.split('/').first() + "_" + appId.split('/').at(1);
50+ appId = splittedAppId.first() + "_" + splittedAppId.at(1);
4951 }
5052 storedApps << appId;
5153 }
@@ -56,19 +58,20 @@ QStringList GSettings::storedApplications() const
5658void GSettings::setStoredApplications(const QStringList &storedApplications)
5759{
5860 QStringList gSettingsList;
61+ gSettingsList.reserve(storedApplications.count());
5962 Q_FOREACH(const QString &entry, storedApplications) {
60− gSettingsList << QString("appid://%1").arg(entry);
63+ gSettingsList << QStringLiteral("appid://%1").arg(entry);
6164 }
6265 // GSettings will emit a changed signal to ourselves. Let's cache the items
6366 // and only forward the changed signal when the list did actually change.
6467 m_cachedItems = gSettingsList;
65− m_gSettings->set("items", gSettingsList);
68+ m_gSettings->set(QStringLiteral("items"), gSettingsList);
6669}
6770
6871void GSettings::onSettingsChanged(const QString &key)
6972{
70− if (key == "items") {
71− const QStringList cachedItems = m_gSettings->get("items").toStringList();
73+ if (key == QLatin1String("items")) {
74+ const QStringList cachedItems = m_gSettings->get(QStringLiteral("items")).toStringList();
7275 if (m_cachedItems != cachedItems) {
7376 m_cachedItems = cachedItems;
7477 Q_EMIT changed();
plugins/Unity/Launcher/launcheritem.cpp+6−6
@@ -38,17 +38,17 @@ LauncherItem::LauncherItem(const QString &appId, const QString &name, const QStr
3838 m_quickList(new QuickListModel(this))
3939{
4040 QuickListEntry nameAction;
41− nameAction.setActionId("launch_item");
41+ nameAction.setActionId(QStringLiteral("launch_item"));
4242 nameAction.setText(m_name);
4343 m_quickList->appendAction(nameAction);
4444
4545 QuickListEntry pinningAction;
46− pinningAction.setActionId("pin_item");
46+ pinningAction.setActionId(QStringLiteral("pin_item"));
4747 pinningAction.setText(gettext("Pin shortcut"));
4848 m_quickList->appendAction(pinningAction);
4949
50− m_quitAction.setActionId("stop_item");
51− m_quitAction.setIcon("application-exit");
50+ m_quitAction.setActionId(QStringLiteral("stop_item"));
51+ m_quitAction.setIcon(QStringLiteral("application-exit"));
5252 m_quitAction.setText(gettext("Quit"));
5353}
5454
@@ -67,7 +67,7 @@ void LauncherItem::setName(const QString &name)
6767 if (m_name != name) {
6868 m_name = name;
6969 QuickListEntry entry;
70− entry.setActionId("launch_item");
70+ entry.setActionId(QStringLiteral("launch_item"));
7171 entry.setText(m_name);
7272 m_quickList->updateAction(entry);
7373 Q_EMIT nameChanged(name);
@@ -102,7 +102,7 @@ void LauncherItem::setPinned(bool pinned)
102102 // Even if pinned status didn't change, we want to update text in case
103103 // the locale has changed since we last set pinned status.
104104 QuickListEntry entry;
105− entry.setActionId("pin_item");
105+ entry.setActionId(QStringLiteral("pin_item"));
106106 entry.setText(pinned ? gettext("Unpin shortcut") : gettext("Pin shortcut"));
107107 m_quickList->updateAction(entry);
108108}
plugins/Unity/Launcher/launchermodel.cpp+6−6
@@ -204,15 +204,15 @@ void LauncherModel::quickListActionInvoked(const QString &appId, int actionIndex
204204 const QString actionId = model->get(actionIndex).actionId();
205205
206206 // Check if this is one of the launcher actions we handle ourselves
207− if (actionId == "pin_item") {
207+ if (actionId == QLatin1String("pin_item")) {
208208 if (item->pinned()) {
209209 requestRemove(appId);
210210 } else {
211211 pin(appId);
212212 }
213− } else if (actionId == "launch_item") {
213+ } else if (actionId == QLatin1String("launch_item")) {
214214 QDesktopServices::openUrl(getUrlForAppId(appId));
215− } else if (actionId == "stop_item") { // Quit
215+ } else if (actionId == QLatin1String("stop_item")) { // Quit
216216 if (m_appManager) {
217217 m_appManager->stopApplication(appId);
218218 }
@@ -236,13 +236,13 @@ QString LauncherModel::getUrlForAppId(const QString &appId) const
236236 return QString();
237237 }
238238
239− if (!appId.contains("_")) {
239+ if (!appId.contains('_')) {
240240 return "application:///" + appId + ".desktop";
241241 }
242242
243243 QStringList parts = appId.split('_');
244244 QString package = parts.value(0);
245− QString app = parts.value(1, "first-listed-app");
245+ QString app = parts.value(1, QStringLiteral("first-listed-app"));
246246 return "appid://" + package + "/" + app + "/current-user-version";
247247}
248248
@@ -503,7 +503,7 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
503503 return;
504504 }
505505
506− if (app->appId() == "unity8-dash") {
506+ if (app->appId() == QLatin1String("unity8-dash")) {
507507 // Not adding the dash app
508508 return;
509509 }
plugins/Unity/Launcher/plugin.cpp+5−5
@@ -39,11 +39,11 @@ void UnityLauncherPlugin::registerTypes(const char *uri)
3939{
4040 Q_ASSERT(uri == QLatin1String("Unity.Launcher"));
4141
42− qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", "Abstract Interface. Cannot be instantiated.");
43− qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", "Abstract Interface. Cannot be instantiated.");
44− qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListInterface", "Abstract Interface. Cannot be instantiated.");
42+ qmlRegisterUncreatableType<LauncherModelInterface>(uri, 0, 1, "LauncherModelInterface", QStringLiteral("Abstract Interface. Cannot be instantiated."));
43+ qmlRegisterUncreatableType<LauncherItemInterface>(uri, 0, 1, "LauncherItemInterface", QStringLiteral("Abstract Interface. Cannot be instantiated."));
44+ qmlRegisterUncreatableType<QuickListModelInterface>(uri, 0, 1, "QuickListInterface", QStringLiteral("Abstract Interface. Cannot be instantiated."));
4545
4646 qmlRegisterSingletonType<LauncherModel>(uri, 0, 1, "LauncherModel", modelProvider);
47− qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", "Can't create new Launcher Items in QML. Get them from the LauncherModel.");
48− qmlRegisterUncreatableType<QuickListModel>(uri, 0, 1, "QuickListModel", "Can't create a QuickListModel in QML. Get them from the LauncherItems.");
47+ qmlRegisterUncreatableType<LauncherItem>(uri, 0, 1, "LauncherItem", QStringLiteral("Can't create new Launcher Items in QML. Get them from the LauncherModel."));
48+ qmlRegisterUncreatableType<QuickListModel>(uri, 0, 1, "QuickListModel", QStringLiteral("Can't create a QuickListModel in QML. Get them from the LauncherItems."));
4949}
plugins/Unity/Session/dbusunitysessionservice.cpp+41−41
@@ -58,7 +58,7 @@ public:
5858 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
5959 LOGIN1_PATH,
6060 LOGIN1_IFACE,
61− "GetSessionByPID");
61+ QStringLiteral("GetSessionByPID"));
6262 msg << (quint32) getpid();
6363
6464 QDBusReply<QDBusObjectPath> reply = QDBusConnection::systemBus().asyncCall(msg);
@@ -66,13 +66,13 @@ public:
6666 logindSessionPath = reply.value().path();
6767
6868 // start watching the Active property
69− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, logindSessionPath, "org.freedesktop.DBus.Properties", "PropertiesChanged",
69+ QDBusConnection::systemBus().connect(LOGIN1_SERVICE, logindSessionPath, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"),
7070 this, SLOT(onPropertiesChanged(QString,QVariantMap,QStringList)));
7171
7272 setupSystemdInhibition();
7373
7474 // re-enable the inhibition upon resume from sleep
75− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, "PrepareForSleep",
75+ QDBusConnection::systemBus().connect(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, QStringLiteral("PrepareForSleep"),
7676 this, SLOT(onResuming(bool)));
7777 } else {
7878 qWarning() << "Failed to get logind session path" << reply.error().message();
@@ -87,7 +87,7 @@ public:
8787 // inhibit systemd handling of power/sleep/lid buttons
8888 // http://www.freedesktop.org/wiki/Software/systemd/inhibit
8989
90− QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, "Inhibit");
90+ QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, QStringLiteral("Inhibit"));
9191 msg << "handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch"; // what
9292 msg << "Unity"; // who
9393 msg << "Unity8 handles power events"; // why
@@ -128,8 +128,8 @@ public:
128128
129129 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
130130 logindSessionPath,
131− "org.freedesktop.DBus.Properties",
132− "Get");
131+ QStringLiteral("org.freedesktop.DBus.Properties"),
132+ QStringLiteral("Get"));
133133 msg << LOGIN1_SESSION_IFACE;
134134 msg << ACTIVE_KEY;
135135
@@ -154,8 +154,8 @@ public:
154154 {
155155 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
156156 logindSessionPath,
157− "org.freedesktop.DBus.Properties",
158− "Get");
157+ QStringLiteral("org.freedesktop.DBus.Properties"),
158+ QStringLiteral("Get"));
159159 msg << LOGIN1_SESSION_IFACE;
160160 msg << IDLE_SINCE_KEY;
161161
@@ -174,7 +174,7 @@ public:
174174 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
175175 logindSessionPath,
176176 LOGIN1_SESSION_IFACE,
177− "SetIdleHint");
177+ QStringLiteral("SetIdleHint"));
178178 msg << idle;
179179 QDBusConnection::systemBus().asyncCall(msg);
180180 }
@@ -217,14 +217,14 @@ Q_SIGNALS:
217217Q_GLOBAL_STATIC(DBusUnitySessionServicePrivate, d)
218218
219219DBusUnitySessionService::DBusUnitySessionService()
220− : UnityDBusObject("/com/canonical/Unity/Session", "com.canonical.Unity")
220+ : UnityDBusObject(QStringLiteral("/com/canonical/Unity/Session"), QStringLiteral("com.canonical.Unity"))
221221{
222222 if (!d->logindSessionPath.isEmpty()) {
223223 // connect our Lock() slot to the logind's session Lock() signal
224− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, "Lock", this, SLOT(Lock()));
224+ QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Lock"), this, SLOT(Lock()));
225225 // ... and our Unlocked() signal to the logind's session Unlock() signal
226226 // (lightdm handles the unlocking by calling logind's Unlock method which in turn emits this signal we connect to)
227− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, "Unlock", this, SIGNAL(Unlocked()));
227+ QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SIGNAL(Unlocked()));
228228 } else {
229229 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
230230 }
@@ -239,36 +239,36 @@ void DBusUnitySessionService::Logout()
239239
240240void DBusUnitySessionService::EndSession()
241241{
242− const QDBusMessage msg = QDBusMessage::createMethodCall("com.ubuntu.Upstart",
243− "/com/ubuntu/Upstart",
244− "com.ubuntu.Upstart0_6",
245− "EndSession");
242+ const QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("com.ubuntu.Upstart"),
243+ QStringLiteral("/com/ubuntu/Upstart"),
244+ QStringLiteral("com.ubuntu.Upstart0_6"),
245+ QStringLiteral("EndSession"));
246246 QDBusConnection::sessionBus().asyncCall(msg);
247247}
248248
249249bool DBusUnitySessionService::CanHibernate() const
250250{
251− return d->checkLogin1Call("CanHibernate");
251+ return d->checkLogin1Call(QStringLiteral("CanHibernate"));
252252}
253253
254254bool DBusUnitySessionService::CanSuspend() const
255255{
256− return d->checkLogin1Call("CanSuspend");
256+ return d->checkLogin1Call(QStringLiteral("CanSuspend"));
257257}
258258
259259bool DBusUnitySessionService::CanHybridSleep() const
260260{
261− return d->checkLogin1Call("CanHybridSleep");
261+ return d->checkLogin1Call(QStringLiteral("CanHybridSleep"));
262262}
263263
264264bool DBusUnitySessionService::CanReboot() const
265265{
266− return d->checkLogin1Call("CanReboot");
266+ return d->checkLogin1Call(QStringLiteral("CanReboot"));
267267}
268268
269269bool DBusUnitySessionService::CanShutdown() const
270270{
271− return d->checkLogin1Call("CanPowerOff");
271+ return d->checkLogin1Call(QStringLiteral("CanPowerOff"));
272272}
273273
274274bool DBusUnitySessionService::CanLock() const
@@ -320,10 +320,10 @@ void DBusUnitySessionService::Lock()
320320{
321321 // lock the session using the org.freedesktop.DisplayManager system DBUS service
322322 const QString sessionPath = QString::fromLocal8Bit(qgetenv("XDG_SESSION_PATH"));
323− QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.DisplayManager",
323+ QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DisplayManager"),
324324 sessionPath,
325− "org.freedesktop.DisplayManager.Session",
326− "Lock");
325+ QStringLiteral("org.freedesktop.DisplayManager.Session"),
326+ QStringLiteral("Lock"));
327327 QDBusReply<void> reply = QDBusConnection::systemBus().asyncCall(msg);
328328 if (!reply.isValid()) {
329329 qWarning() << "Lock call failed" << reply.error().message();
@@ -346,7 +346,7 @@ void DBusUnitySessionService::RequestLogout()
346346
347347void DBusUnitySessionService::Reboot()
348348{
349− d->makeLogin1Call("Reboot", {false});
349+ d->makeLogin1Call(QStringLiteral("Reboot"), {false});
350350}
351351
352352void DBusUnitySessionService::RequestReboot()
@@ -357,22 +357,22 @@ void DBusUnitySessionService::RequestReboot()
357357
358358void DBusUnitySessionService::Shutdown()
359359{
360− d->makeLogin1Call("PowerOff", {false});
360+ d->makeLogin1Call(QStringLiteral("PowerOff"), {false});
361361}
362362
363363void DBusUnitySessionService::Suspend()
364364{
365− d->makeLogin1Call("Suspend", {false});
365+ d->makeLogin1Call(QStringLiteral("Suspend"), {false});
366366}
367367
368368void DBusUnitySessionService::Hibernate()
369369{
370− d->makeLogin1Call("Hibernate", {false});
370+ d->makeLogin1Call(QStringLiteral("Hibernate"), {false});
371371}
372372
373373void DBusUnitySessionService::HybridSleep()
374374{
375− d->makeLogin1Call("HybridSleep", {false});
375+ d->makeLogin1Call(QStringLiteral("HybridSleep"), {false});
376376}
377377
378378void DBusUnitySessionService::RequestShutdown()
@@ -392,16 +392,16 @@ enum class Action : unsigned
392392
393393void performAsyncUnityCall(const QString &method)
394394{
395− const QDBusMessage msg = QDBusMessage::createMethodCall("com.canonical.Unity",
396− "/com/canonical/Unity/Session",
397− "com.canonical.Unity.Session",
395+ const QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("com.canonical.Unity"),
396+ QStringLiteral("/com/canonical/Unity/Session"),
397+ QStringLiteral("com.canonical.Unity.Session"),
398398 method);
399399 QDBusConnection::sessionBus().asyncCall(msg);
400400}
401401
402402
403403DBusGnomeSessionManagerWrapper::DBusGnomeSessionManagerWrapper()
404− : UnityDBusObject("/org/gnome/SessionManager/EndSessionDialog", "com.canonical.Unity")
404+ : UnityDBusObject(QStringLiteral("/org/gnome/SessionManager/EndSessionDialog"), QStringLiteral("com.canonical.Unity"))
405405{
406406}
407407
@@ -414,15 +414,15 @@ void DBusGnomeSessionManagerWrapper::Open(const unsigned type, const unsigned ar
414414 switch (static_cast<Action>(type))
415415 {
416416 case Action::LOGOUT:
417− performAsyncUnityCall("RequestLogout");
417+ performAsyncUnityCall(QStringLiteral("RequestLogout"));
418418 break;
419419
420420 case Action::REBOOT:
421− performAsyncUnityCall("RequestReboot");
421+ performAsyncUnityCall(QStringLiteral("RequestReboot"));
422422 break;
423423
424424 case Action::SHUTDOWN:
425− performAsyncUnityCall("RequestShutdown");
425+ performAsyncUnityCall(QStringLiteral("RequestShutdown"));
426426 break;
427427
428428 default:
@@ -432,7 +432,7 @@ void DBusGnomeSessionManagerWrapper::Open(const unsigned type, const unsigned ar
432432
433433
434434DBusGnomeScreensaverWrapper::DBusGnomeScreensaverWrapper()
435− : UnityDBusObject("/org/gnome/ScreenSaver", "org.gnome.ScreenSaver")
435+ : UnityDBusObject(QStringLiteral("/org/gnome/ScreenSaver"), QStringLiteral("org.gnome.ScreenSaver"))
436436{
437437 connect(d, &DBusUnitySessionServicePrivate::screensaverActiveChanged, this, &DBusGnomeScreensaverWrapper::ActiveChanged);
438438}
@@ -451,7 +451,7 @@ void DBusGnomeScreensaverWrapper::SetActive(bool lock)
451451
452452void DBusGnomeScreensaverWrapper::Lock()
453453{
454− performAsyncUnityCall("Lock");
454+ performAsyncUnityCall(QStringLiteral("Lock"));
455455}
456456
457457quint32 DBusGnomeScreensaverWrapper::GetActiveTime() const
@@ -466,9 +466,9 @@ void DBusGnomeScreensaverWrapper::SimulateUserActivity()
466466
467467
468468DBusScreensaverWrapper::DBusScreensaverWrapper()
469− : UnityDBusObject("/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver")
469+ : UnityDBusObject(QStringLiteral("/org/freedesktop/ScreenSaver"), QStringLiteral("org.freedesktop.ScreenSaver"))
470470{
471− QDBusConnection::sessionBus().registerObject("/ScreenSaver", this, QDBusConnection::ExportScriptableContents); // compat path, also register here
471+ QDBusConnection::sessionBus().registerObject(QStringLiteral("/ScreenSaver"), this, QDBusConnection::ExportScriptableContents); // compat path, also register here
472472 connect(d, &DBusUnitySessionServicePrivate::screensaverActiveChanged, this, &DBusScreensaverWrapper::ActiveChanged);
473473}
474474
@@ -488,7 +488,7 @@ bool DBusScreensaverWrapper::SetActive(bool lock)
488488
489489void DBusScreensaverWrapper::Lock()
490490{
491− performAsyncUnityCall("Lock");
491+ performAsyncUnityCall(QStringLiteral("Lock"));
492492}
493493
494494quint32 DBusScreensaverWrapper::GetActiveTime() const
plugins/Utils/CMakeLists.txt+1
@@ -23,6 +23,7 @@ set(QMLPLUGIN_SRC
2323 windowscreenshotprovider.cpp
2424 easingcurve.cpp
2525 windowstatestorage.cpp
26+ timezoneFormatter.cpp
2627 plugin.cpp
2728 )
2829
plugins/Utils/plugin.cpp+4−1
@@ -36,6 +36,7 @@
3636#include "windowscreenshotprovider.h"
3737#include "windowstatestorage.h"
3838#include "constants.h"
39+#include "timezoneFormatter.h"
3940
4041static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine)
4142{
@@ -67,6 +68,8 @@ void UtilsPlugin::registerTypes(const char *uri)
6768 qmlRegisterSingletonType<WindowStateStorage>(uri, 0, 1, "WindowStateStorage", createWindowStateStorage);
6869 qmlRegisterType<InputWatcher>(uri, 0, 1, "InputWatcher");
6970 qmlRegisterSingletonType<Constants>(uri, 0, 1, "Constants", createConstants);
71+ qmlRegisterSingletonType<TimezoneFormatter>(uri, 0, 1, "TimezoneFormatter",
72+ [](QQmlEngine*, QJSEngine*) -> QObject* { return new TimezoneFormatter; });
7073 qmlRegisterType<ActiveFocusLogger>(uri, 0, 1, "ActiveFocusLogger");
7174}
7275
@@ -74,5 +77,5 @@ void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
7477{
7578 QQmlExtensionPlugin::initializeEngine(engine, uri);
7679
77− engine->addImageProvider(QLatin1String("window"), new WindowScreenshotProvider);
80+ engine->addImageProvider(QStringLiteral("window"), new WindowScreenshotProvider);
7881}
plugins/Utils/relativetimeformatter.cpp+4−4
@@ -185,8 +185,8 @@ char* generate_full_format_string_at_time (GDateTime* now,
185185 /* Translators, please edit/rearrange these strftime(3) tokens to suit your locale!
186186 This format string is used for showing, on a 12-hour clock, times that happened before a week from now.
187187 (\u2003 is a unicode em space which is slightly wider than a normal space.)
188− en_US example: "%a %d %b\u2003%l:%M %p" --> "Fri Oct 31 1:00 PM"
189− en_GB example: "%a %b %d\u2003%l:%M %p" --> "Fri 31 Oct 1:00 PM" */
188+ en_US example: "%a %b %d\u2003%l:%M %p" --> "Fri Oct 31 1:00 PM"
189+ en_GB example: "%a %d %b\u2003%l:%M %p" --> "Fri 31 Oct 1:00 PM" */
190190 g_string_assign (ret, dgettext_datetime("%a %d %b\u2003%l:%M %p"));
191191 break;
192192 }
@@ -229,8 +229,8 @@ char* generate_full_format_string_at_time (GDateTime* now,
229229 /* Translators, please edit/rearrange these strftime(3) tokens to suit your locale!
230230 This format string is used for showing, on a 24-hour clock, times that happened before a week from now.
231231 (\u2003 is a unicode em space which is slightly wider than a normal space.)
232− en_US example: "%a %d %b\u2003%H:%M" --> "Fri Oct 31 13:00"
233− en_GB example: "%a %b %d\u2003%H:%M" --> "Fri 31 Oct 13:00" */
232+ en_US example: "%a %b %d\u2003%H:%M" --> "Fri Oct 31 13:00"
233+ en_GB example: "%a %d %b\u2003%H:%M" --> "Fri 31 Oct 13:00" */
234234 g_string_assign (ret, dgettext_datetime("%a %d %b\u2003%H:%M"));
235235 break;
236236 }
plugins/Utils/timeformatter.cpp+3−3
@@ -113,7 +113,7 @@ TimeFormatter::TimeFormatter(QObject *parent): QObject(parent)
113113 priv = new TimeFormatterPrivate;
114114 priv->formatter = this;
115115 priv->time = 0;
116− priv->format = "yyyy-MM-dd hh:mm";
116+ priv->format = QStringLiteral("yyyy-MM-dd hh:mm");
117117 priv->system_bus = nullptr;
118118 priv->subscription_id = 0;
119119 priv->cancellable = g_cancellable_new ();
@@ -182,7 +182,7 @@ QString TimeFormatter::formatTime() const
182182}
183183
184184GDateTimeFormatter::GDateTimeFormatter(QObject* parent)
185−: TimeFormatter("%d-%m-%Y %I:%M%p", parent)
185+: TimeFormatter(QStringLiteral("%d-%m-%Y %I:%M%p"), parent)
186186{
187187}
188188
@@ -194,7 +194,7 @@ QString GDateTimeFormatter::formatTime() const
194194
195195 datetime = g_date_time_new_from_unix_local(time());
196196 if (!datetime) {
197− return "";
197+ return QLatin1String("");
198198 }
199199
200200 time_string = g_date_time_format(datetime, formatBytes.constData());
plugins/Utils/timezoneFormatter.cppnew file+35
@@ -0,0 +1,35 @@
1+/*
2+ * Copyright 2015 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+#include <QTimeZone>
18+
19+#include "timezoneFormatter.h"
20+
21+TimezoneFormatter::TimezoneFormatter(QObject *parent)
22+ : QObject(parent)
23+{
24+}
25+
26+QString TimezoneFormatter::currentTimeInTimezone(const QVariant &tzId) const
27+{
28+ QTimeZone tz(tzId.toByteArray());
29+ if (tz.isValid()) {
30+ const QDateTime now = QDateTime::currentDateTime().toTimeZone(tz);
31+ // return locale-aware string in the form "day, hh:mm", e.g. "Mon 14:30" or "Mon 1:30 pm"
32+ return QStringLiteral("%1 %2").arg(now.toString("ddd")).arg(now.time().toString(Qt::DefaultLocaleShortDate));
33+ }
34+ return QString();
35+}
plugins/Utils/timezoneFormatter.hnew file+32
@@ -0,0 +1,32 @@
1+/*
2+ * Copyright 2015 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+#ifndef TIMEZONE_FORMATTER_H
18+#define TIMEZONE_FORMATTER_H
19+
20+#include <QObject>
21+
22+class TimezoneFormatter : public QObject
23+{
24+ Q_OBJECT
25+public:
26+ TimezoneFormatter(QObject * parent = nullptr);
27+ ~TimezoneFormatter() = default;
28+
29+ Q_INVOKABLE QString currentTimeInTimezone(const QVariant &tzId) const;
30+};
31+
32+#endif
plugins/Utils/windowstatestorage.cpp+6−6
@@ -30,7 +30,7 @@ WindowStateStorage::WindowStateStorage(QObject *parent):
3030 QObject(parent)
3131{
3232 QString dbPath = QDir::homePath() + "/.cache/unity8/";
33− m_db = QSqlDatabase::addDatabase("QSQLITE");
33+ m_db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
3434 QDir dir;
3535 dir.mkpath(dbPath);
3636 m_db.setDatabaseName(dbPath + "windowstatestorage.sqlite");
@@ -71,7 +71,7 @@ WindowStateStorage::WindowState WindowStateStorage::getState(const QString &wind
7171
7272void WindowStateStorage::saveGeometry(const QString &windowId, const QRect &rect)
7373{
74− QString queryString = QString("INSERT OR REPLACE INTO geometry (windowId, x, y, width, height) values ('%1', '%2', '%3', '%4', '%5');")
74+ QString queryString = QStringLiteral("INSERT OR REPLACE INTO geometry (windowId, x, y, width, height) values ('%1', '%2', '%3', '%4', '%5');")
7575 .arg(windowId)
7676 .arg(rect.x())
7777 .arg(rect.y())
@@ -96,7 +96,7 @@ void WindowStateStorage::executeAsyncQuery(const QString &queryString)
9696
9797QRect WindowStateStorage::getGeometry(const QString &windowId, const QRect &defaultValue)
9898{
99− QString queryString = QString("SELECT * FROM geometry WHERE windowId = '%1';")
99+ QString queryString = QStringLiteral("SELECT * FROM geometry WHERE windowId = '%1';")
100100 .arg(windowId);
101101
102102 QSqlQuery query = getValue(queryString);
@@ -104,7 +104,7 @@ QRect WindowStateStorage::getGeometry(const QString &windowId, const QRect &defa
104104 if (!query.first()) {
105105 return defaultValue;
106106 }
107− return QRect(query.value("x").toInt(), query.value("y").toInt(), query.value("width").toInt(), query.value("height").toInt());
107+ return QRect(query.value(QStringLiteral("x")).toInt(), query.value(QStringLiteral("y")).toInt(), query.value(QStringLiteral("width")).toInt(), query.value(QStringLiteral("height")).toInt());
108108}
109109
110110void WindowStateStorage::initdb()
@@ -115,9 +115,9 @@ void WindowStateStorage::initdb()
115115 return;
116116 }
117117
118− if (!m_db.tables().contains("geometry")) {
118+ if (!m_db.tables().contains(QStringLiteral("geometry"))) {
119119 QSqlQuery query;
120− query.exec("CREATE TABLE geometry(windowId TEXT UNIQUE, x INTEGER, y INTEGER, width INTEGER, height INTEGER);");
120+ query.exec(QStringLiteral("CREATE TABLE geometry(windowId TEXT UNIQUE, x INTEGER, y INTEGER, width INTEGER, height INTEGER);"));
121121 }
122122
123123 if (!m_db.tables().contains("state")) {
plugins/Wizard/PageList.cpp+3−3
@@ -40,8 +40,8 @@ PageList::PageList(QObject *parent)
4040 m_index(-1),
4141 m_pages()
4242{
43− QString qmlSuffix = ".qml";
44− QString disabledSuffix = ".disabled";
43+ QString qmlSuffix = QStringLiteral(".qml");
44+ QString disabledSuffix = QStringLiteral(".disabled");
4545 QSet<QString> disabledPages;
4646 QStringList dataDirs;
4747
@@ -53,7 +53,7 @@ PageList::PageList(QObject *parent)
5353
5454 Q_FOREACH(const QString &dataDir, dataDirs) {
5555 QDir dir(dataDir + "/Wizard/Pages");
56− QStringList entries = dir.entryList(QStringList("[0-9]*"), QDir::Files | QDir::Readable);
56+ QStringList entries = dir.entryList(QStringList(QStringLiteral("[0-9]*")), QDir::Files | QDir::Readable);
5757 Q_FOREACH(const QString &entry, entries) {
5858 if (!m_pages.contains(entry) && entry.endsWith(qmlSuffix))
5959 m_pages.insert(entry, dir.absoluteFilePath(entry));
plugins/Wizard/System.cpp+12−12
@@ -42,7 +42,7 @@ System::System()
4242QString System::wizardEnabledPath()
4343{
4444 // Uses ubuntu-system-settings namespace for historic compatibility reasons
45− return QDir::home().filePath(".config/ubuntu-system-settings/wizard-has-run");
45+ return QDir::home().filePath(QStringLiteral(".config/ubuntu-system-settings/wizard-has-run"));
4646}
4747
4848bool System::wizardEnabled() const
@@ -58,7 +58,7 @@ void System::setWizardEnabled(bool enabled)
5858 if (enabled) {
5959 QFile::remove(wizardEnabledPath());
6060 } else {
61− QDir(wizardEnabledPath()).mkpath("..");
61+ QDir(wizardEnabledPath()).mkpath(QStringLiteral(".."));
6262 QFile(wizardEnabledPath()).open(QIODevice::WriteOnly);
6363 m_fsWatcher.addPath(wizardEnabledPath());
6464 Q_EMIT wizardEnabledChanged();
@@ -79,10 +79,10 @@ void System::setSessionVariable(const QString &variable, const QString &value)
7979 QMap<QString,QString> valueMap;
8080 valueMap.insert(variable, value);
8181
82− QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.DBus",
83− "/org/freedesktop/DBus",
84− "org.freedesktop.DBus",
85− "UpdateActivationEnvironment");
82+ QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DBus"),
83+ QStringLiteral("/org/freedesktop/DBus"),
84+ QStringLiteral("org.freedesktop.DBus"),
85+ QStringLiteral("UpdateActivationEnvironment"));
8686
8787 msg << QVariant::fromValue(valueMap);
8888 QDBusConnection::sessionBus().asyncCall(msg);
@@ -90,21 +90,21 @@ void System::setSessionVariable(const QString &variable, const QString &value)
9090
9191void System::updateSessionLanguage(const QString &locale)
9292{
93− const QString language = locale.split(".")[0];
93+ const QString language = locale.split(QStringLiteral("."))[0];
9494
95− setSessionVariable("LANGUAGE", language);
96− setSessionVariable("LANG", locale);
97− setSessionVariable("LC_ALL", locale);
95+ setSessionVariable(QStringLiteral("LANGUAGE"), language);
96+ setSessionVariable(QStringLiteral("LANG"), locale);
97+ setSessionVariable(QStringLiteral("LC_ALL"), locale);
9898
9999 // QLocale caches the default locale on startup, and Qt uses that cached
100100 // copy when formatting dates. So manually update it here.
101101 QLocale::setDefault(QLocale(locale));
102102
103103 // Restart bits of the session to pick up new language.
104− QProcess::startDetached("sh -c \"initctl emit indicator-services-end; \
104+ QProcess::startDetached(QStringLiteral("sh -c \"initctl emit indicator-services-end; \
105105 initctl stop scope-registry; \
106106 initctl stop smart-scopes-proxy; \
107107 initctl emit --no-wait indicator-services-start; \
108108 initctl restart --no-wait maliit-server; \
109− initctl restart --no-wait unity8-dash\"");
109+ initctl restart --no-wait unity8-dash\""));
110110}
po/unity8.pot+36−34
@@ -8,7 +8,7 @@ msgid ""
88msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2015-08-25 14:53+0200\n"
11+"POT-Creation-Date: 2015-09-16 00:49+0200\n"
1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,7 +18,7 @@ msgstr ""
1818"Content-Transfer-Encoding: 8bit\n"
1919"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
2020
21−#: plugins/LightDM/Greeter.cpp:112
21+#: plugins/IntegratedLightDM/Greeter.cpp:112
2222msgid "Password: "
2323msgstr ""
2424
@@ -134,83 +134,83 @@ msgid_plural "Please wait %1 minutes and then try again…"
134134msgstr[0] ""
135135msgstr[1] ""
136136
137−#: qml/Components/Dialogs.qml:112
137+#: qml/Components/Dialogs.qml:115
138138msgctxt "Title: Lock/Log out dialog"
139139msgid "Log out"
140140msgstr ""
141141
142−#: qml/Components/Dialogs.qml:113
142+#: qml/Components/Dialogs.qml:116
143143msgid "Are you sure you want to log out?"
144144msgstr ""
145145
146−#: qml/Components/Dialogs.qml:115
146+#: qml/Components/Dialogs.qml:118
147147msgctxt "Button: Lock the system"
148148msgid "Lock"
149149msgstr ""
150150
151−#: qml/Components/Dialogs.qml:122
151+#: qml/Components/Dialogs.qml:125
152152msgctxt "Button: Log out from the system"
153153msgid "Log Out"
154154msgstr ""
155155
156−#: qml/Components/Dialogs.qml:129 qml/Components/Dialogs.qml:162
157−#: qml/Components/Dialogs.qml:221
156+#: qml/Components/Dialogs.qml:132 qml/Components/Dialogs.qml:165
157+#: qml/Components/Dialogs.qml:224
158158msgid "Cancel"
159159msgstr ""
160160
161−#: qml/Components/Dialogs.qml:141
161+#: qml/Components/Dialogs.qml:144
162162msgctxt "Title: Reboot/Shut down dialog"
163163msgid "Shut down"
164164msgstr ""
165165
166−#: qml/Components/Dialogs.qml:142
166+#: qml/Components/Dialogs.qml:145
167167msgid "Are you sure you want to shut down?"
168168msgstr ""
169169
170−#: qml/Components/Dialogs.qml:144
170+#: qml/Components/Dialogs.qml:147
171171msgctxt "Button: Reboot the system"
172172msgid "Reboot"
173173msgstr ""
174174
175−#: qml/Components/Dialogs.qml:153
175+#: qml/Components/Dialogs.qml:156
176176msgctxt "Button: Shut down the system"
177177msgid "Shut down"
178178msgstr ""
179179
180−#: qml/Components/Dialogs.qml:175
180+#: qml/Components/Dialogs.qml:178
181181msgctxt "Title: Reboot dialog"
182182msgid "Reboot"
183183msgstr ""
184184
185−#: qml/Components/Dialogs.qml:176
185+#: qml/Components/Dialogs.qml:179
186186msgid "Are you sure you want to reboot?"
187187msgstr ""
188188
189−#: qml/Components/Dialogs.qml:178
189+#: qml/Components/Dialogs.qml:181
190190msgid "No"
191191msgstr ""
192192
193−#: qml/Components/Dialogs.qml:185
193+#: qml/Components/Dialogs.qml:188
194194msgid "Yes"
195195msgstr ""
196196
197−#: qml/Components/Dialogs.qml:200
197+#: qml/Components/Dialogs.qml:203
198198msgctxt "Title: Power off/Restart dialog"
199199msgid "Power"
200200msgstr ""
201201
202−#: qml/Components/Dialogs.qml:201
202+#: qml/Components/Dialogs.qml:204
203203msgid ""
204204"Are you sure you would like\n"
205205"to power off?"
206206msgstr ""
207207
208−#: qml/Components/Dialogs.qml:203
208+#: qml/Components/Dialogs.qml:206
209209msgctxt "Button: Power off the system"
210210msgid "Power off"
211211msgstr ""
212212
213−#: qml/Components/Dialogs.qml:212
213+#: qml/Components/Dialogs.qml:215
214214msgctxt "Button: Restart the system"
215215msgid "Restart"
216216msgstr ""
@@ -271,8 +271,10 @@ msgstr ""
271271msgid "Less..."
272272msgstr ""
273273
274−#: qml/Dash/Previews/PreviewCommentInput.qml:61
275−#: qml/Dash/Previews/PreviewRatingInput.qml:169
274+#: qml/Dash/Previews/PreviewCommentInput.qml:68
275+#: qml/Dash/Previews/PreviewRatingInput.qml:174
276+#: qml/Panel/Indicators/MessageMenuItemFactory.qml:148
277+#: qml/Panel/Indicators/MessageMenuItemFactory.qml:205
276278msgid "Send"
277279msgstr ""
278280
@@ -387,62 +389,62 @@ msgstr ""
387389msgid "Conference"
388390msgstr ""
389391
390−#: qml/Panel/Indicators/MenuItemFactory.qml:674
392+#: qml/Panel/Indicators/MenuItemFactory.qml:718
391393msgid "Nothing is playing"
392394msgstr ""
393395
394−#: qml/Panel/Indicators/MenuItemFactory.qml:803
396+#: qml/Panel/Indicators/MenuItemFactory.qml:847
395397#, qt-format
396398msgid "%1 hour"
397399msgid_plural "%1 hours"
398400msgstr[0] ""
399401msgstr[1] ""
400402
401−#: qml/Panel/Indicators/MenuItemFactory.qml:807
403+#: qml/Panel/Indicators/MenuItemFactory.qml:851
402404#, qt-format
403405msgid "%1 minute"
404406msgid_plural "%1 minutes"
405407msgstr[0] ""
406408msgstr[1] ""
407409
408−#: qml/Panel/Indicators/MenuItemFactory.qml:812
410+#: qml/Panel/Indicators/MenuItemFactory.qml:856
409411#, qt-format
410412msgid "%1 second"
411413msgid_plural "%1 seconds"
412414msgstr[0] ""
413415msgstr[1] ""
414416
415−#: qml/Panel/Indicators/MenuItemFactory.qml:815
417+#: qml/Panel/Indicators/MenuItemFactory.qml:859
416418msgid "0 seconds"
417419msgstr ""
418420
419421#. Translators: String like "1 hour, 2 minutes, 3 seconds remaining"
420−#: qml/Panel/Indicators/MenuItemFactory.qml:817
422+#: qml/Panel/Indicators/MenuItemFactory.qml:861
421423#, qt-format
422424msgid "%1 remaining"
423425msgstr ""
424426
425−#: qml/Panel/Indicators/MenuItemFactory.qml:823
427+#: qml/Panel/Indicators/MenuItemFactory.qml:867
426428msgid "In queue…"
427429msgstr ""
428430
429−#: qml/Panel/Indicators/MenuItemFactory.qml:827
431+#: qml/Panel/Indicators/MenuItemFactory.qml:871
430432msgid "Downloading"
431433msgstr ""
432434
433−#: qml/Panel/Indicators/MenuItemFactory.qml:829
435+#: qml/Panel/Indicators/MenuItemFactory.qml:873
434436msgid "Paused, tap to resume"
435437msgstr ""
436438
437−#: qml/Panel/Indicators/MenuItemFactory.qml:831
439+#: qml/Panel/Indicators/MenuItemFactory.qml:875
438440msgid "Canceled"
439441msgstr ""
440442
441−#: qml/Panel/Indicators/MenuItemFactory.qml:833
443+#: qml/Panel/Indicators/MenuItemFactory.qml:877
442444msgid "Finished"
443445msgstr ""
444446
445−#: qml/Panel/Indicators/MenuItemFactory.qml:835
447+#: qml/Panel/Indicators/MenuItemFactory.qml:879
446448msgid "Failed, tap to retry"
447449msgstr ""
448450
qml/Notifications/Notification.qml+11−7
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013, 2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -17,11 +17,10 @@
1717import QtQuick 2.0
1818import QtMultimedia 5.0
1919import Powerd 0.1
20−import Ubuntu.Components 1.1
20+import Ubuntu.Components 1.2
2121import Unity.Notifications 1.0
2222import QMenuModel 0.1
2323import Utils 0.1
24−
2524import Ubuntu.Components.ListItems 0.1 as ListItem
2625
2726Item {
@@ -49,6 +48,8 @@ Item {
4948 readonly property color sdDarkGrey: "#dddddd"
5049 readonly property color sdFontColor: "#5d5d5d"
5150 readonly property real contentSpacing: units.gu(2)
51+ readonly property bool canBeClosed: type === Notification.Ephemeral
52+ property bool hasMouse
5253
5354 objectName: "background"
5455 implicitHeight: type !== Notification.PlaceHolder ? (fullscreen ? maxHeight : outterColumn.height - shapedBack.anchors.topMargin + contentSpacing * 2) : 0
@@ -216,6 +217,8 @@ Item {
216217 onClicked: {
217218 if (notification.type == Notification.Interactive) {
218219 notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
220+ } else if (hasMouse && canBeClosed) {
221+ notification.notification.close()
219222 } else {
220223 notificationList.currentIndex = index;
221224 }
@@ -280,7 +283,7 @@ Item {
280283 fontSize: "medium"
281284 color: darkOnBright ? sdFontColor : Theme.palette.selected.backgroundText
282285 elide: Text.ElideRight
283− textFormat: Text.PlainText
286+ textFormat: Text.StyledText
284287 }
285288
286289 Label {
@@ -297,7 +300,7 @@ Item {
297300 wrapMode: Text.WordWrap
298301 maximumLineCount: type == Notification.SnapDecision ? 12 : 2
299302 elide: Text.ElideRight
300− textFormat: Text.PlainText
303+ textFormat: Text.StyledText
301304 }
302305 }
303306
@@ -471,7 +474,7 @@ Item {
471474 onClicked: notification.notification.invokeAction(oneOverTwoLoaderBottom.actionId)
472475 }
473476 }
474− sourceComponent: (index == 1 || index == 2) ? oneOverTwoButtonBottom : undefined
477+ sourceComponent: (index == 1 || index == 2) ? oneOverTwoButtonBottom : undefined
475478 }
476479 }
477480 }
@@ -487,7 +490,7 @@ Item {
487490 margins: contentSpacing
488491 }
489492 visible: notification.type === Notification.SnapDecision && actionRepeater.count > 0 && !oneOverTwoCase.visible
490− spacing: units.gu(2)
493+ spacing: contentSpacing
491494 layoutDirection: Qt.RightToLeft
492495
493496 Loader {
@@ -499,6 +502,7 @@ Item {
499502 width: buttonRow.width
500503 leftIconName: "call-end"
501504 rightIconName: "call-start"
505+ clickToAct: notification.hasMouse
502506 onRightTriggered: {
503507 notification.notification.invokeAction(notification.actions.data(0, ActionModel.RoleActionId))
504508 }
qml/Notifications/Notifications.qml+3−1
@@ -28,6 +28,7 @@ ListView {
2828
2929 property real margin
3030 property bool useModal: snapDecisionProxyModel.count > 0
31+ property bool hasMouse
3132
3233 UnitySortFilterProxyModel {
3334 id: snapDecisionProxyModel
@@ -52,12 +53,13 @@ ListView {
5253 secondaryIconSource: model.secondaryIcon
5354 summary: model.summary
5455 body: model.body
55− value: model.value
56+ value: model.value ? model.value : -1
5657 actions: model.actions
5758 notificationId: model.id
5859 notification: notificationList.model.getRaw(notificationId)
5960 maxHeight: notificationList.height
6061 margins: notificationList.margin
62+ hasMouse: notificationList.hasMouse
6163
6264 // make sure there's no opacity-difference between the several
6365 // elements in a notification
qml/Notifications/SwipeToAct.qml+38−3
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 20014-2015 Canonical, Ltd.
2+ * Copyright (C) 2014-2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -15,12 +15,12 @@
1515 */
1616
1717import QtQuick 2.3
18−import Ubuntu.Components 1.1
18+import Ubuntu.Components 1.2
1919
2020Item {
2121 id: swipeToAct
2222
23− height: childrenRect.height
23+ height: clickToAct ? leftButton.height : childrenRect.height
2424
2525 signal leftTriggered()
2626 signal rightTriggered()
@@ -28,6 +28,8 @@ Item {
2828 property string leftIconName
2929 property string rightIconName
3030
31+ property bool clickToAct
32+
3133 QtObject {
3234 id: priv
3335
@@ -64,15 +66,45 @@ Item {
6466 }
6567 }
6668
69+ Button {
70+ id: leftButton
71+ objectName: "leftButton"
72+ anchors.verticalCenter: parent.verticalCenter
73+ anchors.left: parent.left
74+ iconName: leftIconName
75+ visible: clickToAct
76+ width: (parent.width / 2) - priv.gap
77+ color: UbuntuColors.red
78+ onClicked: {
79+ leftTriggered()
80+ }
81+ }
82+
83+ Button {
84+ id: rightButton
85+ objectName: "rightButton"
86+ anchors.verticalCenter: parent.verticalCenter
87+ anchors.right: parent.right
88+ iconName: rightIconName
89+ visible: clickToAct
90+ width: (parent.width / 2) - priv.gap
91+ color: UbuntuColors.green
92+ onClicked: {
93+ rightTriggered()
94+ }
95+ }
96+
6797 UbuntuShape {
6898 id: row
6999 width: parent.width
70100 height: priv.sliderHeight
71101 color: priv.sliderBGColor
72102 borderSource: "none"
103+ visible: !clickToAct
73104
74105 UbuntuShape {
75106 id: leftShape
107+ objectName: "leftArea"
76108 anchors.top: parent.top
77109 anchors.left: parent.left
78110 anchors.margins: priv.gap
@@ -167,6 +199,7 @@ Item {
167199 color: "white"
168200 }
169201 }
202+
170203 Row {
171204 anchors.verticalCenter: parent.verticalCenter
172205 anchors.left: slider.right
@@ -189,6 +222,7 @@ Item {
189222
190223 UbuntuShape {
191224 id: rightShape
225+ objectName: "rightArea"
192226 anchors.top: parent.top
193227 anchors.right: parent.right
194228 anchors.margins: priv.gap
@@ -214,6 +248,7 @@ Item {
214248 MouseArea {
215249 id: mouseArea
216250 objectName: "swipeMouseArea"
251+ enabled: !clickToAct
217252
218253 anchors.fill: row
219254 drag.target: slider
qml/OrientedShell.qml+1−1
@@ -155,7 +155,7 @@ Rectangle {
155155 nativeWidth: root.width
156156 nativeHeight: root.height
157157 mode: applicationArguments.mode
158− cursorVisible: UnityInputInfo.mice > deviceConfiguration.ignoredMice
158+ hasMouse: UnityInputInfo.mice > deviceConfiguration.ignoredMice
159159
160160 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
161161 // what's the output device (eg: big TV, desktop monitor, phone display), etc.
qml/Panel/IndicatorItem.qml+1−1
@@ -243,7 +243,7 @@ IndicatorDelegate {
243243 return;
244244 }
245245
246− title = rootActionState.title ? rootActionState.title : "";
246+ title = rootActionState.title ? rootActionState.title : rootActionState.accessibleName;
247247 leftLabel = rootActionState.leftLabel ? rootActionState.leftLabel : "";
248248 rightLabel = rootActionState.rightLabel ? rootActionState.rightLabel : "";
249249 icons = rootActionState.icons;
qml/Panel/IndicatorPage.qml+1−1
@@ -23,7 +23,7 @@ IndicatorBase {
2323 id: main
2424
2525 //const
26− property string title: rootActionState.title
26+ property string title: rootActionState.title || rootActionState.accessibleName // some indicators don't expose a title but only the accessible-desc
2727 property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
2828 readonly property alias factory: _factory
2929
qml/Panel/Indicators/IndicatorDelegate.qml+1−1
@@ -21,5 +21,5 @@ import QtQuick 2.0
2121
2222IndicatorBase {
2323 readonly property bool indicatorVisible: rootActionState.indicatorVisible
24− readonly property string title: rootActionState.title
24+ readonly property string title: rootActionState.title || rootActionState.accessibleName
2525}
qml/Panel/Indicators/MenuItemFactory.qml+93−5
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2013,2015 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU Lesser General Public License as published by
@@ -12,9 +12,6 @@
1212 *
1313 * You should have received a copy of the GNU Lesser General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
1815 */
1916
2017import QtQuick 2.0
@@ -23,7 +20,8 @@ import Ubuntu.Settings.Components 0.1
2320import QMenuModel 0.1
2421import Utils 0.1 as Utils
2522import Ubuntu.Components.ListItems 0.1 as ListItems
26−import Ubuntu.Components 1.1
23+import Ubuntu.Components 1.2
24+import Unity.Session 0.1
2725
2826Item {
2927 id: menuFactory
@@ -60,6 +58,12 @@ Item {
6058 "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
6159 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
6260 "com.canonical.indicator.network.modeminfoitem" : modeminfoitem,
61+
62+ "com.canonical.indicator.calendar": calendarMenu,
63+ "com.canonical.indicator.location": timezoneMenu,
64+
65+ "indicator.user-menu-item": userMenuItem,
66+ "indicator.guest-menu-item": userMenuItem
6367 },
6468 "indicator-messages" : {
6569 "com.canonical.indicator.button" : messagesButtonMenu
@@ -422,6 +426,90 @@ Item {
422426 }
423427 }
424428
429+ Component {
430+ id: userMenuItem
431+
432+ Menus.UserSessionMenu {
433+ objectName: "userSessionMenu"
434+ highlightWhenPressed: false
435+
436+ property QtObject menuData: null
437+ property var menuModel: menuFactory.menuModel
438+ property int menuIndex: -1
439+
440+ name: menuData && menuData.label || "" // label is the user's real name
441+ iconSource: menuData && menuData.icon || ""
442+
443+ // would be better to compare with the logname but sadly the indicator doesn't expose that
444+ active: DBusUnitySessionService.RealName() !== "" ? DBusUnitySessionService.RealName() == name
445+ : DBusUnitySessionService.UserName() == name
446+
447+ onTriggered: {
448+ menuModel.activate(menuIndex);
449+ }
450+ }
451+ }
452+
453+ Component {
454+ id: calendarMenu
455+
456+ Menus.CalendarMenu {
457+ objectName: "calendarMenu"
458+ highlightWhenPressed: false
459+ focus: true
460+ }
461+ }
462+
463+ Component {
464+ id: timezoneMenu
465+
466+ Menus.TimeZoneMenu {
467+ id: tzMenuItem
468+ objectName: "timezoneMenu"
469+
470+ property QtObject menuData: null
471+ property var menuModel: menuFactory.menuModel
472+ property int menuIndex: -1
473+ property var extendedData: menuData && menuData.ext || undefined
474+ readonly property string tz: getExtendedProperty(extendedData, "xCanonicalTimezone", "UTC")
475+ property var updateTimer: Timer {
476+ repeat: true
477+ running: tzMenuItem.visible // only run when we're open
478+ onTriggered: tzMenuItem.time = Utils.TimezoneFormatter.currentTimeInTimezone(tzMenuItem.tz)
479+ }
480+
481+ city: menuData && menuData.label || ""
482+ time: Utils.TimezoneFormatter.currentTimeInTimezone(tz)
483+ enabled: menuData && menuData.sensitive || false
484+
485+ onMenuModelChanged: {
486+ loadAttributes();
487+ }
488+ onMenuIndexChanged: {
489+ loadAttributes();
490+ }
491+ onTriggered: {
492+ tzActionGroup.setLocation.activate(tz);
493+ }
494+
495+ QDBusActionGroup {
496+ id: tzActionGroup
497+ busType: DBus.SessionBus
498+ busName: "com.canonical.indicator.datetime"
499+ objectPath: "/com/canonical/indicator/datetime"
500+
501+ property variant setLocation: action("set-location")
502+
503+ Component.onCompleted: tzActionGroup.start()
504+ }
505+
506+ function loadAttributes() {
507+ if (!menuModel || menuIndex == -1) return;
508+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-timezone': 'string'});
509+ }
510+ }
511+ }
512+
425513 Component {
426514 id: wifiSection;
427515
qml/Panel/Indicators/MessageMenuItemFactory.qml+1−1
@@ -145,7 +145,7 @@ Loader {
145145 title: menuData && menuData.label || ""
146146 time: timeFormatter.timeString
147147 body: getExtendedProperty(extendedData, "xCanonicalText", "")
148− replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
148+ replyButtonText: getExtendedProperty(replyActionDescription, "label", i18n.tr("Send"))
149149 replyHintText: i18n.ctr("Label: Hint in message indicator line edit", "Reply")
150150 // icons
151151 avatar: getExtendedProperty(extendedData, "icon", "image://theme/contact")
qml/Panel/Indicators/client/IndicatorRepresentation.qml+3−1
@@ -26,7 +26,9 @@ import "../.."
2626Page {
2727 id: root
2828
29− title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title : ""
29+ title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title :
30+ indicatorProperties && indicatorProperties.accessibleName ? indicatorProperties.accessibleName
31+ : ""
3032 property variant indicatorProperties
3133
3234 anchors.fill: parent
qml/Shell.qml+3−1
@@ -65,6 +65,7 @@ Item {
6565 function updateFocusedAppOrientationAnimated() {
6666 applicationsDisplayLoader.item.updateFocusedAppOrientationAnimated();
6767 }
68+ property bool hasMouse: false
6869
6970 // to be read from outside
7071 readonly property int mainAppWindowOrientationAngle:
@@ -633,6 +634,7 @@ Item {
633634
634635 model: NotificationBackend.Model
635636 margin: units.gu(1)
637+ hasMouse: shell.hasMouse
636638
637639 y: topmostIsFullscreen ? 0 : panel.panelHeight
638640 height: parent.height - (topmostIsFullscreen ? 0 : panel.panelHeight)
@@ -686,7 +688,7 @@ Item {
686688
687689 Cursor {
688690 id: cursor
689− visible: shell.cursorVisible
691+ visible: shell.hasMouse
690692 z: screenGrabber.z + 1
691693 }
692694
qml/Stages/DesktopStage.qml−3
@@ -139,9 +139,6 @@ Rectangle {
139139 height: units.gu(50)
140140 focus: model.appId === priv.focusedAppId
141141
142− readonly property int minWidth: units.gu(10)
143− readonly property int minHeight: units.gu(10)
144−
145142 property bool maximized: false
146143 property bool minimized: false
147144 property bool animationsEnabled: true
qml/Stages/PhoneStage.qml+15−7
@@ -48,17 +48,12 @@ Rectangle {
4848 onBeingResizedChanged: {
4949 if (beingResized) {
5050 // Brace yourselves for impact!
51− spreadView.selectedIndex = -1;
52− spreadView.phase = 0;
53− spreadView.contentX = -spreadView.shift;
51+ priv.reset();
5452 }
5553 }
5654 onSpreadEnabledChanged: {
5755 if (!spreadEnabled) {
58− // reset. go back to display the focused app
59− spreadView.selectedIndex = -1;
60− spreadView.phase = 0;
61− spreadView.contentX = -spreadView.shift;
56+ priv.reset();
6257 }
6358 }
6459 function updateFocusedAppOrientation() {
@@ -94,6 +89,7 @@ Rectangle {
9489 readonly property var mainApp: applicationManager.focusedApplicationId
9590 ? applicationManager.findApplication(applicationManager.focusedApplicationId)
9691 : null
92+
9793 property int mainAppWindowOrientationAngle: 0
9894 readonly property bool orientationChangesEnabled: priv.focusedAppOrientationChangesEnabled
9995 && !priv.focusedAppDelegateIsDislocated
@@ -216,6 +212,18 @@ Rectangle {
216212 // Is more stable than "spreadView.shiftedContentX === 0" as it filters out noise caused by
217213 // Flickable.contentX changing due to resizes.
218214 property bool fullyShowingFocusedApp: true
215+
216+ function reset() {
217+ // The app that's about to go to foreground has to be focused, otherwise
218+ // it would leave us in an inconsistent state.
219+ if (!root.applicationManager.focusedApplicationId && root.applicationManager.count > 0) {
220+ root.applicationManager.focusApplication(root.applicationManager.get(0).appId);
221+ }
222+
223+ spreadView.selectedIndex = -1;
224+ spreadView.phase = 0;
225+ spreadView.contentX = -spreadView.shift;
226+ }
219227 }
220228 Timer {
221229 id: fullyShowingFocusedAppUpdateTimer
qml/Stages/SpreadDelegate.qml+1−1
@@ -268,7 +268,7 @@ FocusScope {
268268 focus: true
269269 anchors {
270270 fill: parent
271− topMargin: appWindow.fullscreen || application.rotatesWindowContents
271+ topMargin: appWindow.fullscreen || (application && application.rotatesWindowContents)
272272 ? 0 : maximizedAppTopMargin
273273 }
274274
src/ApplicationArguments.h+2−2
@@ -31,10 +31,10 @@ class ApplicationArguments : public QObject
3131public:
3232 ApplicationArguments(QObject *parent = nullptr);
3333
34− void setDeviceName(QString deviceName) { m_deviceName = deviceName; }
34+ void setDeviceName(const QString &deviceName) { m_deviceName = deviceName; }
3535 QString deviceName() const { return m_deviceName; }
3636
37− void setMode(QString mode) { m_mode = mode; }
37+ void setMode(const QString &mode) { m_mode = mode; }
3838 QString mode() const { return m_mode; }
3939
4040private:
src/CachingNetworkManagerFactory.cpp+1−1
@@ -46,7 +46,7 @@ QNetworkAccessManager *CachingNetworkManagerFactory::create(QObject *parent) {
4646 QNetworkAccessManager *manager = new CachingNetworkAccessManager(parent);
4747
4848 QNetworkDiskCache* cache = new QNetworkDiskCache(manager);
49− cache->setCacheDirectory(QString("%1/network").arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)));
49+ cache->setCacheDirectory(QStringLiteral("%1/network").arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)));
5050
5151 manager->setCache(cache);
5252 return manager;
src/Dash/main.cpp+10−10
@@ -36,20 +36,20 @@ int main(int argc, const char *argv[])
3636 QGuiApplication *application = new QGuiApplication(argc, (char**)argv);
3737
3838 QCommandLineParser parser;
39− parser.setApplicationDescription("Description: Unity 8 Shell Dash");
39+ parser.setApplicationDescription(QStringLiteral("Description: Unity 8 Shell Dash"));
4040 parser.addHelpOption();
4141
42− QCommandLineOption mousetouchOption("mousetouch",
43− "Allow the mouse to provide touch input");
42+ QCommandLineOption mousetouchOption(QStringLiteral("mousetouch"),
43+ QStringLiteral("Allow the mouse to provide touch input"));
4444 parser.addOption(mousetouchOption);
4545
46− QCommandLineOption windowGeometryOption(QStringList() << "windowgeometry",
47− "Specify the window geometry as [<width>x<height>]", "windowgeometry", "1");
46+ QCommandLineOption windowGeometryOption(QStringList() << QStringLiteral("windowgeometry"),
47+ QStringLiteral("Specify the window geometry as [<width>x<height>]"), QStringLiteral("windowgeometry"), QStringLiteral("1"));
4848 parser.addOption(windowGeometryOption);
4949
5050 // FIXME Remove once we drop the need of the hint
51− QCommandLineOption desktopFileHintOption("desktop_file_hint",
52− "The desktop_file_hint option for QtMir", "hint_file");
51+ QCommandLineOption desktopFileHintOption(QStringLiteral("desktop_file_hint"),
52+ QStringLiteral("The desktop_file_hint option for QtMir"), QStringLiteral("hint_file"));
5353 parser.addOption(desktopFileHintOption);
5454
5555 // Treat args with single dashes the same as arguments with two dashes
@@ -60,7 +60,7 @@ int main(int argc, const char *argv[])
6060 ApplicationArguments qmlArgs;
6161
6262 if (getenv("QT_LOAD_TESTABILITY")) {
63− QLibrary testLib(QLatin1String("qttestability"));
63+ QLibrary testLib(QStringLiteral("qttestability"));
6464 if (testLib.load()) {
6565 typedef void (*TasInitialize)(void);
6666 TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
@@ -91,8 +91,8 @@ int main(int argc, const char *argv[])
9191 }
9292 }
9393
94− view->setTitle("Scopes");
95− view->rootContext()->setContextProperty("applicationArguments", &qmlArgs);
94+ view->setTitle(QStringLiteral("Scopes"));
95+ view->rootContext()->setContextProperty(QStringLiteral("applicationArguments"), &qmlArgs);
9696
9797 // You will need this if you want to interact with touch-only components using a mouse
9898 // Needed only when manually testing on a desktop.
src/Panel/Indicators/client/indicatorsclient.cpp+7−7
@@ -40,16 +40,16 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
4040 prependImportPaths(m_view->engine(), ::overrideImportPaths());
4141 appendImportPaths(m_view->engine(), ::fallbackImportPaths());
4242
43− QString profile = "phone";
44− if (args.contains(QLatin1String("-profile")) && args.size() > args.indexOf(QLatin1String("-profile")) + 1) {
45− profile = args.at(args.indexOf(QLatin1String("-profile")) + 1);
43+ QString profile = QStringLiteral("phone");
44+ if (args.contains(QStringLiteral("-profile")) && args.size() > args.indexOf(QStringLiteral("-profile")) + 1) {
45+ profile = args.at(args.indexOf(QStringLiteral("-profile")) + 1);
4646 }
47− m_view->rootContext()->setContextProperty("indicatorProfile", profile);
47+ m_view->rootContext()->setContextProperty(QStringLiteral("indicatorProfile"), profile);
4848
49− m_view->setSource(QUrl("IndicatorsClient.qml"));
49+ m_view->setSource(QUrl(QStringLiteral("IndicatorsClient.qml")));
5050 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
51− if (args.contains(QLatin1String("-windowgeometry")) && args.size() > args.indexOf(QLatin1String("-windowgeometry")) + 1) {
52− QStringList geometryArg = args.at(args.indexOf(QLatin1String("-windowgeometry")) + 1).split('x');
51+ if (args.contains(QStringLiteral("-windowgeometry")) && args.size() > args.indexOf(QStringLiteral("-windowgeometry")) + 1) {
52+ QStringList geometryArg = args.at(args.indexOf(QStringLiteral("-windowgeometry")) + 1).split('x');
5353 if (geometryArg.size() == 2) {
5454 m_view->resize(geometryArg.at(0).toInt(), geometryArg.at(1).toInt());
5555 }
src/UnityCommandLineParser.cpp+25−24
@@ -26,36 +26,36 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
2626 m_gridUnit = getenvFloat(ENV_GRID_UNIT_PX, DEFAULT_GRID_UNIT_PX);
2727
2828 QCommandLineParser parser;
29− parser.setApplicationDescription("Description: Unity 8 Shell");
29+ parser.setApplicationDescription(QStringLiteral("Description: Unity 8 Shell"));
3030 parser.addHelpOption();
3131
32− QCommandLineOption fullscreenOption("fullscreen",
33− "Run in fullscreen");
32+ QCommandLineOption fullscreenOption(QStringLiteral("fullscreen"),
33+ QStringLiteral("Run in fullscreen"));
3434 parser.addOption(fullscreenOption);
3535
36− QCommandLineOption framelessOption("frameless",
37− "Run without window borders");
36+ QCommandLineOption framelessOption(QStringLiteral("frameless"),
37+ QStringLiteral("Run without window borders"));
3838 parser.addOption(framelessOption);
3939
40− QCommandLineOption mousetouchOption("mousetouch",
41− "Allow the mouse to provide touch input");
40+ QCommandLineOption mousetouchOption(QStringLiteral("mousetouch"),
41+ QStringLiteral("Allow the mouse to provide touch input"));
4242 parser.addOption(mousetouchOption);
4343
44− QCommandLineOption windowGeometryOption(QStringList() << "windowgeometry",
45− "Specify the window geometry as [<width>x<height>]", "windowgeometry", "1");
44+ QCommandLineOption windowGeometryOption(QStringList() << QStringLiteral("windowgeometry"),
45+ QStringLiteral("Specify the window geometry as [<width>x<height>]"), QStringLiteral("windowgeometry"), QStringLiteral("1"));
4646 parser.addOption(windowGeometryOption);
4747
48− QCommandLineOption testabilityOption("testability",
49− "DISCOURAGED: Please set QT_LOAD_TESTABILITY instead.\nLoad the testability driver");
48+ QCommandLineOption testabilityOption(QStringLiteral("testability"),
49+ QStringLiteral("DISCOURAGED: Please set QT_LOAD_TESTABILITY instead.\nLoad the testability driver"));
5050 parser.addOption(testabilityOption);
5151
52− QCommandLineOption devicenameOption(QStringList() << "devicename",
53− "Specify the device name instead of letting Unity 8 find it out", "devicename", "");
52+ QCommandLineOption devicenameOption(QStringList() << QStringLiteral("devicename"),
53+ QStringLiteral("Specify the device name instead of letting Unity 8 find it out"), QStringLiteral("devicename"), QLatin1String(""));
5454 parser.addOption(devicenameOption);
5555
56− QCommandLineOption modeOption("mode",
57− "Whether to run greeter and/or shell [full-greeter, full-shell, greeter, shell]",
58− "mode", "full-greeter");
56+ QCommandLineOption modeOption(QStringLiteral("mode"),
57+ QStringLiteral("Whether to run greeter and/or shell [full-greeter, full-shell, greeter, shell]"),
58+ QStringLiteral("mode"), QStringLiteral("full-greeter"));
5959 parser.addOption(modeOption);
6060
6161 // Treat args with single dashes the same as arguments with two dashes
@@ -83,7 +83,7 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
8383
8484int UnityCommandLineParser::parsePixelsValue(const QString &str)
8585{
86− if (str.endsWith("gu", Qt::CaseInsensitive)) {
86+ if (str.endsWith(QLatin1String("gu"), Qt::CaseInsensitive)) {
8787 QString numStr = str;
8888 numStr.remove(numStr.size() - 2, 2);
8989 return numStr.toInt() * m_gridUnit;
@@ -105,13 +105,14 @@ void UnityCommandLineParser::resolveMode(QCommandLineParser &parser, QCommandLin
105105 // If an invalid option was specified, set it to the default
106106 // If no default was provided in the QCommandLineOption constructor, abort.
107107 if (!parser.isSet(modeOption) ||
108− (parser.value(modeOption) != "full-greeter" &&
109− parser.value(modeOption) != "full-shell" &&
110− parser.value(modeOption) != "greeter" &&
111− parser.value(modeOption) != "shell")) {
112−
113− if (modeOption.defaultValues().first() != nullptr) {
114− m_mode = modeOption.defaultValues().first();
108+ (parser.value(modeOption) != QLatin1String("full-greeter") &&
109+ parser.value(modeOption) != QLatin1String("full-shell") &&
110+ parser.value(modeOption) != QLatin1String("greeter") &&
111+ parser.value(modeOption) != QLatin1String("shell"))) {
112+
113+ const QStringList defaultValues = modeOption.defaultValues();
114+ if (!defaultValues.isEmpty()) {
115+ m_mode = defaultValues.first();
115116 qWarning() << "Mode argument was not provided or was set to an illegal value."
116117 " Using default value of --mode=" << m_mode;
117118 } else {
src/libunity8-private/unitydbusobject.cpp+2−2
@@ -64,8 +64,8 @@ void UnityDBusObject::notifyPropertyChanged(const QString& propertyName, const Q
6464 changedProps.insert(propertyName, value);
6565
6666 message = QDBusMessage::createSignal(path(),
67− "org.freedesktop.DBus.Properties",
68− "PropertiesChanged");
67+ QStringLiteral("org.freedesktop.DBus.Properties"),
68+ QStringLiteral("PropertiesChanged"));
6969 message << interface;
7070 message << changedProps;
7171 message << QStringList();
src/libunity8-private/unitydbusvirtualobject.cpp+2−2
@@ -61,8 +61,8 @@ void UnityDBusVirtualObject::notifyPropertyChanged(const QString& interface, con
6161 changedProps.insert(propertyName, value);
6262
6363 message = QDBusMessage::createSignal(path() + "/" + node,
64− "org.freedesktop.DBus.Properties",
65− "PropertiesChanged");
64+ QStringLiteral("org.freedesktop.DBus.Properties"),
65+ QStringLiteral("PropertiesChanged"));
6666 message << interface;
6767 message << changedProps;
6868 message << QStringList();
src/main.cpp+4−4
@@ -43,7 +43,7 @@ int main(int argc, const char *argv[])
4343 isMirServer = true;
4444 }
4545
46− QGuiApplication::setApplicationName("unity8");
46+ QGuiApplication::setApplicationName(QStringLiteral("unity8"));
4747 QGuiApplication *application;
4848
4949 application = new QGuiApplication(argc, (char**)argv);
@@ -65,7 +65,7 @@ int main(int argc, const char *argv[])
6565 // The testability driver is only loaded by QApplication but not by QGuiApplication.
6666 // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own.
6767 if (parser.hasTestability() || getenv("QT_LOAD_TESTABILITY")) {
68− QLibrary testLib(QLatin1String("qttestability"));
68+ QLibrary testLib(QStringLiteral("qttestability"));
6969 if (testLib.load()) {
7070 typedef void (*TasInitialize)(void);
7171 TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
@@ -85,7 +85,7 @@ int main(int argc, const char *argv[])
8585 QQuickView* view = new QQuickView();
8686 view->setResizeMode(QQuickView::SizeRootObjectToView);
8787 view->setColor("black");
88− view->setTitle("Unity8 Shell");
88+ view->setTitle(QStringLiteral("Unity8 Shell"));
8989
9090 if (parser.windowGeometry().isValid()) {
9191 view->setWidth(parser.windowGeometry().width());
@@ -93,7 +93,7 @@ int main(int argc, const char *argv[])
9393 }
9494
9595 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
96− view->rootContext()->setContextProperty("applicationArguments", &qmlArgs);
96+ view->rootContext()->setContextProperty(QStringLiteral("applicationArguments"), &qmlArgs);
9797 if (parser.hasFrameless()) {
9898 view->setFlags(Qt::FramelessWindowHint);
9999 }
tests/autopilot/unity8/indicators/tests/test_indicators.py+10−13
@@ -16,9 +16,11 @@
1616# You should have received a copy of the GNU General Public License
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19+import platform
20+
1921from testscenarios import multiply_scenarios
2022
21−from autopilot import platform
23+import autopilot.platform
2224
2325from unity8.indicators import tests
2426
@@ -39,12 +41,6 @@ class IndicatorExistsTestCase(tests.DeviceIndicatorTestCase):
3941 tests.IndicatorTestCase.device_emulation_scenarios
4042 )
4143
42− def setUp(self):
43− super().setUp()
44− if (platform.model() == 'Nexus 10' and
45− self.indicator_name == 'indicator-bluetooth'):
46− self.skipTest('Nexus 10 does not have bluetooth at the moment.')
47−
4844 def test_indicator_exists(self):
4945 self.main_window._get_indicator_panel_item(
5046 self.indicator_name
@@ -74,12 +70,6 @@ class IndicatorPageTitleMatchesWidgetTestCase(tests.DeviceIndicatorTestCase):
7470 tests.IndicatorTestCase.device_emulation_scenarios
7571 )
7672
77− def setUp(self):
78− super().setUp()
79− if (platform.model() == 'Nexus 10' and
80− self.indicator_name == 'indicator-bluetooth'):
81− self.skipTest('Nexus 10 does not have bluetooth at the moment.')
82−
8373 def test_indicator_page_title_matches_widget(self):
8474 """Swiping open an indicator must show its correct title.
8575
@@ -87,5 +77,12 @@ class IndicatorPageTitleMatchesWidgetTestCase(tests.DeviceIndicatorTestCase):
8777 """
8878 indicator_page = self.main_window.open_indicator_page(
8979 self.indicator_name)
80+ if self.indicator_name == 'indicator-bluetooth':
81+ if autopilot.platform.model() == 'Nexus 10':
82+ self.expectFailure('Nexus 10 does not have bluetooth at the moment.',
83+ self.assertTrue, indicator_page.visible)
84+ if platform.linux_distribution()[2] == 'wily':
85+ self.expectFailure('Bluetooth doesn\'t work on wily at the moment.',
86+ self.assertTrue, indicator_page.visible)
9087 self.assertTrue(indicator_page.visible)
9188 self.assertEqual(indicator_page.title, self.title)
tests/mocks/Unity/Notifications/MockActionModel.cpp+1−1
@@ -59,7 +59,7 @@ QHash<int, QByteArray> ActionModel::roleNames() const {
5959 return roles;
6060}
6161
62−Q_INVOKABLE QVariant ActionModel::data(int row, int role) const
62+QVariant ActionModel::data(int row, int role) const
6363{
6464 return data(index(row, 0), role);
6565}
tests/mocks/Unity/Notifications/MockNotification.cpp+1
@@ -39,6 +39,7 @@ MockNotification::MockNotification(QObject *parent) : QObject(parent), p(new Moc
3939}
4040
4141MockNotification::~MockNotification() {
42+ delete p->actionsModel;
4243}
4344
4445QString MockNotification::getSummary() const {
tests/mocks/Unity/Notifications/MockNotification.h+1−1
@@ -30,7 +30,7 @@ struct MockNotificationPrivate;
3030
3131class MockNotification : public QObject {
3232 Q_OBJECT
33− Q_ENUMS(Type)
33+ Q_ENUMS(Type Urgency)
3434 Q_PROPERTY(QString summary READ getSummary WRITE setSummary NOTIFY summaryChanged)
3535 Q_PROPERTY(QString body READ getBody WRITE setBody NOTIFY bodyChanged)
3636 Q_PROPERTY(int nid READ getID WRITE setID NOTIFY idChanged)
tests/mocks/Unity/Notifications/MockNotificationModel.cpp+5−1
@@ -35,6 +35,10 @@ MockNotificationModel::MockNotificationModel(QObject *parent) : QAbstractListMod
3535}
3636
3737MockNotificationModel::~MockNotificationModel() {
38+ Q_FOREACH(MockNotification *n, m_queue) {
39+ n->deleteLater();
40+ }
41+ m_queue.clear();
3842}
3943
4044int MockNotificationModel::rowCount(const QModelIndex &) const {
@@ -47,7 +51,7 @@ int MockNotificationModel::getCount() const {
4751
4852QVariant MockNotificationModel::data(const QModelIndex &index, int role) const {
4953 if (!index.isValid())
50− return QVariant();
54+ return QVariant();
5155
5256 switch(role) {
5357 case ModelInterface::RoleType:
tests/qmltests/Notifications/tst_Notifications.qml+61−8
@@ -12,16 +12,15 @@
1212 *
1313 * You should have received a copy of the GNU Lesser General Public License
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Mirco Mueller <mirco.mueller@canonical.com>
1815 */
1916
20−import QtQuick 2.0
17+import QtQuick 2.4
18+import QtQuick.Layouts 1.1
2119import QtTest 1.0
2220import ".."
2321import "../../../qml/Notifications"
24−import Ubuntu.Components 0.1
22+import "../../../qml/Components/UnityInputInfo"
23+import Ubuntu.Components 1.2
2524import Unity.Test 0.1
2625import Unity.Notifications 1.0
2726import QtMultimedia 5.0
@@ -77,7 +76,7 @@ Item {
7776 "type": Notification.Ephemeral,
7877 "hints": {},
7978 "summary": "Cole Raby",
80− "body": "I did not expect it to be that late.",
79+ "body": "I did not expect it to be <b>that</b> late.",
8180 "icon": "../graphics/avatars/amanda.png",
8281 "secondaryIcon": "../graphics/applicationIcons/facebook.png",
8382 "rawActions": ["reply_id", "Dummy"]})
@@ -91,7 +90,7 @@ Item {
9190 "type": Notification.Ephemeral,
9291 "hints": {"x-canonical-non-shaped-icon": "true"},
9392 "summary": "Contacts",
94− "body": "Synchronised contacts-database with cloud-storage.",
93+ "body": "Synchronised contacts-database &amp; cloud-storage.",
9594 "icon": "../graphics/applicationIcons/contacts-app.png",
9695 "secondaryIcon": "",
9796 "rawActions": ["reply_id", "Dummy"]})
@@ -189,6 +188,7 @@ Item {
189188
190189 anchors.fill: parent
191190 model: mockModel
191+ hasMouse: UnityInputInfo.mice > 0 // for testing, we add/remove only a mock mouse
192192 }
193193 }
194194
@@ -218,7 +218,7 @@ Item {
218218
219219 Button {
220220 width: parent.width
221− text: "add an non-shaped-icon-summary-body"
221+ text: "add a non-shaped-icon-summary-body"
222222 onClicked: rootRow.addEphemeralNonShapedIconNotification()
223223 }
224224
@@ -257,6 +257,24 @@ Item {
257257 text: "clear model"
258258 onClicked: rootRow.clearNotifications()
259259 }
260+
261+ RowLayout {
262+ Layout.fillWidth: true
263+ CheckBox {
264+ id: fakeMouseCB
265+ onClicked: {
266+ if (checked) {
267+ UnityInputInfo.inputInfo.addMockMouse();
268+ } else {
269+ UnityInputInfo.inputInfo.removeMockMouse();
270+ }
271+ }
272+ }
273+ Label {
274+ text: "With fake mouse"
275+ anchors.verticalCenter: parent.verticalCenter
276+ }
277+ }
260278 }
261279 }
262280
@@ -675,6 +693,41 @@ Item {
675693 tryCompare(mockModel, "count", before - 1)
676694 }
677695 }
696+
697+ function test_clickToClose_data() { // reuse the data
698+ UnityInputInfo.inputInfo.addMockMouse();
699+ return test_NotificationRenderer_data();
700+ }
701+
702+ function test_clickToClose(data) {
703+ // populate model with some mock notifications
704+ mockModel.append(data.n)
705+
706+ // make sure the view is properly updated before going on
707+ notifications.forceLayout();
708+ waitForRendering(notifications);
709+
710+ var notification = findChild(notifications, "notification" + (mockModel.count - 1))
711+ verify(!!notification, "notification wasn't found");
712+
713+ // click-to-dismiss check
714+ waitForRendering(notification);
715+ var before = mockModel.count;
716+ var canBeClosed = notification.canBeClosed;
717+ mouseClick(notification);
718+
719+ if (canBeClosed) {
720+ // closing the notification, the model count should be one less
721+ tryCompare(mockModel, "count", before - 1)
722+ } else {
723+ // not closing, model stays the same
724+ tryCompare(mockModel, "count", before)
725+ }
726+ }
727+
728+ function cleanupTestCase() {
729+ UnityInputInfo.inputInfo.removeMockMouse();
730+ }
678731 }
679732 }
680733}
tests/qmltests/Notifications/tst_SwipeToAct.qml+58−14
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014, 2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -14,10 +14,12 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
17+import QtQuick 2.4
18+import QtQuick.Layouts 1.1
1819import QtTest 1.0
1920import ".."
2021import "../../../qml/Notifications"
22+import "../../../qml/Components/UnityInputInfo"
2123import Ubuntu.Components 0.1
2224import Unity.Test 0.1
2325import Unity.Notifications 1.0
@@ -74,7 +76,10 @@ Item {
7476 icon: "../graphics/avatars/amanda.png",
7577 secondaryIcon: "incoming-call",
7678 actions: [{ id: "ok_id", label: "Ok"},
77− { id: "cancel_id", label: "Cancel"}]
79+ { id: "cancel_id", label: "Cancel"},
80+ { id: "foo_id", label: "Foo"},
81+ { id: "bar_id", label: "Bar"}
82+ ]
7883 }
7984
8085 mockModel.append(n)
@@ -97,7 +102,6 @@ Item {
97102
98103 MouseArea{
99104 id: clickThroughCatcher
100−
101105 anchors.fill: parent
102106 }
103107
@@ -108,6 +112,7 @@ Item {
108112
109113 anchors.fill: parent
110114 model: mockModel
115+ hasMouse: UnityInputInfo.mice > 0 // for testing, we add/remove only a mock mouse
111116 }
112117 }
113118
@@ -140,6 +145,24 @@ Item {
140145 text: "clear model"
141146 onClicked: rootRow.clearNotifications()
142147 }
148+
149+ RowLayout {
150+ Layout.fillWidth: true
151+ CheckBox {
152+ id: fakeMouseCB
153+ onClicked: {
154+ if (checked) {
155+ UnityInputInfo.inputInfo.addMockMouse();
156+ } else {
157+ UnityInputInfo.inputInfo.removeMockMouse();
158+ }
159+ }
160+ }
161+ Label {
162+ text: "With fake mouse"
163+ anchors.verticalCenter: parent.verticalCenter
164+ }
165+ }
143166 }
144167 }
145168
@@ -258,21 +281,42 @@ Item {
258281
259282 if(data.buttonRowVisible) {
260283 var swipeButton = findChild(buttonRow, "notify_swipe_button")
261− var slider = findChild(swipeButton, "slider")
262− var swipeMouseArea = findChild(swipeButton, "swipeMouseArea")
263− var x = swipeMouseArea.width / 2
264− var y = swipeMouseArea.height / 2
284+
285+ if (!swipeButton.clickToAct) { // don't run if there's a real mouse
286+ var slider = findChild(swipeButton, "slider")
287+ var swipeMouseArea = findChild(swipeButton, "swipeMouseArea")
288+ var x = swipeMouseArea.width / 2
289+ var y = swipeMouseArea.height / 2
290+
291+ if(data.checkSwipeToActAccept) {
292+ tryCompareFunction(function() { mouseDrag(slider, x, y, (swipeMouseArea.width / 2) - slider.width, 0); return actionSpy.signalArguments.length > 0; }, true);
293+ compare(actionSpy.signalArguments[0][0], data.actions.data(0, ActionModel.RoleActionId), "got wrong id for positive action");
294+ actionSpy.clear();
295+ }
296+ if(data.checkSwipeToActReject) {
297+ tryCompareFunction(function() { mouseDrag(slider, x, y, -(swipeMouseArea.width / 2), 0); return actionSpy.signalArguments.length > 0; }, true);
298+ compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action");
299+ actionSpy.clear();
300+ }
301+ }
302+
303+ // add a mock mouse, test clicking the left/right buttons
304+ UnityInputInfo.inputInfo.addMockMouse();
305+ var leftButton = findChild(swipeButton, "leftButton");
306+ var rightButton = findChild(swipeButton, "rightButton");
265307
266308 if(data.checkSwipeToActAccept) {
267− tryCompareFunction(function() { mouseDrag(slider, x, y, (swipeMouseArea.width / 2) - slider.width, 0); return actionSpy.signalArguments.length > 0; }, true);
268− compare(actionSpy.signalArguments[0][0], data.actions.data(0, ActionModel.RoleActionId), "got wrong id for positive action")
269− actionSpy.clear()
309+ mouseClick(rightButton);
310+ compare(actionSpy.signalArguments[0][0], data.actions.data(0, ActionModel.RoleActionId), "got wrong id for positive action");
311+ actionSpy.clear();
270312 }
313+
271314 if(data.checkSwipeToActReject) {
272− tryCompareFunction(function() { mouseDrag(slider, x, y, -(swipeMouseArea.width / 2), 0); return actionSpy.signalArguments.length > 0; }, true);
273− compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action")
274− actionSpy.clear()
315+ mouseClick(leftButton);
316+ compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action");
317+ actionSpy.clear();
275318 }
319+ UnityInputInfo.inputInfo.removeMockMouse();
276320 }
277321 }
278322 }
tests/qmltests/tst_OrientedShell.qml+106−1
@@ -1000,6 +1000,60 @@ Rectangle {
10001000 tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle);
10011001 }
10021002
1003+ /*
1004+ Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1476757
1005+
1006+ Steps:
1007+ 1- have a portrait-only app in foreground (eg unity8-dash)
1008+ 2- launch or switch to some other application
1009+ 3- right-edge swipe to show the apps spread
1010+ 4- swipe up to close the current app (the one from step 2)
1011+ 5- lock the phone (press the power button)
1012+ 6- unlock the phone (press power button again and swipe greeter away)
1013+ * app from step 1 should be on foreground and focused
1014+ 7- rotate phone
1015+
1016+ Expected outcome:
1017+ - The portrait-only application stays put
1018+
1019+ Actual outcome:
1020+ - The portrait-only application rotates freely
1021+ */
1022+ function test_lockPhoneAfterClosingAppInSpreadThenUnlockAndRotate() {
1023+ loadShell("mako");
1024+
1025+ var gmailApp = ApplicationManager.startApplication("gmail-webapp");
1026+ verify(gmailApp);
1027+
1028+ waitUntilAppSurfaceShowsUp("gmail-webapp");
1029+
1030+ performEdgeSwipeToShowAppSpread();
1031+
1032+ swipeToCloseCurrentAppInSpread();
1033+
1034+ // press the power key once
1035+ Powerd.setStatus(Powerd.Off, Powerd.Unknown);
1036+ var greeter = findChild(shell, "greeter");
1037+ tryCompare(greeter, "fullyShown", true);
1038+
1039+ // and a second time to turn the display back on
1040+ Powerd.setStatus(Powerd.On, Powerd.Unknown);
1041+
1042+ swipeAwayGreeter();
1043+
1044+ verify(isAppSurfaceFocused("unity8-dash"))
1045+
1046+ signalSpy.clear();
1047+ signalSpy.target = shell;
1048+ signalSpy.signalName = "widthChanged";
1049+ verify(signalSpy.valid);
1050+
1051+ rotateTo(90);
1052+
1053+ // shell shouldn't have change its orientation at any moment
1054+ compare(signalSpy.count, 0);
1055+ }
1056+
10031057 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
10041058 function rotateTo(angle) {
10051059 switch (angle) {
@@ -1020,6 +1074,12 @@ Rectangle {
10201074 }
10211075
10221076 var rotationStates = findInvisibleChild(orientedShell, "rotationStates");
1077+ verify(rotationStates.d);
1078+ verify(rotationStates.d.stateUpdateTimer);
1079+
1080+ // wait for the delayed state update to take place, if any
1081+ tryCompare(rotationStates.d.stateUpdateTimer, "running", false);
1082+
10231083 waitUntilTransitionsEnd(rotationStates);
10241084 }
10251085
@@ -1243,7 +1303,6 @@ Rectangle {
12431303 var childs = new Array(0);
12441304 childs.push(obj)
12451305 while (childs.length > 0) {
1246− console.log("Checking " + childs[0].objectName);
12471306 if (childs[0].objectName === "surfaceItem"
12481307 && childs[0].surface !== undefined
12491308 && childs[0].surface === surface) {
@@ -1256,5 +1315,51 @@ Rectangle {
12561315 }
12571316 return null;
12581317 }
1318+
1319+ function swipeToCloseCurrentAppInSpread() {
1320+ var spreadView = findChild(shell, "spreadView");
1321+ verify(spreadView);
1322+
1323+ var delegateToClose = findChild(spreadView, "appDelegate0");
1324+ verify(delegateToClose);
1325+
1326+ var appIdToClose = ApplicationManager.get(0).appId;;
1327+ var appCountBefore = ApplicationManager.count;
1328+
1329+ // ensure the current app is widely visible by swiping to the right,
1330+ // which will move the app windows accordingly
1331+ touchFlick(shell,
1332+ shell.width * 0.25, shell.width / 2,
1333+ shell.width, shell.width / 2);
1334+
1335+ tryCompare(spreadView, "flicking", false);
1336+ tryCompare(spreadView, "moving", false);
1337+
1338+ // Swipe up close to its left edge, as it is the only area of it guaranteed to be exposed
1339+ // in the spread. Eg: its center could be covered by some other delegate.
1340+ touchFlick(delegateToClose,
1341+ 1, delegateToClose.height / 2,
1342+ 1, - delegateToClose.height / 4);
1343+
1344+ // ensure it got closed
1345+ tryCompare(ApplicationManager, "count", appCountBefore - 1);
1346+ compare(ApplicationManager.findApplication(appIdToClose), null);
1347+ }
1348+
1349+ function isAppSurfaceFocused(appId) {
1350+ var appWindow = findChild(shell, "appWindow_" + appId);
1351+ verify(appWindow);
1352+
1353+ var app = ApplicationManager.findApplication(appId);
1354+ verify(app);
1355+
1356+ var surface = app.session.surface;
1357+ verify(surface);
1358+
1359+ var surfaceItem = findSurfaceItem(appWindow, surface);
1360+ verify(surfaceItem);
1361+
1362+ return surfaceItem.activeFocus;
1363+ }
12591364 }
12601365}