File indexing completed on 2025-02-02 05:02:43
0001 /* 0002 SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef LOCKMANAGER_H 0008 #define LOCKMANAGER_H 0009 0010 #include "solidextras_export.h" 0011 0012 #include <QObject> 0013 0014 class LockBackend : public QObject 0015 { 0016 public: 0017 explicit LockBackend(QObject *parent = nullptr) : QObject(parent) 0018 {} 0019 ~LockBackend() override = default; 0020 virtual void setInhibitionOn(const QString &explanation) = 0; 0021 virtual void setInhibitionOff() = 0; 0022 }; 0023 0024 class SOLIDEXTRAS_EXPORT LockManager : public QObject 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 explicit LockManager(QObject *parent = nullptr); 0030 ~LockManager() override; 0031 0032 public Q_SLOTS: 0033 /** Toggle screen lock inhibition. 0034 * @param explanation A human-readable explanation on why the screen lock is inhibited. 0035 * (not used on all platforms). 0036 */ 0037 void toggleInhibitScreenLock(const QString &explanation); 0038 private: 0039 LockBackend *m_backend; 0040 bool m_inhibit; 0041 }; 0042 0043 #endif // LOCKMANAGER_H