// // Created by zpf on 23-1-31. // #ifndef UKUI_NOTIFICATION_SERVER_PRIVATE_H #define UKUI_NOTIFICATION_SERVER_PRIVATE_H #include #include #include class QDBusServiceWatcher; namespace NotificationServer { class Notification { friend class ServerPrivate; QString m_appName; uint m_id = 0; QString m_appIcon; QString m_summary; QString m_body; QStringList m_actions; QVariantMap m_hints; int m_timeout; }; class ServerPrivate : public QObject, protected QDBusContext { Q_OBJECT //dbus interface public: QStringList GetCapabilities() const; uint Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout); void CloseNotification(uint id); QString GetServerInformation(QString &vendor, QString &version, QString &spec_version) const; /** * 注册成为通知中心客户端 */ void RegisterClient(); /** * 注销 */ void UnRegisterClient(); /** * 通知中心关闭通知 * @param id 通知id * @param reason 关闭原因 */ void CloseNotification(uint id, uint); void InvokeAction(uint id, const QString &action_key); Q_SIGNALS: void NotificationClosed(uint id, uint reason); void ActionInvoked(uint id, const QString &actionKey); void ActivationToken(uint id, const QString &ActivationToken); public: explicit ServerPrivate(QObject *parent = nullptr); ~ServerPrivate() override; bool init(); static QString notificationServiceName(); static QString notificationServicePath(); static QString notificationServiceInterface(); private: void sendCache(); QDBusServiceWatcher *m_notificationWatchers = nullptr; uint m_increasedNotificationId = 1; QVector m_notificationsCache; }; } // NotificationServer #endif //UKUI_NOTIFICATION_SERVER_PRIVATE_H