diff options
author | link2xt <link2xt@testrun.org> | 2021-08-22 11:54:42 +0000 |
---|---|---|
committer | link2xt <link2xt@testrun.org> | 2021-08-22 11:54:42 +0000 |
commit | 552fb4e6b280e9b7d0f9688a1734b110ee7460b0 (patch) | |
tree | 4d5e7e74b38bf0b4cc8820d1c3983026b8597198 /qml/ChatlistPage.qml | |
parent | 3f524a1aadede291f9e54a73232336fa98b26a06 (diff) | |
download | kdeltachat-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.qml | 33 |
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) } } } |