Commit ddba6db1 authored by Bhushan Shah's avatar Bhushan Shah

app: filter out the kcms which are not in current form factor

parent cd0acd73
......@@ -17,6 +17,7 @@ target_link_libraries(plasma-settings
KF5::QuickAddons
KF5::I18n
KF5::WindowSystem
KF5::Declarative
)
install( TARGETS plasma-settings ${INSTALL_TARGETS_DEFAULT_ARGS} )
......@@ -7,21 +7,31 @@
#include <KPluginLoader>
#include <KPluginFactory>
#include <KDeclarative/KDeclarative>
#include <QDebug>
ModulesModel::ModulesModel(QObject* parent)
: QAbstractListModel(parent)
, m_plugins()
{
qDebug() << "Current platform is " << KDeclarative::KDeclarative::runtimePlatform();
for (KPluginMetaData pluginMetaData : KPackage::PackageLoader::self()->listPackages(QString(), "kpackage/kcms/")) {
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("KPackage/GenericQML"));
package.setDefaultPackageRoot("kpackage/kcms");
package.setPath(pluginMetaData.pluginId());
Data d;
d.plugin = pluginMetaData;
m_plugins.append(d);
bool isCurrentPlatform = false;
for (QString platform : KDeclarative::KDeclarative::runtimePlatform()) {
if (pluginMetaData.formFactors().contains(platform)) {
qDebug() << "Platform for " << pluginMetaData.name() << " is " << pluginMetaData.formFactors();
isCurrentPlatform = true;
}
}
if (isCurrentPlatform) {
Data d;
d.plugin = pluginMetaData;
m_plugins.append(d);
}
}
}
......
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