mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
notifications: Ensure correct state is being set for do not disturb
Change the "toggleDoNotDisturbMode" function to "setDoNotDisturbMode" and add a parameter so that we actually set the mode to the intended value, not just flip it.
This commit is contained in:
parent
3d068528d0
commit
54cd4d548e
1 changed files with 14 additions and 5 deletions
|
|
@ -129,12 +129,21 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles Do Not Disturb mode.
|
* Sets Do Not Disturb mode to the intended setting.
|
||||||
|
* Note: The state may not change to the desired setting, always read doNotDisturbEnabled for the current state.
|
||||||
*/
|
*/
|
||||||
function toggleDoNotDisturbMode() {
|
function setDoNotDisturbMode(doNotDisturb: bool) {
|
||||||
if (doNotDisturbModeEnabled) {
|
if (!doNotDisturb) {
|
||||||
notificationSettings.defaults();
|
// Turn off do not disturb
|
||||||
|
|
||||||
|
notificationSettings.notificationsInhibitedUntil = undefined;
|
||||||
|
notificationSettings.revokeApplicationInhibitions();
|
||||||
|
notificationSettings.fullscreenFocused = false;
|
||||||
|
// overrules current mirrored screen setup, updates again when screen configuration changes
|
||||||
|
notificationSettings.screensMirrored = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Turn on do not disturb
|
||||||
// We just have a global toggle, so set it to a really long time (in this case, a year)
|
// We just have a global toggle, so set it to a really long time (in this case, a year)
|
||||||
var until = new Date();
|
var until = new Date();
|
||||||
until.setFullYear(until.getFullYear() + 1);
|
until.setFullYear(until.getFullYear() + 1);
|
||||||
|
|
@ -157,7 +166,7 @@ Item {
|
||||||
|
|
||||||
function onDoNotDisturbChanged() {
|
function onDoNotDisturbChanged() {
|
||||||
if (root.doNotDisturbModeEnabled !== MobileShellState.ShellDBusClient.doNotDisturb) {
|
if (root.doNotDisturbModeEnabled !== MobileShellState.ShellDBusClient.doNotDisturb) {
|
||||||
root.toggleDoNotDisturbMode();
|
root.setDoNotDisturbMode(MobileShellState.ShellDBusClient.doNotDisturb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue