File indexing completed on 2024-05-12 07:57:05
0001 /* 0002 SPDX-FileCopyrightText: 2014 Alejandro Fiestas Olivares <afiestas@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef SOLID_FD_INHIBITION_H 0008 #define SOLID_FD_INHIBITION_H 0009 0010 #include "backends/abstractinhibition.h" 0011 #include "inhibition.h" 0012 #include "solid/power.h" 0013 0014 #include <QDBusMessage> 0015 #include <qglobal.h> 0016 0017 namespace Solid 0018 { 0019 class FdInhibition : public AbstractInhibition 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit FdInhibition(Power::InhibitionTypes inhibitions, const QString &description, QObject *parent = nullptr); 0024 virtual ~FdInhibition(); 0025 0026 void start() override; 0027 void stop() override; 0028 Inhibition::State state() const override; 0029 0030 void setDescription(const QString &description); 0031 0032 private Q_SLOTS: 0033 void slotDBusReply(const QDBusMessage &msg); 0034 void slotDBusError(const QDBusError &error); 0035 0036 private: 0037 void setState(const Inhibition::State &state); 0038 0039 int m_fd; 0040 Inhibition::State m_state; 0041 QString m_description; 0042 Power::InhibitionTypes m_inhibitions; 0043 }; 0044 } 0045 0046 #endif // SOLID_FD_INHIBITION_H