File indexing completed on 2024-05-12 17:07:19
0001 /* 0002 kcmsmserver.h 0003 SPDX-FileCopyrightText: 2000 Oswald Buddenhagen <ob6@inf.tu-dresden.de> 0004 0005 based on kcmtaskbar.h 0006 SPDX-FileCopyrightText: 2000 Kurt Granroth <granroth@kde.org> 0007 SPDX-FileCopyrightText: 2019 Kevin Ottens <kevin.ottens@enioka.com> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 #pragma once 0012 0013 #include <KQuickAddons/ManagedConfigModule> 0014 0015 class QAction; 0016 0017 class SMServerConfigImpl; 0018 0019 class OrgFreedesktopLogin1ManagerInterface; 0020 0021 /// KCM handling the desktop session and in particular the login and logout 0022 /// handling. 0023 class SMServerConfig : public KQuickAddons::ManagedConfigModule 0024 { 0025 Q_OBJECT 0026 0027 /// True if we are in an UEFI system. 0028 Q_PROPERTY(bool isUefi READ isUefi CONSTANT) 0029 0030 /// Config telling if we should restart in the setup screen next time we boot. 0031 Q_PROPERTY(bool restartInSetupScreen READ restartInSetupScreen WRITE setRestartInSetupScreen NOTIFY restartInSetupScreenChanged) 0032 0033 /// Error message, empty if there is no error 0034 Q_PROPERTY(QString error READ error NOTIFY errorChanged) 0035 0036 /// Can setup the firmware 0037 Q_PROPERTY(bool canFirmwareSetup READ canFirmwareSetup CONSTANT) 0038 0039 public: 0040 explicit SMServerConfig(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args); 0041 ~SMServerConfig() override; 0042 0043 bool isUefi() const; 0044 0045 bool restartInSetupScreen() const; 0046 void setRestartInSetupScreen(bool isUefi); 0047 0048 QString error() const; 0049 0050 bool canFirmwareSetup() const; 0051 0052 /// Tell the computer to reboot. 0053 Q_INVOKABLE void reboot(); 0054 0055 void defaults() override; 0056 0057 public Q_SLOTS: 0058 void save() override; 0059 0060 Q_SIGNALS: 0061 void isUefiChanged(); 0062 void restartInSetupScreenChanged(); 0063 void errorChanged(); 0064 void ksmserverSettingsChanged(); 0065 0066 private: 0067 bool isSaveNeeded() const override; 0068 bool isDefaults() const override; 0069 0070 void checkFirmwareSetupRequested(); 0071 0072 OrgFreedesktopLogin1ManagerInterface *m_login1Manager = nullptr; 0073 QAction *m_rebootNowAction = nullptr; 0074 bool m_isUefi = false; 0075 bool m_restartInSetupScreen = false; 0076 bool m_restartInSetupScreenInitial = false; 0077 bool m_canFirmwareSetup = false; 0078 QString m_error; 0079 };