summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2016-06-12 15:44:00 +0200
committerJavier <dev.git@javispedro.com>2016-06-12 15:44:00 +0200
commite555e7549d369feaf2e6176a75a5f56fe2774995 (patch)
treecd95e3c2656b0e20a955f3e01b7aa6583dbf9d66
parent5f0258acc1c18db4f1bc40e40cdb01a9f0e16ab2 (diff)
downloadlibwatchfish-e555e7549d369feaf2e6176a75a5f56fe2774995.tar.gz
libwatchfish-e555e7549d369feaf2e6176a75a5f56fe2774995.zip
add category property to Notification
-rw-r--r--notification.cpp16
-rw-r--r--notification.h6
-rw-r--r--notificationmonitor.cpp2
3 files changed, 24 insertions, 0 deletions
diff --git a/notification.cpp b/notification.cpp
index e57006a..d0addbd 100644
--- a/notification.cpp
+++ b/notification.cpp
@@ -45,6 +45,7 @@ struct NotificationPrivate
QString body;
QDateTime timestamp;
QString icon;
+ QString category;
quint8 urgency;
bool transient;
QString previewSummary;
@@ -158,6 +159,21 @@ void Notification::setIcon(const QString &icon)
}
}
+QString Notification::category() const
+{
+ Q_D(const Notification);
+ return d->category;
+}
+
+void Notification::setCategory(const QString &category)
+{
+ Q_D(Notification);
+ if (category != d->category) {
+ d->category = category;
+ emit categoryChanged();
+ }
+}
+
int Notification::urgency() const
{
Q_D(const Notification);
diff --git a/notification.h b/notification.h
index 2eb00f1..36690c4 100644
--- a/notification.h
+++ b/notification.h
@@ -44,6 +44,8 @@ class Notification : public QObject
Q_PROPERTY(QDateTime timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged)
/** Icon file path */
Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
+ /** Category ID */
+ Q_PROPERTY(QString category READ category WRITE setCategory NOTIFY categoryChanged)
Q_PROPERTY(int urgency READ urgency WRITE setUrgency NOTIFY urgencyChanged)
Q_PROPERTY(bool transient READ transient WRITE setTransient NOTIFY transientChanged)
@@ -86,6 +88,9 @@ public:
QString icon() const;
void setIcon(const QString &icon);
+ QString category() const;
+ void setCategory(const QString &category);
+
int urgency() const;
void setUrgency(int urgency);
@@ -112,6 +117,7 @@ signals:
void bodyChanged();
void timestampChanged();
void iconChanged();
+ void categoryChanged();
void urgencyChanged();
void transientChanged();
diff --git a/notificationmonitor.cpp b/notificationmonitor.cpp
index 5e159ec..60e226a 100644
--- a/notificationmonitor.cpp
+++ b/notificationmonitor.cpp
@@ -114,6 +114,8 @@ void NotificationMonitorPrivate::processIncomingNotification(quint32 id, const P
n->setTimestamp(QDateTime::currentDateTime());
}
+ n->setCategory(proto.hints.value("category"));
+
n->setPreviewSummary(proto.hints.value("x-nemo-preview-summary"));
n->setPreviewBody(proto.hints.value("x-nemo-preview-body"));