diff --git a/dataengines/konsoleprofiles/CMakeLists.txt b/dataengines/konsoleprofiles/CMakeLists.txt --- a/dataengines/konsoleprofiles/CMakeLists.txt +++ b/dataengines/konsoleprofiles/CMakeLists.txt @@ -8,8 +8,9 @@ add_library(plasma_engine_konsoleprofiles MODULE ${konsoleprofilesengine_SRCS}) target_link_libraries(plasma_engine_konsoleprofiles KF5::Plasma + KF5::Notifications + KF5::KIOGui KF5::Service - KF5::KIOCore ) kcoreaddons_desktop_to_json(plasma_engine_konsoleprofiles plasma-dataengine-konsoleprofiles.desktop SERVICE_TYPES plasma-dataengine.desktop) diff --git a/dataengines/konsoleprofiles/konsoleprofilesservice.cpp b/dataengines/konsoleprofiles/konsoleprofilesservice.cpp --- a/dataengines/konsoleprofiles/konsoleprofilesservice.cpp +++ b/dataengines/konsoleprofiles/konsoleprofilesservice.cpp @@ -19,9 +19,12 @@ #include "konsoleprofilesservice.h" #include -#include #include +#include + +#include + KonsoleProfilesService::KonsoleProfilesService(QObject* parent, const QString& profileName) : Plasma::Service(parent) { @@ -49,11 +52,23 @@ if (operation == QLatin1String("open")) { // Q_ASSERT(!jobParameters.isEmpty()); - QStringList args; - args << QStringLiteral("--profile") << destination(); - KToolInvocation::kdeinitExec(QStringLiteral("konsole"), args); + // Would be nice if we could just return this in createJob above + auto *job = new KIO::CommandLauncherJob(QStringLiteral("konsole"), { + QStringLiteral("--profile"), destination() + }); + job->setDesktopName(QStringLiteral("org.kde.konsole")); + + auto *delegate = new KNotificationJobUiDelegate; + delegate->setAutoErrorHandlingEnabled(true); + job->setUiDelegate(delegate); + + connect(job, &KIO::CommandLauncherJob::result, this, [this, job] { + setError(job->error()); + setErrorText(job->errorText()); + emitResult(); + }); - setResult(true); + job->start(); } } diff --git a/runners/katesessions/CMakeLists.txt b/runners/katesessions/CMakeLists.txt --- a/runners/katesessions/CMakeLists.txt +++ b/runners/katesessions/CMakeLists.txt @@ -2,7 +2,7 @@ set(krunner_katesessions_SRCS katesessions.cpp) add_library(krunner_katesessions MODULE ${krunner_katesessions_SRCS}) -target_link_libraries(krunner_katesessions KF5::KIOCore KF5::I18n KF5::Runner) +target_link_libraries(krunner_katesessions KF5::KIOGui KF5::Notifications KF5::I18n KF5::Runner) install(TARGETS krunner_katesessions DESTINATION ${KDE_INSTALL_PLUGINDIR}) install(FILES plasma-runner-katesessions.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/runners/katesessions/katesessions.cpp b/runners/katesessions/katesessions.cpp --- a/runners/katesessions/katesessions.cpp +++ b/runners/katesessions/katesessions.cpp @@ -28,7 +28,9 @@ #include #include -#include +#include + +#include K_EXPORT_PLASMA_RUNNER(katesessionsrunner, KateSessions) @@ -114,8 +116,16 @@ { Q_UNUSED(context) - KToolInvocation::kdeinitExec(QStringLiteral("kate"), {QStringLiteral("--start"), - match.data().toString(), QStringLiteral("-n")}); + auto *job = new KIO::CommandLauncherJob(QStringLiteral("kate"), { + QStringLiteral("--start"), match.data().toString(), QStringLiteral("-n") + }); + job->setDesktopName(QStringLiteral("org.kde.kate")); + + auto *delegate = new KNotificationJobUiDelegate; + delegate->setAutoErrorHandlingEnabled(true); + job->setUiDelegate(delegate); + + job->start(); } #include "katesessions.moc" diff --git a/runners/konsoleprofiles/CMakeLists.txt b/runners/konsoleprofiles/CMakeLists.txt --- a/runners/konsoleprofiles/CMakeLists.txt +++ b/runners/konsoleprofiles/CMakeLists.txt @@ -7,7 +7,9 @@ add_library(krunner_konsoleprofiles MODULE ${krunner_konsoleprofiles_SRCS}) target_link_libraries(krunner_konsoleprofiles KF5::Runner + KF5::KIOGui KF5::I18n + KF5::Notifications ) install(TARGETS krunner_konsoleprofiles DESTINATION ${KDE_INSTALL_PLUGINDIR}) diff --git a/runners/konsoleprofiles/konsoleprofiles.cpp b/runners/konsoleprofiles/konsoleprofiles.cpp --- a/runners/konsoleprofiles/konsoleprofiles.cpp +++ b/runners/konsoleprofiles/konsoleprofiles.cpp @@ -21,10 +21,11 @@ #include "konsoleprofiles.h" // KF +#include +#include #include -#include #include -#include +#include // Qt #include #include @@ -173,11 +174,16 @@ return; } - const QStringList args { - QStringLiteral("--profile"), - profile - }; - KToolInvocation::kdeinitExec(QStringLiteral("konsole"), args); + auto *job = new KIO::CommandLauncherJob(QStringLiteral("konsole"), { + QStringLiteral("--profile"), profile + }); + job->setDesktopName(QStringLiteral("org.kde.konsole")); + + auto *delegate = new KNotificationJobUiDelegate; + delegate->setAutoErrorHandlingEnabled(true); + job->setUiDelegate(delegate); + + job->start(); }