Debian Codegraph @

resources/qml/dialogs/FallbackAuthDialog.qml

raw
1 // SPDX-FileCopyrightText: Nheko Contributors
2 //
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 import QtQuick
6 import QtQuick.Controls
7 import im.nheko
8
9 ApplicationWindow {
10 id: fallbackRoot
11
12 required property FallbackAuth fallback
13
14 function accept() {
15 fallback.confirm();
16 fallbackRoot.close();
17 }
18
19 function reject() {
20 fallback.cancel();
21 fallbackRoot.close();
22 }
23
24 color: palette.window
25 title: qsTr("Fallback authentication")
26 flags: Qt.Tool | Qt.WindowStaysOnTopHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
27 height: msg.implicitHeight + footer.implicitHeight
28 width: Math.max(msg.implicitWidth, footer.implicitWidth)
29
30 Shortcut {
31 sequence: StandardKey.Cancel
32 onActivated: fallbackRoot.reject()
33 }
34
35 Label {
36 id: msg
37
38 anchors.fill: parent
39 padding: 8
40 text: qsTr("Open the fallback, follow the steps, and confirm after completing them.")
41 }
42
43 footer: DialogButtonBox {
44 onAccepted: fallbackRoot.accept()
45 onRejected: fallbackRoot.reject()
46
47 Button {
48 text: qsTr("Open Fallback in Browser")
49 onClicked: fallback.openFallbackAuth()
50 }
51
52 Button {
53 text: qsTr("Cancel")
54 DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
55 }
56
57 Button {
58 text: qsTr("Confirm")
59 DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
60 }
61 }
62
63 }