File indexing completed on 2024-04-28 04:00:49

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_STATES_JOB_H
0008 #define SOLID_STATES_JOB_H
0009 
0010 #include "power.h"
0011 #include "solid_export.h"
0012 
0013 #include <Solid/Job>
0014 
0015 namespace Solid
0016 {
0017 class StatesJobPrivate;
0018 /**
0019  * Returns the states supported on the device
0020  *
0021  * Different devices and different operating systems support
0022  * a different set of states such Sleep or Hibernation.
0023  *
0024  */
0025 class SOLID_EXPORT StatesJob : public Job
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit StatesJob(QObject *parent = nullptr);
0031 
0032     /**
0033      * Once the job is finished, returns the supported Power::InhibitionTypes
0034      */
0035     Power::InhibitionTypes states() const;
0036 
0037 private Q_SLOTS:
0038     void doStart() override;
0039 
0040     /**
0041      * We have to re-declare the signal because
0042      * if not, Q_PROPERTY wouldn't work.
0043      */
0044 Q_SIGNALS:
0045     void result(Solid::Job *job);
0046 
0047 private:
0048     Q_DECLARE_PRIVATE(StatesJob)
0049 };
0050 } // Solid namespace
0051 #endif // SOLID_STATES_JOB_H