Commit 5a615041 authored by Nicolas Fella's avatar Nicolas Fella Committed by Albert Astals Cid
Browse files

Port away from deprecated plugin things

parent 2fcc61d5
Pipeline #113681 passed with stage
in 55 seconds
......@@ -9,7 +9,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(krdc VERSION ${RELEASE_SERVICE_VERSION})
set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.85.0")
set (KF5_MIN_VERSION "5.89.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
......
......@@ -11,9 +11,8 @@
#include <KConfigSkeleton>
#include <KLocalizedString>
#include <KPluginSelector>
#include <KPluginWidget>
#include <KPluginMetaData>
#include <KPluginInfo>
PreferencesDialog::PreferencesDialog(QWidget *parent, KConfigSkeleton *skeleton)
: KConfigDialog(parent, QStringLiteral("preferences"), skeleton)
......@@ -29,11 +28,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, KConfigSkeleton *skeleton)
skeleton->config()->group("hostpreferences"));
addPage(hostPreferencesList, i18n("Hosts"), QStringLiteral("computer"), i18n("Host Configuration"));
m_pluginSelector = new KPluginSelector();
const QList<KPluginInfo> offers = KPluginInfo::fromMetaData(KPluginLoader::findPlugins(QStringLiteral("krdc")));
m_pluginSelector->addPlugins(offers, KPluginSelector::ReadConfigFile,
i18n("Plugins"), QStringLiteral("Service"), KSharedConfig::openConfig());
m_pluginSelector->load();
m_pluginSelector = new KPluginWidget();
const QVector<KPluginMetaData> offers = KPluginMetaData::findPlugins(QStringLiteral("krdc"));
m_pluginSelector->setConfig(KSharedConfig::openConfig()->group(QStringLiteral("Plugins")));
m_pluginSelector->addPlugins(offers, i18n("Plugins"));
addPage(m_pluginSelector, i18n("Plugins"), QStringLiteral("preferences-plugin"), i18n("Plugin Configuration"));
connect(this, SIGNAL(accepted()), SLOT(saveState()));
......
......@@ -12,7 +12,7 @@
#include <QDialogButtonBox>
class KConfigSkeleton;
class KPluginSelector;
class KPluginWidget;
class PreferencesDialog : public KConfigDialog
{
......@@ -30,7 +30,7 @@ private Q_SLOTS:
void settingsChanged();
private:
KPluginSelector *m_pluginSelector;
KPluginWidget *m_pluginSelector;
bool m_settingsChanged;
void enableButton(QDialogButtonBox::StandardButton standardButton);
};
......
......@@ -193,26 +193,17 @@ void MainWindow::setupActions()
void MainWindow::loadAllPlugins()
{
const QVector<KPluginMetaData> offers = KPluginLoader::findPlugins(QStringLiteral("krdc"));
const QVector<KPluginMetaData> offers = KPluginMetaData::findPlugins(QStringLiteral("krdc"));
const KConfigGroup conf = KSharedConfig::openConfig()->group(QStringLiteral("Plugins"));
for (const KPluginMetaData &plugin : offers) {
KPluginInfo pluginInfo = KPluginInfo::fromMetaData(plugin);
pluginInfo.load(conf);
const bool enabled = pluginInfo.isPluginEnabled();
const bool enabled = plugin.isEnabled(conf);
if (enabled) {
RemoteViewFactory *component = nullptr;
KPluginLoader loader(plugin.fileName());
KPluginFactory *factory = loader.factory();
if (factory) {
component = factory->create<RemoteViewFactory>();
}
const auto result = KPluginFactory::instantiatePlugin<RemoteViewFactory>(plugin);
if (component) {
if (result) {
RemoteViewFactory *component = result.plugin;
const int sorting = plugin.value(QStringLiteral("X-KDE-KRDC-Sorting")).toInt();
m_remoteViewFactories.insert(sorting, component);
}
......
......@@ -13,7 +13,6 @@
#include "remoteviewfactory.h"
#include <KXmlGuiWindow>
#include <KPluginInfo>
class KComboBox;
class KLineEdit;
......
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