aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-05-16 14:55:17 +0300
committerlink2xt <link2xt@testrun.org>2021-05-16 14:55:50 +0300
commit670960e18a7e9a1d994f26af27a12c73a7413c9a (patch)
tree96510410e8837310b75fa4af6f301af0428f4977
parentc89e617850480b4949adbc33e07cb1b2293aa3a9 (diff)
downloadkdeltachat-670960e18a7e9a1d994f26af27a12c73a7413c9a.tar.gz
kdeltachat-670960e18a7e9a1d994f26af27a12c73a7413c9a.zip
Do not open special chats from the chatlist
Archive chat and contact request chatlist items should be treated differently. While they are not implemented, selecting them is a no-op.
-rw-r--r--qml/ChatlistPage.qml45
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")
}
}