Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KAccounts Integration
Commits
39ac07f5
Commit
39ac07f5
authored
Jul 12, 2022
by
Nicolas Fella
Browse files
Port away from deprecated KPluginLoader
parent
217353a8
Pipeline
#217973
passed with stage
in 52 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/kded/kded_accounts.cpp
View file @
39ac07f5
...
...
@@ -9,7 +9,6 @@
#include
<core.h>
#include
<KPluginFactory>
#include
<KPluginLoader>
#include
<KPluginMetaData>
#include
<QCoreApplication>
...
...
@@ -30,28 +29,21 @@ KDEDAccounts::KDEDAccounts(QObject *parent, const QList<QVariant> &)
connect
(
KAccounts
::
accountsManager
(),
&
Accounts
::
Manager
::
accountCreated
,
this
,
&
KDEDAccounts
::
accountCreated
);
connect
(
KAccounts
::
accountsManager
(),
&
Accounts
::
Manager
::
accountRemoved
,
this
,
&
KDEDAccounts
::
accountRemoved
);
const
QVector
<
KPluginMetaData
>
data
=
KPlugin
Loader
::
findPlugins
(
QStringLiteral
(
"kaccounts/daemonplugins"
));
const
QVector
<
KPluginMetaData
>
data
=
KPlugin
MetaData
::
findPlugins
(
QStringLiteral
(
"kaccounts/daemonplugins"
));
for
(
const
KPluginMetaData
&
metadata
:
data
)
{
if
(
!
metadata
.
isValid
())
{
qDebug
()
<<
"Invalid metadata"
<<
metadata
.
name
();
continue
;
}
KPluginLoader
loader
(
metadata
.
fileName
());
KPluginFactory
*
factory
=
loader
.
factory
();
const
auto
result
=
KPluginFactory
::
instantiatePlugin
<
KAccountsDPlugin
>
(
metadata
,
this
,
{});
if
(
!
factory
)
{
qDebug
()
<<
"
KPluginFactory could not
load
the
plugin
:
"
<<
metadata
.
pluginId
()
<<
loader
.
errorString
()
;
if
(
!
result
)
{
qDebug
()
<<
"
Error
load
ing
plugin"
<<
metadata
.
name
()
<<
result
.
errorString
;
continue
;
}
KAccountsDPlugin
*
plugin
=
factory
->
create
<
KAccountsDPlugin
>
(
this
,
QVariantList
());
if
(
!
plugin
)
{
qDebug
()
<<
"Error loading plugin"
<<
metadata
.
name
()
<<
loader
.
errorString
();
continue
;
}
m_plugins
<<
plugin
;
m_plugins
<<
result
.
plugin
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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