Commit 25f5492f authored by Alexey Min's avatar Alexey Min Committed by Albert Astals Cid
Browse files

Port away from deprecated methods

Fixes thigs like:
warning: ‘static QVector<KPluginMetaData> KPluginLoader::findPlugins(
  const QString&, std::function<bool(const KPluginMetaData&)>)’
  is deprecated: Since 5.86.
  Use KPluginMetaData::findPlugins instead [-Wdeprecated-declarations]
parent 96eb21da
Pipeline #122105 passed with stage
in 53 seconds
......@@ -9,7 +9,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(krfb VERSION ${RELEASE_SERVICE_VERSION})
set(QT_MIN_VERSION 5.15.0)
set(KF5_MIN_VERSION 5.85.0)
set(KF5_MIN_VERSION 5.86.0)
find_package(ECM ${KF5_MIN_VERSION} NO_MODULE REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${ECM_MODULE_PATH})
......
......@@ -28,7 +28,6 @@
#include <QGlobalStatic>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KPluginMetaData>
#include <QtCore/QSharedPointer>
......@@ -70,22 +69,15 @@ void EventsManager::loadPlugins()
i.toBack();
QSet<QString> unique;
while (i.hasPrevious()) {
KPluginMetaData data = i.previous();
KPluginMetaData data = i.previous();
// only load plugins once, even if found multiple times!
if (unique.contains(data.name()))
if (unique.contains(data.name())) {
continue;
KPluginFactory *factory = KPluginLoader(data.fileName()).factory();
if (!factory) {
qCDebug(KRFB) << "KPluginFactory could not load the plugin:" << data.fileName();
continue;
} else {
qCDebug(KRFB) << "found plugin at " << data.fileName();
}
auto plugin = factory->create<EventsPlugin>(this);
if (plugin) {
m_plugins.insert(data.pluginId(), plugin);
const KPluginFactory::Result<EventsPlugin> result = KPluginFactory::instantiatePlugin<EventsPlugin>(data);
if (result.plugin) {
m_plugins.insert(data.pluginId(), result.plugin);
qCDebug(KRFB) << "Loaded plugin with name " << data.pluginId();
} else {
qCDebug(KRFB) << "unable to load plugin for " << data.fileName();
......
......@@ -27,7 +27,6 @@
#include <QGlobalStatic>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KPluginMetaData>
#include <QSharedPointer>
......@@ -61,9 +60,7 @@ FrameBufferManager *FrameBufferManager::instance()
void FrameBufferManager::loadPlugins()
{
//qDebug();
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb/framebuffer"));
const QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("krfb/framebuffer"));
QVectorIterator<KPluginMetaData> i(plugins);
i.toBack();
......@@ -73,18 +70,10 @@ void FrameBufferManager::loadPlugins()
// only load plugins once, even if found multiple times!
if (unique.contains(data.name()))
continue;
KPluginFactory *factory = KPluginLoader(data.fileName()).factory();
if (!factory) {
qCDebug(KRFB) << "KPluginFactory could not load the plugin:" << data.fileName();
continue;
} else {
qCDebug(KRFB) << "found plugin at " << data.fileName();
}
auto plugin = factory->create<FrameBufferPlugin>(this);
if (plugin) {
m_plugins.insert(data.pluginId(), plugin);
const KPluginFactory::Result<FrameBufferPlugin> result = KPluginFactory::instantiatePlugin<FrameBufferPlugin>(data);
if (result.plugin) {
m_plugins.insert(data.pluginId(), result.plugin);
qCDebug(KRFB) << "Loaded plugin with name " << data.pluginId();
} else {
qCDebug(KRFB) << "unable to load plugin for " << data.fileName();
......
......@@ -22,7 +22,6 @@
#include <KStandardAction>
#include <KActionCollection>
#include <KNewPasswordDialog>
#include <KPluginLoader>
#include <KPluginMetaData>
#include <QIcon>
......@@ -83,7 +82,7 @@ public:
}
void fillFrameBuffersCombo() {
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("krfb/framebuffer"));
const QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("krfb/framebuffer"));
QSet<QString> unique;
QVectorIterator<KPluginMetaData> i(plugins);
i.toBack();
......
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