Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/server_p.h
Show All 33 Lines | 31 | { | |||
---|---|---|---|---|---|
34 | //QString applicationIconName; | 34 | //QString applicationIconName; | ||
35 | QString reason; | 35 | QString reason; | ||
36 | QVariantMap hints; | 36 | QVariantMap hints; | ||
37 | }; | 37 | }; | ||
38 | 38 | | |||
39 | namespace NotificationManager | 39 | namespace NotificationManager | ||
40 | { | 40 | { | ||
41 | 41 | | |||
42 | class ServerInfo; | ||||
43 | | ||||
42 | class Q_DECL_HIDDEN ServerPrivate : public QObject, protected QDBusContext | 44 | class Q_DECL_HIDDEN ServerPrivate : public QObject, protected QDBusContext | ||
43 | { | 45 | { | ||
44 | Q_OBJECT | 46 | Q_OBJECT | ||
45 | 47 | | |||
46 | // DBus | 48 | // DBus | ||
47 | // Inhibitions | 49 | // Inhibitions | ||
48 | Q_PROPERTY(bool Inhibited READ inhibited) | 50 | Q_PROPERTY(bool Inhibited READ inhibited) | ||
49 | 51 | | |||
Show All 16 Lines | 52 | public: | |||
66 | void UnInhibit(uint cookie); | 68 | void UnInhibit(uint cookie); | ||
67 | bool inhibited() const; // property getter | 69 | bool inhibited() const; // property getter | ||
68 | 70 | | |||
69 | Q_SIGNALS: | 71 | Q_SIGNALS: | ||
70 | // DBus | 72 | // DBus | ||
71 | void NotificationClosed(uint id, uint reason); | 73 | void NotificationClosed(uint id, uint reason); | ||
72 | void ActionInvoked(uint id, const QString &actionKey); | 74 | void ActionInvoked(uint id, const QString &actionKey); | ||
73 | 75 | | |||
76 | void validChanged(); | ||||
77 | | ||||
74 | void inhibitedChanged(); | 78 | void inhibitedChanged(); | ||
75 | 79 | | |||
76 | void externalInhibitedChanged(); | 80 | void externalInhibitedChanged(); | ||
77 | void externalInhibitionsChanged(); | 81 | void externalInhibitionsChanged(); | ||
78 | 82 | | |||
79 | void serviceOwnershipLost(); | 83 | void serviceOwnershipLost(); | ||
80 | 84 | | |||
81 | public: // stuff used by public class | 85 | public: // stuff used by public class | ||
86 | friend class ServerInfo; | ||||
87 | static QString notificationServiceName(); | ||||
88 | | ||||
82 | bool init(); | 89 | bool init(); | ||
83 | uint add(const Notification ¬ification); | 90 | uint add(const Notification ¬ification); | ||
84 | 91 | | |||
92 | ServerInfo *currentOwner() const; | ||||
93 | | ||||
85 | // Server only handles external application inhibitions but we still want the Inhibited property | 94 | // Server only handles external application inhibitions but we still want the Inhibited property | ||
86 | // expose the actual inhibition state for applications to check. | 95 | // expose the actual inhibition state for applications to check. | ||
87 | void setInhibited(bool inhibited); | 96 | void setInhibited(bool inhibited); | ||
88 | 97 | | |||
89 | bool externalInhibited() const; | 98 | bool externalInhibited() const; | ||
90 | QList<Inhibition> externalInhibitions() const; | 99 | QList<Inhibition> externalInhibitions() const; | ||
91 | void clearExternalInhibitions(); | 100 | void clearExternalInhibitions(); | ||
92 | 101 | | |||
93 | bool m_valid = false; | 102 | bool m_valid = false; | ||
94 | uint m_highestNotificationId = 1; | 103 | uint m_highestNotificationId = 1; | ||
95 | 104 | | |||
96 | private slots: | 105 | private slots: | ||
97 | void onBroadcastNotification(const QMap<QString, QVariant> &properties); | 106 | void onBroadcastNotification(const QMap<QString, QVariant> &properties); | ||
98 | 107 | | |||
99 | private: | 108 | private: | ||
100 | void onServiceUnregistered(const QString &serviceName); | 109 | void onServiceOwnershipLost(const QString &serviceName); | ||
110 | void onInhibitionServiceUnregistered(const QString &serviceName); | ||||
111 | void onInhibitedChanged(); // emit DBus change signal | ||||
112 | | ||||
113 | bool m_dbusObjectValid = false; | ||||
114 | | ||||
115 | mutable QScopedPointer<ServerInfo> m_currentOwner; | ||||
101 | 116 | | |||
102 | QDBusServiceWatcher *m_inhibitionWatcher = nullptr; | 117 | QDBusServiceWatcher *m_inhibitionWatcher = nullptr; | ||
103 | uint m_highestInhibitionCookie = 0; | 118 | uint m_highestInhibitionCookie = 0; | ||
104 | QHash<uint /*cookie*/, Inhibition> m_externalInhibitions; | 119 | QHash<uint /*cookie*/, Inhibition> m_externalInhibitions; | ||
105 | QHash<uint /*cookie*/, QString> m_inhibitionServices; | 120 | QHash<uint /*cookie*/, QString> m_inhibitionServices; | ||
106 | 121 | | |||
107 | bool m_inhibited = false; | 122 | bool m_inhibited = false; | ||
108 | 123 | | |||
109 | Notification m_lastNotification; | 124 | Notification m_lastNotification; | ||
110 | 125 | | |||
111 | }; | 126 | }; | ||
112 | 127 | | |||
113 | } // namespace NotificationManager | 128 | } // namespace NotificationManager |