diff options
author | Nate Graham <nate@kde.org> | 2019-11-08 09:20:22 -0700 |
---|---|---|
committer | Nate Graham <nate@kde.org> | 2019-11-26 07:58:57 -0700 |
commit | 23d4f14601fd8ff5ca7f28b0ad245ec1935799b2 (patch) | |
tree | 6aa0e72a17beeb7c54779045bd9237a3e45fb079 | |
parent | 9b8ef694412c688c9f1e0a6f41b49ac7492ec35a (diff) | |
download | kconfig-23d4f14601fd8ff5ca7f28b0ad245ec1935799b2.tar.gz kconfig-23d4f14601fd8ff5ca7f28b0ad245ec1935799b2.tar.bz2 |
Only create a session config when actually restoring a session
Summary:
This allows manually invoking session restoration logic without creating duplicate
configs, in support of D25106 and https://invent.kde.org/kde/okular/merge_requests/58/
Test Plan: Apply either of the above patches and verify that it works
Reviewers: #frameworks, davidedmundson
Reviewed By: davidedmundson
Subscribers: anthonyfieroni, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D25219
-rw-r--r-- | src/gui/kconfiggui.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/kconfiggui.cpp b/src/gui/kconfiggui.cpp index f65bba59..7eb4711e 100644 --- a/src/gui/kconfiggui.cpp +++ b/src/gui/kconfiggui.cpp @@ -39,7 +39,7 @@ KConfig *KConfigGui::sessionConfig() #ifdef QT_NO_SESSIONMANAGER #error QT_NO_SESSIONMANAGER was set, this will not compile. Reconfigure Qt with Session management support. #endif - if (!hasSessionConfig()) { + if (!hasSessionConfig() && qApp->isSessionRestored()) { // create the default instance specific config object // from applications' -session command line parameter s_sessionConfig = new KConfig(configName(qApp->sessionId(), @@ -70,6 +70,10 @@ bool KConfigGui::hasSessionConfig() #if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 11) QString KConfigGui::sessionConfigName() { - return sessionConfig()->name(); + if (sessionConfig()) { + return sessionConfig()->name(); + } else { + return QString(); + } } #endif |