Use KPackage in kcmscripts
Test Plan: Tested all but show OSD appeared Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: graesslin, plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D2977
This commit is contained in:
parent
ff6e042c7f
commit
b1e76ed8c4
2 changed files with 16 additions and 3 deletions
|
@ -18,6 +18,7 @@ target_link_libraries(kcm_kwin_scripts
|
||||||
KF5::KCMUtils
|
KF5::KCMUtils
|
||||||
KF5::KIOCore
|
KF5::KIOCore
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
|
KF5::Package
|
||||||
KF5::Plasma
|
KF5::Plasma
|
||||||
KF5::NewStuff
|
KF5::NewStuff
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,8 +33,10 @@
|
||||||
#include <KMessageBox>
|
#include <KMessageBox>
|
||||||
#include <KMessageWidget>
|
#include <KMessageWidget>
|
||||||
#include <KPluginInfo>
|
#include <KPluginInfo>
|
||||||
#include <KServiceTypeTrader>
|
#include <KPackage/PackageLoader>
|
||||||
|
#include <KPackage/Package>
|
||||||
#include <Plasma/Package>
|
#include <Plasma/Package>
|
||||||
|
|
||||||
#include <KNewStuff3/KNS3/DownloadDialog>
|
#include <KNewStuff3/KNS3/DownloadDialog>
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
@ -95,8 +97,18 @@ void Module::importScript()
|
||||||
|
|
||||||
void Module::updateListViewContents()
|
void Module::updateListViewContents()
|
||||||
{
|
{
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("KWin/Script", "not (exist [X-KWin-Exclude-Listing]) or [X-KWin-Exclude-Listing] == false");
|
auto filter = [](const KPluginMetaData &md) {
|
||||||
QList<KPluginInfo> scriptinfos = KPluginInfo::fromServices(offers);
|
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<KPluginInfo> scriptinfos = KPluginInfo::fromMetaData(scripts.toVector());
|
||||||
|
|
||||||
ui->scriptSelector->addPlugins(scriptinfos, KPluginSelector::ReadConfigFile, QString(), QString(), m_kwinConfig);
|
ui->scriptSelector->addPlugins(scriptinfos, KPluginSelector::ReadConfigFile, QString(), QString(), m_kwinConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue