summary refs log tree commit diff
path: root/resources/qml/dialogs/ReCaptchaDialog.qml
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2023-06-28 17:00:34 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2023-07-06 08:35:37 -0400
commitfedc178827c5648b0ccbdd2cd08dcebc920ac416 (patch)
tree7c6c59b60899d8c7a321bea8fe44c7d04f79040f /resources/qml/dialogs/ReCaptchaDialog.qml
parentRemove unneeded forward declaration (diff)
downloadnheko-fedc178827c5648b0ccbdd2cd08dcebc920ac416.tar.xz
Port the reCAPTCHA dialog to QML
Diffstat (limited to 'resources/qml/dialogs/ReCaptchaDialog.qml')
-rw-r--r--resources/qml/dialogs/ReCaptchaDialog.qml63
1 files changed, 63 insertions, 0 deletions
diff --git a/resources/qml/dialogs/ReCaptchaDialog.qml b/resources/qml/dialogs/ReCaptchaDialog.qml
new file mode 100644

index 00000000..0da62cbc --- /dev/null +++ b/resources/qml/dialogs/ReCaptchaDialog.qml
@@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick +import QtQuick.Controls +import im.nheko + +ApplicationWindow { + id: recaptchaRoot + + required property ReCaptcha recaptcha + + function accept() { + recaptcha.confirm(); + recaptchaRoot.close(); + } + + function reject() { + recaptcha.cancel(); + recaptchaRoot.close(); + } + + color: palette.window + title: recaptcha.context + flags: Qt.Tool | Qt.WindowStaysOnTopHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint + height: msg.implicitHeight + footer.implicitHeight + width: Math.max(msg.implicitWidth, footer.implicitWidth) + + Shortcut { + sequence: StandardKey.Cancel + onActivated: recaptchaRoot.reject() + } + + Label { + id: msg + + anchors.fill: parent + padding: 8 + text: qsTr("Solve the reCAPTCHA and press the confirm button") + } + + footer: DialogButtonBox { + onAccepted: recaptchaRoot.accept() + onRejected: recaptchaRoot.reject() + + Button { + text: qsTr("Open reCAPTCHA") + onClicked: recaptcha.openReCaptcha() + } + + Button { + text: qsTr("Cancel") + DialogButtonBox.buttonRole: DialogButtonBox.RejectRole + } + + Button { + text: qsTr("Confirm") + DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole + } + } + +}