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 @@ -75,28 +75,17 @@ ComboBox { id: portbox - readonly property var ports: Ports Layout.fillWidth: true - onModelChanged: currentIndex = ActivePortIndex + onModelChanged: currentIndex = model.indexOf(Ports[ActivePortIndex]) 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; - } + onActivated: ActivePortIndex = Ports.indexOf(model[index]) + textRole: "description" + + model: Ports.filter(function (port) { + // If availability is unknown show the port + return port.availability !== Port.Unavailable + }) + } }