Commit 09787958 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Fix speaker test not showing sinks/buttons

Summary:
Initially no sink is selected in the combobox which leads to an empty speaker test widget. Furthermore, when only one sink is available the combobox isn't shown at all, resulting in the speaker test not working because currentIndex will be -1.

Fix this by setting the initial index to 0 and use 0 instead of -1 for querying model data when the combobox isn't shown

Test Plan: With 1 available sink speaker test works. With two available sinks the first one is selected at startup, speaker test works

Reviewers: #plasma, drosca, ngraham

Reviewed By: ngraham

Subscribers: aacid, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D23620
parent e4cd6f30
......@@ -130,11 +130,15 @@ ScrollView {
}
onCurrentIndexChanged: updatePulseObject()
onCurrentTextChanged: updatePulseObject()
Component.onCompleted: updatePulseObject()
Component.onCompleted: {
sinks.currentIndex = 0
updatePulseObject()
}
function updatePulseObject() {
Qt.callLater(function() {
pulseObject = model.data(model.index(sinks.currentIndex, 0), model.role("PulseObject"));
// When the combobox isn't shown currentIndex is -1, so use 0 in that case
pulseObject = model.data(model.index(Math.max(sinks.currentIndex, 0), 0), model.role("PulseObject"));
});
}
}
......
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