Commit 37214faf authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[ListItemBase] Open options menu also on right click like a context menu

parent 158157bc
...@@ -141,7 +141,10 @@ PlasmaComponents.ListItem { ...@@ -141,7 +141,10 @@ PlasmaComponents.ListItem {
id: contextMenuButton id: contextMenuButton
icon: "application-menu" icon: "application-menu"
checkable: true checkable: true
onClicked: contextMenu.show() onClicked: {
contextMenu.visualParent = this;
contextMenu.showRelative();
}
tooltip: i18n("Show additional options for %1", defaultButton.text) tooltip: i18n("Show additional options for %1", defaultButton.text)
visible: { visible: {
// if it is a sink type and there are at least two sink devices. Same for source type. // if it is a sink type and there are at least two sink devices. Same for source type.
...@@ -284,15 +287,24 @@ PlasmaComponents.ListItem { ...@@ -284,15 +287,24 @@ PlasmaComponents.ListItem {
fill: parent fill: parent
leftMargin: clientIcon.width leftMargin: clientIcon.width
} }
acceptedButtons: Qt.MiddleButton acceptedButtons: Qt.MiddleButton | Qt.RightButton
onClicked: Muted = !Muted onPressed: {
if (mouse.button === Qt.RightButton) {
contextMenu.visualParent = this;
contextMenu.show(mouse.x, mouse.y);
}
}
onClicked: {
if (mouse.button === Qt.MiddleButton) {
Muted = !Muted;
}
}
} }
} }
PlasmaComponents.ContextMenu { PlasmaComponents.ContextMenu {
id: contextMenu id: contextMenu
visualParent: contextMenuButton
placement: PlasmaCore.Types.BottomPosedLeftAlignedPopup placement: PlasmaCore.Types.BottomPosedLeftAlignedPopup
onStatusChanged: { onStatusChanged: {
...@@ -422,7 +434,12 @@ PlasmaComponents.ListItem { ...@@ -422,7 +434,12 @@ PlasmaComponents.ListItem {
} }
} }
function show() { function show(x, y) {
loadDynamicActions();
open(x, y);
}
function showRelative(){
loadDynamicActions(); loadDynamicActions();
openRelative(); openRelative();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment