Solid

inhibition.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 "inhibition.h"
8 #include "backends/abstractinhibition.h"
9 
10 using namespace Solid;
11 
12 class Solid::InhibitionPrivate
13 {
14 public:
15  AbstractInhibition *backendObject;
16 };
17 
19  : QObject(parent)
20  , d_ptr(new InhibitionPrivate)
21 {
22  d_ptr->backendObject = backend;
23  connect(d_ptr->backendObject, &AbstractInhibition::stateChanged, this, &Inhibition::stateChanged);
24 }
25 
26 Inhibition::~Inhibition()
27 {
28  delete d_ptr->backendObject;
29  delete d_ptr;
30 }
31 
33 {
34  d_ptr->backendObject->start();
35 }
36 
38 {
39  d_ptr->backendObject->stop();
40 }
41 
42 Inhibition::State Inhibition::state() const
43 {
44  return d_ptr->backendObject->state();
45 }
46 
State state() const
Returns the current state of the object.
void stop()
Stops the inhibition.
Definition: inhibition.cpp:37
Inhibition(AbstractInhibition *backend, QObject *parent=0)
This is meant to be instantiated by backends only.
Definition: inhibition.cpp:18
void start()
Starts the inhibition.
Definition: inhibition.cpp:32
Represents an inhibition, allows to stop and start it.
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 Tue Mar 2 2021 01:16:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.