From 8a4d85f801368137a0b1c17621947b334e280257 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 5 Oct 2020 22:58:07 +0200 Subject: Show different verification errors --- .../qml/device-verification/DeviceVerification.qml | 1 - resources/qml/device-verification/Failed.qml | 28 ++++++++++++---------- resources/qml/device-verification/Waiting.qml | 4 ++-- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'resources/qml') diff --git a/resources/qml/device-verification/DeviceVerification.qml b/resources/qml/device-verification/DeviceVerification.qml index 4e93df06..64f10b35 100644 --- a/resources/qml/device-verification/DeviceVerification.qml +++ b/resources/qml/device-verification/DeviceVerification.qml @@ -6,7 +6,6 @@ import im.nheko 1.0 ApplicationWindow { property var flow - property var tran_id title: stack.currentItem.title id: dialog diff --git a/resources/qml/device-verification/Failed.qml b/resources/qml/device-verification/Failed.qml index 6b5d57ef..fcff7893 100644 --- a/resources/qml/device-verification/Failed.qml +++ b/resources/qml/device-verification/Failed.qml @@ -2,23 +2,29 @@ import QtQuick 2.3 import QtQuick.Controls 2.10 import QtQuick.Layouts 1.10 +import im.nheko 1.0 + Pane { - property string title: qsTr("Verification timed out") + property string title: qsTr("Verification failed") ColumnLayout { spacing: 16 Text { + id: content + Layout.maximumWidth: 400 Layout.fillHeight: true Layout.fillWidth: true + wrapMode: Text.Wrap - id: content text: switch (flow.error) { - case VerificationStatus.UnknownMethod: return qsTr("Device verification timed out.") - case VerificationStatus.MismatchedCommitment: return qsTr("Device verification timed out.") - case VerificationStatus.MismatchedSAS: return qsTr("Device verification timed out.") - case VerificationStatus.KeyMismatch: return qsTr("Device verification timed out.") - case VerificationStatus.Timeout: return qsTr("Device verification timed out.") - case VerificationStatus.OutOfOrder: return qsTr("Device verification timed out.") + case DeviceVerificationFlow.UnknownMethod: return qsTr("Other client does not support our verification protocol.") + case DeviceVerificationFlow.MismatchedCommitment: + case DeviceVerificationFlow.MismatchedSAS: + case DeviceVerificationFlow.KeyMismatch: return qsTr("Key mismatch detected!") + case DeviceVerificationFlow.Timeout: return qsTr("Device verification timed out.") + case DeviceVerificationFlow.User: return qsTr("Other party canceled the verification.") + case DeviceVerificationFlow.OutOfOrder: return qsTr("Device verification timed out.") + default: return "Unknown verification error."; } color:colors.text verticalAlignment: Text.AlignVCenter @@ -31,11 +37,7 @@ Pane { Layout.alignment: Qt.AlignRight text: qsTr("Close") - onClicked: { - deviceVerificationList.remove(tran_id); - flow.deleteFlow(); - dialog.close() - } + onClicked: dialog.close() } } } diff --git a/resources/qml/device-verification/Waiting.qml b/resources/qml/device-verification/Waiting.qml index f36910e7..38abf767 100644 --- a/resources/qml/device-verification/Waiting.qml +++ b/resources/qml/device-verification/Waiting.qml @@ -20,12 +20,12 @@ Pane { case "WaitingForMac": return qsTr("Waiting for other side to complete the verification request.") } - color:colors.text + color: colors.text verticalAlignment: Text.AlignVCenter } BusyIndicator { Layout.alignment: Qt.AlignHCenter - palette: color + palette: colors } RowLayout { Button { -- cgit 1.5.1