matrixion/resources/qml/dialogs/ReCaptchaDialog.qml
2023-10-30 22:17:28 -04:00

60 lines
1.4 KiB
QML

// 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
flags: Qt.Tool | Qt.WindowStaysOnTopHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
height: msg.implicitHeight + footer.implicitHeight
title: recaptcha.context
width: Math.max(msg.implicitWidth, footer.implicitWidth)
footer: DialogButtonBox {
onAccepted: recaptchaRoot.accept()
onRejected: recaptchaRoot.reject()
Button {
text: qsTr("Open reCAPTCHA")
onClicked: recaptcha.openReCaptcha()
}
Button {
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
text: qsTr("Cancel")
}
Button {
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
text: qsTr("Confirm")
}
}
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")
}
}