1 #ifndef MISC_UTILS_NOTIFICATION_H 2 #define MISC_UTILS_NOTIFICATION_H 9 QT_FORWARD_DECLARE_CLASS(QDBusPendingCallWatcher)
11 class OrgFreedesktopNotificationsInterface;
35 Q_PROPERTY(QString title READ title WRITE setTitle)
36 Q_PROPERTY(QString message READ message WRITE setMessage)
37 Q_PROPERTY(QString icon READ icon WRITE setIcon)
38 Q_PROPERTY(
int timeout READ timeout WRITE setTimeout)
39 Q_PROPERTY(QStringList actions READ actions WRITE setActions)
40 Q_PROPERTY(
bool visible READ isVisible)
44 explicit
DBusNotification(const QString &title, const QString &icon,
int timeout = 10000, QObject *parent =
nullptr);
47 static
bool isAvailable();
48 const QString &title() const;
49 void setTitle(const QString &title);
50 const QString &message() const;
51 void setMessage(const QString &message);
52 const QString &icon() const;
53 void setIcon(const QString &icon);
56 void setTimeout(
int timeout);
57 const QStringList &actions() const;
58 void setActions(const QStringList &actions);
59 const QVariantMap &hints() const;
61 bool isVisible() const;
62 void deleteOnCloseOrError();
66 bool show(const QString &message);
67 bool update(const QString &line);
78 void actionInvoked(const QString &action);
81 void handleNotifyResult(QDBusPendingCallWatcher *);
82 static
void handleNotificationClosed(uint
id, uint reason);
83 static
void handleActionInvoked(uint
id, const QString &action);
86 static
void initInterface();
89 QDBusPendingCallWatcher *m_watcher;
94 QStringList m_actions;
96 static OrgFreedesktopNotificationsInterface *m_dbusInterface;
176 #endif // MISC_UTILS_NOTIFICATION_H void setIcon(const QString &icon)
Sets the icon name.
void setActions(const QStringList &actions)
Sets the list of available actions.
void setMessage(const QString &message)
Sets the message to be shown.
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
bool isVisible() const
Returns whether the notification is (still) visible.
void setTitle(const QString &title)
void setTimeout(int timeout)
Sets the number of milliseconds the notification will be visible after calling show().
const QStringList & actions() const
const QVariantMap & hints() const
The DBusNotification class emits D-Bus notifications.
const QString & icon() const
const QString & message() const