Commit 6d25115e authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[libtaskmanager] Port KRun::runApplication to KIO::ApplicationLauncherJob

While at it, also remove some unused related includes that are likely remnant from before
this was all done centrally in TaskTools

Differential Revision: https://phabricator.kde.org/D28906
parent a28e110c
......@@ -26,7 +26,7 @@ include(KDEPackageAppTemplates)
include(KDEClangFormat)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Plasma DocTools Runner NotifyConfig Su NewStuff Wallet
Plasma DocTools Runner Notifications NotifyConfig Su NewStuff Wallet
IdleTime Declarative I18n KCMUtils TextWidgets KDELibs4Support Crash GlobalAccel
DBusAddons Wayland CoreAddons People ActivitiesStats)
find_package(KDED CONFIG REQUIRED)
......
......@@ -48,7 +48,9 @@ target_link_libraries(taskmanager
KF5::ConfigCore
KF5::I18n
KF5::KIOCore
KF5::KIOGui
KF5::KIOWidgets
KF5::Notifications
KF5::WaylandClient
KF5::WindowSystem
)
......
......@@ -22,7 +22,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "tasktools.h"
#include <KDesktopFile>
#include <KRun>
#include <KNotificationJobUiDelegate>
#include <KService>
#include <KStartupInfo>
#include <KSycoca>
......@@ -31,6 +31,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <KActivities/Consumer>
#include <KActivities/ResourceInstance>
#include <KIO/ApplicationLauncherJob>
#include <config-X11.h>
#include <QIcon>
......@@ -599,8 +601,11 @@ void LauncherTasksModel::requestOpenUrls(const QModelIndex &index, const QList<Q
return;
}
KRun::runApplication(*service, urls, nullptr, KRun::RunFlags(), QString(),
KStartupInfo::createNewStartupIdForTimestamp(timeStamp));
auto *job = new KIO::ApplicationLauncherJob(service);
job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoErrorHandlingEnabled));
job->setUrls(urls);
job->setStartupId(KStartupInfo::createNewStartupIdForTimestamp(timeStamp));
job->start();
KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("applications:") + service->storageId()),
QStringLiteral("org.kde.libtaskmanager"));
......
......@@ -27,6 +27,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <kemailsettings.h>
#include <KFileItem>
#include <KMimeTypeTrader>
#include <KNotificationJobUiDelegate>
#include <KRun>
#include <KServiceTypeTrader>
#include <KSharedConfig>
......@@ -34,6 +35,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <KWindowSystem>
#include <KProcessList>
#include <KIO/ApplicationLauncherJob>
#include <config-X11.h>
#include <QDir>
......@@ -813,8 +816,11 @@ void runApp(const AppData &appData, const QList<QUrl> &urls)
}
if (service && service->isApplication()) {
KRun::runApplication(*service, urls, nullptr, KRun::RunFlags(), QString(),
KStartupInfo::createNewStartupIdForTimestamp(timeStamp));
auto *job = new KIO::ApplicationLauncherJob(service);
job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoErrorHandlingEnabled));
job->setUrls(urls);
job->setStartupId(KStartupInfo::createNewStartupIdForTimestamp(timeStamp));
job->start();
KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("applications:") + service->storageId()),
QStringLiteral("org.kde.libtaskmanager"));
......
......@@ -22,9 +22,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "tasktools.h"
#include "virtualdesktopinfo.h"
#include <KActivities/ResourceInstance>
#include <KDirWatch>
#include <KRun>
#include <KService>
#include <KSharedConfig>
#include <KWayland/Client/connection_thread.h>
......
......@@ -23,11 +23,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "tasktools.h"
#include "xwindowsystemeventbatcher.h"
#include <KActivities/ResourceInstance>
#include <KDesktopFile>
#include <KDirWatch>
#include <KIconLoader>
#include <KRun>
#include <KService>
#include <KSharedConfig>
#include <KStartupInfo>
......
Markdown is supported
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