Commit d60bf674 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from deprecated KPluginLoader

parent 9b8f3dbd
Pipeline #217974 passed with stage
in 57 seconds
......@@ -9,7 +9,8 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
project(kimagemapeditor VERSION ${RELEASE_SERVICE_VERSION})
set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.83.0")
set (KF5_MIN_VERSION "5.86.0")
set (KDE_COMPILERSETTINGS_LEVEL "5.83.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
......
......@@ -38,7 +38,6 @@
#include <KToolBar>
#include <KWindowConfig>
#include <KXMLGUIFactory>
#include <KPluginLoader>
#include <KPluginFactory>
#include <KPluginMetaData>
......@@ -70,14 +69,9 @@ KimeShell::KimeShell(const char * )
setupActions();
qCDebug(KIMAGEMAPEDITOR_LOG) << "KimeShell starting 2";
const auto plugins = KPluginLoader::findPlugins(QStringLiteral("kf5/parts"),
[](const KPluginMetaData& metaData) {
return metaData.pluginId() == QLatin1String("kimagemapeditorpart");
});
const auto result = KPluginFactory::instantiatePlugin<KParts::ReadWritePart>(KPluginMetaData(QStringLiteral("kf5/parts/kimagemapeditorpart")), this);
KPluginFactory *factory = plugins.isEmpty() ? nullptr : KPluginLoader(plugins.first().fileName()).factory();
if (!factory) {
if (!result) {
// can't do anything useful without part, thus quit the app
KMessageBox::error(this, i18n("Could not find kimagemapeditorpart part!"));
......@@ -87,10 +81,10 @@ KimeShell::KimeShell(const char * )
return;
}
m_part = factory->create<KParts::ReadWritePart>(this);
m_part = result.plugin;
m_editorInterface = qobject_cast<KImageMapEditorInterface*>(m_part);
if (!m_part || !m_editorInterface) {
if (!m_editorInterface) {
// can't do anything useful without part, thus quit the app
KMessageBox::error(this, i18n("Could not create kimagemapeditorpart part!"));
......
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