Changeset View
Changeset View
Standalone View
Standalone View
kcms/desktoptheme/kcm.h
Show All 33 Lines | |||||
34 | } | 34 | } | ||
35 | 35 | | |||
36 | namespace KIO | 36 | namespace KIO | ||
37 | { | 37 | { | ||
38 | class FileCopyJob; | 38 | class FileCopyJob; | ||
39 | } | 39 | } | ||
40 | 40 | | |||
41 | class QQuickItem; | 41 | class QQuickItem; | ||
42 | class QStandardItemModel; | | |||
43 | class DesktopThemeSettings; | 42 | class DesktopThemeSettings; | ||
43 | class FilterProxyModel; | ||||
44 | class ThemesModel; | ||||
44 | 45 | | |||
45 | class KCMDesktopTheme : public KQuickAddons::ManagedConfigModule | 46 | class KCMDesktopTheme : public KQuickAddons::ManagedConfigModule | ||
46 | { | 47 | { | ||
47 | Q_OBJECT | 48 | Q_OBJECT | ||
49 | | ||||
48 | Q_PROPERTY(DesktopThemeSettings *desktopThemeSettings READ desktopThemeSettings CONSTANT) | 50 | Q_PROPERTY(DesktopThemeSettings *desktopThemeSettings READ desktopThemeSettings CONSTANT) | ||
49 | Q_PROPERTY(QStandardItemModel *desktopThemeModel READ desktopThemeModel CONSTANT) | 51 | Q_PROPERTY(FilterProxyModel *filteredModel READ filteredModel CONSTANT) | ||
52 | Q_PROPERTY(ThemesModel *desktopThemeModel READ desktopThemeModel CONSTANT) | ||||
50 | Q_PROPERTY(bool downloadingFile READ downloadingFile NOTIFY downloadingFileChanged) | 53 | Q_PROPERTY(bool downloadingFile READ downloadingFile NOTIFY downloadingFileChanged) | ||
51 | Q_PROPERTY(bool canEditThemes READ canEditThemes CONSTANT) | 54 | Q_PROPERTY(bool canEditThemes READ canEditThemes CONSTANT) | ||
52 | 55 | | |||
53 | public: | 56 | public: | ||
54 | enum Roles { | | |||
55 | PluginNameRole = Qt::UserRole + 1, | | |||
56 | ThemeNameRole, | | |||
57 | DescriptionRole, | | |||
58 | FollowsSystemColorsRole, | | |||
59 | IsLocalRole, | | |||
60 | PendingDeletionRole | | |||
61 | }; | | |||
62 | Q_ENUM(Roles) | | |||
63 | 57 | | |||
64 | KCMDesktopTheme(QObject *parent, const QVariantList &args); | 58 | KCMDesktopTheme(QObject *parent, const QVariantList &args); | ||
65 | ~KCMDesktopTheme() override; | 59 | ~KCMDesktopTheme() override; | ||
66 | 60 | | |||
67 | DesktopThemeSettings *desktopThemeSettings() const; | 61 | DesktopThemeSettings *desktopThemeSettings() const; | ||
68 | QStandardItemModel *desktopThemeModel() const; | 62 | ThemesModel *desktopThemeModel() const; | ||
69 | 63 | FilterProxyModel *filteredModel() const; | |||
70 | Q_INVOKABLE int pluginIndex(const QString &pluginName) const; | | |||
71 | 64 | | |||
72 | bool downloadingFile() const; | 65 | bool downloadingFile() const; | ||
73 | 66 | | |||
74 | bool canEditThemes() const; | 67 | bool canEditThemes() const; | ||
75 | 68 | | |||
76 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | 69 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | ||
77 | Q_INVOKABLE void installThemeFromFile(const QUrl &url); | 70 | Q_INVOKABLE void installThemeFromFile(const QUrl &url); | ||
78 | 71 | | |||
79 | Q_INVOKABLE void setPendingDeletion(int index, bool pending); | | |||
80 | | ||||
81 | Q_INVOKABLE void applyPlasmaTheme(QQuickItem *item, const QString &themeName); | 72 | Q_INVOKABLE void applyPlasmaTheme(QQuickItem *item, const QString &themeName); | ||
82 | 73 | | |||
83 | Q_INVOKABLE void editTheme(const QString &themeName); | 74 | Q_INVOKABLE void editTheme(const QString &themeName); | ||
84 | 75 | | |||
85 | Q_SIGNALS: | 76 | Q_SIGNALS: | ||
86 | void downloadingFileChanged(); | 77 | void downloadingFileChanged(); | ||
87 | 78 | | |||
88 | void showSuccessMessage(const QString &message); | 79 | void showSuccessMessage(const QString &message); | ||
89 | void showErrorMessage(const QString &message); | 80 | void showErrorMessage(const QString &message); | ||
90 | 81 | | |||
91 | public Q_SLOTS: | 82 | public Q_SLOTS: | ||
92 | void load() override; | 83 | void load() override; | ||
93 | void save() override; | 84 | void save() override; | ||
94 | void defaults() override; | 85 | void defaults() override; | ||
95 | 86 | | |||
96 | private: | 87 | private: | ||
97 | bool isSaveNeeded() const override; | 88 | bool isSaveNeeded() const override; | ||
98 | 89 | | |||
99 | void processPendingDeletions(); | 90 | void processPendingDeletions(); | ||
100 | 91 | | |||
101 | void installTheme(const QString &path); | 92 | void installTheme(const QString &path); | ||
102 | 93 | | |||
103 | DesktopThemeSettings *m_settings; | 94 | DesktopThemeSettings *m_settings; | ||
104 | 95 | | |||
105 | QStandardItemModel *m_model; | 96 | ThemesModel *m_model; | ||
106 | QStringList m_pendingRemoval; | 97 | FilterProxyModel *m_filteredModel; | ||
107 | QHash<QString, Plasma::Theme*> m_themes; | 98 | QHash<QString, Plasma::Theme*> m_themes; | ||
108 | bool m_haveThemeExplorerInstalled; | 99 | bool m_haveThemeExplorerInstalled; | ||
109 | 100 | | |||
110 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | 101 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | ||
111 | 102 | | |||
112 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | 103 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | ||
113 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | 104 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | ||
114 | }; | 105 | }; | ||
115 | 106 | | |||
116 | Q_DECLARE_LOGGING_CATEGORY(KCM_DESKTOP_THEME) | 107 | Q_DECLARE_LOGGING_CATEGORY(KCM_DESKTOP_THEME) | ||
117 | 108 | | |||
118 | #endif // _KCM_DESKTOPTHEME_H | 109 | #endif // _KCM_DESKTOPTHEME_H |