@@ -58,7 +58,7 @@ public:
58 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
58 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
59 LOGIN1_PATH,
59 LOGIN1_PATH,
60 LOGIN1_IFACE,
60 LOGIN1_IFACE,
61− "GetSessionByPID");
61+ QStringLiteral("GetSessionByPID"));
62 msg << (quint32) getpid();
62 msg << (quint32) getpid();
64 QDBusReply<QDBusObjectPath> reply = QDBusConnection::systemBus().asyncCall(msg);
64 QDBusReply<QDBusObjectPath> reply = QDBusConnection::systemBus().asyncCall(msg);
@@ -66,13 +66,13 @@ public:
66 logindSessionPath = reply.value().path();
66 logindSessionPath = reply.value().path();
68 // start watching the Active property
68 // 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"),
70 this, SLOT(onPropertiesChanged(QString,QVariantMap,QStringList)));
70 this, SLOT(onPropertiesChanged(QString,QVariantMap,QStringList)));
72 setupSystemdInhibition();
72 setupSystemdInhibition();
74 // re-enable the inhibition upon resume from sleep
74 // 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"),
76 this, SLOT(onResuming(bool)));
76 this, SLOT(onResuming(bool)));
78 qWarning() << "Failed to get logind session path" << reply.error().message();
78 qWarning() << "Failed to get logind session path" << reply.error().message();
@@ -87,7 +87,7 @@ public:
87 // inhibit systemd handling of power/sleep/lid buttons
87 // inhibit systemd handling of power/sleep/lid buttons
88 // http://www.freedesktop.org/wiki/Software/systemd/inhibit
88 // http://www.freedesktop.org/wiki/Software/systemd/inhibit
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"));
91 msg << "handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch"; // what
91 msg << "handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch"; // what
92 msg << "Unity"; // who
92 msg << "Unity"; // who
93 msg << "Unity8 handles power events"; // why
93 msg << "Unity8 handles power events"; // why
@@ -128,8 +128,8 @@ public:
129 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
129 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
130 logindSessionPath,
130 logindSessionPath,
131− "org.freedesktop.DBus.Properties",
131+ QStringLiteral("org.freedesktop.DBus.Properties"),
132− "Get");
132+ QStringLiteral("Get"));
133 msg << LOGIN1_SESSION_IFACE;
133 msg << LOGIN1_SESSION_IFACE;
134 msg << ACTIVE_KEY;
134 msg << ACTIVE_KEY;
@@ -154,8 +154,8 @@ public:
155 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
155 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
156 logindSessionPath,
156 logindSessionPath,
157− "org.freedesktop.DBus.Properties",
157+ QStringLiteral("org.freedesktop.DBus.Properties"),
158− "Get");
158+ QStringLiteral("Get"));
159 msg << LOGIN1_SESSION_IFACE;
159 msg << LOGIN1_SESSION_IFACE;
160 msg << IDLE_SINCE_KEY;
160 msg << IDLE_SINCE_KEY;
@@ -174,7 +174,7 @@ public:
174 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
174 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE,
175 logindSessionPath,
175 logindSessionPath,
176 LOGIN1_SESSION_IFACE,
176 LOGIN1_SESSION_IFACE,
177− "SetIdleHint");
177+ QStringLiteral("SetIdleHint"));
178 msg << idle;
178 msg << idle;
179 QDBusConnection::systemBus().asyncCall(msg);
179 QDBusConnection::systemBus().asyncCall(msg);
@@ -217,14 +217,14 @@ Q_SIGNALS:
217Q_GLOBAL_STATIC(DBusUnitySessionServicePrivate, d)
217Q_GLOBAL_STATIC(DBusUnitySessionServicePrivate, d)
219DBusUnitySessionService::DBusUnitySessionService()
219DBusUnitySessionService::DBusUnitySessionService()
220− : UnityDBusObject("/com/canonical/Unity/Session", "com.canonical.Unity")
220+ : UnityDBusObject(QStringLiteral("/com/canonical/Unity/Session"), QStringLiteral("com.canonical.Unity"))
222 if (!d->logindSessionPath.isEmpty()) {
222 if (!d->logindSessionPath.isEmpty()) {
223 // connect our Lock() slot to the logind's session Lock() signal
223 // 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()));
225 // ... and our Unlocked() signal to the logind's session Unlock() signal
225 // ... and our Unlocked() signal to the logind's session Unlock() signal
226 // (lightdm handles the unlocking by calling logind's Unlock method which in turn emits this signal we connect to)
226 // (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()));
229 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
229 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
@@ -239,36 +239,36 @@ void DBusUnitySessionService::Logout()
240void DBusUnitySessionService::EndSession()
240void DBusUnitySessionService::EndSession()
242− const QDBusMessage msg = QDBusMessage::createMethodCall("com.ubuntu.Upstart",
242+ const QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("com.ubuntu.Upstart"),
243− "/com/ubuntu/Upstart",
243+ QStringLiteral("/com/ubuntu/Upstart"),
244− "com.ubuntu.Upstart0_6",
244+ QStringLiteral("com.ubuntu.Upstart0_6"),
245− "EndSession");
245+ QStringLiteral("EndSession"));
246 QDBusConnection::sessionBus().asyncCall(msg);
246 QDBusConnection::sessionBus().asyncCall(msg);
249bool DBusUnitySessionService::CanHibernate() const
249bool DBusUnitySessionService::CanHibernate() const
251− return d->checkLogin1Call("CanHibernate");
251+ return d->checkLogin1Call(QStringLiteral("CanHibernate"));
254bool DBusUnitySessionService::CanSuspend() const
254bool DBusUnitySessionService::CanSuspend() const
256− return d->checkLogin1Call("CanSuspend");
256+ return d->checkLogin1Call(QStringLiteral("CanSuspend"));
259bool DBusUnitySessionService::CanHybridSleep() const
259bool DBusUnitySessionService::CanHybridSleep() const
261− return d->checkLogin1Call("CanHybridSleep");
261+ return d->checkLogin1Call(QStringLiteral("CanHybridSleep"));
264bool DBusUnitySessionService::CanReboot() const
264bool DBusUnitySessionService::CanReboot() const
266− return d->checkLogin1Call("CanReboot");
266+ return d->checkLogin1Call(QStringLiteral("CanReboot"));
269bool DBusUnitySessionService::CanShutdown() const
269bool DBusUnitySessionService::CanShutdown() const
271− return d->checkLogin1Call("CanPowerOff");
271+ return d->checkLogin1Call(QStringLiteral("CanPowerOff"));
274bool DBusUnitySessionService::CanLock() const
274bool DBusUnitySessionService::CanLock() const
@@ -320,10 +320,10 @@ void DBusUnitySessionService::Lock()
321 // lock the session using the org.freedesktop.DisplayManager system DBUS service
321 // lock the session using the org.freedesktop.DisplayManager system DBUS service
322 const QString sessionPath = QString::fromLocal8Bit(qgetenv("XDG_SESSION_PATH"));
322 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"),
324 sessionPath,
324 sessionPath,
325− "org.freedesktop.DisplayManager.Session",
325+ QStringLiteral("org.freedesktop.DisplayManager.Session"),
326− "Lock");
326+ QStringLiteral("Lock"));
327 QDBusReply<void> reply = QDBusConnection::systemBus().asyncCall(msg);
327 QDBusReply<void> reply = QDBusConnection::systemBus().asyncCall(msg);
328 if (!reply.isValid()) {
328 if (!reply.isValid()) {
329 qWarning() << "Lock call failed" << reply.error().message();
329 qWarning() << "Lock call failed" << reply.error().message();
@@ -346,7 +346,7 @@ void DBusUnitySessionService::RequestLogout()
347void DBusUnitySessionService::Reboot()
347void DBusUnitySessionService::Reboot()
349− d->makeLogin1Call("Reboot", {false});
349+ d->makeLogin1Call(QStringLiteral("Reboot"), {false});
352void DBusUnitySessionService::RequestReboot()
352void DBusUnitySessionService::RequestReboot()
@@ -357,22 +357,22 @@ void DBusUnitySessionService::RequestReboot()
358void DBusUnitySessionService::Shutdown()
358void DBusUnitySessionService::Shutdown()
360− d->makeLogin1Call("PowerOff", {false});
360+ d->makeLogin1Call(QStringLiteral("PowerOff"), {false});
363void DBusUnitySessionService::Suspend()
363void DBusUnitySessionService::Suspend()
365− d->makeLogin1Call("Suspend", {false});
365+ d->makeLogin1Call(QStringLiteral("Suspend"), {false});
368void DBusUnitySessionService::Hibernate()
368void DBusUnitySessionService::Hibernate()
370− d->makeLogin1Call("Hibernate", {false});
370+ d->makeLogin1Call(QStringLiteral("Hibernate"), {false});
373void DBusUnitySessionService::HybridSleep()
373void DBusUnitySessionService::HybridSleep()
375− d->makeLogin1Call("HybridSleep", {false});
375+ d->makeLogin1Call(QStringLiteral("HybridSleep"), {false});
378void DBusUnitySessionService::RequestShutdown()
378void DBusUnitySessionService::RequestShutdown()
@@ -392,16 +392,16 @@ enum class Action : unsigned
393void performAsyncUnityCall(const QString &method)
393void performAsyncUnityCall(const QString &method)
395− const QDBusMessage msg = QDBusMessage::createMethodCall("com.canonical.Unity",
395+ const QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("com.canonical.Unity"),
396− "/com/canonical/Unity/Session",
396+ QStringLiteral("/com/canonical/Unity/Session"),
397− "com.canonical.Unity.Session",
397+ QStringLiteral("com.canonical.Unity.Session"),
399 QDBusConnection::sessionBus().asyncCall(msg);
399 QDBusConnection::sessionBus().asyncCall(msg);
403DBusGnomeSessionManagerWrapper::DBusGnomeSessionManagerWrapper()
403DBusGnomeSessionManagerWrapper::DBusGnomeSessionManagerWrapper()
404− : UnityDBusObject("/org/gnome/SessionManager/EndSessionDialog", "com.canonical.Unity")
404+ : UnityDBusObject(QStringLiteral("/org/gnome/SessionManager/EndSessionDialog"), QStringLiteral("com.canonical.Unity"))
@@ -414,15 +414,15 @@ void DBusGnomeSessionManagerWrapper::Open(const unsigned type, const unsigned ar
414 switch (static_cast<Action>(type))
414 switch (static_cast<Action>(type))
416 case Action::LOGOUT:
416 case Action::LOGOUT:
417− performAsyncUnityCall("RequestLogout");
417+ performAsyncUnityCall(QStringLiteral("RequestLogout"));
420 case Action::REBOOT:
420 case Action::REBOOT:
421− performAsyncUnityCall("RequestReboot");
421+ performAsyncUnityCall(QStringLiteral("RequestReboot"));
424 case Action::SHUTDOWN:
424 case Action::SHUTDOWN:
425− performAsyncUnityCall("RequestShutdown");
425+ performAsyncUnityCall(QStringLiteral("RequestShutdown"));
@@ -432,7 +432,7 @@ void DBusGnomeSessionManagerWrapper::Open(const unsigned type, const unsigned ar
434DBusGnomeScreensaverWrapper::DBusGnomeScreensaverWrapper()
434DBusGnomeScreensaverWrapper::DBusGnomeScreensaverWrapper()
435− : UnityDBusObject("/org/gnome/ScreenSaver", "org.gnome.ScreenSaver")
435+ : UnityDBusObject(QStringLiteral("/org/gnome/ScreenSaver"), QStringLiteral("org.gnome.ScreenSaver"))
437 connect(d, &DBusUnitySessionServicePrivate::screensaverActiveChanged, this, &DBusGnomeScreensaverWrapper::ActiveChanged);
437 connect(d, &DBusUnitySessionServicePrivate::screensaverActiveChanged, this, &DBusGnomeScreensaverWrapper::ActiveChanged);
@@ -451,7 +451,7 @@ void DBusGnomeScreensaverWrapper::SetActive(bool lock)
452void DBusGnomeScreensaverWrapper::Lock()
452void DBusGnomeScreensaverWrapper::Lock()
454− performAsyncUnityCall("Lock");
454+ performAsyncUnityCall(QStringLiteral("Lock"));
457quint32 DBusGnomeScreensaverWrapper::GetActiveTime() const
457quint32 DBusGnomeScreensaverWrapper::GetActiveTime() const
@@ -466,9 +466,9 @@ void DBusGnomeScreensaverWrapper::SimulateUserActivity()
468DBusScreensaverWrapper::DBusScreensaverWrapper()
468DBusScreensaverWrapper::DBusScreensaverWrapper()
469− : UnityDBusObject("/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver")
469+ : UnityDBusObject(QStringLiteral("/org/freedesktop/ScreenSaver"), QStringLiteral("org.freedesktop.ScreenSaver"))
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
472 connect(d, &DBusUnitySessionServicePrivate::screensaverActiveChanged, this, &DBusScreensaverWrapper::ActiveChanged);
472 connect(d, &DBusUnitySessionServicePrivate::screensaverActiveChanged, this, &DBusScreensaverWrapper::ActiveChanged);
@@ -488,7 +488,7 @@ bool DBusScreensaverWrapper::SetActive(bool lock)
489void DBusScreensaverWrapper::Lock()
489void DBusScreensaverWrapper::Lock()
491− performAsyncUnityCall("Lock");
491+ performAsyncUnityCall(QStringLiteral("Lock"));
494quint32 DBusScreensaverWrapper::GetActiveTime() const
494quint32 DBusScreensaverWrapper::GetActiveTime() const