Commit 1a8b6ba7 authored by Nate Graham's avatar Nate Graham
Browse files

Show "open or execute?" dialog when opening executable files

Those files may be executable and the user wants them to execute. For
example:
- Shell scripts the user has written to perform commonly-used actions
- Windows executables opened with WINE

For this reason, we should stop explicitly blocking running executable
files when accessed with KRunner runners or Kicker/Kickoff/Application
Dashboard, and instead show the typical "open or execute?" dialog that
respects the user's setting for what to do in this case.

BUG: 455924
FIXED-IN: 5.26
parent 2b8dc987
Pipeline #220389 passed with stage
in 6 minutes and 10 seconds
......@@ -7,7 +7,10 @@
#include "fileentry.h"
#include "actionlist.h"
#include <QApplication>
#include <KFileItem>
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#include <KIO/StatJob>
......@@ -105,6 +108,8 @@ bool FileEntry::run(const QString &actionId, const QVariant &argument)
if (actionId.isEmpty()) {
auto job = new KIO::OpenUrlJob(m_fileItem->url());
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->setShowOpenOrExecuteDialog(true);
job->start();
return true;
......
......@@ -14,6 +14,7 @@
#include <config-X11.h>
#include <QApplication>
#include <QDir>
#include <QIcon>
#include <QMimeDatabase>
......@@ -30,6 +31,7 @@
#include <KActivities/ResourceInstance>
#include <KFileItem>
#include <KIO/ApplicationLauncherJob>
#include <KIO/JobUiDelegate>
#include <KIO/OpenFileManagerWindowJob>
#include <KIO/OpenUrlJob>
#include <KLocalizedString>
......@@ -365,7 +367,8 @@ bool RecentUsageModel::trigger(int row, const QString &actionId, const QVariant
const QUrl resourceUrl = docData(resource, Kicker::UrlRole, mimeType).toUrl();
auto job = new KIO::OpenUrlJob(resourceUrl);
job->setRunExecutables(false);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->setShowOpenOrExecuteDialog(true);
job->start();
return true;
......
......@@ -20,6 +20,7 @@
#include <Baloo/IndexerConfig>
#include <Baloo/Query>
#include <KIO/JobUiDelegate>
#include <KIO/OpenFileManagerWindowJob>
#include <KIO/OpenUrlJob>
#include <KNotificationJobUiDelegate>
......@@ -158,7 +159,7 @@ void SearchRunner::Run(const QString &id, const QString &actionId)
}
auto *job = new KIO::OpenUrlJob(url);
job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoErrorHandlingEnabled));
job->setRunExecutables(false);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->setShowOpenOrExecuteDialog(true);
job->start();
}
......@@ -6,10 +6,12 @@
#include "recentdocuments.h"
#include <QApplication>
#include <QDir>
#include <QMimeData>
#include <KIO/Job>
#include <KIO/JobUiDelegate>
#include <KIO/OpenFileManagerWindowJob>
#include <KIO/OpenUrlJob>
#include <KLocalizedString>
......@@ -108,8 +110,8 @@ void RecentDocuments::run(const Plasma::RunnerContext &context, const Plasma::Qu
}
auto *job = new KIO::OpenUrlJob(url);
job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoErrorHandlingEnabled));
job->setRunExecutables(false);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->setShowOpenOrExecuteDialog(true);
job->start();
}
......
Supports Markdown
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