Warning, /network/angelfish/lib/contents/ui/PermissionQuestion.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2020 Jonah BrĂ¼chert <jbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import org.kde.kirigami 2.4 as Kirigami
0006 import QtWebEngine 1.9
0007 
0008 Kirigami.InlineMessage {
0009     property int permission
0010     property string origin
0011 
0012     id: permissionQuestion
0013     text: {
0014         switch(permission) {
0015         case WebEngineView.Geolocation:
0016             i18n("Do you want to allow the website to access the geo location?")
0017             break
0018         case WebEngineView.MediaAudioCapture:
0019             i18n("Do you want to allow the website to access the microphone?")
0020             break
0021         case WebEngineView.MediaVideoCapture:
0022             i18n("Do you want to allow the website to access the camera?")
0023             break
0024         case WebEngineView.MediaAudioVideoCapture:
0025             i18n("Do you want to allow the website to access the camera and the microphone?")
0026             break
0027         case WebEngineView.DesktopVideoCapture:
0028             i18n("Do you want to allow the website to share your screen?")
0029             break
0030         case WebEngineView.DesktopAudioVideoCapture:
0031             i18n("Do you want to allow the website to share the sound output?")
0032             break
0033         case WebEngineView.Notifications:
0034             i18n("Do you want to allow the website to send you notifications?")
0035             break
0036         }
0037     }
0038     showCloseButton: false
0039 
0040     actions: [
0041         Kirigami.Action {
0042             icon.name: "dialog-ok-apply"
0043             text: i18n("Accept")
0044             onTriggered: {
0045                 currentWebView.grantFeaturePermission(
0046                     permissionQuestion.origin,
0047                     permissionQuestion.permission, true)
0048                 permissionQuestion.visible = false
0049             }
0050         },
0051         Kirigami.Action {
0052             icon.name: "dialog-cancel"
0053             text: i18n("Decline")
0054             onTriggered: {
0055                 currentWebView.grantFeaturePermission(
0056                     permissionQuestion.origin,
0057                     permissionQuestion.permission, false)
0058                 permissionQuestion.visible = false
0059             }
0060         }
0061     ]
0062 }