aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-02-23 17:35:08 +0300
committerlink2xt <link2xt@testrun.org>2021-02-23 17:35:08 +0300
commit02fa66112ff228926bd55aaf7630dfd73c298109 (patch)
tree7dc900ab3014ca83b6b9de05df7c6652659cedaf
parent5cc6dd5005e8f630cc80b7b3c51cf302bb08e9a0 (diff)
downloadkdeltachat-02fa66112ff228926bd55aaf7630dfd73c298109.tar.gz
kdeltachat-02fa66112ff228926bd55aaf7630dfd73c298109.zip
Mark chat as noticed when selected
-rw-r--r--eventemitter.cpp3
-rw-r--r--eventemitter.h1
-rw-r--r--qml/ChatlistPage.qml8
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)