Commit 24ba367c authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Use KPluginFactory for KOrganizer plugins

Adapt to the plugin system change
parent 2c39ee68
Pipeline #76649 canceled with stage
......@@ -66,7 +66,7 @@ set(GRAVATAR_LIB_VERSION "5.18.40")
set(PIMCOMMON_LIB_VERSION "5.18.41")
set(GRANTLEETHEME_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(LIBKDEPIM_LIB_VERSION "5.18.40")
set(KADDRESSBOOK_IMPORTEXPORT_LIB_VERSION "5.18.40")
set(LIBKLEO_LIB_VERSION "5.18.40")
......
......@@ -13,8 +13,12 @@
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KPluginFactory>
Datenums::Datenums()
K_PLUGIN_FACTORY(DatenumsFactory, registerPlugin<Datenums>();)
Datenums::Datenums(QObject *parent, const QVariantList &args)
: Decoration(parent, args)
{
KConfig _config(QStringLiteral("korganizerrc"), KConfig::NoGlobals);
KConfigGroup config(&_config, "Calendar/Datenums Plugin");
......@@ -144,3 +148,5 @@ Element::List Datenums::createWeekElements(const QDate &date)
return result;
}
#include "datenums.moc"
......@@ -15,10 +15,7 @@ using namespace EventViews::CalendarDecoration;
class Datenums : public Decoration
{
public:
Datenums();
~Datenums() override
{
}
Datenums(QObject *parent = nullptr, const QVariantList &args = {});
void configure(QWidget *parent) override;
......@@ -37,16 +34,5 @@ private:
DayNumbers mDisplayedInfo;
};
class DatenumsFactory : public DecorationFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.kde.korganizer.Datenums")
public:
Decoration *createPluginFactory() override
{
return new Datenums;
}
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Datenums::DayNumbers)
......@@ -14,23 +14,23 @@
#include <KConfigGroup>
#include <KIO/Scheduler>
#include <KLocalizedString>
#include <KPluginFactory>
#include <QDomDocument>
#include <chrono>
K_PLUGIN_FACTORY(PicofthedayFactory, registerPlugin<Picoftheday>();)
using namespace std::chrono_literals;
// https://www.mediawiki.org/wiki/API:Picture_of_the_day_viewer
Picoftheday::Picoftheday()
Picoftheday::Picoftheday(QObject *parent, const QVariantList &args)
: Decoration(parent, args)
{
KConfig _config(QStringLiteral("korganizerrc"));
KConfigGroup config(&_config, "Picture of the Day Plugin");
mThumbSize = config.readEntry("InitialThumbnailSize", QSize(120, 60));
}
Picoftheday::~Picoftheday()
{
}
void Picoftheday::configure(QWidget *parent)
{
ConfigDialog dlg(parent);
......@@ -333,3 +333,5 @@ void POTDElement::setThumbnailSize(QSize size)
{
mThumbSize = size;
}
#include "picoftheday.moc"
......@@ -16,8 +16,7 @@ using namespace EventViews::CalendarDecoration;
class Picoftheday : public Decoration
{
public:
Picoftheday();
~Picoftheday() override;
Picoftheday(QObject *parent = nullptr, const QVariantList &args = {});
Q_REQUIRED_RESULT Element::List createDayElements(const QDate &) override;
......@@ -29,17 +28,6 @@ private:
QSize mThumbSize;
};
class PicofthedayFactory : public DecorationFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.kde.korganizer.Picoftheday")
public:
Decoration *createPluginFactory() override
{
return new Picoftheday;
}
};
class POTDElement : public StoredElement
{
Q_OBJECT
......
......@@ -12,8 +12,12 @@
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KPluginFactory>
ThisDayInHistory::ThisDayInHistory()
K_PLUGIN_FACTORY(ThisDayInHistoryFactory, registerPlugin<ThisDayInHistory>();)
ThisDayInHistory::ThisDayInHistory(QObject *parent, const QVariantList &args)
: Decoration(parent, args)
{
KConfig _config(QStringLiteral("korganizerrc"));
KConfigGroup config(&_config, "This Day in History Plugin");
......@@ -53,3 +57,5 @@ Element::List ThisDayInHistory::createMonthElements(const QDate &date)
return elements;
}
#include "thisdayinhistory.moc"
......@@ -15,10 +15,7 @@ using namespace EventViews::CalendarDecoration;
class ThisDayInHistory : public Decoration
{
public:
ThisDayInHistory();
~ThisDayInHistory() override
{
}
ThisDayInHistory(QObject *parent = nullptr, const QVariantList &args = {});
Q_REQUIRED_RESULT Element::List createDayElements(const QDate &) override;
Q_REQUIRED_RESULT Element::List createMonthElements(const QDate &) override;
......@@ -27,15 +24,3 @@ public:
Q_REQUIRED_RESULT QString info() const override;
};
class ThisDayInHistoryFactory : public DecorationFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.kde.korganizer.ThisDayInHistory")
public:
Decoration *createPluginFactory() override
{
return new ThisDayInHistory;
}
};
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