Commit 9397d3a2 authored by Konrad Materka's avatar Konrad Materka
Browse files

[applets/systemtray] Simplify rowCount

parent be476538
......@@ -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()}
}
}
Supports Markdown
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