Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/server.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
62 | #ifdef HAVE_LIMITS_H | 62 | #ifdef HAVE_LIMITS_H | ||
63 | #include <limits.h> | 63 | #include <limits.h> | ||
64 | #endif | 64 | #endif | ||
65 | 65 | | |||
66 | #include <QFile> | 66 | #include <QFile> | ||
67 | #include <QPushButton> | 67 | #include <QPushButton> | ||
68 | #include <QRegExp> | 68 | #include <QRegExp> | ||
69 | #include <QDBusConnection> | 69 | #include <QDBusConnection> | ||
70 | #include <QDBusMessage> | ||||
70 | #include <QSocketNotifier> | 71 | #include <QSocketNotifier> | ||
71 | #include <QStandardPaths> | 72 | #include <QStandardPaths> | ||
72 | #include <QDebug> | 73 | #include <QDebug> | ||
73 | #include <QAction> | 74 | #include <QAction> | ||
74 | #include <QApplication> | 75 | #include <QApplication> | ||
75 | 76 | | |||
76 | #include <kactioncollection.h> | 77 | #include <kactioncollection.h> | ||
77 | #include <kauthorized.h> | 78 | #include <kauthorized.h> | ||
78 | #include <kconfig.h> | 79 | #include <kconfig.h> | ||
79 | #include <KSharedConfig> | 80 | #include <KSharedConfig> | ||
80 | #include <kdesktopfile.h> | 81 | #include <kdesktopfile.h> | ||
81 | #include <QTemporaryFile> | 82 | #include <QTemporaryFile> | ||
82 | #include <kconfiggroup.h> | 83 | #include <kconfiggroup.h> | ||
83 | #include <kprocess.h> | 84 | #include <kprocess.h> | ||
84 | #include <kshell.h> | 85 | #include <kshell.h> | ||
85 | 86 | | |||
86 | #include <KScreenLocker/KsldApp> | 87 | #include <KScreenLocker/KsldApp> | ||
87 | 88 | | |||
88 | #include <kdisplaymanager.h> | 89 | #include <kdisplaymanager.h> | ||
89 | #include <QX11Info> | 90 | #include <QX11Info> | ||
90 | #include <krandom.h> | 91 | #include <krandom.h> | ||
91 | #include <klauncher_interface.h> | 92 | #include <klauncher_interface.h> | ||
92 | #include <qstandardpaths.h> | 93 | #include <qstandardpaths.h> | ||
93 | 94 | | |||
94 | #include "switchuserdialog.h" | 95 | #include "kscreenlocker_interface.h" | ||
95 | 96 | | |||
96 | KSMServer* the_server = nullptr; | 97 | KSMServer* the_server = nullptr; | ||
97 | 98 | | |||
98 | KSMServer* KSMServer::self() | 99 | KSMServer* KSMServer::self() | ||
99 | { | 100 | { | ||
100 | return the_server; | 101 | return the_server; | ||
101 | } | 102 | } | ||
102 | 103 | | |||
▲ Show 20 Lines • Show All 515 Lines • ▼ Show 20 Line(s) | 604 | { | |||
618 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/KSMServer"), this); | 619 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/KSMServer"), this); | ||
619 | kcminitSignals = nullptr; | 620 | kcminitSignals = nullptr; | ||
620 | the_server = this; | 621 | the_server = this; | ||
621 | clean = false; | 622 | clean = false; | ||
622 | 623 | | |||
623 | shutdownType = KWorkSpace::ShutdownTypeNone; | 624 | shutdownType = KWorkSpace::ShutdownTypeNone; | ||
624 | 625 | | |||
625 | state = Idle; | 626 | state = Idle; | ||
626 | dialogActive = false; | | |||
627 | saveSession = false; | 627 | saveSession = false; | ||
628 | wmPhase1WaitingCount = 0; | 628 | wmPhase1WaitingCount = 0; | ||
629 | KConfigGroup config(KSharedConfig::openConfig(), "General"); | 629 | KConfigGroup config(KSharedConfig::openConfig(), "General"); | ||
630 | clientInteracting = nullptr; | 630 | clientInteracting = nullptr; | ||
631 | xonCommand = config.readEntry( "xonCommand", "xon" ); | 631 | xonCommand = config.readEntry( "xonCommand", "xon" ); | ||
632 | 632 | | |||
633 | selectWm( windowManager ); | 633 | selectWm( windowManager ); | ||
634 | 634 | | |||
▲ Show 20 Lines • Show All 451 Lines • ▼ Show 20 Line(s) | |||||
1086 | 1086 | | |||
1087 | void KSMServer::rebootWithoutConfirmation() | 1087 | void KSMServer::rebootWithoutConfirmation() | ||
1088 | { | 1088 | { | ||
1089 | shutdown(KWorkSpace::ShutdownConfirmNo, KWorkSpace::ShutdownTypeReboot, KWorkSpace::ShutdownModeDefault); | 1089 | shutdown(KWorkSpace::ShutdownConfirmNo, KWorkSpace::ShutdownTypeReboot, KWorkSpace::ShutdownModeDefault); | ||
1090 | } | 1090 | } | ||
1091 | 1091 | | |||
1092 | void KSMServer::openSwitchUserDialog() | 1092 | void KSMServer::openSwitchUserDialog() | ||
1093 | { | 1093 | { | ||
1094 | if (dialogActive) { | 1094 | //this method exists only for compatibility. Users should ideally call this directly | ||
1095 | return; | 1095 | OrgKdeScreensaverInterface iface(QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("/ScreenSaver"), QDBusConnection::sessionBus()); | ||
mart: should we need some confirmation from the screenlocker that the operation actually went well? | |||||
good question. The method is void, but we could still throw an error. I checked all our code that calls this and they don't check the return. davidedmundson: good question.
The method is void, but we could still throw an error.
I checked all our code… | |||||
1096 | } | 1096 | iface.SwitchUser(); | ||
1097 | | ||||
1098 | QProcess *p = new QProcess(this); | | |||
1099 | p->setProgram(QStringLiteral(SWITCHUSER_GREETER_BIN)); | | |||
1100 | | ||||
1101 | connect(p, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, [this, p] { | | |||
1102 | p->deleteLater(); | | |||
1103 | dialogActive = false; | | |||
1104 | }); | | |||
1105 | | ||||
1106 | dialogActive = true; | | |||
1107 | p->start(); | | |||
1108 | } | 1097 | } | ||
1109 | 1098 | | |||
1110 | void KSMServer::runShutdownScripts() | 1099 | void KSMServer::runShutdownScripts() | ||
1111 | { | 1100 | { | ||
1112 | const QStringList shutdownFolders = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("plasma-workspace/shutdown"), QStandardPaths::LocateDirectory); | 1101 | const QStringList shutdownFolders = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QStringLiteral("plasma-workspace/shutdown"), QStandardPaths::LocateDirectory); | ||
1113 | foreach (const QString &shutDownFolder, shutdownFolders) { | 1102 | foreach (const QString &shutDownFolder, shutdownFolders) { | ||
1114 | QDir dir(shutDownFolder); | 1103 | QDir dir(shutDownFolder); | ||
1115 | if (!dir.exists()) { | 1104 | if (!dir.exists()) { | ||
Show All 18 Lines |
should we need some confirmation from the screenlocker that the operation actually went well?