Manually update badge count in initActiveConnection
Without doing this, it's possible to start NeoChat and have no badge count despite having notable notifications. The reason for this is if badgeNotificationCount was updated and changed before this function call, and a call to refreshBadgeNotificationCount doesn't emit the changed signal. This is easy to work around by calling updateBadgeNotificationCount ourselves.
This commit is contained in:
@@ -246,7 +246,10 @@ void Controller::initActiveConnection(NeoChatConnection *oldConnection, NeoChatC
|
||||
if (newConnection) {
|
||||
connect(newConnection, &NeoChatConnection::errorOccured, this, &Controller::errorOccured);
|
||||
connect(newConnection, &NeoChatConnection::badgeNotificationCountChanged, this, &Controller::updateBadgeNotificationCount);
|
||||
|
||||
// Refresh and update manually, in case we init too late for the badge count to actually change.
|
||||
newConnection->refreshBadgeNotificationCount();
|
||||
updateBadgeNotificationCount(newConnection->badgeNotificationCount());
|
||||
}
|
||||
Q_EMIT activeConnectionChanged(newConnection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user