diff --git a/activities.cpp b/activities.cpp index 14cfb89423..8bf1b90966 100644 --- a/activities.cpp +++ b/activities.cpp @@ -24,7 +24,6 @@ along with this program. If not, see . // KDE #include #include -#include #include // Qt #include @@ -80,7 +79,7 @@ void Activities::slotRemoved(const QString &activity) client->setOnActivity(activity, false); } //toss out any session data for it - KConfigGroup cg(KGlobal::config(), QString("SubSession: ") + activity); + KConfigGroup cg(KSharedConfig::openConfig(), QString("SubSession: ") + activity); cg.deleteGroup(); } diff --git a/clients/aurorae/src/lib/auroraetheme.cpp b/clients/aurorae/src/lib/auroraetheme.cpp index b6f7f40966..eed0e80f26 100644 --- a/clients/aurorae/src/lib/auroraetheme.cpp +++ b/clients/aurorae/src/lib/auroraetheme.cpp @@ -27,7 +27,6 @@ // KDE #include #include -#include namespace Aurorae { diff --git a/composite.cpp b/composite.cpp index 432bc25f5f..a7b04477b9 100644 --- a/composite.cpp +++ b/composite.cpp @@ -48,7 +48,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include @@ -182,7 +181,7 @@ void Compositor::slotCompositingOptionsInitialized() qDebug() << "Initializing OpenGL compositing"; // Some broken drivers crash on glXQuery() so to prevent constant KWin crashes: - KSharedConfigPtr unsafeConfigPtr = KGlobal::config(); + KSharedConfigPtr unsafeConfigPtr = KSharedConfig::openConfig(); KConfigGroup unsafeConfig(unsafeConfigPtr, "Compositing"); const QString openGLIsUnsafe = QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString()); if (unsafeConfig.readEntry(openGLIsUnsafe, false)) @@ -380,7 +379,7 @@ void Compositor::deleteUnusedSupportProperties() void Compositor::fallbackToXRenderCompositing() { finish(); - KConfigGroup config(KGlobal::config(), "Compositing"); + KConfigGroup config(KSharedConfig::openConfig(), "Compositing"); config.writeEntry("Backend", "XRender"); config.sync(); options->setCompositingMode(XRenderCompositing); @@ -401,7 +400,7 @@ void Compositor::slotConfigChanged() void Compositor::slotReinitialize() { // Reparse config. Config options will be reloaded by setup() - KGlobal::config()->reparseConfiguration(); + KSharedConfig::openConfig()->reparseConfiguration(); // Restart compositing finish(); diff --git a/compositingprefs.cpp b/compositingprefs.cpp index 56e36a3498..4a03b251af 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -24,7 +24,6 @@ along with this program. If not, see . #include "kwinglplatform.h" #include -#include #include #include #include @@ -52,13 +51,13 @@ CompositingPrefs::~CompositingPrefs() bool CompositingPrefs::openGlIsBroken() { const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString())); - return KConfigGroup(KGlobal::config(), "Compositing").readEntry(unsafeKey, false); + return KConfigGroup(KSharedConfig::openConfig(), "Compositing").readEntry(unsafeKey, false); } bool CompositingPrefs::compositingPossible() { // first off, check whether we figured that we'll crash on detection because of a buggy driver - KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing"); + KConfigGroup gl_workaround_group(KSharedConfig::openConfig(), "Compositing"); const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString())); if (gl_workaround_group.readEntry("Backend", "OpenGL") == QStringLiteral("OpenGL") && gl_workaround_group.readEntry(unsafeKey, false)) @@ -88,7 +87,7 @@ bool CompositingPrefs::compositingPossible() QString CompositingPrefs::compositingNotPossibleReason() { // first off, check whether we figured that we'll crash on detection because of a buggy driver - KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing"); + KConfigGroup gl_workaround_group(KSharedConfig::openConfig(), "Compositing"); const QString unsafeKey(QStringLiteral("OpenGLIsUnsafe") + (is_multihead ? QString::number(screen_number) : QString())); if (gl_workaround_group.readEntry("Backend", "OpenGL") == QStringLiteral("OpenGL") && gl_workaround_group.readEntry(unsafeKey, false)) diff --git a/decorations.cpp b/decorations.cpp index 606abfe23d..24f4626e3f 100644 --- a/decorations.cpp +++ b/decorations.cpp @@ -23,7 +23,6 @@ along with this program. If not, see . #include "config-kwin.h" #include -#include #include #include #include @@ -35,7 +34,7 @@ KWIN_SINGLETON_FACTORY(DecorationPlugin) DecorationPlugin::DecorationPlugin(QObject *parent) : QObject(parent) - , KDecorationPlugins(KGlobal::config()) + , KDecorationPlugins(KSharedConfig::openConfig()) , m_disabled(false) { defaultPlugin = QStringLiteral("kwin3_oxygen"); diff --git a/effects.cpp b/effects.cpp index 02f6a24e3d..a15abf2c24 100644 --- a/effects.cpp +++ b/effects.cpp @@ -59,7 +59,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include @@ -319,8 +318,7 @@ void EffectsHandlerImpl::slotEffectsQueried() KService::List offers = watcher->result(); QStringList effectsToBeLoaded; QStringList checkDefault; - KSharedConfig::Ptr _config = KGlobal::config(); - KConfigGroup conf(_config, "Plugins"); + KConfigGroup conf(KSharedConfig::openConfig(), "Plugins"); // First unload necessary effects foreach (const KService::Ptr & service, offers) { diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp index 1e8251fbd1..fccccb87bb 100644 --- a/effects/coverswitch/coverswitch.cpp +++ b/effects/coverswitch/coverswitch.cpp @@ -28,7 +28,6 @@ along with this program. If not, see . #include #include #include -#include #include #include diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index c6604d33e3..c45c8176a5 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -28,7 +28,6 @@ along with this program. If not, see . #include #include #include -#include #include #include diff --git a/effects/invert/invert.cpp b/effects/invert/invert.cpp index d02253ded2..fd9409728a 100644 --- a/effects/invert/invert.cpp +++ b/effects/invert/invert.cpp @@ -25,7 +25,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp index 1d6d4a40c1..be96bbb2c2 100644 --- a/effects/logout/logout.cpp +++ b/effects/logout/logout.cpp @@ -29,7 +29,6 @@ along with this program. If not, see . #include #include -#include #include #include diff --git a/effects/lookingglass/lookingglass.cpp b/effects/lookingglass/lookingglass.cpp index 64b4f6aca9..4a20a2ce47 100644 --- a/effects/lookingglass/lookingglass.cpp +++ b/effects/lookingglass/lookingglass.cpp @@ -32,7 +32,6 @@ along with this program. If not, see . #include #include #include -#include #include #include diff --git a/effects/startupfeedback/startupfeedback.cpp b/effects/startupfeedback/startupfeedback.cpp index 5c0eaf87e4..f99e5eead7 100644 --- a/effects/startupfeedback/startupfeedback.cpp +++ b/effects/startupfeedback/startupfeedback.cpp @@ -25,7 +25,6 @@ along with this program. If not, see . #include // KDE #include -#include #include #include #include diff --git a/effects/trackmouse/trackmouse.cpp b/effects/trackmouse/trackmouse.cpp index 58ff0be15b..efee832195 100644 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -32,8 +32,6 @@ along with this program. If not, see . #include #include -#include - #include #include #include diff --git a/geometry.cpp b/geometry.cpp index 4ce5f40da1..6e1a3e0bdf 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -34,7 +34,6 @@ along with this program. If not, see . #include "workspace.h" #include -#include #include #include "placement.h" diff --git a/main.cpp b/main.cpp index 304ea84453..25a60c0e4e 100644 --- a/main.cpp +++ b/main.cpp @@ -37,7 +37,6 @@ along with this program. If not, see . #include #include #include -#include #include // Qt #include @@ -207,7 +206,7 @@ void Application::start() { setQuitOnLastWindowClosed(false); - KSharedConfig::Ptr config = KGlobal::config(); + KSharedConfig::Ptr config = KSharedConfig::openConfig(); if (!config->isImmutable() && m_configLock) { // TODO: This shouldn't be necessary //config->setReadOnly( true ); diff --git a/manage.cpp b/manage.cpp index 2033cd2c0d..0904ede8af 100644 --- a/manage.cpp +++ b/manage.cpp @@ -24,7 +24,6 @@ along with this program. If not, see . #include "client.h" #include -#include #ifdef KWIN_BUILD_ACTIVITIES #include "activities.h" diff --git a/options.cpp b/options.cpp index ab449f338f..e6d016bea3 100644 --- a/options.cpp +++ b/options.cpp @@ -30,7 +30,6 @@ along with this program. If not, see . #include #include #include -#include #include #include @@ -116,7 +115,7 @@ int currentRefreshRate() Options::Options(QObject *parent) : QObject(parent) - , m_settings(new Settings(KGlobal::config())) + , m_settings(new Settings(KSharedConfig::openConfig())) , m_focusPolicy(ClickToFocus) , m_nextFocusPrefersMouse(false) , m_clickRaise(false) @@ -655,7 +654,7 @@ void Options::setUnredirectFullscreen(bool unredirectFullscreen) return; } if (GLPlatform::instance()->driver() == Driver_Intel) { // write back the value - KConfigGroup(KGlobal::config(), "Compositing").writeEntry("UnredirectFullscreen", false); + KConfigGroup(m_settings->config(), "Compositing").writeEntry("UnredirectFullscreen", false); } m_unredirectFullscreen = unredirectFullscreen; emit unredirectFullscreenChanged(); @@ -780,7 +779,7 @@ void Options::setGlPreferBufferSwap(char glPreferBufferSwap) void Options::reparseConfiguration() { - KGlobal::config()->reparseConfiguration(); + m_settings->config()->reparseConfiguration(); } unsigned long Options::updateSettings() @@ -806,7 +805,6 @@ unsigned long Options::updateSettings() unsigned long Options::loadConfig() { - KSharedConfig::Ptr _config = KGlobal::config(); m_settings->readConfig(); unsigned long changed = 0; changed |= KDecorationOptions::updateSettings(m_settings->config()); // read decoration settings @@ -814,14 +812,14 @@ unsigned long Options::loadConfig() syncFromKcfgc(); // Electric borders - KConfigGroup config(_config, "Windows"); + KConfigGroup config(m_settings->config(), "Windows"); OpTitlebarDblClick = windowOperation(config.readEntry("TitlebarDoubleClickCommand", "Maximize"), true); setOpMaxButtonLeftClick(windowOperation(config.readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true)); setOpMaxButtonMiddleClick(windowOperation(config.readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true)); setOpMaxButtonRightClick(windowOperation(config.readEntry("MaximizeButtonRightClickCommand", "Maximize (horizontal only)"), true)); // Mouse bindings - config = KConfigGroup(_config, "MouseBindings"); + config = KConfigGroup(m_settings->config(), "MouseBindings"); // TODO: add properties for missing options CmdTitlebarWheel = mouseWheelCommand(config.readEntry("CommandTitlebarWheel", "Switch to Window Tab to the Left/Right")); CmdAllModKey = (config.readEntry("CommandAllKey", "Alt") == QStringLiteral("Meta")) ? Qt::Key_Meta : Qt::Key_Alt; @@ -841,7 +839,7 @@ unsigned long Options::loadConfig() setCommandAll3(mouseCommand(config.readEntry("CommandAll3", "Resize"), false)); // TODO: should they be moved into reloadCompositingSettings? - config = KConfigGroup(_config, "Compositing"); + config = KConfigGroup(m_settings->config(), "Compositing"); setMaxFpsInterval(1 * 1000 * 1000 * 1000 / config.readEntry("MaxFPS", Options::defaultMaxFps())); setRefreshRate(config.readEntry("RefreshRate", Options::defaultRefreshRate())); setVBlankTime(config.readEntry("VBlankTime", Options::defaultVBlankTime()) * 1000); // config in micro, value in nano resolution @@ -891,8 +889,7 @@ void Options::syncFromKcfgc() bool Options::loadCompositingConfig (bool force) { - KSharedConfig::Ptr _config = KGlobal::config(); - KConfigGroup config(_config, "Compositing"); + KConfigGroup config(m_settings->config(), "Compositing"); bool useCompositing = false; CompositingType compositingMode = NoCompositing; @@ -956,8 +953,7 @@ void Options::reloadCompositingSettings(bool force) prefs.detect(); } - KSharedConfig::Ptr _config = KGlobal::config(); - KConfigGroup config(_config, "Compositing"); + KConfigGroup config(m_settings->config(), "Compositing"); setGlDirect(prefs.enableDirectRendering()); setGlSmoothScale(qBound(-1, config.readEntry("GLTextureFilter", Options::defaultGlSmoothScale()), 2)); diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index cc26b50795..3069bd04ba 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -33,7 +33,6 @@ along with this program. If not, see . #include "../workspace.h" // KDE #include -#include #include #include #include @@ -231,7 +230,7 @@ KWin::AbstractScript::~AbstractScript() KConfigGroup KWin::AbstractScript::config() const { - return KGlobal::config()->group(QStringLiteral("Script-") + m_pluginName); + return KSharedConfig::openConfig()->group(QStringLiteral("Script-") + m_pluginName); } void KWin::AbstractScript::stop() @@ -640,7 +639,7 @@ void KWin::Scripting::start() LoadScriptList KWin::Scripting::queryScriptsToLoad() { - KSharedConfig::Ptr _config = KGlobal::config(); + KSharedConfig::Ptr _config = KSharedConfig::openConfig(); static bool s_started = false; if (s_started) { _config->reparseConfiguration(); diff --git a/sm.cpp b/sm.cpp index e7487e35f0..3a3b52e02f 100644 --- a/sm.cpp +++ b/sm.cpp @@ -26,7 +26,6 @@ along with this program. If not, see . #include #include #include -#include #include "workspace.h" #include "client.h" @@ -164,7 +163,7 @@ void Workspace::storeClient(KConfigGroup &cg, int num, Client *c) void Workspace::storeSubSession(const QString &name, QSet sessionIds) { //TODO clear it first - KConfigGroup cg(KGlobal::config(), QStringLiteral("SubSession: ") + name); + KConfigGroup cg(KSharedConfig::openConfig(), QStringLiteral("SubSession: ") + name); int count = 0; int active_client = -1; for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) { @@ -247,7 +246,7 @@ void Workspace::addSessionInfo(KConfigGroup &cg) void Workspace::loadSubSessionInfo(const QString &name) { - KConfigGroup cg(KGlobal::config(), QStringLiteral("SubSession: ") + name); + KConfigGroup cg(KSharedConfig::openConfig(), QStringLiteral("SubSession: ") + name); addSessionInfo(cg); } diff --git a/tabbox/declarative.cpp b/tabbox/declarative.cpp index b169c60e72..81268d6738 100644 --- a/tabbox/declarative.cpp +++ b/tabbox/declarative.cpp @@ -34,7 +34,6 @@ along with this program. If not, see . #include // include KDE -#include #include #include #include diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index afef2912ea..5c2f664734 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -54,7 +54,6 @@ along with this program. If not, see . #include #include #include -#include #include #include // X11 @@ -711,7 +710,7 @@ void TabBox::hide(bool abort) void TabBox::reconfigure() { - KSharedConfigPtr c(KGlobal::config()); + KSharedConfigPtr c = KSharedConfig::openConfig(); KConfigGroup config = c->group("TabBox"); loadConfig(c->group("TabBox"), m_defaultConfig); @@ -1277,7 +1276,7 @@ void TabBox::CDEWalkThroughWindows(bool forward) Client* nc = c; bool options_traverse_all; { - KConfigGroup group(KGlobal::config(), "TabBox"); + KConfigGroup group(KSharedConfig::openConfig(), "TabBox"); options_traverse_all = group.readEntry("TraverseAll", false); } diff --git a/useractions.cpp b/useractions.cpp index aff0df7b02..bab454961f 100755 --- a/useractions.cpp +++ b/useractions.cpp @@ -68,7 +68,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include @@ -342,7 +341,7 @@ void UserActionsMenu::init() action = advancedMenu->addAction(i18n("S&pecial Application Settings...")); action->setIcon(KIcon(QStringLiteral("preferences-system-windows-actions"))); action->setData(Options::ApplicationRulesOp); - if (!KGlobal::config()->isImmutable() && + if (!KSharedConfig::openConfig()->isImmutable() && !KAuthorized::authorizeControlModules(configModules(true)).isEmpty()) { advancedMenu->addSeparator(); action = advancedMenu->addAction(i18nc("Entry in context menu of window decoration to open the configuration module of KWin", diff --git a/workspace.cpp b/workspace.cpp index a2fc38b259..9be8d598da 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -65,7 +65,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include @@ -265,13 +264,14 @@ Workspace::Workspace(bool restore) void Workspace::init() { updateXTime(); // Needed for proper initialization of user_time in Client ctor + KSharedConfigPtr config = KSharedConfig::openConfig(); Screens *screens = Screens::self(); - screens->setConfig(KGlobal::config()); + screens->setConfig(config); screens->reconfigure(); connect(options, SIGNAL(configChanged()), screens, SLOT(reconfigure())); #ifdef KWIN_BUILD_SCREENEDGES ScreenEdges *screenEdges = ScreenEdges::self(); - screenEdges->setConfig(KGlobal::config()); + screenEdges->setConfig(config); screenEdges->init(); connect(options, SIGNAL(configChanged()), screenEdges, SLOT(reconfigure())); connect(VirtualDesktopManager::self(), SIGNAL(layoutChanged(int,int)), screenEdges, SLOT(updateLayout())); @@ -300,7 +300,7 @@ void Workspace::init() vds->setNavigationWrappingAround(options->isRollOverDesktops()); connect(options, SIGNAL(rollOverDesktopsChanged(bool)), vds, SLOT(setNavigationWrappingAround(bool))); vds->setRootInfo(rootInfo); - vds->setConfig(KGlobal::config()); + vds->setConfig(config); // Now we know how many desktops we'll have, thus we initialize the positioning object Placement::create(this); @@ -464,7 +464,7 @@ Workspace::~Workspace() XDeleteProperty(display(), rootWindow(), atoms->kwin_running); delete RuleBook::self(); - KGlobal::config()->sync(); + KSharedConfig::openConfig()->sync(); RootInfo::destroy(); delete startup; @@ -813,7 +813,7 @@ void Workspace::slotReconfigure() bool borderlessMaximizedWindows = options->borderlessMaximizedWindows(); - KGlobal::config()->reparseConfiguration(); + KSharedConfig::openConfig()->reparseConfiguration(); unsigned long changed = options->updateSettings(); emit configChanged();