Solid

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

KDE's Doxygen guidelines are available online.