diff --git a/src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp b/src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp index 9072f338c..0e8032c4a 100644 --- a/src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp +++ b/src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp @@ -7,7 +7,12 @@ #include "EscapeSequenceUrlFilterHotSpot.h" +#include +#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) +#include +#else #include +#endif #include #include @@ -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(); } diff --git a/src/filterHotSpots/FileFilterHotspot.cpp b/src/filterHotSpots/FileFilterHotspot.cpp index 0ebca7953..25e7fed00 100644 --- a/src/filterHotSpots/FileFilterHotspot.cpp +++ b/src/filterHotSpots/FileFilterHotspot.cpp @@ -25,7 +25,12 @@ #include #include +#include +#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) +#include +#else #include +#endif #include #include #include @@ -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(); } diff --git a/src/session/SessionController.cpp b/src/session/SessionController.cpp index ad1487a6d..65f35d4cf 100644 --- a/src/session/SessionController.cpp +++ b/src/session/SessionController.cpp @@ -46,7 +46,12 @@ #include +#include +#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) +#include +#else #include +#endif #include #include @@ -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(); } }