From 902d4a7eb26ea9d927a6c9d94646ce9b6fe84087 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Sat, 11 Feb 2023 21:40:07 -0500 Subject: [PATCH 1/4] Add a fancy delegate when encryption is enabled --- resources/qml/delegates/EncryptionEnabled.qml | 61 +++++++++++++++++++ resources/qml/delegates/MessageDelegate.qml | 5 +- resources/res.qrc | 1 + 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 resources/qml/delegates/EncryptionEnabled.qml diff --git a/resources/qml/delegates/EncryptionEnabled.qml b/resources/qml/delegates/EncryptionEnabled.qml new file mode 100644 index 00000000..090ab3bb --- /dev/null +++ b/resources/qml/delegates/EncryptionEnabled.qml @@ -0,0 +1,61 @@ +// SPDX-FileCopyrightText: 2023 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import ".." +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 +import im.nheko 1.0 + +Rectangle { + id: r + + required property string username + + radius: fontMetrics.lineSpacing / 2 + Nheko.paddingMedium + width: parent.width ? parent.width : 0 + height: contents.implicitHeight + Nheko.paddingMedium * 2 + color: Nheko.colors.alternateBase + border.color: Nheko.theme.green + border.width: 2 + + RowLayout { + id: contents + + anchors.fill: parent + anchors.margins: Nheko.paddingMedium + spacing: Nheko.paddingMedium + + Image { + source: "image://colorimage/:/icons/icons/ui/shield-filled-checkmark.svg?" + Nheko.theme.green + Layout.alignment: Qt.AlignVCenter + width: 24 + height: width + } + + Column { + spacing: Nheko.paddingSmall + Layout.fillWidth: true + + MatrixText { + text: qsTr("%1 enabled end-to-end encryption").arg(r.username) + font.bold: true + font.pointSize: 14 + color: Nheko.colors.text + width: parent.width + } + + MatrixText { + text: qsTr("Encryption keeps your messages safe by locking them with a key that only the people in this room have. " + + "That means that even if somebody gains unauthorized access to your messages, they will not be able to see " + + "what they say.") + color: Nheko.colors.text + width: parent.width + } + + } + + } + +} diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml index d0569c5a..e8b76b6e 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml @@ -253,9 +253,8 @@ Item { DelegateChoice { roleValue: MtxEvent.Encryption - Pill { - text: qsTr("%1 enabled encryption").arg(d.userName) - isStateEvent: d.isStateEvent + EncryptionEnabled { + username: d.userName } } diff --git a/resources/res.qrc b/resources/res.qrc index 9eca9a98..9663b5a3 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -196,6 +196,7 @@ qml/voip/ScreenShare.qml qml/voip/VideoCall.qml confettiparticle.svg + qml/delegates/EncryptionEnabled.qml media/ring.ogg From 707af2c11dfec929ab61089c49422e7c101800dd Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Mon, 13 Feb 2023 09:22:31 -0500 Subject: [PATCH 2/4] Update message --- resources/qml/delegates/EncryptionEnabled.qml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/qml/delegates/EncryptionEnabled.qml b/resources/qml/delegates/EncryptionEnabled.qml index 090ab3bb..8be12b04 100644 --- a/resources/qml/delegates/EncryptionEnabled.qml +++ b/resources/qml/delegates/EncryptionEnabled.qml @@ -47,9 +47,7 @@ Rectangle { } MatrixText { - text: qsTr("Encryption keeps your messages safe by locking them with a key that only the people in this room have. " - + "That means that even if somebody gains unauthorized access to your messages, they will not be able to see " - + "what they say.") + text: qsTr("Encryption keeps your messages safe by only allowing the people you sent the message to to read it. For extra security, if you want to make sure you are talking to the right person, you can verify them in real life.") color: Nheko.colors.text width: parent.width } From 1f8777178ecc3c6fac598a461e8c2c6071dff6ee Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Mon, 13 Feb 2023 09:40:24 -0500 Subject: [PATCH 3/4] Limit max width of blurb --- resources/qml/delegates/EncryptionEnabled.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/delegates/EncryptionEnabled.qml b/resources/qml/delegates/EncryptionEnabled.qml index 8be12b04..2e2684e4 100644 --- a/resources/qml/delegates/EncryptionEnabled.qml +++ b/resources/qml/delegates/EncryptionEnabled.qml @@ -14,7 +14,8 @@ Rectangle { required property string username radius: fontMetrics.lineSpacing / 2 + Nheko.paddingMedium - width: parent.width ? parent.width : 0 + width: parent.width ? Math.min(parent.width, 700) : 0 + anchors.horizontalCenter: parent.horizontalCenter height: contents.implicitHeight + Nheko.paddingMedium * 2 color: Nheko.colors.alternateBase border.color: Nheko.theme.green From 92d9539824b8b9091dede4a04dec8ada31437f45 Mon Sep 17 00:00:00 2001 From: Loren Burkholder <55629213+LorenDB@users.noreply.github.com> Date: Tue, 14 Feb 2023 12:44:26 -0500 Subject: [PATCH 4/4] Update resources/qml/delegates/EncryptionEnabled.qml Co-authored-by: DeepBlueV7.X --- resources/qml/delegates/EncryptionEnabled.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/delegates/EncryptionEnabled.qml b/resources/qml/delegates/EncryptionEnabled.qml index 2e2684e4..d23e0469 100644 --- a/resources/qml/delegates/EncryptionEnabled.qml +++ b/resources/qml/delegates/EncryptionEnabled.qml @@ -48,7 +48,7 @@ Rectangle { } MatrixText { - text: qsTr("Encryption keeps your messages safe by only allowing the people you sent the message to to read it. For extra security, if you want to make sure you are talking to the right person, you can verify them in real life.") + text: qsTr("Encryption keeps your messages safe by only allowing the people you sent the message to to read it. For extra security, if you want to make sure you are talking to the right people, you can verify them in real life.") color: Nheko.colors.text width: parent.width }