Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM EventViews
Commits
c9283455
Commit
c9283455
authored
Aug 17, 2021
by
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
Changes
4
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
c9283455
cmake_minimum_required
(
VERSION 3.16 FATAL_ERROR
)
set
(
PIM_VERSION
"5.18.4
0
"
)
set
(
PIM_VERSION
"5.18.4
1
"
)
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.4
0
"
)
set
(
CALENDARSUPPORT_LIB_VERSION
"5.18.4
1
"
)
find_package
(
KF5Akonadi
${
AKONADI_LIB_VERSION
}
CONFIG REQUIRED
)
find_package
(
Qt5
${
QT_REQUIRED_VERSION
}
CONFIG REQUIRED Widgets
)
...
...
src/agenda/agendaview.cpp
View file @
c9283455
...
...
@@ -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
>
();
}
}
...
...
src/agenda/calendardecoration.cpp
View file @
c9283455
...
...
@@ -137,7 +137,8 @@ QUrl StoredElement::url() const
////////////////////////////////////////////////////////////////////////////////
Decoration
::
Decoration
()
Decoration
::
Decoration
(
QObject
*
parent
,
const
QVariantList
&
args
)
:
CalendarSupport
::
Plugin
(
parent
,
args
)
{
}
...
...
src/agenda/calendardecoration.h
View file @
c9283455
...
...
@@ -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
;
};
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment