Commit 15d403b1 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from deprecated KPluginLoader

parent 32f75bb3
Pipeline #170961 passed with stage
in 3 minutes and 8 seconds
......@@ -10,9 +10,10 @@ set (RELEASE_SERVICE_COMPACT_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}${RELEASE_
project(kmplot VERSION "1.3.${RELEASE_SERVICE_COMPACT_VERSION}")
set (QT_MIN_VERSION "5.6.0")
set (KF5_MIN_VERSION "5.69.0")
set (KF5_MIN_VERSION "5.86.0")
set (KDE_COMPILERSETTINGS_LEVEL "5.82.0")
find_package (ECM 1.3.0 REQUIRED NO_MODULE)
find_package (ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} )
include(CheckIncludeFiles)
......
......@@ -24,7 +24,7 @@
#include <KIO/CommandLauncherJob>
#include <KLocalizedString>
#include <KMessageBox>
#include <KPluginLoader>
#include <KPluginFactory>
#include <KShortcutsDialog>
#include <KStandardAction>
#include <KToggleFullScreenAction>
......@@ -61,19 +61,15 @@ KmPlot::KmPlot(const QCommandLineParser &parser)
// this routine will find and load our Part. it finds the Part by
// name which is a bad idea usually.. but it's alright in this
// case since our Part is made for this Shell
KPluginFactory *factory = KPluginLoader(QStringLiteral("kf5/parts/kmplotpart")).factory();
if (factory) {
// ask the factory to create an instance of the part
// our hands on it
m_part = factory->create<KParts::ReadWritePart>(this);
if (m_part) {
// tell the KParts::MainWindow that this is indeed the main widget
setCentralWidget(m_part->widget());
// m_part->widget()->setFocus();
// and integrate the part's GUI with the shell's
setupGUI(Keys | ToolBar | Save);
createGUI(m_part);
}
const auto result = KPluginFactory::instantiatePlugin<KParts::ReadWritePart>(KPluginMetaData(QStringLiteral("kf5/parts/kmplotpart")), this);
if (result) {
m_part = result.plugin;
// tell the KParts::MainWindow that this is indeed the main widget
setCentralWidget(m_part->widget());
// m_part->widget()->setFocus();
// and integrate the part's GUI with the shell's
setupGUI(Keys | ToolBar | Save);
createGUI(m_part);
} else {
// if we couldn't find our Part, we exit since the Shell by
// itself can't do anything useful
......
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