diff options
-rw-r--r-- | eventemitter.cpp | 3 | ||||
-rw-r--r-- | eventemitter.h | 1 | ||||
-rw-r--r-- | qml/ChatlistPage.qml | 8 |
3 files changed, 12 insertions, 0 deletions
diff --git a/eventemitter.cpp b/eventemitter.cpp index 2265429..b6273bd 100644 --- a/eventemitter.cpp +++ b/eventemitter.cpp @@ -86,6 +86,9 @@ DcAccountsEventEmitter::processEvent(DcEvent *event) event->getData2Int()); std::cout << "Emitted incoming message!" << std::endl; break; + case DC_EVENT_MSGS_NOTICED: + emit messagesNoticed(event->getAccountId(), event->getData1Int()); + break; default: std::cout << "Not processing " << event->getId() << std::endl; } diff --git a/eventemitter.h b/eventemitter.h index 21a8af1..b81778b 100644 --- a/eventemitter.h +++ b/eventemitter.h @@ -52,5 +52,6 @@ signals: void chatModified(uint32_t accountId, int chatId); void incomingMessage(uint32_t accountId, int chatId, int msgId); void messagesChanged(uint32_t accountId, int chatId, int msgId); + void messagesNoticed(uint32_t accountId, int chatId); void incomingEvent(); }; diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml index 2e1d7fe..5d108c8 100644 --- a/qml/ChatlistPage.qml +++ b/qml/ChatlistPage.qml @@ -18,8 +18,15 @@ Kirigami.Page { updateChatlist(); } + signal messagesNoticed + onMessagesNoticed: { + // Reload chatlist + updateChatlist(); + } + Component.onCompleted: { eventEmitter.onMessagesChanged.connect(messagesChanged) + eventEmitter.onMessagesNoticed.connect(messagesNoticed) updateChatlist() } @@ -81,6 +88,7 @@ Kirigami.Page { onCurrentItemChanged: { var chatId = chatlistModel.get(currentIndex).chatId + chatlistPage.context.marknoticedChat(chatId) console.log("Current index is " + currentIndex) console.log("Selected chat " + chatId) |