Warning, /plasma/discover/libdiscover/backends/FlatpakBackend/qml/PermissionsList.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2022 Suhaas Joshi <joshiesuhaas0@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 pragma ComponentBehavior: Bound 0008 0009 import QtQuick 0010 import QtQuick.Controls as QQC2 0011 import QtQuick.Layouts 0012 import org.kde.discover as Discover 0013 import org.kde.kcmutils as KCMUtils 0014 import org.kde.kirigami as Kirigami 0015 import org.kde.kirigami.delegates as KD 0016 0017 ColumnLayout { 0018 id: root 0019 0020 required property Discover.AbstractResource resource 0021 0022 visible: list.model.rowCount() > 0 0023 spacing: 0 0024 0025 Kirigami.Heading { 0026 Layout.fillWidth: true 0027 Layout.bottomMargin: Kirigami.Units.largeSpacing 0028 text: i18ndc("libdiscover", "%1 is the name of the application", "Permissions for %1", root.resource.name) 0029 level: 2 0030 type: Kirigami.Heading.Type.Primary 0031 wrapMode: Text.Wrap 0032 } 0033 0034 Repeater { 0035 id: list 0036 model: root.resource.permissionsModel() 0037 0038 delegate: QQC2.ItemDelegate { 0039 id: delegate 0040 0041 required property var model 0042 required property string brief 0043 required property string description 0044 0045 Layout.fillWidth: true 0046 0047 text: brief 0048 icon.name: model.icon 0049 0050 // so that it gets neither hover nor pressed appearance when it's not interactive 0051 hoverEnabled: root.resource.isInstalled 0052 down: root.resource.isInstalled ? undefined : false 0053 0054 // ToolTip is intentionally omitted, as everything is wrapped and thus visible 0055 0056 contentItem: KD.IconTitleSubtitle { 0057 icon: icon.fromControlsIcon(delegate.icon) 0058 title: delegate.text 0059 subtitle: delegate.description 0060 selected: delegate.highlighted || delegate.down 0061 font: delegate.font 0062 wrapMode: Text.Wrap 0063 } 0064 0065 onClicked: { 0066 if (root.resource.isInstalled) { 0067 // TODO: Not only open KCM on the app's page, but also focus on relevant permission row 0068 KCMUtils.KCMLauncher.openSystemSettings("kcm_flatpak", [root.resource.ref]); 0069 } 0070 } 0071 } 0072 } 0073 0074 QQC2.Button { 0075 Layout.alignment: Qt.AlignHCenter 0076 Layout.maximumWidth: parent.width 0077 Layout.topMargin: Kirigami.Units.largeSpacing 0078 visible: root.resource.isInstalled 0079 text: i18nd("libdiscover", "Configure permissions…") 0080 icon.name: "configure" 0081 onClicked: { 0082 KCMUtils.KCMLauncher.openSystemSettings("kcm_flatpak", [root.resource.ref]); 0083 } 0084 } 0085 }