Changeset View
Changeset View
Standalone View
Standalone View
logind.cpp
Show All 16 Lines | |||||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "logind.h" | 20 | #include "logind.h" | ||
21 | 21 | | |||
22 | #include <KLocalizedString> | 22 | #include <KLocalizedString> | ||
23 | 23 | | |||
24 | #include <QCoreApplication> | 24 | #include <QCoreApplication> | ||
25 | #include <QDebug> | | |||
26 | #include <QDBusConnection> | 25 | #include <QDBusConnection> | ||
27 | #include <QDBusConnectionInterface> | 26 | #include <QDBusConnectionInterface> | ||
28 | #include <QDBusServiceWatcher> | 27 | #include <QDBusServiceWatcher> | ||
29 | 28 | | |||
29 | #include <kscreenlocker_logging.h> | ||||
30 | | ||||
30 | const static QString s_login1Service = QStringLiteral("org.freedesktop.login1"); | 31 | const static QString s_login1Service = QStringLiteral("org.freedesktop.login1"); | ||
31 | const static QString s_login1Path = QStringLiteral("/org/freedesktop/login1"); | 32 | const static QString s_login1Path = QStringLiteral("/org/freedesktop/login1"); | ||
32 | const static QString s_login1ManagerInterface = QStringLiteral("org.freedesktop.login1.Manager"); | 33 | const static QString s_login1ManagerInterface = QStringLiteral("org.freedesktop.login1.Manager"); | ||
33 | const static QString s_login1SessionInterface = QStringLiteral("org.freedesktop.login1.Session"); | 34 | const static QString s_login1SessionInterface = QStringLiteral("org.freedesktop.login1.Session"); | ||
34 | 35 | | |||
35 | const static QString s_consolekitService = QStringLiteral("org.freedesktop.ConsoleKit"); | 36 | const static QString s_consolekitService = QStringLiteral("org.freedesktop.ConsoleKit"); | ||
36 | const static QString s_consolekitPath = QStringLiteral("/org/freedesktop/ConsoleKit/Manager"); | 37 | const static QString s_consolekitPath = QStringLiteral("/org/freedesktop/ConsoleKit/Manager"); | ||
37 | const static QString s_consolekitManagerInterface = QStringLiteral("org.freedesktop.ConsoleKit.Manager"); | 38 | const static QString s_consolekitManagerInterface = QStringLiteral("org.freedesktop.ConsoleKit.Manager"); | ||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 139 | { | |||
139 | connect(watcher, &QDBusPendingCallWatcher::finished, this, | 140 | connect(watcher, &QDBusPendingCallWatcher::finished, this, | ||
140 | [this](QDBusPendingCallWatcher *self) { | 141 | [this](QDBusPendingCallWatcher *self) { | ||
141 | QDBusPendingReply<QDBusObjectPath> reply = *self; | 142 | QDBusPendingReply<QDBusObjectPath> reply = *self; | ||
142 | self->deleteLater(); | 143 | self->deleteLater(); | ||
143 | if (m_connected) { | 144 | if (m_connected) { | ||
144 | return; | 145 | return; | ||
145 | } | 146 | } | ||
146 | if (!reply.isValid()) { | 147 | if (!reply.isValid()) { | ||
147 | qDebug() << "The session is not registered: " << reply.error().message(); | 148 | qCDebug(KSCREENLOCKER) << "The session is not registered: " | ||
149 | << reply.error().message(); | ||||
148 | return; | 150 | return; | ||
149 | } | 151 | } | ||
150 | const QString sessionPath = reply.value().path(); | 152 | const QString sessionPath = reply.value().path(); | ||
151 | qDebug() << "Session path:" << sessionPath; | 153 | qCDebug(KSCREENLOCKER) << "Session path:" << sessionPath; | ||
152 | 154 | | |||
153 | // connections need to be done this way as the object exposes both method and signal | 155 | // connections need to be done this way as the object exposes both method and signal | ||
154 | // with name "Lock"/"Unlock". Qt is not able to automatically handle this. | 156 | // with name "Lock"/"Unlock". Qt is not able to automatically handle this. | ||
155 | m_bus.connect(*m_service, | 157 | m_bus.connect(*m_service, | ||
156 | sessionPath, | 158 | sessionPath, | ||
157 | *m_sessionInterface, | 159 | *m_sessionInterface, | ||
158 | QStringLiteral("Lock"), | 160 | QStringLiteral("Lock"), | ||
159 | this, | 161 | this, | ||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |