Search for the plugin of the other plasmoid

Summary:
Some applets use completely the code of another one with the key
X-Plasma-RootPath.
At the moment it doesn't work on applets that have a binary plugin portion
This makes pluginloader load the plugin of the original applet we're using

Test Plan:
an applet that falls back to one that has a binary plugin now works.
ones that fall back to applets without binary plugin still work
normal applets as well

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D22675
This commit is contained in:
Marco Martin 2019-07-23 10:47:33 +02:00
parent 28bc0f3ea1
commit 0e859870a9

View File

@ -180,10 +180,18 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
}
// Need to pass the empty directory because it's where plasmoids used to be
const auto plugins = d->plasmoidCache.findPluginsById(name, { PluginLoaderPrivate::s_plasmoidsPluginDir, {} });
auto plugins = d->plasmoidCache.findPluginsById(name, { PluginLoaderPrivate::s_plasmoidsPluginDir, {} });
const KPackage::Package p = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"), name);
// If the applet is using another applet package, search for the plugin of the other applet
if (plugins.isEmpty()) {
const QString parentPlugin = p.metadata().value(QStringLiteral("X-Plasma-RootPath"));
if (!parentPlugin.isEmpty()) {
plugins = d->plasmoidCache.findPluginsById(parentPlugin, { PluginLoaderPrivate::s_plasmoidsPluginDir, {} });
}
}
if (!plugins.isEmpty()) {
KPluginLoader loader(plugins.first().fileName());
if (!isPluginVersionCompatible(loader)) {