Commit 4f90ad96 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port decoration plugin loading away from KServiceTypeTrader

It is deprecated

Use KPluginMetaData and KPluginFactory instead
parent 3d6c3bb4
Pipeline #169338 passed with stage
in 11 minutes and 21 seconds
......@@ -84,7 +84,6 @@ endif()
ecm_set_disabled_deprecation_versions(QT 5.15.2
KF 5.93.0
KSERVICE 5.89.0 #KServiceTypeTrader::self
)
......
......@@ -422,31 +422,14 @@ void AgendaHeader::loadDecorations(const QStringList &decorations, const QString
CalendarDecoration::Decoration *AgendaHeader::loadCalendarDecoration(const QString &name)
{
const QString type = CalendarSupport::Plugin::serviceType();
const int version = CalendarSupport::Plugin::interfaceVersion();
auto result = KPluginFactory::instantiatePlugin<CalendarDecoration::Decoration>(KPluginMetaData(QLatin1String("korganizer/") + name));
QString constraint;
if (version >= 0) {
constraint = QStringLiteral("[X-KDE-PluginInterfaceVersion] == %1").arg(QString::number(version));
}
KService::List list = KServiceTypeTrader::self()->query(type, constraint);
KService::List::ConstIterator it;
for (it = list.constBegin(); it != list.constEnd(); ++it) {
if ((*it)->desktopEntryName() == name) {
KService::Ptr service = *it;
KPluginFactory *factory = KPluginFactory::loadFactory(KPluginMetaData(service->library())).plugin;
if (!factory) {
qCDebug(CALENDARVIEW_LOG) << "Factory creation failed";
return nullptr;
}
return factory->create<CalendarDecoration::Decoration>();
}
if (result) {
return result.plugin;
} else {
qCDebug(CALENDARVIEW_LOG) << "Factory creation failed" << result.errorString;
return nullptr;
}
return nullptr;
}
class EventViews::EventIndicatorPrivate
......
Supports Markdown
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