Fix notifications with libquotient 0.7

This commit is contained in:
Tobias Fella
2022-10-11 22:26:26 +02:00
parent 785a82df93
commit 1c9575ccfd
4 changed files with 93 additions and 2 deletions

View File

@@ -5,7 +5,6 @@
#include "neochatconfig.h"
#include "neochatroom.h"
#include "notificationsmanager.h"
#include "roommanager.h"
#include "user.h"
@@ -20,7 +19,10 @@
#include <QGuiApplication>
#include <utility>
#ifndef QUOTIENT_07
#include "notificationsmanager.h"
#include <csapi/notifications.h>
#endif
using namespace Quotient;
@@ -115,7 +117,6 @@ void RoomListModel::setConnection(Connection *connection)
doResetModel();
handleNotifications();
Q_EMIT connectionChanged();
}
@@ -171,7 +172,9 @@ void RoomListModel::connectRoomSignals(NeoChatRoom *room)
connect(room, &Room::addedMessages, this, [this, room] {
refresh(room, {LastEventRole, SubtitleTextRole});
});
#ifndef QUOTIENT_07
connect(room, &Room::notificationCountChanged, this, &RoomListModel::handleNotifications);
#endif
connect(room, &Room::highlightCountChanged, this, [this, room] {
if (room->highlightCount() == 0) {
return;
@@ -197,6 +200,7 @@ void RoomListModel::connectRoomSignals(NeoChatRoom *room)
connect(room, &Room::notificationCountChanged, this, &RoomListModel::refreshNotificationCount);
}
#ifndef QUOTIENT_07
void RoomListModel::handleNotifications()
{
static bool initial = true;
@@ -245,6 +249,7 @@ void RoomListModel::handleNotifications()
}
});
}
#endif
void RoomListModel::refreshNotificationCount()
{