Commit ee01acaa authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to KIO::OpenUrlJob

parent 18c720e0
Pipeline #20862 passed with stage
in 6 minutes and 57 seconds
......@@ -24,6 +24,11 @@
#include <QVBoxLayout>
#include <viewerplugintoolmanager.h>
#include <KRun>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#endif
#include <KPIMTextEdit/kpimtextedit/texttospeechwidget.h>
......@@ -183,9 +188,17 @@ void ArticleViewerWebEngineWidgetNg::slotOpenInBrowser()
connect(job, &WebEngineViewer::WebEngineExportHtmlPageJob::success, this, &ArticleViewerWebEngineWidgetNg::slotExportHtmlPageSuccess);
job->start();
} else {
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
KRun::RunFlags flags;
flags |= KRun::RunExecutables;
KRun::runUrl(currentUrl, QStringLiteral("text/html"), this, flags);
#else
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(currentUrl, QStringLiteral("text/html"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setDeleteTemporaryFile(true);
job->setRunExecutables(true);
job->start();
#endif
}
}
......
......@@ -36,6 +36,11 @@
#include <webengine/webengineframe.h>
#include <QStringList>
#include <QDesktopServices>
#include <kio_version.h>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#endif
using namespace Akregator;
......@@ -240,8 +245,13 @@ void FrameManager::openInExternalBrowser(const OpenUrlRequest &request)
if (request.args().mimeType().isEmpty()) {
QDesktopServices::openUrl(url);
} else {
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
KRun::RunFlags flag = {};
KRun::runUrl(url, request.args().mimeType(), nullptr /*window*/, flag);
#else
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url, request.args().mimeType());
job->start();
#endif
}
}
......
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