diff --git a/kcmkwin/kwinscripts/CMakeLists.txt b/kcmkwin/kwinscripts/CMakeLists.txt index ad19db60c7..c6cd344cea 100644 --- a/kcmkwin/kwinscripts/CMakeLists.txt +++ b/kcmkwin/kwinscripts/CMakeLists.txt @@ -18,6 +18,7 @@ target_link_libraries(kcm_kwin_scripts KF5::KCMUtils KF5::KIOCore KF5::I18n + KF5::Package KF5::Plasma KF5::NewStuff ) diff --git a/kcmkwin/kwinscripts/module.cpp b/kcmkwin/kwinscripts/module.cpp index 7ecf963673..6b0519f58a 100644 --- a/kcmkwin/kwinscripts/module.cpp +++ b/kcmkwin/kwinscripts/module.cpp @@ -33,8 +33,10 @@ #include #include #include -#include +#include +#include #include + #include #include "version.h" @@ -95,8 +97,18 @@ void Module::importScript() void Module::updateListViewContents() { - KService::List offers = KServiceTypeTrader::self()->query("KWin/Script", "not (exist [X-KWin-Exclude-Listing]) or [X-KWin-Exclude-Listing] == false"); - QList scriptinfos = KPluginInfo::fromServices(offers); + auto filter = [](const KPluginMetaData &md) { + if (md.value(QStringLiteral("X-KWin-Exclude-Listing")) == QLatin1String("true") ) { + return false; + } + return true; + }; + + const QString scriptFolder = QStringLiteral("kwin/scripts/"); + const auto scripts = KPackage::PackageLoader::self()->findPackages(QStringLiteral("KWin/Script"), scriptFolder, filter); + + QList scriptinfos = KPluginInfo::fromMetaData(scripts.toVector()); + ui->scriptSelector->addPlugins(scriptinfos, KPluginSelector::ReadConfigFile, QString(), QString(), m_kwinConfig); }