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

This commit is contained in:
iaom 2023-11-14 16:37:11 +08:00
parent 8233bfaa07
commit eed5f84cf4
2 changed files with 4 additions and 7 deletions

View File

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

View File

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