diff --git a/applet/contents/ui/ListItemBase.qml b/applet/contents/ui/ListItemBase.qml --- a/applet/contents/ui/ListItemBase.qml +++ b/applet/contents/ui/ListItemBase.qml @@ -282,6 +282,13 @@ 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 --- a/src/kcm/package/contents/ui/DeviceListItem.qml +++ b/src/kcm/package/contents/ui/DeviceListItem.qml @@ -24,6 +24,8 @@ import org.kde.kquickcontrolsaddons 2.0 +import org.kde.plasma.private.volume 0.1 + ColumnLayout { id: delegate width: parent.width @@ -73,12 +75,28 @@ 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; + } } }