[applets/systemtray] Simplify rowCount

wilder-5.22
Konrad Materka 5 years ago
parent be476538cd
commit 9397d3a289
  1. 2
      applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
  2. 17
      applets/systemtray/package/contents/ui/HiddenItemsView.qml

@ -74,7 +74,7 @@ Item {
PlasmaComponents.ToolButton {
id: backButton
visible: systemTrayState.activeApplet && systemTrayState.activeApplet.expanded && (hiddenItemsView.itemCount > 0)
visible: systemTrayState.activeApplet && systemTrayState.activeApplet.expanded && (hiddenLayout.itemCount > 0)
icon.name: LayoutMirroring.enabled ? "go-previous-symbolic-rtl" : "go-previous-symbolic"
onClicked: systemTrayState.setActiveApplet(null)
}

@ -31,7 +31,6 @@ MouseArea {
id: hiddenTasksView
property alias layout: hiddenTasks
readonly property alias itemCount: hiddenTasks.itemCount
hoverEnabled: true
onExited: hiddenTasks.currentIndex = -1
@ -57,11 +56,7 @@ MouseArea {
highlight: PlasmaComponents.Highlight {}
highlightMoveDuration: 0
property int itemCount: model.rowCount()
Component.onCompleted: {
itemCount = model.rowCount()
}
readonly property int itemCount: model.count
model: PlasmaCore.SortFilterModel {
sourceModel: plasmoid.nativeInterface.systemTrayModel
@ -73,14 +68,4 @@ MouseArea {
delegate: ItemLoader {}
}
}
Connections {
target: hiddenTasks.model
// hiddenTasks.count is not updated when ListView is hidden and is not rendered
// manually update itemCount so that expander arrow hides/shows itself correctly
function onModelReset() {hiddenTasks.itemCount = hiddenTasks.model.rowCount()}
function onRowsInserted() {hiddenTasks.itemCount = hiddenTasks.model.rowCount()}
function onRowsRemoved() {hiddenTasks.itemCount = hiddenTasks.model.rowCount()}
function onLayoutChanged() {hiddenTasks.itemCount = hiddenTasks.model.rowCount()}
}
}

Loading…
Cancel
Save