diff --git a/src/gui/applicationlauncherjob.h b/src/gui/applicationlauncherjob.h --- a/src/gui/applicationlauncherjob.h +++ b/src/gui/applicationlauncherjob.h @@ -61,11 +61,10 @@ /** * @brief Creates a ApplicationLauncherJob - * @param service the service (application desktop file) to run - * @param serviceAction the service action within the service to run + * @param serviceAction the service action to run * @param parent the parent QObject */ - explicit ApplicationLauncherJob(const KService::Ptr &service, const KServiceAction &serviceAction, QObject *parent = nullptr); + explicit ApplicationLauncherJob(const KServiceAction &serviceAction, QObject *parent = nullptr); /** * Destructor. diff --git a/src/gui/applicationlauncherjob.cpp b/src/gui/applicationlauncherjob.cpp --- a/src/gui/applicationlauncherjob.cpp +++ b/src/gui/applicationlauncherjob.cpp @@ -50,8 +50,8 @@ { } -KIO::ApplicationLauncherJob::ApplicationLauncherJob(const KService::Ptr &service, const KServiceAction &serviceAction, QObject *parent) - : ApplicationLauncherJob(service, parent) +KIO::ApplicationLauncherJob::ApplicationLauncherJob(const KServiceAction &serviceAction, QObject *parent) + : ApplicationLauncherJob(serviceAction.service(), parent) { Q_ASSERT(d->m_service); d->m_service.detach(); diff --git a/src/widgets/kdesktopfileactions.cpp b/src/widgets/kdesktopfileactions.cpp --- a/src/widgets/kdesktopfileactions.cpp +++ b/src/widgets/kdesktopfileactions.cpp @@ -23,10 +23,12 @@ #include "../core/config-kmountpoint.h" // for HAVE_VOLMGT (yes I cheat a bit) #include "kio_widgets_debug.h" +#include #include "krun.h" #include "kautomount.h" #include #include +#include #include #include @@ -386,10 +388,16 @@ } #endif } else { - //qDebug() << action.name() << "first url's path=" << urls.first().toLocalFile() << "exec=" << action.exec(); - KRun::run(action.exec(), urls, nullptr, action.text(), action.icon()); - // The action may update the desktop file. Example: eject unmounts (#5129). - org::kde::KDirNotify::emitFilesChanged(urls); + KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(action); + job->setUrls(urls); + QObject::connect(job, &KJob::result, qApp, [urls]() { + // The action may update the desktop file. Example: eject unmounts (#5129). + org::kde::KDirNotify::emitFilesChanged(urls); + }); + auto *delegate = new KDialogJobUiDelegate; + delegate->setAutoErrorHandlingEnabled(true); + job->setUiDelegate(delegate); + job->start(); } }