From 9a4a70178e49fb3dce542c826b621efc6430e52f Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 6 May 2024 21:12:54 +0200 Subject: [PATCH] Add basic cross-signing support --- src/qml/AccountMenu.qml | 6 ++++++ src/qml/DirectChatDrawerHeader.qml | 27 +++++++++++++++++++++------ src/qml/RoomInformation.qml | 10 ++++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/qml/AccountMenu.qml b/src/qml/AccountMenu.qml index 40ae9d3f7..5c709d710 100644 --- a/src/qml/AccountMenu.qml +++ b/src/qml/AccountMenu.qml @@ -71,6 +71,12 @@ QQC2.Menu { title: i18nc("@title:window", "Open Key Backup") }) } + QQC2.MenuItem { + text: i18nc("@action:inmenu", "Verify this Device") + icon.name: "security-low" + onTriggered: root.connection.startSelfVerification() + enabled: Controller.ssssSupported + } QQC2.MenuItem { text: i18n("Logout") icon.name: "list-remove-user" diff --git a/src/qml/DirectChatDrawerHeader.qml b/src/qml/DirectChatDrawerHeader.qml index 3d4e00476..a0873fd16 100644 --- a/src/qml/DirectChatDrawerHeader.qml +++ b/src/qml/DirectChatDrawerHeader.qml @@ -59,12 +59,27 @@ ColumnLayout { } } - Kirigami.Heading { + RowLayout { Layout.fillWidth: true - type: Kirigami.Heading.Type.Primary - wrapMode: QQC2.Label.Wrap - text: root.room.displayName - textFormat: Text.PlainText - horizontalAlignment: Text.AlignHCenter + Layout.alignment: Qt.AlignHCenter + Kirigami.Icon { + id: securityIcon + //TODO figure out how to make this update + source: room.connection.isUserVerified(root.room.directChatRemoteMember.id) ? + (room.connection.allSessionsSelfVerified(root.room.directChatRemoteMember.id) ? "security-high" : "security-medium") + : "security-low" + + } + Kirigami.Heading { + type: Kirigami.Heading.Type.Primary + wrapMode: QQC2.Label.Wrap + text: root.room.displayName + textFormat: Text.PlainText + horizontalAlignment: Text.AlignHCenter + } + Item { + Layout.preferredWidth: visible ? securityIcon.width : 0 + visible: securityIcon.visible + } } } diff --git a/src/qml/RoomInformation.qml b/src/qml/RoomInformation.qml index d5afb7dc3..200049ccc 100644 --- a/src/qml/RoomInformation.qml +++ b/src/qml/RoomInformation.qml @@ -89,6 +89,16 @@ QQC2.ScrollView { } } + Delegates.RoundedItemDelegate { + visible: root.room.isDirectChat() + icon.name: "security-low-symbolic" + text: i18nc("@action:button", "Verify user") + + onClicked: root.room.startVerification() + + Layout.fillWidth: true + } + Delegates.RoundedItemDelegate { id: favouriteButton visible: !root.room.isSpace