Commit 7e61ba62 authored by David Faure's avatar David Faure
Browse files

Port KRun::runUrl to KIO::OpenUrlJob

Summary: Uploading so as not to lose it, but it has to wait for KF 5.71

Test Plan: Builds

Differential Revision: https://phabricator.kde.org/D29598
parent c6bb4cf9
......@@ -42,6 +42,8 @@
#include <KIO/EmptyTrashJob>
#include <KIO/JobUiDelegate>
#include <KIO/RestoreJob>
#include <KIO/CommandLauncherJob>
#include <KIO/OpenUrlJob>
#include <KFileCopyToMenu>
#include <KJobWidgets>
#include <KJobUiDelegate>
......@@ -503,7 +505,9 @@ void KonqPopupMenuPrivate::slotPopupEmptyTrashBin()
void KonqPopupMenuPrivate::slotConfigTrashBin()
{
KRun::run(QStringLiteral("kcmshell5 kcmtrash"), QList<QUrl>(), m_parentWidget);
KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5 kcmtrash"));
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, m_parentWidget));
job->start();
}
void KonqPopupMenuPrivate::slotPopupRestoreTrashedItems()
......@@ -556,5 +560,8 @@ void KonqPopupMenuPrivate::slotShowOriginalFile()
// Now destUrl points to the target file, let's go up to parent dir
destUrl = destUrl.adjusted(QUrl::RemoveFilename);
KRun::runUrl(destUrl, QStringLiteral("inode/directory"), m_parentWidget, KRun::RunFlags());
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(destUrl, QStringLiteral("inode/directory"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, m_parentWidget));
job->start();
}
......@@ -33,7 +33,6 @@
#include <KConfigGroup>
#include <KToolInvocation>
#include <KSharedConfig>
#include <KRun>
#include <KProtocolInfo>
#include <QInputDialog>
#include <KLocalizedString>
......@@ -41,6 +40,8 @@
#include <KUriFilter>
#include <Sonnet/Dialog>
#include <sonnet/backgroundchecker.h>
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#include <QBuffer>
#include <QVariant>
......@@ -540,7 +541,9 @@ void WebEngineBrowserExtension::slotViewDocumentSource()
const QUrl pageUrl (view()->url());
if (pageUrl.isLocalFile()) {
KRun::runUrl(pageUrl, QL1S("text/plain"), view(), KRun::RunFlags());
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(pageUrl, QL1S("text/plain"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, view()));
job->start();
} else {
view()->page()->toHtml([this](const QString& html) {
QTemporaryFile tempFile;
......@@ -548,7 +551,11 @@ void WebEngineBrowserExtension::slotViewDocumentSource()
tempFile.setAutoRemove(false);
if (tempFile.open()) {
tempFile.write(html.toUtf8());
KRun::runUrl(QUrl::fromLocalFile(tempFile.fileName()), QL1S("text/plain"), view(), KRun::RunFlags(KRun::DeleteTemporaryFiles));
tempFile.close();
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(tempFile.fileName()), QL1S("text/plain"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, view()));
job->setDeleteTemporaryFile(true);
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