Verified Commit 0c4d2f7b authored by Jonah Brüchert's avatar Jonah Brüchert
Browse files

Implement feature permission requests

parent 050ab7e9
......@@ -250,4 +250,10 @@ WebEngineView {
authSheet.request = request
authSheet.open()
}
onFeaturePermissionRequested: {
permissionQuestion.permission = feature
permissionQuestion.origin = securityOrigin
permissionQuestion.visible = true
}
}
......@@ -122,7 +122,7 @@ Kirigami.ApplicationWindow {
actions: [
Kirigami.Action {
iconName: "tab-new"
icon.name: "tab-new"
text: i18n("Open")
onTriggered: {
tabs.newTab(newTabQuestion.url.toString())
......@@ -153,7 +153,7 @@ Kirigami.ApplicationWindow {
}
},
Kirigami.Action {
iconName: "dialog-cancel"
icon.name: "dialog-cancel"
text: i18n("Cancel")
onTriggered: {
downloadQuestion.download.cancel()
......@@ -163,6 +163,49 @@ Kirigami.ApplicationWindow {
]
}
Kirigami.InlineMessage {
property int permission
property string origin
id: permissionQuestion
text: {
var text = ""
if (permission === WebEngineView.Geolocation)
text = i18n("geo location")
else if (permission === WebEngineView.MediaAudioCapture)
text = i18n("the microphone")
else if (permission === WebEngineView.MediaVideoCapture)
text = i18n("the camera")
else if (permission === WebEngineView.MediaAudioVideoCapture)
text = i18n("camera and microphone")
i18n("Do you want to allow the website to access " + text + "?")
}
showCloseButton: false
anchors.bottom: navigation.top
anchors.left: parent.left
anchors.right: parent.right
actions: [
Kirigami.Action {
icon.name: "dialog-ok-apply"
text: i18n("Accept")
onTriggered: {
currentWebView.grantFeaturePermission(permissionQuestion.origin, permissionQuestion.permission, true)
permissionQuestion.visible = false
}
},
Kirigami.Action {
icon.name: "dialog-cancel"
text: i18n("Decline")
onTriggered: {
currentWebView.grantFeaturePermission(permissionQuestion.origin, permissionQuestion.permission, false)
downloadQuestion.visible = false
}
}
]
}
// Container for the progress bar
Item {
id: progressItem
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment