1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2020 Henri Chain <henri.chain@enioka.com>
4
5 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#ifndef SYSTEMDPROCESSRUNNER_H
9#define SYSTEMDPROCESSRUNNER_H
10#include "kprocessrunner_p.h"
11
12class OrgFreedesktopSystemd1ManagerInterface;
13class OrgFreedesktopDBusPropertiesInterface;
14class QDBusObjectPath;
15class QDBusPendingCallWatcher;
16
17const auto systemdService = QStringLiteral("org.freedesktop.systemd1");
18const auto systemdPath = QStringLiteral("/org/freedesktop/systemd1");
19
20class SystemdProcessRunner : public KProcessRunner
21{
22 Q_OBJECT
23
24public:
25 explicit SystemdProcessRunner();
26 void startProcess() override;
27 bool waitForStarted(int timeout) override;
28 static KProcessRunner::LaunchMode modeAvailable();
29
30private:
31 void handleProperties(QDBusPendingCallWatcher *watcher);
32 void handleUnitNew(const QString &newName, const QDBusObjectPath &newPath);
33 void systemdError(const QString &error);
34
35 bool m_exited = false;
36 QString m_serviceName;
37 QString m_servicePath;
38 QString m_jobPath;
39 OrgFreedesktopSystemd1ManagerInterface *m_manager = nullptr;
40 OrgFreedesktopDBusPropertiesInterface *m_serviceProperties = nullptr;
41};
42#endif // SYSTEMDPROCESSRUNNER_H
43

source code of kio/src/gui/systemd/systemdprocessrunner_p.h