Plasma-workspace

notification.h
1/*
2 SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#pragma once
8
9#include <QDateTime>
10#include <QImage>
11#include <QList>
12#include <QString>
13#include <QUrl>
14
15#include "notifications.h"
16
17#include "notificationmanager_export.h"
18
19namespace NotificationManager
20{
21/**
22 * @short Represents a single notification.
23 *
24 * @author Kai Uwe Broulik <kde@privat.broulik.de>
25 **/
26class NOTIFICATIONMANAGER_EXPORT Notification
27{
28public:
29 explicit Notification(uint id = 0);
30
31 Notification(const Notification &other);
32 Notification(Notification &&other) Q_DECL_NOEXCEPT;
33
34 Notification &operator=(const Notification &other);
35 Notification &operator=(Notification &&other) Q_DECL_NOEXCEPT;
36
37 virtual ~Notification();
38
39 uint id() const;
40
41 QString dBusService() const;
42 void setDBusService(const QString &dBusService);
43
44 // Creation time of the original notification
45 QDateTime created() const;
46 void setCreated(const QDateTime &created);
47
48 // Last time it was updated, or invalid if it never was
49 QDateTime updated() const;
50 void resetUpdated();
51
52 bool read() const;
53 void setRead(bool read);
54
55 QString summary() const;
56 void setSummary(const QString &summary);
57
58 QString body() const;
59 void setBody(const QString &body);
60
61 // This returns the raw body data as provided by the notification
62 // this is useful when you want to html sanitization at different
63 // stage then the notification server.
64 QString rawBody() const;
65
66 QString icon() const;
67 void setIcon(const QString &icon);
68
69 QImage image() const;
70 void setImage(const QImage &image);
71
72 QString desktopEntry() const;
73 void setDesktopEntry(const QString &desktopEntry);
74
75 QString notifyRcName() const;
76 QString eventId() const;
77
78 QString applicationName() const;
79 void setApplicationName(const QString &applicationName);
80
81 QString applicationIconName() const;
82 void setApplicationIconName(const QString &applicationIconName);
83
84 QString originName() const;
85
86 // should we group the two into a QPair or something?
87 QStringList actionNames() const;
88 QStringList actionLabels() const;
89 bool hasDefaultAction() const;
90 QString defaultActionLabel() const;
91 void setActions(const QStringList &actions);
92
93 QList<QUrl> urls() const;
94 void setUrls(const QList<QUrl> &urls);
95
96 // FIXME use separate enum again
97 Notifications::Urgency urgency() const;
98 void setUrgency(Notifications::Urgency urgency);
99
100 bool userActionFeedback() const;
101
102 int timeout() const;
103 void setTimeout(int timeout);
104
105 bool configurable() const;
106 QString configureActionLabel() const;
107
108 bool hasReplyAction() const;
109 QString replyActionLabel() const;
110 QString replyPlaceholderText() const;
111 QString replySubmitButtonText() const;
112 QString replySubmitButtonIconName() const;
113
114 QString category() const;
115
116 bool expired() const;
117 void setExpired(bool expired);
118
119 bool dismissed() const;
120 void setDismissed(bool dismissed);
121
122 bool resident() const;
123 void setResident(bool resident);
124
125 bool transient() const;
126 void setTransient(bool transient);
127
128 // Little bit of mess here, we want to sometime keep track of processed hints, and not process it.
129 QVariantMap hints() const;
130 void setHints(const QVariantMap &hints);
131
132 void processHints(const QVariantMap &hints);
133
134private:
135 friend class NotificationsModel;
136 friend class AbstractNotificationsModel;
137 friend class ServerPrivate;
138
139 class Private;
140 Private *d;
141};
142
143} // namespace NotificationManager
Represents a single notification.
Urgency
The notification urgency.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:42 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.