Unverified Commit 359ec78c authored by Christian (Fuchs)'s avatar Christian (Fuchs) Committed by David Rosca
Browse files

Add "move to device" functionality to hamburger menu

This patch adds the possibility to choose a device for a playback / recording stream in the hamburger menu.
As per the discussion with the developers, the drag & drop functionality stays untouched and is still available.

This is added to be a bit more consistent with the kcm and to make the functionality easier to discover.

The menu is only shown when there are more than one possibilities to choose from in order to not confuse users.

FEATURE: 384292

Differential Revision: https://phabricator.kde.org/D10901
parent 3e7f7047
......@@ -331,6 +331,37 @@ PlasmaComponents.ListItem {
contextMenu.addMenuItem(menuItem);
}
}
// Choose output / input device
// By choice only shown when there are at least two options
if ((type == "sink-input" && sinkView.model.count > 1) || (type == "source-input" && sourceView.model.count > 1)) {
contextMenu.addMenuItem(newSeperator());
var menuItem = newMenuItem();
if (type == "sink-input") {
menuItem.text = i18nc("Heading for a list of possible output devices (speakers, headphones, ...) to choose", "Play audio using");
} else {
menuItem.text = i18nc("Heading for a list of possible input devices (built-in microphone, headset, ...) to choose", "Record audio using");
}
menuItem.section = true;
contextMenu.addMenuItem(menuItem);
var sModel = type == "sink-input" ? sinkView.model : sourceView.model;
for (var i = 0; i < sModel.count; ++i) {
var data = sModel.get(i);
var menuItem = newMenuItem();
menuItem.text = data.Description;
menuItem.enabled = true;
menuItem.checkable = true;
menuItem.checked = data.Index === PulseObject.deviceIndex;
var setActiveSink = function(sinkIndex) {
return function() {
PulseObject.deviceIndex = sinkIndex;
};
};
menuItem.clicked.connect(setActiveSink(data.Index));
contextMenu.addMenuItem(menuItem);
}
}
}
function show() {
......
Supports Markdown
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