summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <[email protected]>2018-10-31 17:12:57 +0000
committerDavid Edmundson <[email protected]>2018-10-31 17:12:57 +0000
commite53e3e1701485389d2a3fcc76c8d37cdf3d7b033 (patch)
tree9f08cb0807d16892dec06c630a619b6b480cbd1b
parent50815c0c305d1781f412beda2c058b91bbcbff90 (diff)
[ksmserver] Fix session restore check
Summary: The old code checked ksmserver->defaultSession in the Startup constructor before ksmserver was set up by main.cpp This refactor moves it to the job, so we'll be checking if we're restoring or not after ksmserver has been set up by main.cpp as well as making the initial code path a bit clearer. Test Plan: Logged in with session restore Logged in with a default session Reviewers: ahartmetz Reviewed By: ahartmetz Subscribers: ahartmetz, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D16550
-rw-r--r--ksmserver/startup.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp
index 10f6677..0bbfec8 100644
--- a/ksmserver/startup.cpp
+++ b/ksmserver/startup.cpp
@@ -198,12 +198,9 @@ Startup::Startup(KSMServer *parent):
ksmserver->setupShortcuts(); // done only here, because it needs kglobalaccel :-/
});
- if (ksmserver->defaultSession()) {
- connect(phase1, &KJob::finished, phase2, &KJob::start);
- } else {
- connect(phase1, &KJob::finished, restoreSession, &KJob::start);
- connect(restoreSession, &KJob::finished, phase2, &KJob::start);
- }
+ connect(phase1, &KJob::finished, restoreSession, &KJob::start);
+ connect(restoreSession, &KJob::finished, phase2, &KJob::start);
+
connect(phase1, &KJob::finished, this, []() {
NotificationThread *loginSound = new NotificationThread();
connect(loginSound, &NotificationThread::finished, loginSound, &NotificationThread::deleteLater);
@@ -291,6 +288,11 @@ RestoreSessionJob::RestoreSessionJob(KSMServer *server): KJob(),
void RestoreSessionJob::start()
{
+ if (m_ksmserver->defaultSession()) {
+ QTimer::singleShot(0, this, [this]() {emitResult();});
+ return;
+ }
+
m_ksmserver->lastAppStarted = 0;
m_ksmserver->lastIdStarted.clear();
m_ksmserver->state = KSMServer::Restoring;