Solid

statesjob.cpp
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#include "statesjob.h"
8#include "backends/abstractstatesjob.h"
9#include "powerbackendloader.h"
10#include "statesjob_p.h"
11
12#include <QDebug>
13
14using namespace Solid;
15
16StatesJobPrivate::StatesJobPrivate()
17{
18 backendJob = nullptr;
19}
20
21StatesJob::StatesJob(QObject *parent)
22 : Job(*new StatesJobPrivate(), parent)
23{
24}
25
26void StatesJob::doStart()
27{
29 d->backendJob = PowerBackendLoader::statesJob();
30 connect(d->backendJob, &AbstractStatesJob::result, [this]() {
31 emitResult();
32 });
33
34 d->backendJob->start();
35}
36
38{
39 if (d_func()->backendJob) {
40 return d_func()->backendJob->states();
41 }
42 qWarning() << "statesJob called without having called start";
43 return Power::None;
44}
45
46#include "moc_statesjob.cpp"
This class represents an asynchronous job performed by Solid, it is usually not used directly but ins...
Definition job.h:37
Returns the states supported on the device.
Definition statesjob.h:26
Power::InhibitionTypes states() const
Once the job is finished, returns the supported Power::InhibitionTypes.
Definition statesjob.cpp:37
The single responsibility of this class is to create arguments valid for logind Inhibit call.
Definition fakebattery.h:16
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:56:28 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.