Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions panels/notification/center/NotifyView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,41 @@ Control {
activeFocusOnTab: false
ScrollBar.vertical: ScrollBar { }
property int nextIndex: -1
property int pendingFocusIndex: -1 // Index to focus after expand operation
property bool panelShown: false

// Forward signals from delegate to root for Tab cycling
function gotoHeaderFirst() { root.gotoHeaderFirst() }
function gotoHeaderLast() { root.gotoHeaderLast() }

// Request focus on item after expand with retry
function requestFocusOnExpand(idx) {
pendingFocusIndex = idx
currentIndex = idx
positionViewAtIndex(idx, ListView.Contain)
expandFocusTimer.retries = 15
expandFocusTimer.start()
}

Timer {
id: expandFocusTimer
property int retries: 15
interval: 50
repeat: true
onTriggered: {
let item = view.itemAtIndex(view.pendingFocusIndex)
if (item && item.enabled) {
item.forceActiveFocus()
view.pendingFocusIndex = -1
stop()
} else if (retries <= 0) {
view.pendingFocusIndex = -1
stop()
}
retries--
}
}

onNextIndexChanged: {
if (nextIndex >= 0 && count > 0) {
currentIndex = nextIndex
Expand Down
4 changes: 3 additions & 1 deletion panels/notification/center/NotifyViewDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ DelegateChooser {

onCollapse: function () {
console.log("collapse group", model.appName)
let collapseIndex = index
notifyModel.collapseApp(index)
root.view.requestFocusOnExpand(collapseIndex)
}

onSetting: function (pos) {
Expand Down Expand Up @@ -259,7 +261,7 @@ DelegateChooser {
console.log("expand")
let expandIndex = model.index
notifyModel.expandApp(expandIndex)
root.view.nextIndex = expandIndex + 1
root.view.requestFocusOnExpand(expandIndex + 1)
}
onSetting: function (pos) {
let tmp = mapToItem(root.view, pos)
Expand Down