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
Utilities
Ark
Commits
0860f58f
Commit
0860f58f
authored
Nov 08, 2021
by
Alexander Lohnau
💬
Browse files
Port away from deprecated KPluginLoader
parent
6486baa8
Pipeline
#95781
passed with stage
in 2 minutes and 49 seconds
Changes
5
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
0860f58f
...
...
@@ -8,7 +8,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project
(
ark VERSION
${
RELEASE_SERVICE_VERSION
}
)
set
(
QT_MIN_VERSION 5.15.0
)
set
(
KF5_MIN_VERSION 5.8
2
.0
)
set
(
KF5_MIN_VERSION 5.8
6
.0
)
set
(
CMAKE_CXX_STANDARD 17
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
...
...
app/mainwindow.cpp
View file @
0860f58f
...
...
@@ -27,7 +27,6 @@
#include
<KSharedConfig>
#include
<KConfigDialog>
#include
<KXMLGUIFactory>
#include
<KPluginLoader>
#include
<KConfigSkeleton>
#include
<QApplication>
...
...
@@ -118,9 +117,7 @@ void MainWindow::dragMoveEvent(QDragMoveEvent * event)
bool
MainWindow
::
loadPart
()
{
KPluginFactory
*
factory
=
KPluginLoader
(
QStringLiteral
(
"kf5/parts/arkpart"
)).
factory
();
m_part
=
factory
?
static_cast
<
KParts
::
ReadWritePart
*>
(
factory
->
create
<
KParts
::
ReadWritePart
>
(
this
))
:
nullptr
;
m_part
=
KPluginFactory
::
instantiatePlugin
<
KParts
::
ReadWritePart
>
(
KPluginMetaData
(
QStringLiteral
(
"kf5/parts/arkpart"
))).
plugin
;
if
(
!
m_part
)
{
KMessageBox
::
error
(
this
,
i18n
(
"Unable to find Ark's KPart component, please check your installation."
));
...
...
autotests/kerfuffle/metadatatest.cpp
View file @
0860f58f
...
...
@@ -5,7 +5,6 @@
*/
#include
"kcoreaddons_version.h"
#include
<KPluginLoader>
#include
<KPluginMetaData>
#include
<QTest>
...
...
@@ -26,11 +25,7 @@ private:
void
MetaDataTest
::
initTestCase
()
{
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0)
m_plugins
=
KPluginLoader
::
findPlugins
(
QStringLiteral
(
"kerfuffle"
));
#else
m_plugins
=
KPluginMetaData
::
findPlugins
(
QStringLiteral
(
"kerfuffle"
));
#endif
}
// If a plugin has invalid JSON metadata (e.g. an extra comma somewhere)
...
...
kerfuffle/archive_kerfuffle.cpp
View file @
0860f58f
...
...
@@ -15,7 +15,6 @@
#include
"pluginmanager.h"
#include
<KPluginFactory>
#include
<KPluginLoader>
#include
<QMimeDatabase>
#include
<QRegularExpression>
...
...
@@ -60,15 +59,9 @@ Archive *Archive::create(const QString &fileName, Plugin *plugin, QObject *paren
qCDebug
(
ARK
)
<<
"Checking plugin"
<<
plugin
->
metaData
().
pluginId
();
KPluginFactory
*
factory
=
KPluginLoader
(
plugin
->
metaData
().
fileName
()).
factory
();
if
(
!
factory
)
{
qCWarning
(
ARK
)
<<
"Invalid plugin factory for"
<<
plugin
->
metaData
().
pluginId
();
return
new
Archive
(
FailedPlugin
,
parent
);
}
const
QVariantList
args
=
{
QVariant
(
QFileInfo
(
fileName
).
absoluteFilePath
()),
QVariant
().
fromValue
(
plugin
->
metaData
())};
ReadOnlyArchiveInterface
*
iface
=
factory
->
create
<
ReadOnlyArchiveInterface
>
(
nullptr
,
args
);
ReadOnlyArchiveInterface
*
iface
=
KPluginFactory
::
instantiatePlugin
<
ReadOnlyArchiveInterface
>
(
plugin
->
metaData
(),
nullptr
,
args
)
.
plugin
;
if
(
!
iface
)
{
qCWarning
(
ARK
)
<<
"Could not create plugin instance"
<<
plugin
->
metaData
().
pluginId
();
return
new
Archive
(
FailedPlugin
,
parent
);
...
...
kerfuffle/pluginmanager.cpp
View file @
0860f58f
...
...
@@ -9,7 +9,6 @@
#include
"settings.h"
#include
"kcoreaddons_version.h"
#include
<KPluginLoader>
#include
<KSharedConfig>
#include
<QFileInfo>
...
...
@@ -194,11 +193,7 @@ QVector<Plugin*> PluginManager::filterBy(const QVector<Plugin*> &plugins, const
void
PluginManager
::
loadPlugins
()
{
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0)
const
QVector
<
KPluginMetaData
>
plugins
=
KPluginLoader
::
findPlugins
(
QStringLiteral
(
"kerfuffle"
));
#else
const
QVector
<
KPluginMetaData
>
plugins
=
KPluginMetaData
::
findPlugins
(
QStringLiteral
(
"kerfuffle"
));
#endif
QSet
<
QString
>
addedPlugins
;
for
(
const
KPluginMetaData
&
metaData
:
plugins
)
{
const
auto
pluginId
=
metaData
.
pluginId
();
...
...
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