Changeset View
Changeset View
Standalone View
Standalone View
plugins/notifications/notification.h
Show All 20 Lines | |||||
21 | #ifndef NOTIFICATION_H | 21 | #ifndef NOTIFICATION_H | ||
22 | #define NOTIFICATION_H | 22 | #define NOTIFICATION_H | ||
23 | 23 | | |||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | #include <QString> | 25 | #include <QString> | ||
26 | #include <KNotification> | 26 | #include <KNotification> | ||
27 | #include <QDir> | 27 | #include <QDir> | ||
28 | 28 | | |||
29 | #include <core/networkpackage.h> | 29 | #include <core/networkpacket.h> | ||
30 | 30 | | |||
31 | class Notification | 31 | class Notification | ||
32 | : public QObject | 32 | : public QObject | ||
33 | { | 33 | { | ||
34 | Q_OBJECT | 34 | Q_OBJECT | ||
35 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.notifications.notification") | 35 | Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.notifications.notification") | ||
36 | Q_PROPERTY(QString internalId READ internalId) | 36 | Q_PROPERTY(QString internalId READ internalId) | ||
37 | Q_PROPERTY(QString appName READ appName) | 37 | Q_PROPERTY(QString appName READ appName) | ||
38 | Q_PROPERTY(QString ticker READ ticker) | 38 | Q_PROPERTY(QString ticker READ ticker) | ||
39 | Q_PROPERTY(QString title READ title) | 39 | Q_PROPERTY(QString title READ title) | ||
40 | Q_PROPERTY(QString text READ text) | 40 | Q_PROPERTY(QString text READ text) | ||
41 | Q_PROPERTY(QString iconPath READ iconPath) | 41 | Q_PROPERTY(QString iconPath READ iconPath) | ||
42 | Q_PROPERTY(bool dismissable READ dismissable) | 42 | Q_PROPERTY(bool dismissable READ dismissable) | ||
43 | Q_PROPERTY(bool hasIcon READ hasIcon) | 43 | Q_PROPERTY(bool hasIcon READ hasIcon) | ||
44 | Q_PROPERTY(bool silent READ silent) | 44 | Q_PROPERTY(bool silent READ silent) | ||
45 | Q_PROPERTY(QString replyId READ replyId) | 45 | Q_PROPERTY(QString replyId READ replyId) | ||
46 | 46 | | |||
47 | public: | 47 | public: | ||
48 | Notification(const NetworkPackage& np, QObject* parent); | 48 | Notification(const NetworkPacket& np, QObject* parent); | ||
49 | ~Notification() override; | 49 | ~Notification() override; | ||
50 | 50 | | |||
51 | QString internalId() const { return m_internalId; } | 51 | QString internalId() const { return m_internalId; } | ||
52 | QString appName() const { return m_appName; } | 52 | QString appName() const { return m_appName; } | ||
53 | QString ticker() const { return m_ticker; } | 53 | QString ticker() const { return m_ticker; } | ||
54 | QString title() const { return m_title; } | 54 | QString title() const { return m_title; } | ||
55 | QString text() const { return m_text; } | 55 | QString text() const { return m_text; } | ||
56 | QString iconPath() const { return m_iconPath; } | 56 | QString iconPath() const { return m_iconPath; } | ||
57 | bool dismissable() const { return m_dismissable; } | 57 | bool dismissable() const { return m_dismissable; } | ||
58 | QString replyId() const { return m_requestReplyId; } | 58 | QString replyId() const { return m_requestReplyId; } | ||
59 | bool hasIcon() const { return m_hasIcon; } | 59 | bool hasIcon() const { return m_hasIcon; } | ||
60 | void show(); | 60 | void show(); | ||
61 | bool silent() const { return m_silent; } | 61 | bool silent() const { return m_silent; } | ||
62 | void update(const NetworkPackage& np); | 62 | void update(const NetworkPacket& np); | ||
63 | bool isReady() const { return m_ready; } | 63 | bool isReady() const { return m_ready; } | ||
64 | KNotification* createKNotification(bool update, const NetworkPackage& np); | 64 | KNotification* createKNotification(bool update, const NetworkPacket& np); | ||
65 | 65 | | |||
66 | public Q_SLOTS: | 66 | public Q_SLOTS: | ||
67 | Q_SCRIPTABLE void dismiss(); | 67 | Q_SCRIPTABLE void dismiss(); | ||
68 | Q_SCRIPTABLE void reply(); | 68 | Q_SCRIPTABLE void reply(); | ||
69 | void closed(); | 69 | void closed(); | ||
70 | 70 | | |||
71 | Q_SIGNALS: | 71 | Q_SIGNALS: | ||
72 | void dismissRequested(const QString& m_internalId); | 72 | void dismissRequested(const QString& m_internalId); | ||
Show All 12 Lines | 76 | private: | |||
85 | bool m_hasIcon; | 85 | bool m_hasIcon; | ||
86 | KNotification* m_notification; | 86 | KNotification* m_notification; | ||
87 | QDir m_imagesDir; | 87 | QDir m_imagesDir; | ||
88 | bool m_silent; | 88 | bool m_silent; | ||
89 | bool m_closed; | 89 | bool m_closed; | ||
90 | QString m_payloadHash; | 90 | QString m_payloadHash; | ||
91 | bool m_ready; | 91 | bool m_ready; | ||
92 | 92 | | |||
93 | void parseNetworkPackage(const NetworkPackage& np); | 93 | void parseNetworkPacket(const NetworkPacket& np); | ||
94 | void loadIcon(const NetworkPackage& np); | 94 | void loadIcon(const NetworkPacket& np); | ||
95 | void applyIcon(); | 95 | void applyIcon(); | ||
96 | void applyNoIcon(); | 96 | void applyNoIcon(); | ||
97 | }; | 97 | }; | ||
98 | 98 | | |||
99 | #endif | 99 | #endif |