summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rosca <[email protected]>2017-02-28 10:31:33 +0100
committerDavid Rosca <[email protected]>2017-05-02 14:03:33 +0200
commit3e497a1518edeadc8ef7b93597b11b7f59a65400 (patch)
tree6590fde6f6d5328887395da5535686b023386523
parentb84ed90c50cdd4778083a3ea503957ca4260ea84 (diff)
Indicate that a port is unavailable
Show "portname (unavailable)" in port list if a port is not available. Differential Revision: https://phabricator.kde.org/D4836
-rw-r--r--applet/contents/ui/ListItemBase.qml7
-rw-r--r--src/kcm/package/contents/ui/DeviceListItem.qml22
2 files changed, 27 insertions, 2 deletions
diff --git a/applet/contents/ui/ListItemBase.qml b/applet/contents/ui/ListItemBase.qml
index 5ce7eb6..e66afbf 100644
--- a/applet/contents/ui/ListItemBase.qml
+++ b/applet/contents/ui/ListItemBase.qml
@@ -282,6 +282,13 @@ PlasmaComponents.ListItem {
var port = PulseObject.ports[i];
var menuItem = newMenuItem();
menuItem.text = port.description;
+ if (port.availability == Port.Unavailable) {
+ if (port.name == "analog-output-speaker" || port.name == "analog-input-microphone-internal") {
+ menuItem.text += i18nc("Port is unavailable", " (unavailable)");
+ } else {
+ menuItem.text += i18nc("Port is unplugged", " (unplugged)");
+ }
+ }
menuItem.enabled = isMultiplePorts;
menuItem.checkable = true;
menuItem.checked = i === PulseObject.activePortIndex;
diff --git a/src/kcm/package/contents/ui/DeviceListItem.qml b/src/kcm/package/contents/ui/DeviceListItem.qml
index fae1e01..2b90f92 100644
--- a/src/kcm/package/contents/ui/DeviceListItem.qml
+++ b/src/kcm/package/contents/ui/DeviceListItem.qml
@@ -24,6 +24,8 @@ import QtQuick.Layouts 1.0
import org.kde.kquickcontrolsaddons 2.0
+import org.kde.plasma.private.volume 0.1
+
ColumnLayout {
id: delegate
width: parent.width
@@ -73,12 +75,28 @@ ColumnLayout {
ComboBox {
id: portbox
+ readonly property var ports: Ports
Layout.fillWidth: true
- model: Ports
onModelChanged: currentIndex = ActivePortIndex
- textRole: "description"
currentIndex: ActivePortIndex
onActivated: ActivePortIndex = index
+
+ onPortsChanged: {
+ var items = [];
+ for (var i = 0; i < ports.length; ++i) {
+ var port = ports[i];
+ var text = port.description;
+ if (port.availability == Port.Unavailable) {
+ if (port.name == "analog-output-speaker" || port.name == "analog-input-microphone-internal") {
+ text += i18nc("Port is unavailable", " (unavailable)");
+ } else {
+ text += i18nc("Port is unplugged", " (unplugged)");
+ }
+ }
+ items.push(text);
+ }
+ model = items;
+ }
}
}