don't use kconfiggroup in threaded script loading at all

BUG: 300934
FIXED-IN: 4.9
REVIEW: 105128
This commit is contained in:
Thomas Lübking 2012-06-02 09:33:25 +02:00
parent 15793ea75c
commit 3b6d52549d
2 changed files with 6 additions and 5 deletions

View file

@ -396,18 +396,19 @@ void KWin::Scripting::start()
QFutureWatcher<LoadScriptList> *watcher = new QFutureWatcher<LoadScriptList>(this); QFutureWatcher<LoadScriptList> *watcher = new QFutureWatcher<LoadScriptList>(this);
connect(watcher, SIGNAL(finished()), this, SLOT(slotScriptsQueried())); connect(watcher, SIGNAL(finished()), this, SLOT(slotScriptsQueried()));
KSharedConfig::Ptr _config = KGlobal::config(); KSharedConfig::Ptr _config = KGlobal::config();
KConfigGroup conf(_config, "Plugins"); QMap<QString,QString> pluginStates = KConfigGroup(_config, "Plugins").entryMap();
watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, conf)); watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, pluginStates));
} }
LoadScriptList KWin::Scripting::queryScriptsToLoad(KConfigGroup &conf) LoadScriptList KWin::Scripting::queryScriptsToLoad(QMap<QString,QString> &pluginStates)
{ {
KService::List offers = KServiceTypeTrader::self()->query("KWin/Script"); KService::List offers = KServiceTypeTrader::self()->query("KWin/Script");
LoadScriptList scriptsToLoad; LoadScriptList scriptsToLoad;
foreach (const KService::Ptr & service, offers) { foreach (const KService::Ptr & service, offers) {
KPluginInfo plugininfo(service); KPluginInfo plugininfo(service);
plugininfo.load(conf); const QString value = pluginStates.value(plugininfo.pluginName() + QString::fromLatin1("Enabled"), QString());
plugininfo.setPluginEnabled(value.isNull() ? plugininfo.isPluginEnabledByDefault() : QVariant(value).toBool());
const bool javaScript = service->property("X-Plasma-API").toString() == "javascript"; const bool javaScript = service->property("X-Plasma-API").toString() == "javascript";
const bool declarativeScript = service->property("X-Plasma-API").toString() == "declarativescript"; const bool declarativeScript = service->property("X-Plasma-API").toString() == "declarativescript";
if (!javaScript && !declarativeScript) { if (!javaScript && !declarativeScript) {

View file

@ -208,7 +208,7 @@ private Q_SLOTS:
void slotScriptsQueried(); void slotScriptsQueried();
private: private:
LoadScriptList queryScriptsToLoad(KConfigGroup &conf); LoadScriptList queryScriptsToLoad(QMap<QString,QString> &pluginStates);
}; };
} }