diff --git a/notifier/CMakeLists.txt b/notifier/CMakeLists.txt --- a/notifier/CMakeLists.txt +++ b/notifier/CMakeLists.txt @@ -4,7 +4,7 @@ target_link_libraries(DiscoverNotifier KF5::Notifications KF5::I18n - KF5::KIOWidgets + KF5::KIOGui KF5::Crash KF5::DBusAddons diff --git a/notifier/DiscoverNotifier.cpp b/notifier/DiscoverNotifier.cpp --- a/notifier/DiscoverNotifier.cpp +++ b/notifier/DiscoverNotifier.cpp @@ -24,11 +24,14 @@ #include #include #include -#include #include #include +#include #include +#include +#include + #include "../libdiscover/utils.h" DiscoverNotifier::DiscoverNotifier(QObject * parent) @@ -61,14 +64,28 @@ void DiscoverNotifier::showDiscover() { - KRun::runCommand(QStringLiteral("plasma-discover"), nullptr); - if (m_updatesAvailableNotification) { m_updatesAvailableNotification->close(); } + auto *job = new KIO::ApplicationLauncherJob(KService::serviceByDesktopName(QStringLiteral("org.kde.discover"))); + job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoErrorHandlingEnabled)); + job->start(); + + if (m_updatesAvailableNotification) { + m_updatesAvailableNotification->close(); + } } void DiscoverNotifier::showDiscoverUpdates() { - KRun::runCommand(QStringLiteral("plasma-discover --mode update"), nullptr); - if (m_updatesAvailableNotification) { m_updatesAvailableNotification->close(); } + auto *job = new KIO::CommandLauncherJob(QStringLiteral("plasma-discover"), { + QStringLiteral("--mode"), + QStringLiteral("update") + }); + job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoErrorHandlingEnabled)); + job->setDesktopName(QStringLiteral("org.kde.discover")); + job->start(); + + if (m_updatesAvailableNotification) { + m_updatesAvailableNotification->close(); + } } void DiscoverNotifier::showUpdatesNotification()