Commit 96cb6e6b authored by David Faure's avatar David Faure
Browse files

Port kfmclient from KRun to OpenUrlJob.

Tested (with firefox as BrowserApplication).
parent feabf56b
......@@ -32,7 +32,8 @@
#include <kmessagebox.h>
#include <kmimetypetrader.h>
#include <kservice.h>
#include <krun.h>
#include <KIO/OpenUrlJob>
#include <KIO/JobUiDelegate>
#include <KStartupInfo>
#include <kurifilter.h>
#include <KConfig>
......@@ -185,11 +186,19 @@ bool ClientApp::createNewWindow(const QUrl &url, bool newTab, bool tempFile, con
qDebug() << "Using external browser" << browserApp;
// TODO we don't handle tempFile here, but most likely the external browser doesn't support it,
// so we should sleep and delete it ourselves....
KRun *run = new KRun(url, nullptr, false /* no progress window */);
QObject::connect(run, &KRun::finished, this, &ClientApp::delayedQuit);
QObject::connect(run, &KRun::error, this, [](){ qApp->exit(1); });
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(url);
//job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, window));
QObject::connect(job, &KJob::result, this, [this](KJob *job) {
if (job->error()) {
} else {
return qApp->exec();
......@@ -212,7 +221,7 @@ bool ClientApp::openProfile(const QString &profileName, const QUrl &url, const Q
void ClientApp::delayedQuit()
// Quit in 2 seconds. This leaves time for KRun to pop up
// Quit in 2 seconds. This leaves time for OpenUrlJob to pop up
// "app not found" in KProcessRunner, if that was the case.
QTimer::singleShot(2000, qApp, SLOT(quit()));
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