Solid

requeststatejob.h
1/*
2 SPDX-FileCopyrightText: 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef SOLID_REQUEST_STATE_JOB_H
8#define SOLID_REQUEST_STATE_JOB_H
9
10#include <Solid/Job>
11
12#include "power.h"
13#include "solid_export.h"
14
15namespace Solid
16{
17class RequestStateJobPrivate;
18/**
19 * Tries to set the device under the state indicated via setState()
20 *
21 * On success this job will contain no error and the device will
22 * be set to the desired state (for example Sleep). On error
23 * use error() and errorText() to know more about the issue.
24 *
25 * @note In some devices changing the system state might happen
26 * too fast for the callee of this job to be notified (for example
27 * the system might suspend before result() is emitted.
28 */
29class SOLID_EXPORT RequestStateJob : public Job
30{
31 Q_OBJECT
32
33public:
34 enum Error {
35 Unsupported = Job::UserDefinedError,
36 };
37
38 explicit RequestStateJob(QObject *parent = nullptr);
39
40 void setState(Power::InhibitionType state);
41
42private Q_SLOTS:
43 void doStart() override;
44
45 /**
46 * We have to re-declare the signal because
47 * if not, Q_PROPERTY wouldn't work.
48 */
49Q_SIGNALS:
51
52private:
53 Q_DECLARE_PRIVATE(RequestStateJob)
54};
55} // Solid namespace
56#endif // SOLID_REQUEST_STATE_JOB_H
This class represents an asynchronous job performed by Solid, it is usually not used directly but ins...
Definition job.h:37
Tries to set the device under the state indicated via setState()
void result(Solid::Job *)
We have to re-declare the signal because if not, Q_PROPERTY wouldn't work.
The single responsibility of this class is to create arguments valid for logind Inhibit call.
Definition fakebattery.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.