Changeset View
Changeset View
Standalone View
Standalone View
kcms/notifications/kcm.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (c) 2019 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * 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 | * published by the Free Software Foundation; either version 2 of | ||||
7 | * 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 | * 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 | * | ||||
12 | * This program is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | * GNU General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU General Public License | ||||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | #pragma once | ||||
22 | | ||||
23 | #include <KQuickAddons/ConfigModule> | ||||
24 | | ||||
25 | class SourcesModel; | ||||
26 | class FilterProxyModel; | ||||
27 | | ||||
28 | namespace NotificationManager { | ||||
29 | class Settings; | ||||
30 | } | ||||
31 | | ||||
32 | class KCMNotifications : public KQuickAddons::ConfigModule | ||||
33 | { | ||||
34 | Q_OBJECT | ||||
35 | | ||||
36 | Q_PROPERTY(SourcesModel *sourcesModel READ sourcesModel CONSTANT) | ||||
37 | Q_PROPERTY(FilterProxyModel *filteredModel READ filteredModel CONSTANT) | ||||
38 | | ||||
39 | Q_PROPERTY(NotificationManager::Settings *settings READ settings CONSTANT) | ||||
40 | | ||||
41 | // So it can show the respective settings module right away | ||||
42 | Q_PROPERTY(QString initialDesktopEntry READ initialDesktopEntry WRITE setInitialDesktopEntry NOTIFY initialDesktopEntryChanged) | ||||
43 | Q_PROPERTY(QString initialNotifyRcName READ initialNotifyRcName WRITE setInitialNotifyRcName NOTIFY initialNotifyRcNameChanged) | ||||
44 | Q_PROPERTY(QString initialEventId READ initialEventId WRITE setInitialEventId NOTIFY initialEventIdChanged) | ||||
45 | | ||||
46 | public: | ||||
47 | KCMNotifications(QObject *parent, const QVariantList &args); | ||||
48 | ~KCMNotifications() override; | ||||
49 | | ||||
50 | SourcesModel *sourcesModel() const; | ||||
51 | FilterProxyModel *filteredModel() const; | ||||
52 | | ||||
53 | NotificationManager::Settings *settings() const; | ||||
54 | | ||||
55 | QString initialDesktopEntry() const; | ||||
56 | void setInitialDesktopEntry(const QString &desktopEntry); | ||||
57 | | ||||
58 | QString initialNotifyRcName() const; | ||||
59 | void setInitialNotifyRcName(const QString ¬ifyRcName); | ||||
60 | | ||||
61 | QString initialEventId() const; | ||||
62 | void setInitialEventId(const QString &eventId); | ||||
63 | | ||||
64 | Q_INVOKABLE void configureEvents(const QString ¬ifyRcName, const QString &eventId, QQuickItem *ctx = nullptr); | ||||
65 | | ||||
66 | public Q_SLOTS: | ||||
67 | void load() override; | ||||
68 | void save() override; | ||||
69 | void defaults() override; | ||||
70 | | ||||
71 | signals: | ||||
72 | void initialDesktopEntryChanged(); | ||||
73 | void initialNotifyRcNameChanged(); | ||||
74 | void initialEventIdChanged(); | ||||
75 | | ||||
76 | private: | ||||
77 | void processPendingDeletions(); | ||||
78 | | ||||
79 | SourcesModel *m_sourcesModel; | ||||
80 | FilterProxyModel *m_filteredModel; | ||||
81 | | ||||
82 | NotificationManager::Settings *m_settings; | ||||
83 | | ||||
84 | QString m_initialDesktopEntry; | ||||
85 | QString m_initialNotifyRcName; | ||||
86 | QString m_initialEventId; | ||||
87 | | ||||
88 | }; |