Changeset View
Changeset View
Standalone View
Standalone View
runners/katesessions/katesessions.cpp
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include <QCollator> | 24 | #include <QCollator> | ||
25 | #include <QDir> | 25 | #include <QDir> | ||
26 | #include <QFileInfo> | 26 | #include <QFileInfo> | ||
27 | #include <QStandardPaths> | 27 | #include <QStandardPaths> | ||
28 | 28 | | |||
29 | #include <KDirWatch> | 29 | #include <KDirWatch> | ||
30 | #include <KLocalizedString> | 30 | #include <KLocalizedString> | ||
31 | #include <KToolInvocation> | 31 | #include <KNotificationJobUiDelegate> | ||
32 | | ||||
33 | #include <KIO/CommandLauncherJob> | ||||
32 | 34 | | |||
33 | K_EXPORT_PLASMA_RUNNER(katesessionsrunner, KateSessions) | 35 | K_EXPORT_PLASMA_RUNNER(katesessionsrunner, KateSessions) | ||
34 | 36 | | |||
35 | KateSessions::KateSessions(QObject *parent, const QVariantList &args) | 37 | KateSessions::KateSessions(QObject *parent, const QVariantList &args) | ||
36 | : Plasma::AbstractRunner(parent, args) | 38 | : Plasma::AbstractRunner(parent, args) | ||
37 | { | 39 | { | ||
38 | setObjectName(QStringLiteral("Kate Sessions")); | 40 | setObjectName(QStringLiteral("Kate Sessions")); | ||
39 | setIgnoredTypes(Plasma::RunnerContext::File | Plasma::RunnerContext::Directory | 41 | setIgnoredTypes(Plasma::RunnerContext::File | Plasma::RunnerContext::Directory | ||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 101 | for (const QString &session: qAsConst(m_sessions)) { | |||
109 | } | 111 | } | ||
110 | } | 112 | } | ||
111 | } | 113 | } | ||
112 | 114 | | |||
113 | void KateSessions::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) | 115 | void KateSessions::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) | ||
114 | { | 116 | { | ||
115 | Q_UNUSED(context) | 117 | Q_UNUSED(context) | ||
116 | 118 | | |||
117 | KToolInvocation::kdeinitExec(QStringLiteral("kate"), {QStringLiteral("--start"), | 119 | auto *job = new KIO::CommandLauncherJob(QStringLiteral("kate"), { | ||
118 | match.data().toString(), QStringLiteral("-n")}); | 120 | QStringLiteral("--start"), match.data().toString(), QStringLiteral("-n") | ||
121 | }); | ||||
122 | job->setDesktopName(QStringLiteral("org.kde.kate")); | ||||
123 | | ||||
124 | auto *delegate = new KNotificationJobUiDelegate; | ||||
125 | delegate->setAutoErrorHandlingEnabled(true); | ||||
126 | job->setUiDelegate(delegate); | ||||
127 | | ||||
128 | job->start(); | ||||
119 | } | 129 | } | ||
120 | 130 | | |||
121 | #include "katesessions.moc" | 131 | #include "katesessions.moc" |