Commit 849f69e5 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Use KPluginFactory to instantiate plugins

Instead of the homegrown factory
parent 5f13e6f3
Pipeline #76462 passed with stage
in 12 minutes and 58 seconds
...@@ -71,7 +71,7 @@ set(PIMCOMMON_LIB_VERSION "5.18.40") ...@@ -71,7 +71,7 @@ set(PIMCOMMON_LIB_VERSION "5.18.40")
set(LIBKDEPIM_LIB_VERSION "5.18.40") set(LIBKDEPIM_LIB_VERSION "5.18.40")
set(LIBINCIDENCEEDITOR_LIB_VERSION "5.18.40") set(LIBINCIDENCEEDITOR_LIB_VERSION "5.18.40")
set(CALENDARSUPPORT_LIB_VERSION "5.18.40") set(CALENDARSUPPORT_LIB_VERSION "5.18.40")
set(EVENTVIEW_LIB_VERSION "5.18.40") set(EVENTVIEW_LIB_VERSION "5.18.41")
set(AKONADI_SEARCH_VERSION "5.18.40") set(AKONADI_SEARCH_VERSION "5.18.40")
find_package(KF5AkonadiSearch ${AKONADI_SEARCH_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiSearch ${AKONADI_SEARCH_VERSION} CONFIG REQUIRED)
......
...@@ -54,21 +54,14 @@ KService::List KOCore::availableCalendarDecorations() ...@@ -54,21 +54,14 @@ KService::List KOCore::availableCalendarDecorations()
EventViews::CalendarDecoration::Decoration *KOCore::loadCalendarDecoration(const KService::Ptr &service) EventViews::CalendarDecoration::Decoration *KOCore::loadCalendarDecoration(const KService::Ptr &service)
{ {
KPluginLoader loader(*service); KPluginLoader loader(*service);
auto factory = loader.instance(); auto factory = loader.factory();
if (!factory) { if (!factory) {
qCDebug(KORGANIZER_LOG) << "Factory creation failed"; qCDebug(KORGANIZER_LOG) << "Factory creation failed";
return nullptr; return nullptr;
} }
auto pluginFactory = qobject_cast<EventViews::CalendarDecoration::DecorationFactory *>(factory); return factory->create<EventViews::CalendarDecoration::Decoration>();
if (!pluginFactory) {
qCDebug(KORGANIZER_LOG) << "Cast failed";
return nullptr;
}
return pluginFactory->createPluginFactory();
} }
void KOCore::addXMLGUIClient(QWidget *wdg, KXMLGUIClient *guiclient) void KOCore::addXMLGUIClient(QWidget *wdg, KXMLGUIClient *guiclient)
......
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