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
wilder-5.26
Nate Graham 4 years ago
parent 2b8dc98749
commit 1a8b6ba787
  1. 5
      applets/kicker/plugin/fileentry.cpp
  2. 5
      applets/kicker/plugin/recentusagemodel.cpp
  3. 5
      runners/baloo/baloosearchrunner.cpp
  4. 6
      runners/recentdocuments/recentdocuments.cpp

@ -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();
}

Loading…
Cancel
Save