fix: close notif group notifs in batches
This commit is contained in:
parent
1d6919b375
commit
c7a943b1c7
2 changed files with 20 additions and 11 deletions
|
|
@ -150,7 +150,7 @@ Item {
|
||||||
id: actionInner
|
id: actionInner
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
sourceComponent: action.modelData.isClose || action.modelData.isCopy ? iconBtn : root.notif.hasActionIcons ? iconComp : textComp
|
sourceComponent: action.modelData.isClose || action.modelData.isCopy ? iconBtn : root.notif?.hasActionIcons ? iconComp : textComp
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
|
|
||||||
|
|
@ -62,16 +62,7 @@ LazyListView {
|
||||||
property int startY
|
property int startY
|
||||||
|
|
||||||
function closeAll(): void {
|
function closeAll(): void {
|
||||||
for (const n of Notifs.notClosed.filter(n => n.appName === modelData))
|
clearTimer.start();
|
||||||
n.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
containmentMask: QtObject {
|
|
||||||
function contains(p: point): bool {
|
|
||||||
if (!root.container.contains(notif.mapToItem(root.container, p)))
|
|
||||||
return false;
|
|
||||||
return notifInner.contains(p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyListView.preferredHeight: closed ? 0 : notifInner.nonAnimHeight
|
LazyListView.preferredHeight: closed ? 0 : notifInner.nonAnimHeight
|
||||||
|
|
@ -111,6 +102,24 @@ LazyListView {
|
||||||
closeAll();
|
closeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: clearTimer
|
||||||
|
|
||||||
|
interval: 15
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: {
|
||||||
|
const notifs = Notifs.notClosed.filter(n => n.appName === notif.modelData);
|
||||||
|
if (notifs.length === 0) {
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const n of notifs.slice(0, 30))
|
||||||
|
n.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NotifGroup {
|
NotifGroup {
|
||||||
id: notifInner
|
id: notifInner
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue