Changeset View
Changeset View
Standalone View
Standalone View
kcms/desktoptheme/kcm.h
Show All 39 Lines | |||||
40 | 40 | | |||
41 | class QQuickItem; | 41 | class QQuickItem; | ||
42 | class QStandardItemModel; | 42 | class QStandardItemModel; | ||
43 | class DesktopThemeSettings; | 43 | class DesktopThemeSettings; | ||
44 | 44 | | |||
45 | class KCMDesktopTheme : public KQuickAddons::ConfigModule | 45 | class KCMDesktopTheme : public KQuickAddons::ConfigModule | ||
46 | { | 46 | { | ||
47 | Q_OBJECT | 47 | Q_OBJECT | ||
48 | Q_PROPERTY(DesktopThemeSettings *desktopThemeSettings READ desktopThemeSettings CONSTANT) | ||||
mart: generic api musings:
could this be upstreamed into ConfigModule directly? (since can't be a… | |||||
Yes, I got something like that in mind down the line. It's a bit early though, I'd like to see first how the changes in KConfig will impact the logic in here. ervin: Yes, I got something like that in mind down the line. It's a bit early though, I'd like to see… | |||||
48 | Q_PROPERTY(QStandardItemModel *desktopThemeModel READ desktopThemeModel CONSTANT) | 49 | Q_PROPERTY(QStandardItemModel *desktopThemeModel READ desktopThemeModel CONSTANT) | ||
49 | Q_PROPERTY(QString selectedPlugin READ selectedPlugin WRITE setSelectedPlugin NOTIFY selectedPluginChanged) | | |||
50 | Q_PROPERTY(int selectedPluginIndex READ selectedPluginIndex NOTIFY selectedPluginIndexChanged) | | |||
51 | Q_PROPERTY(bool downloadingFile READ downloadingFile NOTIFY downloadingFileChanged) | 50 | Q_PROPERTY(bool downloadingFile READ downloadingFile NOTIFY downloadingFileChanged) | ||
52 | Q_PROPERTY(bool canEditThemes READ canEditThemes CONSTANT) | 51 | Q_PROPERTY(bool canEditThemes READ canEditThemes CONSTANT) | ||
53 | 52 | | |||
54 | public: | 53 | public: | ||
55 | enum Roles { | 54 | enum Roles { | ||
56 | PluginNameRole = Qt::UserRole + 1, | 55 | PluginNameRole = Qt::UserRole + 1, | ||
57 | ThemeNameRole, | 56 | ThemeNameRole, | ||
58 | DescriptionRole, | 57 | DescriptionRole, | ||
59 | IsLocalRole, | 58 | IsLocalRole, | ||
60 | PendingDeletionRole | 59 | PendingDeletionRole | ||
61 | }; | 60 | }; | ||
62 | Q_ENUM(Roles) | 61 | Q_ENUM(Roles) | ||
63 | 62 | | |||
64 | KCMDesktopTheme(QObject *parent, const QVariantList &args); | 63 | KCMDesktopTheme(QObject *parent, const QVariantList &args); | ||
65 | ~KCMDesktopTheme() override; | 64 | ~KCMDesktopTheme() override; | ||
66 | 65 | | |||
66 | DesktopThemeSettings *desktopThemeSettings() const; | ||||
67 | QStandardItemModel *desktopThemeModel() const; | 67 | QStandardItemModel *desktopThemeModel() const; | ||
68 | 68 | | |||
69 | QString selectedPlugin() const; | 69 | Q_INVOKABLE int pluginIndex(const QString &pluginName) const; | ||
70 | void setSelectedPlugin(const QString &plugin); | | |||
71 | int selectedPluginIndex() const; | | |||
72 | 70 | | |||
73 | bool downloadingFile() const; | 71 | bool downloadingFile() const; | ||
74 | 72 | | |||
75 | bool canEditThemes() const; | 73 | bool canEditThemes() const; | ||
76 | 74 | | |||
77 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | 75 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | ||
78 | Q_INVOKABLE void installThemeFromFile(const QUrl &url); | 76 | Q_INVOKABLE void installThemeFromFile(const QUrl &url); | ||
79 | 77 | | |||
80 | Q_INVOKABLE void setPendingDeletion(int index, bool pending); | 78 | Q_INVOKABLE void setPendingDeletion(int index, bool pending); | ||
81 | 79 | | |||
82 | Q_INVOKABLE void applyPlasmaTheme(QQuickItem *item, const QString &themeName); | 80 | Q_INVOKABLE void applyPlasmaTheme(QQuickItem *item, const QString &themeName); | ||
83 | 81 | | |||
84 | Q_INVOKABLE void editTheme(const QString &themeName); | 82 | Q_INVOKABLE void editTheme(const QString &themeName); | ||
85 | 83 | | |||
86 | Q_SIGNALS: | 84 | Q_SIGNALS: | ||
87 | void selectedPluginChanged(const QString &plugin); | | |||
88 | void selectedPluginIndexChanged(); | | |||
89 | void downloadingFileChanged(); | 85 | void downloadingFileChanged(); | ||
90 | 86 | | |||
91 | void showSuccessMessage(const QString &message); | 87 | void showSuccessMessage(const QString &message); | ||
92 | void showErrorMessage(const QString &message); | 88 | void showErrorMessage(const QString &message); | ||
93 | 89 | | |||
94 | public Q_SLOTS: | 90 | public Q_SLOTS: | ||
95 | void load() override; | 91 | void load() override; | ||
96 | void save() override; | 92 | void save() override; | ||
97 | void defaults() override; | 93 | void defaults() override; | ||
98 | 94 | | |||
99 | private: | 95 | private: | ||
100 | void updateNeedsSave(); | 96 | void updateNeedsSave(); | ||
101 | 97 | | |||
102 | void processPendingDeletions(); | 98 | void processPendingDeletions(); | ||
103 | 99 | | |||
104 | void installTheme(const QString &path); | 100 | void installTheme(const QString &path); | ||
105 | 101 | | |||
106 | DesktopThemeSettings *m_settings; | 102 | DesktopThemeSettings *m_settings; | ||
107 | 103 | | |||
108 | QStandardItemModel *m_model; | 104 | QStandardItemModel *m_model; | ||
109 | QString m_selectedPlugin; | 105 | QString m_currentTheme; | ||
110 | QStringList m_pendingRemoval; | 106 | QStringList m_pendingRemoval; | ||
111 | QHash<QString, Plasma::Theme*> m_themes; | 107 | QHash<QString, Plasma::Theme*> m_themes; | ||
112 | bool m_haveThemeExplorerInstalled; | 108 | bool m_haveThemeExplorerInstalled; | ||
113 | 109 | | |||
114 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | 110 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | ||
115 | 111 | | |||
116 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | 112 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | ||
117 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | 113 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | ||
118 | }; | 114 | }; | ||
119 | 115 | | |||
120 | Q_DECLARE_LOGGING_CATEGORY(KCM_DESKTOP_THEME) | 116 | Q_DECLARE_LOGGING_CATEGORY(KCM_DESKTOP_THEME) | ||
121 | 117 | | |||
122 | #endif // _KCM_DESKTOPTHEME_H | 118 | #endif // _KCM_DESKTOPTHEME_H |
generic api musings:
could this be upstreamed into ConfigModule directly? (since can't be a virtual, a protected setter?)