[applets/systemtray] Fix highlight when applet comes back from hidden

Highlight should work correctly if selected applet changes state
and is moved to hidden area and then comes back to visble area.

BUG: 435687
FIXED-IN: 5.22.0
wilder-5.22
Konrad Materka 5 years ago
parent a24370d08f
commit d6a2e1976e
  1. 18
      applets/systemtray/package/contents/ui/CurrentItemHighLight.qml

@ -54,6 +54,7 @@ PlasmaCore.FrameSvgItem {
return prefix;
}
// update when System Tray is expanded - applet activated or hidden icons shown
Connections {
target: systemTrayState
@ -66,6 +67,7 @@ PlasmaCore.FrameSvgItem {
}
}
// update when applet changes parent (e.g. moves from active to hidden icons)
Connections {
target: systemTrayState.activeApplet
@ -74,6 +76,7 @@ PlasmaCore.FrameSvgItem {
}
}
// update when System Tray size changes
Connections {
target: parent
@ -86,9 +89,18 @@ PlasmaCore.FrameSvgItem {
}
}
// update when scale of newly added tray item changes (check 'add' animation in GridView in main.qml)
Connections {
target: !!highlightedItem && highlightedItem.parent ? highlightedItem.parent : null
function onScaleChanged() {
updateHighlightedItem();
}
}
function updateHighlightedItem() {
if (systemTrayState.expanded) {
if (systemTrayState.activeApplet && systemTrayState.activeApplet.parent.inVisibleLayout) {
if (systemTrayState.activeApplet && systemTrayState.activeApplet.parent && systemTrayState.activeApplet.parent.inVisibleLayout) {
changeHighlightedItem(systemTrayState.activeApplet.parent.container);
} else { // 'Show hiden items' popup
changeHighlightedItem(parent);
@ -100,8 +112,8 @@ PlasmaCore.FrameSvgItem {
function changeHighlightedItem(nextItem) {
// do not animate the first appearance
// or when size of parent (root) changes
if (!highlightedItem || (highlightedItem === nextItem && nextItem === parent)) {
// or when the property value of a highlighted item changes
if (!highlightedItem || (highlightedItem === nextItem)) {
animationEnabled = false;
}

Loading…
Cancel
Save