Changeset View
Changeset View
Standalone View
Standalone View
kcm/kcm.h
Show All 31 Lines | |||||
32 | class WallpaperIntegration; | 32 | class WallpaperIntegration; | ||
33 | } | 33 | } | ||
34 | 34 | | |||
35 | namespace KDeclarative | 35 | namespace KDeclarative | ||
36 | { | 36 | { | ||
37 | class ConfigPropertyMap; | 37 | class ConfigPropertyMap; | ||
38 | } | 38 | } | ||
39 | 39 | | |||
40 | | ||||
40 | class ScreenLockerKcm : public KCModule | 41 | class ScreenLockerKcm : public KCModule | ||
41 | { | 42 | { | ||
42 | Q_OBJECT | 43 | Q_OBJECT | ||
43 | Q_PROPERTY(KDeclarative::ConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY wallpaperConfigurationChanged) | | |||
44 | Q_PROPERTY(QString currentWallpaper READ currentWallpaper NOTIFY currentWallpaperChanged) | | |||
45 | | ||||
46 | public: | 44 | public: | ||
47 | enum Roles { | 45 | enum Roles { | ||
48 | PluginNameRole = Qt::UserRole +1, | 46 | PluginNameRole = Qt::UserRole +1, | ||
49 | ScreenhotRole | 47 | ScreenhotRole | ||
50 | }; | 48 | }; | ||
51 | explicit ScreenLockerKcm(QWidget *parent = nullptr, const QVariantList& args = QVariantList()); | 49 | explicit ScreenLockerKcm(QWidget *parent = nullptr, const QVariantList& args = QVariantList()); | ||
52 | 50 | | |||
53 | KDeclarative::ConfigPropertyMap *wallpaperConfiguration() const; | 51 | KDeclarative::ConfigPropertyMap *wallpaperConfiguration() const; | ||
Show All 17 Lines | 66 | private: | |||
71 | void loadWallpapers(); | 69 | void loadWallpapers(); | ||
72 | void selectWallpaper(const QString &pluginId); | 70 | void selectWallpaper(const QString &pluginId); | ||
73 | void loadWallpaperConfig(); | 71 | void loadWallpaperConfig(); | ||
74 | KPackage::Package m_package; | 72 | KPackage::Package m_package; | ||
75 | KActionCollection *m_actionCollection; | 73 | KActionCollection *m_actionCollection; | ||
76 | ScreenLockerKcmForm *m_ui; | 74 | ScreenLockerKcmForm *m_ui; | ||
77 | ScreenLocker::WallpaperIntegration *m_wallpaperIntegration = nullptr; | 75 | ScreenLocker::WallpaperIntegration *m_wallpaperIntegration = nullptr; | ||
78 | }; | 76 | }; | ||
77 | | ||||
78 | //see https://bugreports.qt.io/browse/QTBUG-57714, don't expose a QWidget as a context property | ||||
79 | class ScreenLockerProxy : public QObject | ||||
80 | { | ||||
81 | Q_OBJECT | ||||
82 | Q_PROPERTY(KDeclarative::ConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY wallpaperConfigurationChanged) | ||||
83 | Q_PROPERTY(QString currentWallpaper READ currentWallpaper NOTIFY currentWallpaperChanged) | ||||
84 | public: | ||||
85 | ScreenLockerProxy(ScreenLockerKcm *parent) : | ||||
86 | QObject(parent), | ||||
87 | q(parent) | ||||
88 | { | ||||
89 | } | ||||
90 | | ||||
91 | KDeclarative::ConfigPropertyMap *wallpaperConfiguration() const { | ||||
92 | return q->wallpaperConfiguration(); | ||||
93 | } | ||||
94 | | ||||
95 | QString currentWallpaper() const { | ||||
96 | return q->currentWallpaper(); | ||||
97 | } | ||||
98 | | ||||
99 | signals: | ||||
100 | void wallpaperConfigurationChanged(); | ||||
101 | void currentWallpaperChanged(); | ||||
102 | | ||||
103 | private: | ||||
104 | ScreenLockerKcm* q; | ||||
105 | }; |