Changeset View
Changeset View
Standalone View
Standalone View
kcms/colors/colors.h
Show All 17 Lines | |||||
18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #pragma once | 22 | #pragma once | ||
23 | 23 | | |||
24 | #include <QScopedPointer> | 24 | #include <QScopedPointer> | ||
25 | #include <QPointer> | 25 | #include <QPointer> | ||
26 | #include <QQmlListReference> | ||||
26 | 27 | | |||
27 | #include <KSharedConfig> | 28 | #include <KSharedConfig> | ||
28 | 29 | | |||
29 | #include <KNewStuff3/KNS3/DownloadDialog> | | |||
30 | 30 | | |||
31 | #include <KQuickAddons/ManagedConfigModule> | 31 | #include <KQuickAddons/ManagedConfigModule> | ||
32 | 32 | | |||
33 | class QProcess; | 33 | class QProcess; | ||
34 | class QTemporaryFile; | 34 | class QTemporaryFile; | ||
35 | 35 | | |||
36 | namespace KIO | 36 | namespace KIO | ||
37 | { | 37 | { | ||
Show All 31 Lines | 54 | public: | |||
69 | }; | 69 | }; | ||
70 | Q_ENUM(SchemeFilter) | 70 | Q_ENUM(SchemeFilter) | ||
71 | 71 | | |||
72 | ColorsModel *model() const; | 72 | ColorsModel *model() const; | ||
73 | FilterProxyModel *filteredModel() const; | 73 | FilterProxyModel *filteredModel() const; | ||
74 | ColorsSettings *colorsSettings() const; | 74 | ColorsSettings *colorsSettings() const; | ||
75 | bool downloadingFile() const; | 75 | bool downloadingFile() const; | ||
76 | 76 | | |||
77 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | 77 | Q_INVOKABLE void reloadModel(const QQmlListReference &changedEntries); | ||
78 | Q_INVOKABLE void installSchemeFromFile(const QUrl &url); | 78 | Q_INVOKABLE void installSchemeFromFile(const QUrl &url); | ||
79 | 79 | | |||
80 | Q_INVOKABLE void editScheme(const QString &schemeName, QQuickItem *ctx); | 80 | Q_INVOKABLE void editScheme(const QString &schemeName, QQuickItem *ctx); | ||
81 | 81 | | |||
82 | public Q_SLOTS: | 82 | public Q_SLOTS: | ||
83 | void load() override; | 83 | void load() override; | ||
84 | void save() override; | 84 | void save() override; | ||
85 | 85 | | |||
86 | Q_SIGNALS: | 86 | Q_SIGNALS: | ||
87 | void downloadingFileChanged(); | 87 | void downloadingFileChanged(); | ||
88 | 88 | | |||
89 | void showSuccessMessage(const QString &message); | 89 | void showSuccessMessage(const QString &message); | ||
90 | void showErrorMessage(const QString &message); | 90 | void showErrorMessage(const QString &message); | ||
91 | 91 | | |||
92 | void showSchemeNotInstalledWarning(const QString &schemeName); | 92 | void showSchemeNotInstalledWarning(const QString &schemeName); | ||
93 | 93 | | |||
94 | private: | 94 | private: | ||
95 | bool isSaveNeeded() const override; | ||||
96 | | ||||
95 | void saveColors(); | 97 | void saveColors(); | ||
96 | void processPendingDeletions(); | 98 | void processPendingDeletions(); | ||
97 | 99 | | |||
98 | void installSchemeFile(const QString &path); | 100 | void installSchemeFile(const QString &path); | ||
99 | 101 | | |||
100 | ColorsModel *m_model; | 102 | ColorsModel *m_model; | ||
101 | FilterProxyModel *m_filteredModel; | 103 | FilterProxyModel *m_filteredModel; | ||
102 | ColorsSettings *m_settings; | 104 | ColorsSettings *m_settings; | ||
103 | 105 | | |||
104 | bool m_selectedSchemeDirty = false; | 106 | bool m_selectedSchemeDirty = false; | ||
105 | 107 | | |||
106 | bool m_applyToAlien = true; | 108 | bool m_applyToAlien = true; | ||
107 | 109 | | |||
108 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | | |||
109 | | ||||
110 | QProcess *m_editDialogProcess = nullptr; | 110 | QProcess *m_editDialogProcess = nullptr; | ||
111 | 111 | | |||
112 | KSharedConfigPtr m_config; | 112 | KSharedConfigPtr m_config; | ||
113 | 113 | | |||
114 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | 114 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | ||
115 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | 115 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | ||
116 | 116 | | |||
117 | }; | 117 | }; |