Commit badadab0 authored by Nicolas Fella's avatar Nicolas Fella Committed by Laurent Montel
Browse files

[kontactsummary] Port away from KServiceTypeTrader

Use KPluginLoader to list the plugins.
parent 38a9cc44
Pipeline #56441 canceled with stage
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
#include <KConfig> #include <KConfig>
#include <KLocalizedString> #include <KLocalizedString>
#include <KPluginInfo> #include <KPluginInfo>
#include <KService> #include <KPluginMetaData>
#include <KServiceTypeTrader>
#include <QIcon> #include <QIcon>
#include <QLabel> #include <QLabel>
...@@ -101,8 +100,9 @@ KCMKontactSummary::KCMKontactSummary(QWidget *parent) ...@@ -101,8 +100,9 @@ KCMKontactSummary::KCMKontactSummary(QWidget *parent)
void KCMKontactSummary::load() void KCMKontactSummary::load()
{ {
KService::List offers = const QVector<KPluginMetaData> pluginMetaDatas = KPluginLoader::findPlugins(QStringLiteral("kontact5"), [](const KPluginMetaData &data) {
KServiceTypeTrader::self()->query(QStringLiteral("Kontact/Plugin"), QStringLiteral("[X-KDE-KontactPluginVersion] == %1").arg(KONTACT_PLUGIN_VERSION)); return data.rawData().value(QStringLiteral("X-KDE-KontactPluginVersion")).toInt() == KONTACT_PLUGIN_VERSION;
});
QStringList activeSummaries; QStringList activeSummaries;
...@@ -124,10 +124,11 @@ void KCMKontactSummary::load() ...@@ -124,10 +124,11 @@ void KCMKontactSummary::load()
mPluginView->clear(); mPluginView->clear();
KPluginInfo::List pluginList = KPluginInfo::fromServices(offers, KConfigGroup(&config, "Plugins")); KPluginInfo::List pluginList = KPluginInfo::fromMetaData(pluginMetaDatas);
KPluginInfo::List::Iterator it; KPluginInfo::List::Iterator it;
KPluginInfo::List::Iterator end(pluginList.end()); KPluginInfo::List::Iterator end(pluginList.end());
for (it = pluginList.begin(); it != end; ++it) { for (it = pluginList.begin(); it != end; ++it) {
it->setConfig(KConfigGroup(&config, "Plugins"));
it->load(); it->load();
if (!it->isPluginEnabled()) { if (!it->isPluginEnabled()) {
......
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