Changeset View
Changeset View
Standalone View
Standalone View
kcms/notifications/kcm.h
Show All 32 Lines | |||||
33 | { | 33 | { | ||
34 | Q_OBJECT | 34 | Q_OBJECT | ||
35 | 35 | | |||
36 | Q_PROPERTY(SourcesModel *sourcesModel READ sourcesModel CONSTANT) | 36 | Q_PROPERTY(SourcesModel *sourcesModel READ sourcesModel CONSTANT) | ||
37 | Q_PROPERTY(FilterProxyModel *filteredModel READ filteredModel CONSTANT) | 37 | Q_PROPERTY(FilterProxyModel *filteredModel READ filteredModel CONSTANT) | ||
38 | 38 | | |||
39 | Q_PROPERTY(NotificationManager::Settings *settings READ settings CONSTANT) | 39 | Q_PROPERTY(NotificationManager::Settings *settings READ settings CONSTANT) | ||
40 | 40 | | |||
41 | Q_PROPERTY(ServerStatus serverStatus READ serverStatus NOTIFY serverStatusChanged) | ||||
42 | Q_PROPERTY(QString serverVendor READ serverVendor NOTIFY serverVendorChanged) | ||||
43 | // Name of the notification server, as provided by the service, e.g. "Plasma" | ||||
44 | // This is *not* the binary name | ||||
45 | Q_PROPERTY(QString serverName READ serverName NOTIFY serverNameChanged) | ||||
46 | | ||||
41 | // So it can show the respective settings module right away | 47 | // So it can show the respective settings module right away | ||
42 | Q_PROPERTY(QString initialDesktopEntry READ initialDesktopEntry WRITE setInitialDesktopEntry NOTIFY initialDesktopEntryChanged) | 48 | Q_PROPERTY(QString initialDesktopEntry READ initialDesktopEntry WRITE setInitialDesktopEntry NOTIFY initialDesktopEntryChanged) | ||
43 | Q_PROPERTY(QString initialNotifyRcName READ initialNotifyRcName WRITE setInitialNotifyRcName NOTIFY initialNotifyRcNameChanged) | 49 | Q_PROPERTY(QString initialNotifyRcName READ initialNotifyRcName WRITE setInitialNotifyRcName NOTIFY initialNotifyRcNameChanged) | ||
44 | Q_PROPERTY(QString initialEventId READ initialEventId WRITE setInitialEventId NOTIFY initialEventIdChanged) | 50 | Q_PROPERTY(QString initialEventId READ initialEventId WRITE setInitialEventId NOTIFY initialEventIdChanged) | ||
45 | 51 | | |||
46 | public: | 52 | public: | ||
47 | KCMNotifications(QObject *parent, const QVariantList &args); | 53 | KCMNotifications(QObject *parent, const QVariantList &args); | ||
48 | ~KCMNotifications() override; | 54 | ~KCMNotifications() override; | ||
49 | 55 | | |||
56 | enum class ServerStatus { | ||||
57 | Unknown = -1, | ||||
58 | NotRunning, | ||||
59 | Running | ||||
60 | }; | ||||
61 | Q_ENUM(ServerStatus) | ||||
62 | | ||||
50 | SourcesModel *sourcesModel() const; | 63 | SourcesModel *sourcesModel() const; | ||
51 | FilterProxyModel *filteredModel() const; | 64 | FilterProxyModel *filteredModel() const; | ||
52 | 65 | | |||
53 | NotificationManager::Settings *settings() const; | 66 | NotificationManager::Settings *settings() const; | ||
54 | 67 | | |||
68 | ServerStatus serverStatus() const; | ||||
69 | Q_SIGNAL void serverStatusChanged(); | ||||
70 | QString serverVendor() const; | ||||
71 | Q_SIGNAL void serverVendorChanged(); | ||||
72 | QString serverName() const; | ||||
73 | Q_SIGNAL void serverNameChanged(); | ||||
74 | | ||||
55 | QString initialDesktopEntry() const; | 75 | QString initialDesktopEntry() const; | ||
56 | void setInitialDesktopEntry(const QString &desktopEntry); | 76 | void setInitialDesktopEntry(const QString &desktopEntry); | ||
57 | 77 | | |||
58 | QString initialNotifyRcName() const; | 78 | QString initialNotifyRcName() const; | ||
59 | void setInitialNotifyRcName(const QString ¬ifyRcName); | 79 | void setInitialNotifyRcName(const QString ¬ifyRcName); | ||
60 | 80 | | |||
61 | QString initialEventId() const; | 81 | QString initialEventId() const; | ||
62 | void setInitialEventId(const QString &eventId); | 82 | void setInitialEventId(const QString &eventId); | ||
63 | 83 | | |||
64 | Q_INVOKABLE void configureEvents(const QString ¬ifyRcName, const QString &eventId, QQuickItem *ctx = nullptr); | 84 | Q_INVOKABLE void configureEvents(const QString ¬ifyRcName, const QString &eventId, QQuickItem *ctx = nullptr); | ||
65 | 85 | | |||
66 | public Q_SLOTS: | 86 | public Q_SLOTS: | ||
67 | void load() override; | 87 | void load() override; | ||
68 | void save() override; | 88 | void save() override; | ||
69 | void defaults() override; | 89 | void defaults() override; | ||
70 | 90 | | |||
71 | signals: | 91 | signals: | ||
72 | void initialDesktopEntryChanged(); | 92 | void initialDesktopEntryChanged(); | ||
73 | void initialNotifyRcNameChanged(); | 93 | void initialNotifyRcNameChanged(); | ||
74 | void initialEventIdChanged(); | 94 | void initialEventIdChanged(); | ||
75 | 95 | | |||
76 | private: | 96 | private: | ||
77 | void processPendingDeletions(); | 97 | void processPendingDeletions(); | ||
78 | 98 | | |||
99 | void setServerStatus(ServerStatus status); | ||||
100 | void setServerInformation(const QString &vendor, const QString &name); | ||||
101 | void updateServerName(); | ||||
102 | | ||||
79 | SourcesModel *m_sourcesModel; | 103 | SourcesModel *m_sourcesModel; | ||
80 | FilterProxyModel *m_filteredModel; | 104 | FilterProxyModel *m_filteredModel; | ||
81 | 105 | | |||
82 | NotificationManager::Settings *m_settings; | 106 | NotificationManager::Settings *m_settings; | ||
83 | 107 | | |||
108 | ServerStatus m_serverStatus = ServerStatus::Unknown; | ||||
109 | QString m_serverVendor; | ||||
110 | QString m_serverName; | ||||
111 | | ||||
84 | QString m_initialDesktopEntry; | 112 | QString m_initialDesktopEntry; | ||
85 | QString m_initialNotifyRcName; | 113 | QString m_initialNotifyRcName; | ||
86 | QString m_initialEventId; | 114 | QString m_initialEventId; | ||
87 | 115 | | |||
88 | }; | 116 | }; |