Commit 7699258c authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

runservice: port away from deprecated KRun API

parent c81b6583
add_executable(runservice main.cpp)
target_link_libraries(runservice KF5::Service KF5::KIOWidgets)
target_link_libraries(runservice KF5::Service KF5::KIOGui)
......@@ -18,26 +18,28 @@
* along with this program. If not, see <>. *
#include <QApplication>
#include <QGuiApplication>
#include <QFile>
#include <QTextStream>
#include <QUrl>
#include <QProcess>
#include <KService>
#include <KRun>
#include <KIO/ApplicationLauncherJob>
int main(int argc, char** argv)
QApplication app(argc, argv);
QGuiApplication app(argc, argv);
if (app.arguments().size() != 2)
return 1;
KService service(app.arguments().constLast());
if (!service.isValid())
KService::Ptr service(new KService(app.arguments().constLast()));
if (!service->isValid())
return 2;
if (KRun::runApplication(service, {}, nullptr) == 0)
return 3;
return 0;
KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service);
QObject::connect(job, &KIO::ApplicationLauncherJob::finished, &app, [&] {
return app.exec();
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