summary refs log tree commit diff
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2023-02-11 21:40:07 -0500
committerLoren Burkholder <computersemiexpert@outlook.com>2023-02-13 20:46:53 -0500
commit902d4a7eb26ea9d927a6c9d94646ce9b6fe84087 (patch)
treebc392bf254741dc1a693047d310fa8e0c5d34fa3
parentTranslated using Weblate (Indonesian) (diff)
downloadnheko-902d4a7eb26ea9d927a6c9d94646ce9b6fe84087.tar.xz
Add a fancy delegate when encryption is enabled
-rw-r--r--resources/qml/delegates/EncryptionEnabled.qml61
-rw-r--r--resources/qml/delegates/MessageDelegate.qml5
-rw-r--r--resources/res.qrc1
3 files changed, 64 insertions, 3 deletions
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 @@
         <file>qml/voip/ScreenShare.qml</file>
         <file>qml/voip/VideoCall.qml</file>
         <file>confettiparticle.svg</file>
+        <file>qml/delegates/EncryptionEnabled.qml</file>
     </qresource>
     <qresource prefix="/media">
         <file>media/ring.ogg</file>