File indexing completed on 2024-12-22 05:15:21

0001 /*
0002     SPDX-FileCopyrightText: 2013 Eike Hein <hein@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "processrunner.h"
0008 
0009 #include <KIO/ApplicationLauncherJob>
0010 #include <KNotificationJobUiDelegate>
0011 #include <QDebug>
0012 
0013 ProcessRunner::ProcessRunner(QObject *parent)
0014     : QObject(parent)
0015 {
0016 }
0017 
0018 ProcessRunner::~ProcessRunner()
0019 {
0020 }
0021 
0022 void ProcessRunner::runMenuEditor()
0023 {
0024     const auto service = KService::serviceByDesktopName(QStringLiteral("org.kde.kmenuedit"));
0025 
0026     if (!service) {
0027         qWarning() << "Could not find kmenuedit";
0028         return;
0029     }
0030 
0031     auto *job = new KIO::ApplicationLauncherJob(service);
0032     auto *delegate = new KNotificationJobUiDelegate;
0033     delegate->setAutoErrorHandlingEnabled(true);
0034     job->setUiDelegate(delegate);
0035     job->start();
0036 }