Commit 35b9b87e authored by Laurent Montel's avatar Laurent Montel
Browse files

Port away from deprecated KIO code

parent 23da6bb6
Pipeline #220605 passed with stage
in 39 seconds
......@@ -22,7 +22,12 @@
#include <KIO/ApplicationLauncherJob>
#include <KIO/OpenUrlJob>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <QDir>
#include <QPixmap>
......@@ -720,7 +725,11 @@ void Selector::open()
auto *job = new KIO::OpenUrlJob(sourceUrl, window());
job->setRunExecutables(false);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#endif
job->start();
}
......@@ -741,7 +750,11 @@ void Selector::openWith(QAction *action)
{
KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob();
job->setUrls(QList<QUrl>() << sourceUrl);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#endif
job->start();
return;
}
......@@ -749,7 +762,11 @@ void Selector::openWith(QAction *action)
if ( name == QLatin1String("-") ) // File Manager
{
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(sourceUrl.adjusted(QUrl::RemoveFilename), QStringLiteral("inode/directory"));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#endif
job->start();
return;
......@@ -758,7 +775,11 @@ void Selector::openWith(QAction *action)
KService::Ptr service = serviceForName[name];
KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service);
job->setUrls(QList<QUrl>() << sourceUrl);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
#endif
job->start();
}
......
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