dtknotifications
notification development tool kit
dnotificationmanager.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 Uniontech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#pragma once
6
10#include <dexpected.h>
11
12DNOTIFICATIONS_BEGIN_NAMESPACE
13DCORE_USE_NAMESPACE
14
15class DNotificationManagerPrivate;
16class DNotificationManager : public QObject
17{
18 Q_OBJECT
19public:
20 explicit DNotificationManager(QObject *parent = nullptr);
21 virtual ~DNotificationManager();
22 QList<QString> recordIds() const;
23
24public Q_SLOTS:
25 DExpected<QList<DNotificationData>> allRecords() const;
26 DExpected<QList<DNotificationData>> getRecordsFromId(int rowCount, const QString &offsetId);
27 DExpected<DNotificationData> getRecordById(const QString &id);
28 DExpected<int> recordCount();
29 DExpected<void> clearRecords();
30 DExpected<void> removeRecord(const QString &id);
31
32 DExpected<ServerInformation> serverInformation();
33 DExpected<QStringList> capbilities();
34
35 DExpected<uint> notify(const QString &appName, uint replacesId,
36 const QString &appIcon, const QString &summary,
37 const QString &body = QString(), const QStringList &actions = QStringList(),
38 const QVariantMap hints = QVariantMap(), int expireTimeout = 5000);
39 DExpected<void> closeNotification(uint id);
40
41 DExpected<QStringList> appList();
42
43 DNotificationAppConfigPtr notificationAppConfig(const QString &id) const;
44 DNotificationDNDModeConfigPtr notificationDNDModeConfig() const;
45 QList<DAbstractNotificationModeConfigPtr> notificationModeConfigs() const;
46
47 DExpected<void> toggleNotificationCenter();
48 DExpected<void> showNotificationCenter();
49 DExpected<void> hideNotificationCenter();
50
51Q_SIGNALS:
52 void actionInvoked(uint id, const QString &actionId);
53 void notificationClosed(uint id, ClosedReason closedReason);
54 void recordAdded(const QString &);
55 void appNotificationConfigChanged(const QString &id, AppNotificationConfigItem item, QVariant var);
56 void dndModeNotificationConfigChanged(DNDModeNotificaitonConfigItem item, QVariant var);
57 void appAdded(const QString &id);
58 void appRemoved(const QString &id);
59
60private:
61 QScopedPointer<DNotificationManagerPrivate> d_ptr;
62 Q_DECLARE_PRIVATE(DNotificationManager)
63};
64
65DNOTIFICATIONS_END_NAMESPACE
DNotificationManager类
Definition: dnotificationmanager.h:17
DExpected< QStringList > capbilities()
获取服务端的能力
DExpected< void > closeNotification(uint id)
关闭id的通知
DExpected< ServerInformation > serverInformation()
获取服务端的信息
DNotificationManager(QObject *parent=nullptr)
构造manager对象,并且进行信号的连接
DExpected< int > recordCount()
获取消息记录的数量
DExpected< void > clearRecords()
清空消息记录
DExpected< DNotificationData > getRecordById(const QString &id)
获取id为offsetId的消息记录
DExpected< uint > notify(const QString &appName, uint replacesId, const QString &appIcon, const QString &summary, const QString &body=QString(), const QStringList &actions=QStringList(), const QVariantMap hints=QVariantMap(), int expireTimeout=5000)
判断密码是否合法
QList< QString > recordIds() const
获取所有消息记录的id
DExpected< QStringList > appList()
获取通知应用列表
DExpected< void > removeRecord(const QString &id)
移除消息记录id
AppNotificationConfigItem
应用通知配置信息
Definition: dnotificationtypes.h:65
ClosedReason
通知关闭原因
Definition: dnotificationtypes.h:58
DNDModeNotificaitonConfigItem
应用通知配置信息
Definition: dnotificationtypes.h:75