Warning, /plasma/discover/libdiscover/backends/SnapBackend/qml/PermissionsButton.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2018 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 pragma ComponentBehavior: Bound
0008 
0009 import QtQuick
0010 import QtQuick.Controls as QQC2
0011 import org.kde.kirigami as Kirigami
0012 import org.kde.discover as Discover
0013 
0014 QQC2.Button {
0015     id: root
0016 
0017     required property Discover.AbstractResource resource
0018 
0019     text: i18nd("libdiscover", "Configure permissions…")
0020     visible: resource.isInstalled && view.count > 0
0021 
0022     onClicked: overlay.open()
0023 
0024     Kirigami.OverlaySheet {
0025         id: overlay
0026 
0027         parent: root.QQC2.Overlay.overlay
0028         title: i18nd("libdiscover", "Permissions for %1", root.resource.name)
0029 
0030         property Discover.InlineMessage errorMessage
0031 
0032         ListView {
0033             id: view
0034             model: root.resource.plugs(root)
0035             Connections {
0036                 target: view.model
0037                 function onError(message) {
0038                     overlay.errorMessage = message
0039                 }
0040             }
0041             header: DiscoverInlineMessage {
0042                 inlineMessage: overlay.errorMessage
0043             }
0044             delegate: QQC2.CheckDelegate {
0045                 id: delegate
0046 
0047                 required property var model
0048 
0049                 width: view.width
0050                 text: model.display
0051                 checked: model.checked
0052                 onToggled: {
0053                     model.checked = checked
0054                 }
0055             }
0056         }
0057     }
0058 }