Commit b5982a42 authored by David Faure's avatar David Faure
Browse files

Port from KRun::displayOpenWithDialog to OpenUrlJob

parent ec608524
......@@ -9,7 +9,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(Konqueror)
set(QT_MIN_VERSION "5.9.0")
set(KF5_MIN_VERSION "5.70.0")
set(KF5_MIN_VERSION "5.71.0")
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
......
......@@ -75,6 +75,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <KIO/ApplicationLauncherJob>
#include <KIO/OpenUrlJob>
#include <QDesktopServices>
#include <QFile>
......@@ -675,21 +676,19 @@ void KonqMainWindow::openUrl(KonqView *_view, const QUrl &_url,
if (associatedAppIsKonqueror && refuseExecutingKonqueror(mimeType)) {
return;
}
QList<QUrl> lst;
lst.append(url);
//qCDebug(KONQUEROR_LOG) << "Got offer" << (offer ? offer->name() : QString("0"));
const bool allowExecution = trustedSource || KParts::BrowserRun::allowExecution(mimeType, url);
if (allowExecution) {
const bool isExecutable = KonqRun::isExecutable(mimeType);
// Open with no offer means the user clicked on "Open With..." button.
if (!offer && !isExecutable) {
(void) KRun::displayOpenWithDialog(lst, this);
} else if (isExecutable) {
if (isExecutable) {
setLocationBarURL(oldLocationBarURL); // Revert to previous locationbar URL
(void)new KRun(url, this);
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
} else {
// If offer is null, it means the user clicked on "Open With..." button.
KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(offer);
job->setUrls(lst);
job->setUrls({url});
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
}
......
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