Commit ce960b80 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to new KPluginFactory::instantiatePlugin

parent dd54f9c4
Pipeline #75666 passed with stage
in 9 minutes and 31 seconds
......@@ -93,7 +93,7 @@ set_package_properties(KUserFeedback PROPERTIES DESCRIPTION "User Feedback lib"
include_directories(${akregator_SOURCE_DIR} ${akregator_BINARY_DIR})
add_definitions(-DTRANSLATION_DOMAIN=\"akregator\")
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055600)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055500)
if (TARGET KUserFeedbackWidgets)
add_definitions(-DWITH_KUSERFEEDBACK)
endif()
......
......@@ -7,12 +7,12 @@
*
*/
#include "feedstorage.h"
#include "kcoreaddons_version.h"
#include "plugin.h"
#include "storage.h"
#include "storagefactory.h"
#include "storagefactoryregistry.h"
#include <KLocalizedString>
#include <Syndication/Atom/Atom>
#include <Syndication/Constants>
......
......@@ -23,6 +23,7 @@
#include "feedlist.h"
#include "fetchqueue.h"
#include "framemanager.h"
#include "kcoreaddons_version.h"
#include "kernel.h"
#include "loadfeedlistcommand.h"
#include "mainwidget.h"
......@@ -609,8 +610,11 @@ void Part::showOptions()
if (TrayIcon::getInstance()) {
connect(m_dialog, qOverload<>(&KCMultiDialog::configCommitted), TrayIcon::getInstance(), &TrayIcon::settingsChanged);
}
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0)
const QVector<KPluginMetaData> availablePlugins = KPluginLoader::findPlugins(QStringLiteral("pim/kcms/akregator"));
#else
const QVector<KPluginMetaData> availablePlugins = KPluginMetaData::findPlugins(QStringLiteral("pim/kcms/akregator"));
#endif
for (const KPluginMetaData &metaData : availablePlugins) {
m_dialog->addModule(metaData);
}
......
......@@ -9,8 +9,8 @@
#include "mainwindow.h"
#include "akregator_part.h"
#include "akregatorconfig.h"
#include "kcoreaddons_version.h"
#include "trayicon.h"
#include <Libkdepim/ProgressStatusBarWidget>
#include <Libkdepim/StatusbarProgressWidget>
#include <PimCommon/BroadcastStatus>
......@@ -22,6 +22,7 @@
#include <KMessageBox>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KPluginMetaData>
#include <KSharedConfig>
#include <KShortcutsDialog>
#include <KSqueezedTextLabel>
......@@ -96,6 +97,7 @@ bool MainWindow::loadPart()
// 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
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0)
KPluginLoader loader(QStringLiteral("akregatorpart"));
KPluginFactory *const factory = loader.factory();
if (!factory) {
......@@ -108,6 +110,16 @@ bool MainWindow::loadPart()
if (!m_part) {
return false;
}
#else
const KPluginMetaData md(QStringLiteral("akregatorpart"));
const auto result = KPluginFactory::instantiatePlugin<KParts::Part>(md, this);
if (result) {
m_part = static_cast<Akregator::Part *>(result.plugin);
} else {
KMessageBox::error(this, i18n("Could not find the Akregator part; please check your installation.\n%1", result.errorString));
return false;
}
#endif
m_part->setObjectName(QStringLiteral("akregator_part"));
setCentralWidget(m_part->widget());
......
Markdown is supported
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