Skip to content

Commit

Permalink
fix: the indicator of notification state doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
18202781743 committed Oct 22, 2024
1 parent 6edb1bd commit 9156853
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
25 changes: 23 additions & 2 deletions plugins/dde-dock/notification/notification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ void Notification::watchNotification(bool newNotification)
this,
SLOT(setNotificationCount(uint))
);

if (newNotification) {
QDBusConnection::sessionBus().connect("org.deepin.dde.Notification1",
"/org/deepin/dde/Notification1",
"org.deepin.dde.Notification1",
"NotificationStateChanged",
this,
SLOT(onNotificationStateChanged(qint64, int))
);
} else {
qDebug(qLcPluginNotification) << "The indicator of notification state doesn't work.";
}
});
}

Expand Down Expand Up @@ -154,7 +166,16 @@ void Notification::setNotificationCount(uint count)
return;
}
m_notificationCount = count;
m_hasNewNotification = true;
Q_EMIT notificationStatusChanged();
Q_EMIT this->notificationCountChanged(count);
}

void Notification::onNotificationStateChanged(qint64 id, int processedType)

Check warning on line 172 in plugins/dde-dock/notification/notification.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'onNotificationStateChanged' is never used.
{
static const int Processed = 2;
if (processedType == Processed) {
if (!m_hasNewNotification) {
m_hasNewNotification = true;
Q_EMIT notificationStatusChanged();
}
}
}
1 change: 1 addition & 0 deletions plugins/dde-dock/notification/notification.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public Q_SLOTS:
private Q_SLOTS:
void onSystemInfoChanged(quint32 info, QDBusVariant value);
void setNotificationCount(uint count);
void onNotificationStateChanged(qint64 id, int processedType);

protected:
void paintEvent(QPaintEvent *e) override;
Expand Down

0 comments on commit 9156853

Please sign in to comment.