9import QtQuick.Templates as T
11import org.kde.plasma.plasmoid
12import org.kde.plasma.core as PlasmaCore
13import org.kde.plasma.extras as PlasmaExtras
14import org.kde.plasma.components as PlasmaComponents
15import org.kde.kirigami as Kirigami
32 default property alias extraControls: extraControlsLayout.data
34 visible: !(Plasmoid.containmentDisplayHints & PlasmaCore.Types.ContainmentDrawsPlasmoidHeading)
36 contentItem: RowLayout {
38 elide: Text.ElideRight
40 Layout.fillWidth: true
45 id: extraControlsLayout
46 visible: children.length > 0
47 Layout.fillHeight: true
49 PlasmaComponents.ToolButton {
51 visible: visibleActions > 0
52 checked: configMenu.status !== PlasmaExtras.Menu.Closed
53 property int visibleActions: menuItemFactory.count
54 property QtObject singleAction: visibleActions === 1 ? menuItemFactory.object.action : null
55 icon.name: "open-menu-symbolic"
56 checkable: visibleActions > 1
57 contentItem.opacity: visibleActions > 1
61 anchors.centerIn: parent
62 active: actionsButton.hovered
63 implicitWidth:
Kirigami.Units.iconSizes.smallMedium
64 implicitHeight: implicitWidth
65 source: actionsButton.singleAction !== null ? actionsButton.singleAction.icon :
""
66 visible: actionsButton.singleAction
70 configMenu.openRelative();
77 singleAction.trigger();
80 PlasmaComponents.ToolTip {
81 text: actionsButton.singleAction ? actionsButton.singleAction.text :
i18nd(
"libplasma6",
"More actions")
85 visualParent: actionsButton
86 placement: PlasmaExtras.Menu.BottomPosedLeftAlignedPopup
92 configMenu.clearMenuItems();
93 const configureAction = Plasmoid.internalAction(
"configure");
94 const actions = Plasmoid.contextualActions
95 .filter(action => action !== configureAction);
98 delegate: PlasmaExtras.MenuItem {
99 required
property QtObject modelData
103 configMenu.addMenuItem(
object);
107 PlasmaComponents.ToolButton {
110 property PlasmaCore.Action internalAction
112 function fetchInternalAction() {
113 internalAction = Plasmoid.internalAction(
"configure");
118 function onInternalActionsChanged(actions) {
119 configureButton.fetchInternalAction();
123 Component.onCompleted: fetchInternalAction()
125 icon.name: "configure"
126 visible: internalAction !== null
127 text: internalAction?.text ?? ""
130 text: configureButton.text
132 onClicked: internalAction?.trigger();
QString i18nd(const char *domain, const char *text, const TYPE &arg...)