Do Not Disturb: factorized logic and toast in its proper service.

This commit is contained in:
LemmyCook 2025-09-05 19:57:22 -04:00
parent 8ec1ad7255
commit 05bfb6fc37
4 changed files with 13 additions and 22 deletions

View file

@ -23,11 +23,5 @@ NIconButton {
onClicked: PanelService.getPanel("notificationHistoryPanel")?.toggle(screen, this)
onRightClicked: {
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
ToastService.showNotice(
Settings.data.notifications.doNotDisturb ? "Do Not Disturb enabled" : "Do Not Disturb disabled",
Settings.data.notifications.doNotDisturb ? "Notifications will be hidden but saved to history" : "Notifications will be shown normally",
"notice", false, 2000)
}
onRightClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
}

View file

@ -40,10 +40,6 @@ Item {
}
function toggleDND() {
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
ToastService.showNotice(
Settings.data.notifications.doNotDisturb ? "Do Not Disturb enabled" : "Do Not Disturb disabled",
Settings.data.notifications.doNotDisturb ? "Notifications will be hidden but saved to history" : "Notifications will be shown normally",
"notice", false, 2000)
}
}

View file

@ -48,13 +48,7 @@ NPanel {
icon: Settings.data.notifications.doNotDisturb ? "notifications_off" : "notifications_active"
tooltipText: Settings.data.notifications.doNotDisturb ? "Do Not Disturb (ON)" : "Do Not Disturb (OFF)"
sizeRatio: 0.8
onClicked: {
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
ToastService.showNotice(
Settings.data.notifications.doNotDisturb ? "Do Not Disturb enabled" : "Do Not Disturb disabled",
Settings.data.notifications.doNotDisturb ? "Notifications will be hidden but saved to history" : "Notifications will be shown normally",
"notice", false, 2000)
}
onClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
}
NIconButton {