Commit fc45802b authored by Laurent Montel's avatar Laurent Montel
Browse files

Port away from deprecated KIO code

parent aa320d81
Pipeline #220956 passed with stage
in 2 minutes and 22 seconds
......@@ -7,7 +7,12 @@
#include "EscapeSequenceUrlFilterHotSpot.h"
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <KIO/OpenUrlJob>
#include <QApplication>
......@@ -31,6 +36,10 @@ void EscapeSequenceUrlHotSpot::activate(QObject *obj)
Q_UNUSED(obj)
auto *job = new KIO::OpenUrlJob(QUrl(_url));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#endif
job->start();
}
......@@ -25,7 +25,12 @@
#include <KIO/OpenUrlJob>
#include <KFileItemListProperties>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <KLocalizedString>
#include <KMessageBox>
#include <KShell>
......@@ -127,7 +132,11 @@ void FileFilterHotSpot::activate(QObject *)
void FileFilterHotSpot::openWithSysDefaultApp(const QString &filePath) const
{
auto *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(filePath));
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#endif
job->setRunExecutables(false); // Always open scripts, shell/python/perl... etc, as text
job->start();
}
......
......@@ -46,7 +46,12 @@
#include <KIO/CommandLauncherJob>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
#include <KIO/JobUiDelegateFactory>
#else
#include <KIO/JobUiDelegate>
#endif
#include <KIO/OpenFileManagerWindowJob>
#include <KIO/OpenUrlJob>
......@@ -552,7 +557,11 @@ void SessionController::handleWebShortcutAction(QAction *action)
const QUrl url = filterData.uri();
auto *job = new KIO::OpenUrlJob(url);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#endif
job->start();
}
}
......@@ -1159,7 +1168,11 @@ void SessionController::openBrowser()
} else {
const QUrl currentUrl = url().isLocalFile() ? url() : QUrl::fromLocalFile(QDir::homePath());
auto *job = new KIO::OpenUrlJob(currentUrl);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#else
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
#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