From 40cc5f665d420071ba6e212c6191c2151f89a065 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Tue, 11 Oct 2022 08:46:12 +0200 Subject: [PATCH] port to KIO::createDefaultJobUiDelegate --- src/dolphinmainwindow.cpp | 9 +++++++++ src/dolphinviewcontainer.cpp | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 496dad6c0..1eed9a016 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -42,7 +42,12 @@ #include #include #include +#include +#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) +#include +#else #include +#endif #include #include #include @@ -1241,7 +1246,11 @@ void DolphinMainWindow::handleUrl(const QUrl& url) activeViewContainer()->setUrl(url); } else { m_lastHandleUrlOpenJob = new KIO::OpenUrlJob(url); +#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) + m_lastHandleUrlOpenJob->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); +#else m_lastHandleUrlOpenJob->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); +#endif m_lastHandleUrlOpenJob->setShowOpenOrExecuteDialog(true); connect(m_lastHandleUrlOpenJob, &KIO::OpenUrlJob::mimeTypeFound, this, diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 66c1de3a9..1930226d8 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -24,7 +24,12 @@ #endif #include #include +#include +#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) +#include +#else #include +#endif #include #include #include @@ -758,7 +763,11 @@ void DolphinViewContainer::slotItemActivated(const KFileItem &item) } KIO::OpenUrlJob *job = new KIO::OpenUrlJob(item.targetUrl(), item.mimetype()); - job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoWarningHandlingEnabled, this)); +#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->setShowOpenOrExecuteDialog(true); connect(job, &KIO::OpenUrlJob::finished, this, &DolphinViewContainer::slotOpenUrlFinished); job->start();