fix(libukui-notification):修复通知通知时无关闭信号的问题

This commit is contained in:
iaom 2023-11-14 16:37:11 +08:00
parent 01486bf1a8
commit 6d76b0bd22
2 changed files with 4 additions and 7 deletions

View File

@ -31,11 +31,7 @@ NotificationClientPrivate::NotificationClientPrivate(NotificationClient *q) : QO
NotificationClientPrivate::~NotificationClientPrivate()
{
if(m_notificationsInterface) {
m_notificationsInterface->call(QDBus::NoBlock, QStringLiteral("UnRegisterClient"));
delete m_notificationsInterface;
m_notificationsInterface = nullptr;
}
unregisterClient();
}
bool NotificationClientPrivate::init()
@ -158,7 +154,7 @@ bool NotificationClientPrivate::closeNotification(uint id, NotificationCloseReas
if(!m_serverInterface) {
return false;
}
QDBusMessage reply = m_serverInterface->callWithArgumentList(QDBus::NoBlock, QStringLiteral("CloseNotification"), {id, reason});
QDBusMessage reply = m_serverInterface->callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("CloseNotification"), {id, static_cast<uint32_t>(reason)});
if (reply.type() == QDBusMessage::ErrorMessage) {
qWarning() << "Failed to call CloseNotification!" << QDBusConnection::sessionBus().lastError();
return false;

View File

@ -174,6 +174,7 @@ void ServerPrivate::CloseNotification(uint id, uint reason)
if(m_notificationsCache.contains(id)) {
m_notificationsCache.remove(id);
}
qDebug() << "CloseNotification" << id << reason;
Q_EMIT NotificationClosed(id, reason);
}