From f152bbeb5b37d2c7337df054e3f6211202dbfcba Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 5 Feb 2023 16:52:06 +0200 Subject: [PATCH] Always show user or group id on the info page (#511) And copy it to the clipboard on tap. --- .../ChatInformationPageContent.qml | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/qml/components/chatInformationPage/ChatInformationPageContent.qml b/qml/components/chatInformationPage/ChatInformationPageContent.qml index 6ee54f0..511bc38 100644 --- a/qml/components/chatInformationPage/ChatInformationPageContent.qml +++ b/qml/components/chatInformationPage/ChatInformationPageContent.qml @@ -300,7 +300,8 @@ SilicaFlickable { } leftMargin: imageContainer.getEased((imageContainer.minDimension + Theme.paddingMedium), 0, imageContainer.tweenFactor) + Theme.horizontalPageMargin title: chatInformationPage.chatInformation.title !== "" ? Emoji.emojify(chatInformationPage.chatInformation.title, Theme.fontSizeLarge) : qsTr("Unknown") - description: (chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat) ? ("@"+(chatInformationPage.privateChatUserInformation.username || chatInformationPage.chatPartnerGroupId)) : "" + description: ((chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat) && chatInformationPage.privateChatUserInformation.username) + ? ("@"+chatInformationPage.privateChatUserInformation.username) : "" } SilicaFlickable { @@ -363,6 +364,27 @@ SilicaFlickable { height: imageContainer.hasImage ? imageContainer.maxDimension : 0 } + Label { + id: copyIdText + x: Math.max(headerItem.x + imageContainer.x - groupInfoItem.x + (imageContainer.width - width)/2, 0) + text: chatInformationPage.chatPartnerGroupId + font.pixelSize: Theme.fontSizeSmall + color: copyIdMouseArea.pressed ? Theme.secondaryHighlightColor : Theme.highlightColor + visible: text !== "" + + MouseArea { + id: copyIdMouseArea + anchors { + fill: parent + margins: -Theme.paddingLarge + } + onClicked: { + Clipboard.text = copyIdText.text + appNotification.show(qsTr("ID has been copied to the clipboard.")); + } + } + } + InformationEditArea { visible: canEdit canEdit: !(chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat) && chatInformationPage.groupInformation.status && (chatInformationPage.groupInformation.status.can_change_info || chatInformationPage.groupInformation.status["@type"] === "chatMemberStatusCreator")