diff options
Diffstat (limited to 'qml')
-rw-r--r-- | qml/ChatlistPage.qml | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml index 31c74a2..71e4bbf 100644 --- a/qml/ChatlistPage.qml +++ b/qml/ChatlistPage.qml @@ -101,24 +101,35 @@ Kirigami.ScrollablePage { model: chatlistModel onCurrentItemChanged: { - var chatId = chatlistModel.get(currentIndex).chatId - chatlistPage.context.marknoticedChat(chatId) - - console.log("Current index is " + currentIndex) - 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(chatlistPage, {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) + console.log("Current index is " + chatlist.currentIndex) + if (currentIndex == -1) { + return; + } + + var chatId = chatlistModel.get(chatlist.currentIndex).chatId + + if (chatId > 9) { + // > DC_CHAT_ID_LAST_SPECIAL + + 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(chatlistPage, {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 (chatPageComponent.status == Component.Error) { - console.log("Error loading chat page: " + chatPageComponent.errorString()) + } else if (chatId == 6) { + console.log("Clicked on archived chat link") } } |