1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-23 10:03:43 +03:00

select proper indicator in combobox list

This commit is contained in:
Michail Vourlakos 2019-04-04 14:52:50 +03:00
parent f9091f3b6c
commit 2919620467

View File

@ -100,6 +100,15 @@ LatteComponents.ComboBoxButton{
}
}
Connections{
target: custom.comboBox.popup
onVisibleChanged: {
if (visible) {
custom.selectChosenType();
}
}
}
function updateButtonInformation() {
if (latteView.indicator.customPluginsCount === 0) {
custom.buttonText = i18n("Download");
@ -151,12 +160,28 @@ LatteComponents.ComboBoxButton{
comboBox.model = actionsModel;
if (custom.type === latteView.indicator.type) {
comboBox.currentIndex = 0;
selectChosenType();
} else {
comboBox.currentIndex = -1;
}
}
function selectChosenType() {
var found = false;
for (var i=0; i<actionsModel.count; ++i) {
if (actionsModel.get(i).pluginId === custom.type) {
found = true;
custom.comboBox.currentIndex = i;
break;
}
}
if (!found) {
custom.comboBox.currentIndex = -1;
}
}
function emptyModel() {
actionsModel.clear();
appendDefaults();