Commit 1f6b9710 authored by Nicolas Fella's avatar Nicolas Fella Committed by Nate Graham
Browse files

[applets/diskanddevices] Add xdg-activation support to device ations

We need to know what app is launched so that CommandLauncherJob can apply xdg-activation

When opening in the file manager we query what the default file manager is and use that

When invoking other actions read a new action metadata key that specifies what is launched

BUG: 460268

(cherry picked from commit 88f8af29)
parent d747d3c0
Pipeline #248440 canceled with stage
in 13 minutes and 8 seconds
......@@ -9,9 +9,13 @@
#include <QDebug>
#include <KApplicationTrader>
#include <KConfigGroup>
#include <KDesktopFile>
#include <KIO/CommandLauncherJob>
#include <KLocalizedString>
#include <KNotificationJobUiDelegate>
#include <KService>
#include <kmacroexpander.h>
#include <solid/block.h>
#include <solid/storageaccess.h>
......@@ -149,6 +153,18 @@ void DelayedExecutor::delayedExecute(const QString &udi)
KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(exec);
job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled));
// To make xdg-activation and startup feedback work we need to pass the desktop file name of what we are launching
if (m_service.service()->storageId().endsWith(QLatin1String("test-predicate-openinwindow.desktop"))) {
// We know that we are going to launch the default file manager, so query the desktop file name of that
const KService::Ptr defaultFileManager = KApplicationTrader::preferredService(QStringLiteral("inode/directory"));
} else {
// Read the app that will be launched from the desktop file
KDesktopFile desktopFile(m_service.service()->storageId());
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