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 #include "statesjob.h" 0008 #include "backends/abstractstatesjob.h" 0009 #include "powerbackendloader.h" 0010 #include "statesjob_p.h" 0011 0012 #include <QDebug> 0013 0014 using namespace Solid; 0015 0016 StatesJobPrivate::StatesJobPrivate() 0017 { 0018 backendJob = nullptr; 0019 } 0020 0021 StatesJob::StatesJob(QObject *parent) 0022 : Job(*new StatesJobPrivate(), parent) 0023 { 0024 } 0025 0026 void StatesJob::doStart() 0027 { 0028 Q_D(StatesJob); 0029 d->backendJob = PowerBackendLoader::statesJob(); 0030 connect(d->backendJob, &AbstractStatesJob::result, [this]() { 0031 emitResult(); 0032 }); 0033 0034 d->backendJob->start(); 0035 } 0036 0037 Power::InhibitionTypes StatesJob::states() const 0038 { 0039 if (d_func()->backendJob) { 0040 return d_func()->backendJob->states(); 0041 } 0042 qWarning() << "statesJob called without having called start"; 0043 return Power::None; 0044 } 0045 0046 #include "moc_statesjob.cpp"