KService::Ptr m_service;
QString m_serviceEntryPath;
QList<QUrl> m_urls;
+ QString m_actionName;
KIO::ApplicationLauncherJob::RunFlags m_runFlags;
QString m_suggestedFileName;
QString m_mimeTypeName;
Q_ASSERT(d->m_service);
d->m_service.detach();
d->m_service->setExec(serviceAction.exec());
+ d->m_actionName = serviceAction.name();
}
KIO::ApplicationLauncherJob::ApplicationLauncherJob(const KDesktopFileAction &desktopFileAction, QObject *parent)
: ApplicationLauncherJob(KService::Ptr(new KService(desktopFileAction.desktopFilePath())), parent)
Q_ASSERT(d->m_service);
d->m_service.detach();
d->m_service->setExec(desktopFileAction.exec());
+ d->m_actionName = desktopFileAction.name();
}
KIO::ApplicationLauncherJob::ApplicationLauncherJob(QObject *parent)
d->m_processRunners.reserve(d->m_numProcessesPending);
for (int i = 1; i < d->m_urls.count(); ++i) {
auto *processRunner =
- KProcessRunner::fromApplication(d->m_service, d->m_serviceEntryPath, {d->m_urls.at(i)}, d->m_runFlags, d->m_suggestedFileName, QByteArray{});
+ KProcessRunner::fromApplication(d->m_service, d->m_serviceEntryPath, {d->m_urls.at(i)}, d->m_actionName, d->m_runFlags, d->m_suggestedFileName, QByteArray{});
d->m_processRunners.push_back(processRunner);
connect(processRunner, &KProcessRunner::processStarted, this, [this](qint64 pid) {
d->slotStarted(pid);
}
auto *processRunner =
- KProcessRunner::fromApplication(d->m_service, d->m_serviceEntryPath, d->m_urls, d->m_runFlags, d->m_suggestedFileName, d->m_startupId);
+ KProcessRunner::fromApplication(d->m_service, d->m_serviceEntryPath, d->m_urls, d->m_actionName, d->m_runFlags, d->m_suggestedFileName, d->m_startupId);
d->m_processRunners.push_back(processRunner);
connect(processRunner, &KProcessRunner::error, this, [this](const QString &errorText) {
setError(KJob::UserDefinedError);
KProcessRunner *KProcessRunner::fromApplication(const KService::Ptr &service,
const QString &serviceEntryPath,
const QList<QUrl> &urls,
+ const QString &actionName,
KIO::ApplicationLauncherJob::RunFlags flags,
const QString &suggestedFileName,
const QByteArray &asn)
const bool notYetSupportedOpenActivationNeeded = !urls.isEmpty();
if (!notYetSupportedOpenActivationNeeded && DBusActivationRunner::activationPossible(service, flags, suggestedFileName)) {
const auto actions = service->actions();
- auto action = std::find_if(actions.cbegin(), actions.cend(), [service](const KServiceAction &action) {
- return action.exec() == service->exec();
+ auto action = std::find_if(actions.cbegin(), actions.cend(), [actionName](const KServiceAction &action) {
+ return action.name() == actionName;
});
+ if (!actionName.isEmpty() && action == actions.cend()) {
+ qCWarning(KIO_GUI) << "Requested action" << actionName << "cannot be found for" << service->name();
+ }
instance = new DBusActivationRunner(action != actions.cend() ? action->name() : QString());
} else {
instance = makeInstance();
static KProcessRunner *fromApplication(const KService::Ptr &service,
const QString &serviceEntryPath,
const QList<QUrl> &urls,
+ const QString &actionName = {},
KIO::ApplicationLauncherJob::RunFlags flags = {},
const QString &suggestedFileName = {},
const QByteArray &asn = {});