aboutsummaryrefslogtreecommitdiff
path: root/qml/ChatlistPage.qml
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-08-22 11:54:42 +0000
committerlink2xt <link2xt@testrun.org>2021-08-22 11:54:42 +0000
commit552fb4e6b280e9b7d0f9688a1734b110ee7460b0 (patch)
tree4d5e7e74b38bf0b4cc8820d1c3983026b8597198 /qml/ChatlistPage.qml
parent3f524a1aadede291f9e54a73232336fa98b26a06 (diff)
downloadkdeltachat-552fb4e6b280e9b7d0f9688a1734b110ee7460b0.tar.gz
kdeltachat-552fb4e6b280e9b7d0f9688a1734b110ee7460b0.zip
Change the chat only on click
Prevents switching the chat during the search.
Diffstat (limited to 'qml/ChatlistPage.qml')
-rw-r--r--qml/ChatlistPage.qml33
1 files changed, 13 insertions, 20 deletions
diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml
index a7341ec..59d178d 100644
--- a/qml/ChatlistPage.qml
+++ b/qml/ChatlistPage.qml
@@ -76,6 +76,18 @@ Kirigami.ScrollablePage {
id: chatlistModel
}
+ function chatClicked(chatId) {
+ if (chatId > 9) {
+ // chatId > DC_CHAT_ID_LAST_SPECIAL
+ loadChat(chatId)
+
+ } else if (chatId == 6) {
+ chatlistPage.archivedOnly = true
+ chatlist.currentIndex = -1
+ updateChatlist();
+ }
+ }
+
function loadChat(chatId) {
chatlistPage.context.marknoticedChat(chatId)
@@ -150,26 +162,6 @@ Kirigami.ScrollablePage {
anchors.fill: parent
model: chatlistModel
- currentIndex: -1
-
- onCurrentItemChanged: {
- console.log("Current index is " + chatlist.currentIndex)
- if (currentIndex == -1) {
- return;
- }
-
- var chatId = chatlistModel.get(chatlist.currentIndex).chatId
-
- if (chatId > 9) {
- // chatId > DC_CHAT_ID_LAST_SPECIAL
- loadChat(chatId)
-
- } else if (chatId == 6) {
- chatlistPage.archivedOnly = true
- chatlist.currentIndex = -1
- updateChatlist();
- }
- }
delegate: ChatlistItem {
context: chatlistPage.context
@@ -182,6 +174,7 @@ Kirigami.ScrollablePage {
isPinned: model.visibility == 2
width: chatlist.width
+ onClicked: chatClicked(model.chatId)
}
}
}