From 72582c26f465925615ea51f8804eb47fed265803 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Wed, 16 Dec 2020 03:45:32 +0200 Subject: [PATCH 1/2] Added "Join chat by id" to the Debug page --- qml/pages/DebugPage.qml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/qml/pages/DebugPage.qml b/qml/pages/DebugPage.qml index b3e1b24..07b9e63 100644 --- a/qml/pages/DebugPage.qml +++ b/qml/pages/DebugPage.qml @@ -18,6 +18,7 @@ */ import QtQuick 2.6 import Sailfish.Silica 1.0 +import WerkWolf.Fernschreiber 1.0 import "../components" import "../js/twemoji.js" as Emoji import "../js/functions.js" as Functions @@ -41,6 +42,31 @@ Page { description: "here be dragons" } + + SectionHeader { + text: "Join chat by id" + } + + Row { + x: Theme.horizontalPageMargin + TextField { + id: chatId + anchors.bottom: parent.bottom + width: column.width - joinButton.width - Theme.horizontalPageMargin - Theme.paddingLarge + placeholderText: "Chat id" + labelVisible: false + EnterKey.iconSource: "image://theme/icon-m-enter-accept" + EnterKey.enabled: text.length > 0 + EnterKey.onClicked: tdLibWrapper.joinChat(text) + } + Button { + id: joinButton + text: "Join" + anchors.bottom: parent.bottom + enabled: chatId.text.length > 0 + onClicked: tdLibWrapper.joinChat(chatId.text) + } + } } VerticalScrollDecorator {} From 25efbb8bc2036b40deca2aee8f40d0cf12094ad2 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Wed, 16 Dec 2020 15:51:06 +0200 Subject: [PATCH 2/2] Added "Show all chats" switch to the Debug page --- qml/pages/DebugPage.qml | 15 +++++++++++---- src/chatlistmodel.cpp | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/qml/pages/DebugPage.qml b/qml/pages/DebugPage.qml index 07b9e63..dee92e4 100644 --- a/qml/pages/DebugPage.qml +++ b/qml/pages/DebugPage.qml @@ -44,15 +44,22 @@ Page { } SectionHeader { - text: "Join chat by id" + text: "Chats" + } + + TextSwitch { + checked: chatListModel.showAllChats + text: "Show all chats" + description: "Including the ones referenced by the chats you have joined." + automaticCheck: false + onClicked: chatListModel.showAllChats = !chatListModel.showAllChats } Row { - x: Theme.horizontalPageMargin TextField { id: chatId anchors.bottom: parent.bottom - width: column.width - joinButton.width - Theme.horizontalPageMargin - Theme.paddingLarge + width: column.width - joinButton.width - Theme.horizontalPageMargin placeholderText: "Chat id" labelVisible: false EnterKey.iconSource: "image://theme/icon-m-enter-accept" @@ -61,7 +68,7 @@ Page { } Button { id: joinButton - text: "Join" + text: "Join by id" anchors.bottom: parent.bottom enabled: chatId.text.length > 0 onClicked: tdLibWrapper.joinChat(chatId.text) diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp index dff621d..b17ea1f 100644 --- a/src/chatlistmodel.cpp +++ b/src/chatlistmodel.cpp @@ -495,7 +495,7 @@ void ChatListModel::addVisibleChat(ChatData *chat) void ChatListModel::updateChatVisibility(const TDLibWrapper::Group *group) { - LOG("Updating chat visibility" << group->groupId); + LOG("Updating chat visibility" << (group ? qPrintable(QString::number(group->groupId)) : "")); // See if any group has been removed from from view for (int i = 0; i < chatList.size(); i++) { ChatData *chat = chatList.at(i);