Commit f48cf072 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[kcmkwin/kwindesktop] Use PackageLoader to get effect metadata

Summary:
`KPluginInfo(KService::Ptr)` is deprecated in favor of using plugin
loaders.

Test Plan:
* Go to System Settins -> Desktop Behavior > Virtual Desktops
* Open Switching tab
* Select Fade desktop
* Click the info button

Reviewers: #kwin, apol, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13851
parent 30954506
......@@ -18,6 +18,7 @@ target_link_libraries(kcm_kwindesktop
KF5::Completion
KF5::GlobalAccel
KF5::I18n
KF5::Package
KF5::WindowSystem
KF5::XmlGui
${X11_LIBRARIES}
......
......@@ -33,6 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KCModuleProxy>
#include <KGlobalAccel>
#include <KLocalizedString>
#include <KPackage/Package>
#include <KPackage/PackageLoader>
#include <KPluginInfo>
#include <KPluginFactory>
#include <KPluginTrader>
......@@ -570,12 +572,17 @@ void KWinDesktopConfig::slotAboutEffectClicked()
delete aboutPlugin;
};
if (fromKService) {
KServiceTypeTrader* trader = KServiceTypeTrader::self();
KService::List services;
services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_" + effect + '\'');
if (services.isEmpty())
const QString pluginId = QStringLiteral("kwin4_effect_%1").arg(effect);
const auto effectsMetaData = KPackage::PackageLoader::self()->findPackages(
QStringLiteral("KWin/Effect"),
QStringLiteral("kwin/effects/"),
[&pluginId](const KPluginMetaData &meta) {
return meta.pluginId() == pluginId;
});
if (effectsMetaData.isEmpty()) {
return;
KPluginInfo pluginInfo(services.first());
}
KPluginInfo pluginInfo(effectsMetaData.first());
const QString name = pluginInfo.name();
const QString comment = pluginInfo.comment();
......
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