]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Port KRun::run usage to run another Dolphin process, to ApplicationLauncherJob
authorDavid Faure <faure@kde.org>
Mon, 13 Apr 2020 20:49:10 +0000 (22:49 +0200)
committerDavid Faure <faure@kde.org>
Tue, 14 Apr 2020 22:44:58 +0000 (00:44 +0200)
Test Plan: Opening a new window works

Reviewers: elvisangelaccio, ngraham, meven

Reviewed By: elvisangelaccio, meven

Subscribers: meven, kfm-devel

Tags: #dolphin

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

src/global.cpp

index 5236fa4d102a9086367bfa61d62dd9eaafff3331..19f43e06b04c5dcac9bfad6e755c579b57da4f55 100644 (file)
@@ -23,7 +23,9 @@
 #include "dolphindebug.h"
 #include "dolphinmainwindowinterface.h"
 
-#include <KRun>
+#include <KDialogJobUiDelegate>
+#include <KIO/ApplicationLauncherJob>
+#include <KService>
 #include <KWindowSystem>
 
 #include <QApplication>
@@ -60,13 +62,11 @@ void Dolphin::openNewWindow(const QList<QUrl> &urls, QWidget *window, const Open
     if (!urls.isEmpty()) {
         command.append(QLatin1String(" %U"));
     }
-    KRun::run(
-        command,
-        urls,
-        window,
-        QApplication::applicationDisplayName(),
-        QApplication::windowIcon().name()
-    );
+    KService::Ptr service(new KService(QApplication::applicationDisplayName(), command, QApplication::windowIcon().name()));
+    auto *job = new KIO::ApplicationLauncherJob(service, window);
+    job->setUrls(urls);
+    job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, window));
+    job->start();
 }
 
 bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFiles, bool splitView, const QString& preferredService)