| 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: recaptchaRoot |
| 11 |
|
| 12 |
required property ReCaptcha recaptcha |
| 13 |
|
| 14 |
function accept() { |
| 15 |
recaptcha.confirm(); |
| 16 |
recaptchaRoot.close(); |
| 17 |
} |
| 18 |
|
| 19 |
function reject() { |
| 20 |
recaptcha.cancel(); |
| 21 |
recaptchaRoot.close(); |
| 22 |
} |
| 23 |
|
| 24 |
color: palette.window |
| 25 |
title: recaptcha.context |
| 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: recaptchaRoot.reject() |
| 33 |
} |
| 34 |
|
| 35 |
Label { |
| 36 |
id: msg |
| 37 |
|
| 38 |
anchors.fill: parent |
| 39 |
padding: 8 |
| 40 |
text: qsTr("Solve the reCAPTCHA and press the confirm button") |
| 41 |
} |
| 42 |
|
| 43 |
footer: DialogButtonBox { |
| 44 |
onAccepted: recaptchaRoot.accept() |
| 45 |
onRejected: recaptchaRoot.reject() |
| 46 |
|
| 47 |
Button { |
| 48 |
text: qsTr("Open reCAPTCHA") |
| 49 |
onClicked: recaptcha.openReCaptcha() |
| 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 |
} |