summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Angelaccio <elvis.angelaccio@kde.org>2016-10-25 16:56:13 (GMT)
committerElvis Angelaccio <elvis.angelaccio@kde.org>2016-10-25 17:01:56 (GMT)
commit33b94c4d09da98113473ea3fbfd574e20cb22bc1 (patch)
treeaf6a1afe356a4b76114f0cd7f144991ea36ae429
parent126220d36953fce2ae2672720db2fa08ce81fe1a (diff)
Filter out duplicate plugins
This prevents problems when Ark is installed both from package manager and in a custom prefix. Plugins are loaded on a first-come first-served base. This means that if the QT_PLUGIN_PATH env variable is defined, only the plugins in the first path defined in that variable will be loaded.
-rw-r--r--kerfuffle/pluginmanager.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/kerfuffle/pluginmanager.cpp b/kerfuffle/pluginmanager.cpp
index adc463f..5bd2ba4 100644
--- a/kerfuffle/pluginmanager.cpp
+++ b/kerfuffle/pluginmanager.cpp
@@ -174,9 +174,17 @@ void PluginManager::loadPlugins()
// use this group to write whether a plugin gets disabled.
const KConfigGroup conf(KSharedConfig::openConfig(), "EnabledPlugins");
+ QSet<QString> addedPlugins;
foreach (const KPluginMetaData &metaData, plugins) {
+ const auto pluginId = metaData.pluginId();
+ // Filter out duplicate plugins.
+ if (addedPlugins.contains(pluginId)) {
+ continue;
+ }
+
Plugin *plugin = new Plugin(this, metaData);
- plugin->setEnabled(conf.readEntry(metaData.pluginId(), true));
+ plugin->setEnabled(conf.readEntry(pluginId, true));
+ addedPlugins << pluginId;
m_plugins << plugin;
}
}