2020-11-16 12:44:23 -04:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtWebEngine 1.10
|
2021-10-20 11:45:38 +02:00
|
|
|
|
2022-07-13 15:29:38 +03:00
|
|
|
import StatusQ.Core 0.1
|
2021-10-20 11:45:38 +02:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
2022-07-13 15:29:38 +03:00
|
|
|
import shared.controls 1.0
|
2021-10-28 00:27:49 +03:00
|
|
|
import shared.popups 1.0
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-11-16 12:44:23 -04:00
|
|
|
|
2021-10-14 13:07:19 +02:00
|
|
|
// TODO: replace with StatusModal
|
2020-11-16 12:44:23 -04:00
|
|
|
ModalPopup {
|
|
|
|
id: root
|
|
|
|
property QtObject request
|
2020-11-18 13:40:08 -04:00
|
|
|
height: 286
|
|
|
|
|
|
|
|
closePolicy: Popup.NoAutoClose
|
2020-11-16 12:44:23 -04:00
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
request.dialogReject();
|
|
|
|
root.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2020-11-18 13:40:08 -04:00
|
|
|
root.title = request.securityOrigin;
|
|
|
|
message.text = request.message;
|
2020-11-18 14:04:12 -04:00
|
|
|
if(request.type === JavaScriptDialogRequest.DialogTypeAlert){
|
2020-11-18 13:40:08 -04:00
|
|
|
cancelButton.visible = false;
|
2020-11-16 12:44:23 -04:00
|
|
|
}
|
2020-11-18 14:04:12 -04:00
|
|
|
if(request.type === JavaScriptDialogRequest.DialogTypePrompt){
|
2020-11-18 13:40:08 -04:00
|
|
|
prompt.text = request.defaultText;
|
|
|
|
prompt.visible = true;
|
|
|
|
svMessage.height = 75;
|
2020-11-16 12:44:23 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-13 15:29:38 +03:00
|
|
|
StatusScrollView {
|
2020-11-18 13:40:08 -04:00
|
|
|
id: svMessage
|
2020-11-16 12:44:23 -04:00
|
|
|
width: parent.width
|
|
|
|
height: 100
|
|
|
|
TextArea {
|
|
|
|
id: message
|
|
|
|
wrapMode: TextEdit.Wrap
|
|
|
|
readOnly: true
|
|
|
|
text: ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-18 13:40:08 -04:00
|
|
|
Input {
|
2020-11-16 12:44:23 -04:00
|
|
|
id: prompt
|
2020-11-18 13:40:08 -04:00
|
|
|
text: ""
|
|
|
|
visible: false
|
|
|
|
anchors.top: svMessage.bottom
|
2022-07-25 16:22:09 +03:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
2020-11-16 12:44:23 -04:00
|
|
|
}
|
|
|
|
|
2020-11-18 13:40:08 -04:00
|
|
|
footer: Item {
|
2021-01-13 14:15:52 -05:00
|
|
|
width: parent.width
|
|
|
|
height: okButton.height
|
2020-11-18 13:40:08 -04:00
|
|
|
|
2021-01-28 12:04:10 +01:00
|
|
|
StatusButton {
|
2020-11-18 13:40:08 -04:00
|
|
|
id: okButton
|
|
|
|
anchors.right: parent.right
|
2022-04-04 13:26:30 +02:00
|
|
|
text: qsTr("Ok")
|
2020-11-18 13:40:08 -04:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: {
|
|
|
|
request.dialogAccept(prompt.text);
|
|
|
|
close();
|
|
|
|
}
|
2020-11-16 12:44:23 -04:00
|
|
|
}
|
|
|
|
|
2021-10-20 11:45:38 +02:00
|
|
|
StatusFlatButton {
|
2020-11-18 13:40:08 -04:00
|
|
|
id: cancelButton
|
|
|
|
anchors.right: okButton.left
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
2022-04-04 13:26:30 +02:00
|
|
|
text: qsTr("Cancel")
|
2020-11-18 13:40:08 -04:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: {
|
|
|
|
request.dialogReject();
|
|
|
|
close();
|
|
|
|
}
|
2020-11-16 12:44:23 -04:00
|
|
|
}
|
|
|
|
}
|
2021-09-30 11:43:29 +02:00
|
|
|
}
|