Commit 33b94c4d authored by Elvis Angelaccio's avatar Elvis Angelaccio
Browse files

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.
parent 126220d3
......@@ -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)) {
Plugin *plugin = new Plugin(this, metaData);
plugin->setEnabled(conf.readEntry(metaData.pluginId(), true));
plugin->setEnabled(conf.readEntry(pluginId, true));
addedPlugins << pluginId;
m_plugins << plugin;
Supports Markdown
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