Commit 5b7b119b authored by Nicolas Fella's avatar Nicolas Fella Committed by Friedrich W. H. Kossebau
Browse files

Port some occurence of KMimeTypeTrader

It is about to be deprecated.

GIT_SILENT
parent fbdbf1c0
Pipeline #30776 passed with stage
in 50 minutes and 46 seconds
......@@ -28,10 +28,14 @@
#include <QVariantList>
#include <kio_version.h>
#include <kservice_version.h>
#include <KSharedConfig>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KMessageBox>
#if KSERVICE_VERSION >= QT_VERSION_CHECK(5, 68, 0)
#include <KApplicationTrader>
#endif
#include <KMimeTypeTrader>
#include <KParts/MainWindow>
#include <KPluginFactory>
......@@ -85,7 +89,11 @@ bool canOpenDefault(const QString& mimeType)
{
if (defaultForMimeType(mimeType).isEmpty() && mimeType == QLatin1String("inode/directory")) {
// potentially happens in non-kde environments apparently, see https://git.reviewboard.kde.org/r/122373
#if KSERVICE_VERSION >= QT_VERSION_CHECK(5, 68, 0)
return KApplicationTrader::preferredService(mimeType);
#else
return KMimeTypeTrader::self()->preferredService(mimeType);
#endif
} else {
return true;
}
......@@ -230,7 +238,11 @@ void OpenWithPlugin::openDefault()
// default handlers
if (m_mimeType == QLatin1String("inode/directory")) {
#if KSERVICE_VERSION >= QT_VERSION_CHECK(5, 68, 0)
KService::Ptr service = KApplicationTrader::preferredService(m_mimeType);
#else
KService::Ptr service = KMimeTypeTrader::self()->preferredService(m_mimeType);
#endif
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
auto* job = new KIO::ApplicationLauncherJob(service);
job->setUrls(m_urls);
......
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