if path is passed, pick the tail

PluginLoader::loadApplet works both by passing a simple plugin
name and a full path of a plasmoid package.

However, when loading the optional C++ plugin, we have to look
in the standard plasmoid plugin path, so only consider the
tail of the path name, as is guaranteed that part is equal to
the plugin name.

BUG:359902
Change-Id: Ic7300b7c12d7693bcb5590e29de780109a8ff81c
This commit is contained in:
Marco Martin 2016-02-29 17:31:38 +01:00
parent f55e20cc5f
commit 40b99a9122

View File

@ -186,11 +186,13 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
}
//if name wasn't a path, pluginName == name
const QString pluginName = name.split('/').last();
// Look for C++ plugins first
auto filter = [&name](const KPluginMetaData &md) -> bool
auto filter = [&pluginName](const KPluginMetaData &md) -> bool
{
return md.pluginId() == name;
return md.pluginId() == pluginName;
};
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_plasmoidsPluginDir, filter);