Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/logout.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | |||||
72 | #include <KNotification> | 72 | #include <KNotification> | ||
73 | #include <kdisplaymanager.h> | 73 | #include <kdisplaymanager.h> | ||
74 | #include "server.h" | 74 | #include "server.h" | ||
75 | #include "global.h" | 75 | #include "global.h" | ||
76 | #include "client.h" | 76 | #include "client.h" | ||
77 | 77 | | |||
78 | #include "logoutprompt_interface.h" | 78 | #include "logoutprompt_interface.h" | ||
79 | #include "shutdown_interface.h" | 79 | #include "shutdown_interface.h" | ||
80 | #include "kwinsession_interface.h" | ||||
80 | 81 | | |||
81 | void KSMServer::logout( int confirm, int sdtype, int sdmode ) | 82 | void KSMServer::logout( int confirm, int sdtype, int sdmode ) | ||
82 | { | 83 | { | ||
83 | // KDE5: remove me | 84 | // KDE5: remove me | ||
84 | if (sdtype == KWorkSpace::ShutdownTypeLogout) | 85 | if (sdtype == KWorkSpace::ShutdownTypeLogout) | ||
85 | sdtype = KWorkSpace::ShutdownTypeNone; | 86 | sdtype = KWorkSpace::ShutdownTypeNone; | ||
86 | 87 | | |||
87 | shutdown( (KWorkSpace::ShutdownConfirm)confirm, | 88 | shutdown( (KWorkSpace::ShutdownConfirm)confirm, | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | |||||
178 | void KSMServer::performLogout() | 179 | void KSMServer::performLogout() | ||
179 | { | 180 | { | ||
180 | if( state >= Shutdown ) { // already performing shutdown | 181 | if( state >= Shutdown ) { // already performing shutdown | ||
181 | return; | 182 | return; | ||
182 | } | 183 | } | ||
183 | if (state != Idle) { | 184 | if (state != Idle) { | ||
184 | QTimer::singleShot(1000, this, &KSMServer::performLogout); | 185 | QTimer::singleShot(1000, this, &KSMServer::performLogout); | ||
185 | } | 186 | } | ||
187 | | ||||
188 | auto reply = m_kwinInterface->setState(QStringLiteral("saving")); | ||||
broulik: `reply` isn't actually used, remove? | |||||
189 | // we don't need to block as we wait for kwin to handle it's session 1 | ||||
190 | // before messaging the clients | ||||
191 | | ||||
186 | state = Shutdown; | 192 | state = Shutdown; | ||
187 | 193 | | |||
188 | // shall we save the session on logout? | 194 | // shall we save the session on logout? | ||
189 | KConfigGroup cg(KSharedConfig::openConfig(), "General"); | 195 | KConfigGroup cg(KSharedConfig::openConfig(), "General"); | ||
190 | saveSession = ( cg.readEntry( "loginMode", | 196 | saveSession = ( cg.readEntry( "loginMode", | ||
191 | QStringLiteral( "restorePreviousLogout" ) ) | 197 | QStringLiteral( "restorePreviousLogout" ) ) | ||
192 | == QLatin1String( "restorePreviousLogout" ) ); | 198 | == QLatin1String( "restorePreviousLogout" ) ); | ||
193 | 199 | | |||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
246 | { | 252 | { | ||
247 | if ( state != Idle ) | 253 | if ( state != Idle ) | ||
248 | return; | 254 | return; | ||
249 | 255 | | |||
250 | if ( currentSession().isEmpty() || currentSession() == QString::fromLocal8Bit( SESSION_PREVIOUS_LOGOUT ) ) | 256 | if ( currentSession().isEmpty() || currentSession() == QString::fromLocal8Bit( SESSION_PREVIOUS_LOGOUT ) ) | ||
251 | sessionGroup = QLatin1String("Session: ") + QString::fromLocal8Bit( SESSION_BY_USER ); | 257 | sessionGroup = QLatin1String("Session: ") + QString::fromLocal8Bit( SESSION_BY_USER ); | ||
252 | 258 | | |||
253 | state = Checkpoint; | 259 | state = Checkpoint; | ||
260 | | ||||
254 | wmPhase1WaitingCount = 0; | 261 | wmPhase1WaitingCount = 0; | ||
255 | saveType = SmSaveLocal; | 262 | saveType = SmSaveLocal; | ||
256 | saveSession = true; | 263 | saveSession = true; | ||
257 | #ifndef NO_LEGACY_SESSION_MANAGEMENT | 264 | #ifndef NO_LEGACY_SESSION_MANAGEMENT | ||
258 | performLegacySessionSave(); | 265 | performLegacySessionSave(); | ||
259 | #endif | 266 | #endif | ||
260 | foreach( KSMClient* c, clients ) { | 267 | foreach( KSMClient* c, clients ) { | ||
261 | c->resetState(); | 268 | c->resetState(); | ||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | 406 | if( c->saveYourselfDone ) { | |||
400 | // Discard also saved state. | 407 | // Discard also saved state. | ||
401 | QStringList discard = c->discardCommand(); | 408 | QStringList discard = c->discardCommand(); | ||
402 | if( !discard.isEmpty()) | 409 | if( !discard.isEmpty()) | ||
403 | executeCommand( discard ); | 410 | executeCommand( discard ); | ||
404 | } | 411 | } | ||
405 | } | 412 | } | ||
406 | } | 413 | } | ||
407 | state = Idle; | 414 | state = Idle; | ||
415 | | ||||
416 | m_kwinInterface->setState(QStringLiteral("normal")); | ||||
417 | | ||||
408 | if (m_performLogoutCall.type() == QDBusMessage::MethodCallMessage) { | 418 | if (m_performLogoutCall.type() == QDBusMessage::MethodCallMessage) { | ||
409 | auto reply = m_performLogoutCall.createReply(false); | 419 | auto reply = m_performLogoutCall.createReply(false); | ||
410 | QDBusConnection::sessionBus().send(reply); | 420 | QDBusConnection::sessionBus().send(reply); | ||
411 | m_performLogoutCall = QDBusMessage(); | 421 | m_performLogoutCall = QDBusMessage(); | ||
412 | } | 422 | } | ||
413 | emit logoutCancelled(); | 423 | emit logoutCancelled(); | ||
414 | } | 424 | } | ||
415 | 425 | | |||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | |||||
514 | { | 524 | { | ||
515 | qCDebug(KSMSERVER) << "Starting killing clients"; | 525 | qCDebug(KSMSERVER) << "Starting killing clients"; | ||
516 | if (state == Killing) { | 526 | if (state == Killing) { | ||
517 | // we are already killing | 527 | // we are already killing | ||
518 | return; | 528 | return; | ||
519 | } | 529 | } | ||
520 | // kill all clients | 530 | // kill all clients | ||
521 | state = Killing; | 531 | state = Killing; | ||
532 | | ||||
533 | m_kwinInterface->setState(QStringLiteral("quitting")); | ||||
534 | | ||||
522 | foreach( KSMClient* c, clients ) { | 535 | foreach( KSMClient* c, clients ) { | ||
523 | if( isWM( c )) // kill the WM as the last one in order to reduce flicker | 536 | if( isWM( c )) // kill the WM as the last one in order to reduce flicker | ||
524 | continue; | 537 | continue; | ||
525 | qCDebug(KSMSERVER) << "startKilling: client " << c->program() << "(" << c->clientId() << ")"; | 538 | qCDebug(KSMSERVER) << "startKilling: client " << c->program() << "(" << c->clientId() << ")"; | ||
526 | SmsDie( c->connection() ); | 539 | SmsDie( c->connection() ); | ||
527 | } | 540 | } | ||
528 | 541 | | |||
529 | qCDebug(KSMSERVER) << " We killed all clients. We have now clients.count()=" << | 542 | qCDebug(KSMSERVER) << " We killed all clients. We have now clients.count()=" << | ||
▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines |
reply isn't actually used, remove?