KGlobal::config() -> KSharedConfig::openConfig()

KWin Core says good bye to KGlobal. We will not miss the threading
issues.
This commit is contained in:
Martin Gräßlin 2013-09-04 16:10:36 +02:00
parent fbc957c048
commit 139201a2e2
23 changed files with 31 additions and 58 deletions

View file

@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KDE
#include <KDE/KConfigGroup>
#include <KDE/KDebug>
#include <KDE/KGlobal>
#include <KActivities/Controller>
// Qt
#include <QtConcurrentRun>
@ -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();
}

View file

@ -27,7 +27,6 @@
// KDE
#include <KDE/KConfig>
#include <KDE/KConfigGroup>
#include <KDE/KGlobal>
namespace Aurorae {

View file

@ -48,7 +48,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QDBusConnection>
#include <kaction.h>
#include <kactioncollection.h>
#include <KDE/KGlobal>
#include <KDE/KLocalizedString>
#include <KDE/KNotification>
#include <KDE/KSelectionWatcher>
@ -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();

View file

@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kwinglplatform.h"
#include <kconfiggroup.h>
#include <KDE/KGlobal>
#include <KDE/KLocalizedString>
#include <kdeversion.h>
#include <ksharedconfig.h>
@ -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))

View file

@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config-kwin.h"
#include <kdecorationfactory.h>
#include <kglobal.h>
#include <KDE/KLocalizedString>
#include <stdlib.h>
#include <QPixmap>
@ -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");

View file

@ -59,7 +59,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KLibrary>
#include <KDE/KDesktopFile>
#include <KDE/KConfigGroup>
#include <KDE/KGlobal>
#include <KDE/KService>
#include <KDE/KServiceTypeTrader>
#include <KDE/KPluginInfo>
@ -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) {

View file

@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KLocalizedString>
#include <kapplication.h>
#include <kcolorscheme.h>
#include <kglobal.h>
#include <KDE/KIcon>
#include <kwinglutils.h>

View file

@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kwinconfig.h>
#include <KDE/KGlobal>
#include <QApplication>
#include <QColor>

View file

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinglutils.h>
#include <kwinglplatform.h>
#include <kactioncollection.h>
#include <KDE/KGlobal>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <QDebug>

View file

@ -29,7 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <QDebug>
#include <KDE/KGlobal>
#include <KDE/KStandardDirs>
#include <QtGui/QMatrix4x4>

View file

@ -32,7 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <QDebug>
#include <KDE/KGlobal>
#include <QVector2D>
#include <kmessagebox.h>

View file

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtGui/QPainter>
// KDE
#include <KDE/KConfigGroup>
#include <KDE/KGlobal>
#include <KDE/KIconLoader>
#include <KDE/KStartupInfo>
#include <KDE/KSelectionOwner>

View file

@ -32,8 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinglutils.h>
#include <kwinxrenderutils.h>
#include <kglobal.h>
#include <kactioncollection.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>

View file

@ -34,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "workspace.h"
#include <kapplication.h>
#include <kglobal.h>
#include <kwindowsystem.h>
#include "placement.h"

View file

@ -37,7 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KConfig>
#include <KDE/KConfigGroup>
#include <KDE/KCrash>
#include <KDE/KGlobal>
#include <KDE/KLocalizedString>
// Qt
#include <qplatformdefs.h>
@ -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 );

View file

@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "client.h"
#include <kstartupinfo.h>
#include <kglobal.h>
#ifdef KWIN_BUILD_ACTIVITIES
#include "activities.h"

View file

@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QProcess>
#include <kapplication.h>
#include <kconfig.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <klocale.h>
@ -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));

View file

@ -33,7 +33,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../workspace.h"
// KDE
#include <KDE/KConfigGroup>
#include <KDE/KGlobal>
#include <KDE/KPluginInfo>
#include <KDE/KServiceTypeTrader>
#include <kdeclarative/kdeclarative.h>
@ -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();

5
sm.cpp
View file

@ -26,7 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <pwd.h>
#include <fixx11h.h>
#include <kconfig.h>
#include <kglobal.h>
#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<QByteArray> 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);
}

View file

@ -34,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtCore/QStandardPaths>
// include KDE
#include <KDE/KGlobal>
#include <KDE/KIconEffect>
#include <KDE/KIconLoader>
#include <KDE/KServiceTypeTrader>

View file

@ -54,7 +54,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KConfigGroup>
#include <KDE/KAction>
#include <KDE/KIcon>
#include <KDE/KGlobal>
#include <KLocalizedString>
#include <kkeyserver.h>
// 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);
}

View file

@ -68,7 +68,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kiconloader.h>
#include <KDE/KLocalizedString>
#include <kconfig.h>
#include <KDE/KGlobal>
#include <KDE/KPushButton>
#include <kglobalaccel.h>
#include <kapplication.h>
@ -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",

View file

@ -65,7 +65,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KActionCollection>
#include <KDE/KConfig>
#include <KDE/KConfigGroup>
#include <KDE/KGlobal>
#include <KDE/KGlobalSettings>
#include <KDE/KLocalizedString>
#include <KDE/KStartupInfo>
@ -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();