Commit 860d6d8e authored by Olivier de Gaalon's avatar Olivier de Gaalon
Browse files

Don't use the session to check enabled state unless necessary

This behaves as a nearly pointless optimization. It's actually done
because we have at least one test that deletes the session, leading
to issues with CompilerManager which rightfully asserts that it's
loaded even after the session has expired.
It's not necessary to check the session for it, so we don't.
parent 18eb7987
......@@ -215,12 +215,10 @@ public:
void foreachEnabledPlugin(F func, const QString &extension = {}, const QVariantMap& constraints = {}, const QString &pluginName = {})
{
foreach (const auto& info, plugins) {
if( !isEnabled(info) ) {
continue;
}
if ((pluginName.isEmpty() || info.pluginName() == pluginName)
&& (extension.isEmpty() || info.property(KEY_Interfaces).toStringList().contains(extension))
&& constraintsMatch(info, constraints))
&& constraintsMatch(info, constraints)
&& isEnabled(info))
{
if (!func(info)) {
break;
......@@ -236,10 +234,14 @@ public:
return false;
}
if (!isGlobalPlugin( info ) || !isUserSelectable( info )) {
return true;
}
KConfigGroup grp = Core::self()->activeSession()->config()->group( KEY_Plugins );
bool isEnabled = grp.readEntry( info.pluginName()+"Enabled", ShellExtension::getInstance()->defaultPlugins().isEmpty() || ShellExtension::getInstance()->defaultPlugins().contains( info.pluginName() ) );
//kDebug() << "read config:" << isEnabled << "is global plugin:" << isGlobalPlugin( info ) << "default:" << ShellExtension::getInstance()->defaultPlugins().isEmpty() << ShellExtension::getInstance()->defaultPlugins().contains( info.pluginName() );
return !isGlobalPlugin( info ) || !isUserSelectable( info ) || isEnabled;
return isEnabled;
}
Core *core;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment