diff options
author | link2xt <link2xt@testrun.org> | 2021-06-14 21:04:55 +0300 |
---|---|---|
committer | link2xt <link2xt@testrun.org> | 2021-06-14 21:04:55 +0300 |
commit | 25da4228768e260ea9f67d5aa10558e7cf9cf7ee (patch) | |
tree | 966a79ef6fbf8e34811fc173d6f82ecd062d1c49 /qml/ChatlistPage.qml | |
parent | 321c19b7415e837acc4e66d535e82518618bc096 (diff) | |
download | kdeltachat-25da4228768e260ea9f67d5aa10558e7cf9cf7ee.tar.gz kdeltachat-25da4228768e260ea9f67d5aa10558e7cf9cf7ee.zip |
ChatlistPage: add an action to open contact requests
Diffstat (limited to 'qml/ChatlistPage.qml')
-rw-r--r-- | qml/ChatlistPage.qml | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml index 5da4d25..6d1a083 100644 --- a/qml/ChatlistPage.qml +++ b/qml/ChatlistPage.qml @@ -45,6 +45,14 @@ Kirigami.ScrollablePage { console.log("Can't open Settings page") } } + }, + Kirigami.Action { + text: "Contact requests" + onTriggered: { + chatlist.currentIndex = -1 + loadChat(1) + console.log("Opening contact requests chat"); + } } ] @@ -52,6 +60,26 @@ Kirigami.ScrollablePage { id: chatlistModel } + function loadChat(chatId) { + chatlistPage.context.marknoticedChat(chatId) + + console.log("Selected chat " + chatId) + + console.log("Depth is " + pageStack.depth) + let chatPageComponent = Qt.createComponent("qrc:/qml/ChatPage.qml") + if (chatPageComponent.status == Component.Ready) { + let myPage = chatPageComponent.createObject(pageStack, {chatId: chatId, context: chatlistPage.context, eventEmitter: chatlistPage.eventEmitter}) + if (pageStack.depth == 1) { + pageStack.push(myPage) + } else if (pageStack.depth == 2) { + pageStack.currentIndex = 1 + pageStack.replace(myPage) + } + } else if (chatPageComponent.status == Component.Error) { + console.log("Error loading chat page: " + chatPageComponent.errorString()) + } + } + function updateChatlist() { let chatlist = chatlistPage.context.getChatlist(chatlistPage.archivedOnly ? 1 : 0) @@ -115,26 +143,8 @@ Kirigami.ScrollablePage { if (chatId == 1 || chatId > 9) { // chatId == DC_CHAT_ID_DEADDROP || chatId > DC_CHAT_ID_LAST_SPECIAL + loadChat(chatId) - if (chatId != 1) { - chatlistPage.context.marknoticedChat(chatId) - } - - console.log("Selected chat " + chatId) - - console.log("Depth is " + pageStack.depth) - let chatPageComponent = Qt.createComponent("qrc:/qml/ChatPage.qml") - if (chatPageComponent.status == Component.Ready) { - let myPage = chatPageComponent.createObject(pageStack, {chatId: chatId, context: chatlistPage.context, eventEmitter: chatlistPage.eventEmitter}) - if (pageStack.depth == 1) { - pageStack.push(myPage) - } else if (pageStack.depth == 2) { - pageStack.currentIndex = 1 - pageStack.replace(myPage) - } - } else if (chatPageComponent.status == Component.Error) { - console.log("Error loading chat page: " + chatPageComponent.errorString()) - } } else if (chatId == 6) { chatlistPage.archivedOnly = true chatlist.currentIndex = -1 |