2020-11-16 16:44:23 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtWebEngine 1.10
|
|
|
|
import "../../../shared"
|
2021-01-28 11:04:10 +00:00
|
|
|
import "../../../shared/status"
|
2020-11-16 16:44:23 +00:00
|
|
|
import "../../../imports"
|
|
|
|
|
|
|
|
ModalPopup {
|
|
|
|
id: root
|
|
|
|
property QtObject request
|
2020-11-18 17:40:08 +00:00
|
|
|
height: 286
|
|
|
|
|
|
|
|
closePolicy: Popup.NoAutoClose
|
2020-11-16 16:44:23 +00:00
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
request.dialogReject();
|
|
|
|
root.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2020-11-18 17:40:08 +00:00
|
|
|
root.title = request.securityOrigin;
|
|
|
|
message.text = request.message;
|
2020-11-18 18:04:12 +00:00
|
|
|
if(request.type === JavaScriptDialogRequest.DialogTypeAlert){
|
2020-11-18 17:40:08 +00:00
|
|
|
cancelButton.visible = false;
|
2020-11-16 16:44:23 +00:00
|
|
|
}
|
2020-11-18 18:04:12 +00:00
|
|
|
if(request.type === JavaScriptDialogRequest.DialogTypePrompt){
|
2020-11-18 17:40:08 +00:00
|
|
|
prompt.text = request.defaultText;
|
|
|
|
prompt.visible = true;
|
|
|
|
svMessage.height = 75;
|
2020-11-16 16:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ScrollView {
|
2020-11-18 17:40:08 +00:00
|
|
|
id: svMessage
|
2020-11-16 16:44:23 +00:00
|
|
|
width: parent.width
|
|
|
|
height: 100
|
|
|
|
TextArea {
|
|
|
|
id: message
|
|
|
|
wrapMode: TextEdit.Wrap
|
|
|
|
readOnly: true
|
|
|
|
text: ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-18 17:40:08 +00:00
|
|
|
Input {
|
2020-11-16 16:44:23 +00:00
|
|
|
id: prompt
|
2020-11-18 17:40:08 +00:00
|
|
|
text: ""
|
|
|
|
visible: false
|
2020-11-16 16:44:23 +00:00
|
|
|
Layout.fillWidth: true
|
2020-11-18 17:40:08 +00:00
|
|
|
anchors.top: svMessage.bottom
|
2020-11-16 16:44:23 +00:00
|
|
|
}
|
|
|
|
|
2020-11-18 17:40:08 +00:00
|
|
|
footer: Item {
|
2021-01-13 19:15:52 +00:00
|
|
|
width: parent.width
|
|
|
|
height: okButton.height
|
2020-11-18 17:40:08 +00:00
|
|
|
|
2021-01-28 11:04:10 +00:00
|
|
|
StatusButton {
|
2020-11-18 17:40:08 +00:00
|
|
|
id: okButton
|
|
|
|
anchors.right: parent.right
|
2021-01-28 11:04:10 +00:00
|
|
|
text: qsTr("Ok")
|
2020-11-18 17:40:08 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: {
|
|
|
|
request.dialogAccept(prompt.text);
|
|
|
|
close();
|
|
|
|
}
|
2020-11-16 16:44:23 +00:00
|
|
|
}
|
|
|
|
|
2021-01-28 11:04:10 +00:00
|
|
|
StatusButton {
|
2020-11-18 17:40:08 +00:00
|
|
|
id: cancelButton
|
2021-01-28 11:04:10 +00:00
|
|
|
type: "secondary"
|
2020-11-18 17:40:08 +00:00
|
|
|
anchors.right: okButton.left
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
2021-01-28 11:04:10 +00:00
|
|
|
text: qsTr("Cancel")
|
2020-11-18 17:40:08 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: {
|
|
|
|
request.dialogReject();
|
|
|
|
close();
|
|
|
|
}
|
2020-11-16 16:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|