File indexing completed on 2024-04-28 16:54:35
0001 /* 0002 SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QDateTime> 0010 #include <QImage> 0011 #include <QList> 0012 #include <QString> 0013 #include <QUrl> 0014 0015 #include "notifications.h" 0016 0017 #include "notificationmanager_export.h" 0018 0019 namespace NotificationManager 0020 { 0021 /** 0022 * @short Represents a single notification. 0023 * 0024 * @author Kai Uwe Broulik <kde@privat.broulik.de> 0025 **/ 0026 class NOTIFICATIONMANAGER_EXPORT Notification 0027 { 0028 public: 0029 explicit Notification(uint id = 0); 0030 0031 Notification(const Notification &other); 0032 Notification(Notification &&other) Q_DECL_NOEXCEPT; 0033 0034 Notification &operator=(const Notification &other); 0035 Notification &operator=(Notification &&other) Q_DECL_NOEXCEPT; 0036 0037 virtual ~Notification(); 0038 0039 uint id() const; 0040 0041 QString dBusService() const; 0042 void setDBusService(const QString &dBusService); 0043 0044 // Creation time of the original notification 0045 QDateTime created() const; 0046 void setCreated(const QDateTime &created); 0047 0048 // Last time it was updated, or invalid if it never was 0049 QDateTime updated() const; 0050 void resetUpdated(); 0051 0052 bool read() const; 0053 void setRead(bool read); 0054 0055 QString summary() const; 0056 void setSummary(const QString &summary); 0057 0058 QString body() const; 0059 void setBody(const QString &body); 0060 0061 // This returns the raw body data as provided by the notification 0062 // this is useful when you want to html sanitization at different 0063 // stage then the notification server. 0064 QString rawBody() const; 0065 0066 QString icon() const; 0067 void setIcon(const QString &icon); 0068 0069 QImage image() const; 0070 void setImage(const QImage &image); 0071 0072 QString desktopEntry() const; 0073 void setDesktopEntry(const QString &desktopEntry); 0074 0075 QString notifyRcName() const; 0076 QString eventId() const; 0077 0078 QString applicationName() const; 0079 void setApplicationName(const QString &applicationName); 0080 0081 QString applicationIconName() const; 0082 void setApplicationIconName(const QString &applicationIconName); 0083 0084 QString originName() const; 0085 0086 // should we group the two into a QPair or something? 0087 QStringList actionNames() const; 0088 QStringList actionLabels() const; 0089 bool hasDefaultAction() const; 0090 QString defaultActionLabel() const; 0091 void setActions(const QStringList &actions); 0092 0093 QList<QUrl> urls() const; 0094 void setUrls(const QList<QUrl> &urls); 0095 0096 // FIXME use separate enum again 0097 Notifications::Urgency urgency() const; 0098 void setUrgency(Notifications::Urgency urgency); 0099 0100 bool userActionFeedback() const; 0101 0102 int timeout() const; 0103 void setTimeout(int timeout); 0104 0105 bool configurable() const; 0106 QString configureActionLabel() const; 0107 0108 bool hasReplyAction() const; 0109 QString replyActionLabel() const; 0110 QString replyPlaceholderText() const; 0111 QString replySubmitButtonText() const; 0112 QString replySubmitButtonIconName() const; 0113 0114 QString category() const; 0115 0116 bool expired() const; 0117 void setExpired(bool expired); 0118 0119 bool dismissed() const; 0120 void setDismissed(bool dismissed); 0121 0122 bool resident() const; 0123 void setResident(bool resident); 0124 0125 bool transient() const; 0126 void setTransient(bool transient); 0127 0128 // Little bit of mess here, we want to sometime keep track of processed hints, and not process it. 0129 QVariantMap hints() const; 0130 void setHints(const QVariantMap &hints); 0131 0132 void processHints(const QVariantMap &hints); 0133 0134 private: 0135 friend class NotificationsModel; 0136 friend class AbstractNotificationsModel; 0137 friend class ServerPrivate; 0138 0139 class Private; 0140 Private *d; 0141 }; 0142 0143 } // namespace NotificationManager