Commit 9e099ffe authored by Nicolas Fella's avatar Nicolas Fella Committed by Albert Astals Cid
Browse files

Port away from KServiceTypeTrader

KServiceTypeTrader will be deprecated, use KPluginFactory to load the cddb KCM
parent 08de2191
......@@ -9,7 +9,8 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(k3b VERSION ${RELEASE_SERVICE_VERSION})
set (QT_MIN_VERSION "5.10.0")
set (KF5_MIN_VERSION "5.72.0")
set (KF5_MIN_VERSION "5.86.0")
set (KDE_COMPILERSETTINGS_LEVEL "5.84")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" "${ECM_MODULE_PATH}")
......
......@@ -14,7 +14,6 @@
#include <KCModuleProxy>
#include <KPluginInfo>
#include <KService>
#include <KServiceTypeTrader>
#include <KPluginLoader>
#include <KPluginMetaData>
#include <KMessageBox>
......
......@@ -8,8 +8,8 @@
#include <KCModule>
#include <KService>
#include <KServiceTypeTrader>
#include <KLocalizedString>
#include <KPluginFactory>
#include <QLabel>
#include <QHBoxLayout>
......@@ -22,20 +22,14 @@ K3b::CddbOptionTab::CddbOptionTab( QWidget* parent )
layout->setContentsMargins( 0, 0, 0, 0 );
m_cddbKcm = 0;
if ( KService::Ptr service = KService::serviceByStorageId( "libkcddb.desktop" ) )
m_cddbKcm = service->createInstance<KCModule>( this );
if (!m_cddbKcm) {
KService::List services = KServiceTypeTrader::self()->query( "KCModule", "[X-KDE-Library] == 'kcm_cddb'" );
if ( !services.isEmpty() ) {
m_cddbKcm = services.first()->createInstance<KCModule>( this );
}
}
if ( m_cddbKcm ) {
const auto result = KPluginFactory::instantiatePlugin<KCModule>(KPluginMetaData(QStringLiteral("kcm_cddb")), this);
if (result) {
m_cddbKcm = result.plugin;
m_cddbKcm->layout()->setContentsMargins( 0, 0, 0, 0 );
layout->addWidget( m_cddbKcm );
}
else {
} else {
QLabel* label = new QLabel( i18n( "Unable to load KCDDB configuration module." ), this );
label->setAlignment( Qt::AlignCenter );
layout->addWidget( label );
......
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