From b51a3e81dd2178c681226458ca4bb73ae98a5e34 Mon Sep 17 00:00:00 2001 From: Miquel Lionel Date: Sat, 20 Nov 2021 13:07:17 +0100 Subject: You can unblock people now and some small fixes - the chatlist is now properly updated on blocking a contact request or contact. - A small message is now displayed after blocking a contact request - A list of blocked contact can be found on the settings page, after clicking 'View blocked users' - The message timestamp is now slightly padded --- qml/ComposePane.qml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'qml/ComposePane.qml') diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml index 06b623d..254e484 100644 --- a/qml/ComposePane.qml +++ b/qml/ComposePane.qml @@ -3,18 +3,18 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.12 +import org.kde.kirigami 2.12 as Kirigami Pane { id: root - required property DcContext context required property var chatId required property var chat property var attachFileUrl: "" + property bool isContactBlocked: false property bool canSend: root.chat && root.chat.canSend property bool isContactRequest: root.chat && root.chat.isContactRequest readonly property string vChatUrl: root.context.getConfig("webrtc_instance") - function createMessage() { let DC_MSG_TEXT = 10; let DC_MSG_FILE = 60; @@ -102,7 +102,7 @@ Pane { Button { id: sendVChatUrl enabled: vChatUrl.length > 0 ? true : false - visible: root.isContactRequest ? false : true + visible: root.canSend hoverEnabled: true ToolTip.visible: hovered ToolTip.text: "Send videochat invitation" @@ -149,23 +149,47 @@ Pane { } Button { + id: acceptCBtn Layout.alignment: Qt.AlignBottom Layout.fillWidth: true text: "Accept" - onClicked: root.context.acceptChat(root.chatId) + onClicked: { + root.context.acceptChat(root.chatId); + root.isContactBlocked = 0; + } visible: root.isContactRequest icon.name: "call-start" } Button { + id: blockCBtn Layout.alignment: Qt.AlignBottom Layout.fillWidth: true text: "Block" - onClicked: root.context.blockChat(root.chatId) + onClicked: { + root.context.blockChat(root.chatId) + updateChatlist(); + acceptCBtn.visible = false; + blockCBtn.visible = false; + root.isContactBlocked = true; + } visible: root.isContactRequest icon.name: "call-stop" } + + TextEdit { + selectByMouse: true + readOnly: true + text: "This contact has been blocked.
You can see who you've blocked
in 'Settings' > 'View blocked users'" + font.bold: true + textFormat: TextEdit.RichText + visible: root.isContactBlocked + Layout.preferredWidth: root.width + Layout.maximumWidth: root.width + horizontalAlignment: TextEdit.AlignHCenter + padding: Kirigami.Units.largeSpacing + } } } -- cgit v1.2.3-70-g09d2