aboutsummaryrefslogtreecommitdiff
path: root/qml
diff options
context:
space:
mode:
Diffstat (limited to 'qml')
-rw-r--r--qml/ChatlistPage.qml48
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