Commit 3955ca70 authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg
Browse files

Port away from KPluginLoader (deprecated)

parent 96325215
Pipeline #169181 passed with stage
in 2 minutes and 12 seconds
......@@ -15,11 +15,15 @@
#include <QVBoxLayout>
// KDE
#include <KPluginFactory>
#include <KPluginLoader>
#include <KPtyDevice>
#include <KPtyProcess>
#include <qtest.h>
#include <kcoreaddons_version.h>
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0)
#include <KPluginLoader>
#endif
// Konsole
#include "../Pty.h"
......@@ -122,6 +126,15 @@ void PartTest::testFd(bool runShell)
KParts::Part *PartTest::createPart()
{
#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 86, 0)
const KPluginMetaData metaData(QStringLiteral("konsolepart"));
Q_ASSERT(metaData.isValid());
KPluginFactory::Result<KParts::Part> result = KPluginFactory::instantiatePlugin<KParts::Part>(metaData, this);
Q_ASSERT(result);
return result.plugin;
#else
auto konsolePartPlugin = KPluginLoader::findPlugin(QStringLiteral("konsolepart"));
if (konsolePartPlugin.isNull()) {
return nullptr;
......@@ -135,6 +148,7 @@ KParts::Part *PartTest::createPart()
auto *terminalPart = factory->create<KParts::Part>(this);
return terminalPart;
#endif
}
QTEST_MAIN(PartTest)
......@@ -17,7 +17,11 @@
// KDE
#include <KPluginFactory>
#include <kcoreaddons_version.h>
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0)
#include <KPluginLoader>
#endif
#include <qtest.h>
using namespace Konsole;
......@@ -220,6 +224,15 @@ void TerminalInterfaceTest::testTerminalInterfaceV2()
KParts::Part *TerminalInterfaceTest::createPart()
{
#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 86, 0)
const KPluginMetaData metaData(QStringLiteral("konsolepart"));
Q_ASSERT(metaData.isValid());
KPluginFactory::Result<KParts::Part> result = KPluginFactory::instantiatePlugin<KParts::Part>(metaData, this);
Q_ASSERT(result);
return result.plugin;
#else
auto konsolePartPlugin = KPluginLoader::findPlugin(QStringLiteral("konsolepart"));
if (konsolePartPlugin.isNull()) {
return nullptr;
......@@ -233,6 +246,7 @@ KParts::Part *TerminalInterfaceTest::createPart()
auto *terminalPart = factory->create<KParts::Part>(this);
return terminalPart;
#endif
}
QTEST_MAIN(TerminalInterfaceTest)
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