Skip to content
Snippets Groups Projects
Commit 365efaa5 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Synchronize setting unread notifications

parent a1d0cc12
No related branches found
No related tags found
No related merge requests found
exit
......@@ -140,6 +140,7 @@ Room::Room(QObject *parent) {
Q_UNUSED(parent);
connect(this, &Room::newEvents, this, &Room::addEvents, Qt::QueuedConnection);
connect(this, &Room::newTags, this, &Room::setTags, Qt::QueuedConnection);
connect(this, &Room::newUnreadState, this, &Room::setUnread, Qt::QueuedConnection);
this->moveToThread(QGuiApplication::instance()->thread());
}
......
......@@ -140,18 +140,21 @@ struct Room : public QAbstractListModel {
emit newEvents(events, prev_batch, next_batch);
}
void applyTags(const std::vector<std::string> &tags) { emit setTags(tags); }
void applyUnreadNotifications(int unread) { emit newUnreadState(unread); }
std::string name();
signals:
void newEvents(std::vector<mtx::events::collections::TimelineEvents> events, std::string prev_batch,
std::string next_batch);
void newTags(std::vector<std::string> tags);
void newUnreadState(int);
void roomNameChanged(QString name);
public slots:
void addEvents(std::vector<mtx::events::collections::TimelineEvents> events, std::string prev_batch,
std::string next_batch);
void setTags(std::vector<std::string> tags) { this->tags = tags; }
void setUnread(int unread) { this->unreadNotifications = unread; }
void fetchOlderMessages();
void sendTextMessage(QString message);
......
......@@ -137,8 +137,8 @@ void Sync::sync() {
}
room->applyTags(tags);
room->applyEvents(timeline, r.timeline.prev_batch, res.next_batch);
room->applyUnreadNotifications(r.unread_notifications.notification_count);
room->unreadNotifications = r.unread_notifications.notification_count;
if (createRoom)
emit newRoom(room);
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment