File indexing completed on 2024-04-28 16:52:17

0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2020 Lucas Biaggi <lbjanuario@gmail.com>
0003 /*
0004  * Firewalld backend for plasma firewall
0005  */
0006 #ifndef SYSTEMDJOB_H
0007 #define SYSTEMDJOB_H
0008 
0009 // #include "kcm_firewall_core_export.h"
0010 #include <KJob>
0011 #include <QDBusMessage>
0012 #include <QLoggingCategory>
0013 #include <types.h>
0014 
0015 Q_DECLARE_LOGGING_CATEGORY(SystemDJobDebug)
0016 
0017 namespace SYSTEMD
0018 {
0019 // KCM_FIREWALL_CORE_EXPORT Q_NAMESPACE
0020 enum actions { ERROR = -1, STOP, START };
0021 }
0022 
0023 class KCM_FIREWALL_CORE_EXPORT SystemdJob : public KJob
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     SystemdJob(const SYSTEMD::actions &action, const QString &service, bool serviceOnly = false);
0029     ~SystemdJob();
0030     void start() override;
0031 
0032 private:
0033     void systemdAction(const SYSTEMD::actions value);
0034     void systemdUnit(const QVariantList values, SYSTEMD::actions action);
0035     void reloadSystemd();
0036     const SYSTEMD::actions m_action;
0037     const QString m_service;
0038     const bool m_serviceOnly;
0039 };
0040 
0041 #endif