File indexing completed on 2024-04-21 05:27:34
0001 /* 0002 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0003 SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org> 0004 SPDX-FileCopyrightText: 2019 Kevin Ottens <kevin.ottens@enioka.com> 0005 SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #pragma once 0010 0011 #include <KConfigPropertyMap> 0012 #include <KQuickManagedConfigModule> 0013 0014 #include "kscreensaversettings.h" 0015 #include "wallpaper_integration.h" 0016 0017 class ScreenLockerKcmForm; 0018 class AppearanceSettings; 0019 namespace ScreenLocker 0020 { 0021 class LnFIntegration; 0022 } 0023 0024 class ScreenLockerKcm : public KQuickManagedConfigModule 0025 { 0026 Q_OBJECT 0027 public: 0028 explicit ScreenLockerKcm(QObject *parent, const KPluginMetaData &data); 0029 0030 Q_PROPERTY(KScreenSaverSettings *settings READ settings CONSTANT) 0031 Q_PROPERTY(KConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY currentWallpaperChanged) 0032 Q_PROPERTY(KConfigPropertyMap *lnfConfiguration READ lnfConfiguration CONSTANT) 0033 Q_PROPERTY(QUrl lnfConfigFile READ lnfConfigFile CONSTANT) 0034 Q_PROPERTY(QUrl wallpaperConfigFile READ wallpaperConfigFile NOTIFY currentWallpaperChanged) 0035 Q_PROPERTY(ScreenLocker::WallpaperIntegration *wallpaperIntegration READ wallpaperIntegration NOTIFY currentWallpaperChanged) 0036 Q_PROPERTY(QString currentWallpaper READ currentWallpaper NOTIFY currentWallpaperChanged) 0037 Q_PROPERTY(bool isDefaultsAppearance READ isDefaultsAppearance NOTIFY isDefaultsAppearanceChanged) 0038 0039 Q_INVOKABLE QList<WallpaperInfo> availableWallpaperPlugins() 0040 { 0041 return KScreenSaverSettings::getInstance().availableWallpaperPlugins(); 0042 } 0043 0044 KScreenSaverSettings *settings() const; 0045 QUrl lnfConfigFile() const; 0046 QUrl wallpaperConfigFile() const; 0047 ScreenLocker::WallpaperIntegration *wallpaperIntegration() const; 0048 QString currentWallpaper() const; 0049 bool isDefaultsAppearance() const; 0050 0051 public Q_SLOTS: 0052 void load() override; 0053 void save() override; 0054 void defaults() override; 0055 void updateState(); 0056 void forceUpdateState(); 0057 0058 Q_SIGNALS: 0059 void currentWallpaperChanged(); 0060 void isDefaultsAppearanceChanged(); 0061 0062 private: 0063 bool isSaveNeeded() const override; 0064 bool isDefaults() const override; 0065 0066 KConfigPropertyMap *wallpaperConfiguration() const; 0067 KConfigPropertyMap *lnfConfiguration() const; 0068 0069 AppearanceSettings *m_appearanceSettings; 0070 QString m_currentWallpaper; 0071 bool m_forceUpdateState = false; 0072 };