Warning, /frameworks/kcmutils/src/qml/components/KPluginDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2022 Alexander Lohnau <alexander.lohnau@gmx.de> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 import QtQuick 2.5 0007 import QtQuick.Controls 2.5 as QQC2 0008 import QtQuick.Controls 2.4 as Controls 0009 0010 import QtQuick.Layouts 1.1 0011 0012 import org.kde.kirigami 2.5 as Kirigami 0013 import org.kde.kcm 1.5 as KCM 0014 0015 /// @since 5.94 0016 // Not using Kirigami.CheckableListItem despite having a checkbox because we 0017 // need the checkbox to be highlighted by KCM.SettingHighlighter, and 0018 // CheckableListItem doesn't have that built in. 0019 Kirigami.BasicListItem { 0020 id: listItem 0021 0022 property list<QQC2.Action> additionalActions 0023 signal configTriggered() 0024 0025 leading: QQC2.CheckBox { 0026 checkState: model.enabled ? Qt.Checked : Qt.Unchecked; 0027 0028 onToggled: model.enabled = checkState 0029 0030 KCM.SettingHighlighter { 0031 highlight: parent.checked !== model.enabledByDefault 0032 } 0033 } 0034 0035 icon: model.icon 0036 label: model.name 0037 subtitle: model.description 0038 0039 // Don't need highlight or hover effects; there is no concept of selection here 0040 hoverEnabled: false 0041 0042 // Some items don't have subtitles and we want everything to have a consistent height 0043 reserveSpaceForSubtitle: true 0044 0045 // Take care of displaying the actions 0046 property var infoAction: Kirigami.Action { 0047 icon.name: "dialog-information" 0048 tooltip: i18nc("@info:tooltip", "About") 0049 onTriggered: { 0050 const aboutDialog = listItem.parent.parent.__aboutDialog 0051 aboutDialog.metaDataInfo = model.metaData 0052 aboutDialog.open() 0053 } 0054 } 0055 property var configureAction: Kirigami.Action { 0056 visible: model.config.isValid 0057 enabled: model.enabled 0058 icon.name: "configure" 0059 tooltip: i18nc("@info:tooltip", "Configure...") 0060 onTriggered: listItem.configTriggered() 0061 } 0062 0063 // Put this in an intermediary property so that we can append to the list 0064 property var __allActions: [] 0065 Component.onCompleted: { 0066 const tmp = []; 0067 tmp.push(infoAction) 0068 tmp.push(configureAction) 0069 for (let i = 0; i < additionalActions.length; i++) { 0070 tmp.push(additionalActions[i]) 0071 } 0072 __allActions = tmp 0073 } 0074 trailing: Kirigami.ActionToolBar { 0075 actions: __allActions 0076 } 0077 }