From 552fb4e6b280e9b7d0f9688a1734b110ee7460b0 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 22 Aug 2021 11:54:42 +0000 Subject: Change the chat only on click Prevents switching the chat during the search. --- qml/ChatlistPage.qml | 33 +++++++++++++-------------------- 1 file 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) } } } -- cgit v1.2.3-70-g09d2