1// SPDX-FileCopyrightText: 2021 Nheko Contributors
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5import QtQuick 2.3
6import QtQuick.Controls 2.3
7import QtQuick.Layouts 1.10
8import im.nheko 1.0
9
10Pane {
11    property string title: qsTr("Verification failed")
12
13    ColumnLayout {
14        spacing: 16
15
16        Text {
17            id: content
18
19            Layout.maximumWidth: 400
20            Layout.fillHeight: true
21            Layout.fillWidth: true
22            wrapMode: Text.Wrap
23            text: {
24                switch (flow.error) {
25                case DeviceVerificationFlow.UnknownMethod:
26                    return qsTr("Other client does not support our verification protocol.");
27                case DeviceVerificationFlow.MismatchedCommitment:
28                case DeviceVerificationFlow.MismatchedSAS:
29                case DeviceVerificationFlow.KeyMismatch:
30                    return qsTr("Key mismatch detected!");
31                case DeviceVerificationFlow.Timeout:
32                    return qsTr("Device verification timed out.");
33                case DeviceVerificationFlow.User:
34                    return qsTr("Other party canceled the verification.");
35                case DeviceVerificationFlow.OutOfOrder:
36                    return qsTr("Verification messages received out of order!");
37                default:
38                    return qsTr("Unknown verification error.");
39                }
40            }
41            color: Nheko.colors.text
42            verticalAlignment: Text.AlignVCenter
43        }
44
45        RowLayout {
46            Item {
47                Layout.fillWidth: true
48            }
49
50            Button {
51                Layout.alignment: Qt.AlignRight
52                text: qsTr("Close")
53                onClicked: dialog.close()
54            }
55
56        }
57
58    }
59
60}
61