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
KontactInterface
Commits
c9666916
Commit
c9666916
authored
Aug 31, 2021
by
Laurent Montel
😁
Browse files
Port away KPluginLoader
parent
d333f9e3
Pipeline
#77523
passed with stage
in 3 minutes and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/core.cpp
View file @
c9666916
...
...
@@ -9,11 +9,12 @@
*/
#include
"core.h"
#include
"kcoreaddons_version.h"
#include
"kontactinterface_debug.h"
#include
<KPluginFactory>
#include
<KPluginLoader>
#include
<KPluginMetaData>
#include
<QDateTime>
#include
<QTimer>
...
...
@@ -69,6 +70,21 @@ KParts::Part *Core::createPart(const char *libname)
return
it
.
value
();
}
#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 86, 0)
qCDebug
(
KONTACTINTERFACE_LOG
)
<<
"Creating new KPart"
;
const
auto
result
=
KPluginFactory
::
instantiatePlugin
<
KParts
::
Part
>
(
KPluginMetaData
(
QString
::
fromLatin1
(
libname
)),
this
);
if
(
result
.
plugin
)
{
d
->
mParts
.
insert
(
libname
,
result
.
plugin
);
QObject
::
connect
(
result
.
plugin
,
&
KParts
::
Part
::
destroyed
,
this
,
[
this
](
QObject
*
obj
)
{
d
->
slotPartDestroyed
(
obj
);
});
}
else
{
d
->
lastErrorMessage
=
result
.
errorString
;
qCWarning
(
KONTACTINTERFACE_LOG
)
<<
d
->
lastErrorMessage
;
}
return
result
.
plugin
;
#else
qCDebug
(
KONTACTINTERFACE_LOG
)
<<
"Creating new KPart"
;
KPluginLoader
loader
(
QString
::
fromLatin1
(
libname
));
...
...
@@ -78,7 +94,6 @@ KParts::Part *Core::createPart(const char *libname)
if
(
factory
)
{
part
=
factory
->
create
<
KParts
::
Part
>
(
this
);
}
if
(
part
)
{
d
->
mParts
.
insert
(
libname
,
part
);
QObject
::
connect
(
part
,
&
KParts
::
Part
::
destroyed
,
this
,
[
this
](
QObject
*
obj
)
{
...
...
@@ -88,8 +103,8 @@ KParts::Part *Core::createPart(const char *libname)
d
->
lastErrorMessage
=
loader
.
errorString
();
qCWarning
(
KONTACTINTERFACE_LOG
)
<<
d
->
lastErrorMessage
;
}
return
part
;
#endif
}
//@cond PRIVATE
...
...
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