Changeset View
Changeset View
Standalone View
Standalone View
kcms/colors/colors.h
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Copyright (c) 2019 Kai Uwe Broulik <kde@privat.broulik.de> | 2 | * Copyright (c) 2019 Kai Uwe Broulik <kde@privat.broulik.de> | ||
3 | * Copyright (c) 2019 Cyril Rossi <cyril.rossi@enioka.com> | ||||
3 | * | 4 | * | ||
4 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of | 7 | * published by the Free Software Foundation; either version 2 of | ||
7 | * the License or (at your option) version 3 or any later version | 8 | * the License or (at your option) version 3 or any later version | ||
8 | * accepted by the membership of KDE e.V. (or its successor approved | 9 | * accepted by the membership of KDE e.V. (or its successor approved | ||
9 | * by the membership of KDE e.V.), which shall act as a proxy | 10 | * by the membership of KDE e.V.), which shall act as a proxy | ||
10 | * defined in Section 14 of version 3 of the license. | 11 | * defined in Section 14 of version 3 of the license. | ||
Show All 11 Lines | |||||
22 | 23 | | |||
23 | #include <QScopedPointer> | 24 | #include <QScopedPointer> | ||
24 | #include <QPointer> | 25 | #include <QPointer> | ||
25 | 26 | | |||
26 | #include <KSharedConfig> | 27 | #include <KSharedConfig> | ||
27 | 28 | | |||
28 | #include <KNewStuff3/KNS3/DownloadDialog> | 29 | #include <KNewStuff3/KNS3/DownloadDialog> | ||
29 | 30 | | |||
30 | #include <KQuickAddons/ConfigModule> | 31 | #include <KQuickAddons/ManagedConfigModule> | ||
31 | 32 | | |||
32 | class QProcess; | 33 | class QProcess; | ||
33 | class QTemporaryFile; | 34 | class QTemporaryFile; | ||
34 | 35 | | |||
35 | namespace KIO | 36 | namespace KIO | ||
36 | { | 37 | { | ||
37 | class FileCopyJob; | 38 | class FileCopyJob; | ||
38 | } | 39 | } | ||
39 | 40 | | |||
40 | class ColorsModel; | 41 | class ColorsModel; | ||
41 | class FilterProxyModel; | 42 | class FilterProxyModel; | ||
43 | class ColorsSettings; | ||||
42 | 44 | | |||
43 | class KCMColors : public KQuickAddons::ConfigModule | 45 | class KCMColors : public KQuickAddons::ManagedConfigModule | ||
44 | { | 46 | { | ||
45 | Q_OBJECT | 47 | Q_OBJECT | ||
46 | 48 | | |||
47 | Q_PROPERTY(ColorsModel *model READ model CONSTANT) | 49 | Q_PROPERTY(ColorsModel *model READ model CONSTANT) | ||
48 | Q_PROPERTY(FilterProxyModel *filteredModel READ filteredModel CONSTANT) | 50 | Q_PROPERTY(FilterProxyModel *filteredModel READ filteredModel CONSTANT) | ||
49 | Q_PROPERTY(bool downloadingFile READ downloadingFile NOTIFY downloadingFileChanged) | 51 | Q_PROPERTY(bool downloadingFile READ downloadingFile NOTIFY downloadingFileChanged) | ||
50 | 52 | | |||
51 | public: | 53 | public: | ||
Show All 22 Lines | |||||
74 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | 76 | Q_INVOKABLE void getNewStuff(QQuickItem *ctx); | ||
75 | Q_INVOKABLE void installSchemeFromFile(const QUrl &url); | 77 | Q_INVOKABLE void installSchemeFromFile(const QUrl &url); | ||
76 | 78 | | |||
77 | Q_INVOKABLE void editScheme(const QString &schemeName, QQuickItem *ctx); | 79 | Q_INVOKABLE void editScheme(const QString &schemeName, QQuickItem *ctx); | ||
78 | 80 | | |||
79 | public Q_SLOTS: | 81 | public Q_SLOTS: | ||
80 | void load() override; | 82 | void load() override; | ||
81 | void save() override; | 83 | void save() override; | ||
82 | void defaults() override; | | |||
83 | 84 | | |||
84 | Q_SIGNALS: | 85 | Q_SIGNALS: | ||
85 | void selectedSchemeChanged(); | | |||
86 | void selectedSchemeIndexChanged(); | | |||
87 | void downloadingFileChanged(); | 86 | void downloadingFileChanged(); | ||
88 | 87 | | |||
89 | void showSuccessMessage(const QString &message); | 88 | void showSuccessMessage(const QString &message); | ||
90 | void showErrorMessage(const QString &message); | 89 | void showErrorMessage(const QString &message); | ||
91 | 90 | | |||
92 | void showSchemeNotInstalledWarning(const QString &schemeName); | 91 | void showSchemeNotInstalledWarning(const QString &schemeName); | ||
93 | 92 | | |||
94 | private: | 93 | private: | ||
95 | void saveColors(); | 94 | void saveColors(); | ||
96 | void processPendingDeletions(); | 95 | void processPendingDeletions(); | ||
97 | 96 | | |||
98 | void installSchemeFile(const QString &path); | 97 | void installSchemeFile(const QString &path); | ||
99 | 98 | | |||
100 | ColorsModel *m_model; | 99 | ColorsModel *m_model; | ||
101 | FilterProxyModel *m_filteredModel; | 100 | FilterProxyModel *m_filteredModel; | ||
101 | ColorsSettings *m_settings; | ||||
102 | 102 | | |||
103 | bool m_selectedSchemeDirty = false; | 103 | bool m_selectedSchemeDirty = false; | ||
104 | 104 | | |||
105 | bool m_applyToAlien = true; | 105 | bool m_applyToAlien = true; | ||
106 | 106 | | |||
107 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | 107 | QPointer<KNS3::DownloadDialog> m_newStuffDialog; | ||
108 | 108 | | |||
109 | QProcess *m_editDialogProcess = nullptr; | 109 | QProcess *m_editDialogProcess = nullptr; | ||
110 | 110 | | |||
111 | KSharedConfigPtr m_config; | 111 | KSharedConfigPtr m_config; | ||
112 | 112 | | |||
113 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | 113 | QScopedPointer<QTemporaryFile> m_tempInstallFile; | ||
114 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | 114 | QPointer<KIO::FileCopyJob> m_tempCopyJob; | ||
115 | 115 | | |||
116 | }; | 116 | }; |