]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DolphinPart: port dolphin's last use of KRun::run to CommandLauncherJob.
authorDavid Faure <faure@kde.org>
Mon, 13 Apr 2020 22:11:16 +0000 (00:11 +0200)
committerDavid Faure <faure@kde.org>
Sat, 18 Apr 2020 11:07:08 +0000 (13:07 +0200)
Summary:
I chose CommandLauncherJob rather than ApplicationLauncherJob
because that would require either looking up org.kde.kfind.desktop
(with a risk of failure) or duplicating the icon name...

Test Plan:
commented out the if() block of the slot, to make sure we end
up launching kfind with this code. Then konqueror /, and Ctrl+F.

Reviewers: broulik

Reviewed By: broulik

Differential Revision: https://phabricator.kde.org/D28810

src/dolphinpart.cpp

index 7e7425121ca81105c7016630a2b6d9289550d5d6..0c41b2becaeecab1fac93cde86fc143978818ac1 100644 (file)
@@ -34,6 +34,7 @@
 #include <KActionCollection>
 #include <KAuthorized>
 #include <KConfigGroup>
+#include <KDialogJobUiDelegate>
 #include <KFileItemListProperties>
 #include <KIconLoader>
 #include <KJobWidgets>
@@ -42,7 +43,7 @@
 #include <KMimeTypeEditor>
 #include <KNS3/KMoreToolsMenuFactory>
 #include <KPluginFactory>
-#include <KRun>
+#include <KIO/CommandLauncherJob>
 #include <KSharedConfig>
 #include <KToolInvocation>
 
@@ -546,7 +547,10 @@ void DolphinPart::slotFindFile()
     if (!(actions.isEmpty())) {
         actions.first()->trigger();
     } else {
-        KRun::run(QStringLiteral("kfind"), {url()}, widget());
+        KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kfind"), {url().toString()}, this);
+        job->setDesktopName(QStringLiteral("org.kde.kfind"));
+        job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, widget()));
+        job->start();
     }
 }