Commit c9283455 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Use KPluginFactory to instantiate plugins

Instead of the homegrown factory
parent 85464717
Pipeline #76461 passed with stage
in 6 minutes and 25 seconds
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.18.40")
set(PIM_VERSION "5.18.41")
project(eventviews VERSION ${PIM_VERSION})
......@@ -34,7 +34,7 @@ set(QT_REQUIRED_VERSION "5.15.2")
set(AKONADICALENDAR_LIB_VERSION "5.18.40")
set(KMIME_LIB_VERSION "5.18.40")
set(LIBKDEPIM_LIB_VERSION "5.18.40")
set(CALENDARSUPPORT_LIB_VERSION "5.18.40")
set(CALENDARSUPPORT_LIB_VERSION "5.18.41")
find_package(KF5Akonadi ${AKONADI_LIB_VERSION} CONFIG REQUIRED)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets)
......
......@@ -2270,19 +2270,13 @@ CalendarDecoration::Decoration *AgendaView::Private::loadCalendarDecoration(cons
KService::Ptr service = *it;
KPluginLoader loader(*service);
auto factory = loader.instance();
auto factory = loader.factory();
if (!factory) {
qCDebug(CALENDARVIEW_LOG) << "Factory creation failed";
return nullptr;
}
auto pluginFactory = qobject_cast<CalendarDecoration::DecorationFactory *>(factory);
if (!pluginFactory) {
qCDebug(CALENDARVIEW_LOG) << "Cast failed";
return nullptr;
}
return pluginFactory->createPluginFactory();
return factory->create<CalendarDecoration::Decoration>();
}
}
......
......@@ -137,7 +137,8 @@ QUrl StoredElement::url() const
////////////////////////////////////////////////////////////////////////////////
Decoration::Decoration()
Decoration::Decoration(QObject *parent, const QVariantList &args)
: CalendarSupport::Plugin(parent, args)
{
}
......
......@@ -139,6 +139,8 @@ protected:
*/
class EVENTVIEWS_EXPORT Decoration : public CalendarSupport::Plugin
{
Q_OBJECT
public:
static int interfaceVersion()
{
......@@ -152,7 +154,7 @@ public:
using List = QList<Decoration *>;
Decoration();
Decoration(QObject *parent = nullptr, const QVariantList &args = {});
~Decoration() override;
/**
......@@ -242,12 +244,6 @@ private:
QMap<QDate, Element::List> mYearElements;
};
class EVENTVIEWS_EXPORT DecorationFactory : public CalendarSupport::PluginFactory
{
Q_OBJECT
public:
Decoration *createPluginFactory() override = 0;
};
}
}
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