File indexing completed on 2024-04-21 03:56:27
0001 /* 0002 SPDX-FileCopyrightText: 2016 Martin Klapetek <mklapetek@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef FAKE_NOTIFICATIONS_SERVER_H 0008 #define FAKE_NOTIFICATIONS_SERVER_H 0009 0010 #include <QHash> 0011 #include <QObject> 0012 #include <QVariantMap> 0013 0014 class NotificationItem 0015 { 0016 public: 0017 QString app_name; 0018 uint replaces_id; 0019 QString app_icon; 0020 QString summary; 0021 QString body; 0022 QStringList actions; 0023 QVariantMap hints; 0024 int timeout; 0025 uint id; 0026 }; 0027 0028 class NotificationsServer : public QObject 0029 { 0030 Q_OBJECT 0031 Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications") 0032 0033 public: 0034 NotificationsServer(QObject *parent = nullptr); 0035 0036 uint counter; 0037 QList<NotificationItem> notifications; 0038 0039 public Q_SLOTS: 0040 uint Notify(const QString &app_name, 0041 uint replaces_id, 0042 const QString &app_icon, 0043 const QString &summary, 0044 const QString &body, 0045 const QStringList &actions, 0046 const QVariantMap &hints, 0047 int timeout); 0048 0049 void CloseNotification(uint id); 0050 0051 QStringList GetCapabilities(); 0052 0053 QString GetServerInformation(QString &vendor, QString &version, QString &specVersion); 0054 0055 Q_SIGNALS: 0056 void NotificationClosed(uint id, uint reason); 0057 void ActionInvoked(uint id, const QString &actionKey); 0058 0059 void newNotification(); 0060 }; 0061 0062 #endif