Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 1ad7a788 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Have KRun start services instead of using KDesktopFileParser + QProcess

BUG: 402513
parent ae1e7105
add_executable(runservice main.cpp)
target_link_libraries(runservice KF5::Service KF5::KIOCore)
target_link_libraries(runservice KF5::Service KF5::KIOWidgets)
......@@ -18,28 +18,27 @@
* along with this program. If not, see <>. *
#include <QCoreApplication>
#include <QApplication>
#include <QFile>
#include <QTextStream>
#include <QUrl>
#include <QProcess>
#include <KService>
#include <KRun>
#include <KIO/DesktopExecParser>
int main(int argc, char** argv)
QCoreApplication app(argc, argv);
QApplication app(argc, argv);
if (app.arguments().size() != 2)
return 1;
KService _service(app.arguments().constLast());
if (!_service.isValid())
KService service(app.arguments().constLast());
if (!service.isValid())
return 2;
QTextStream cerr(stderr);
KIO::DesktopExecParser execParser(_service, {});
if (KRun::runApplication(service, {}, nullptr) == 0)
return 3;
auto args = execParser.resultingArguments();
const auto execName = args.takeFirst();
return !QProcess::startDetached(execName, args);
return 0;
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