Protect live state during restore and reset
This commit is contained in:
@@ -6,6 +6,33 @@ import qs.config
|
||||
import qs.services
|
||||
|
||||
ShellRoot {
|
||||
id: root
|
||||
|
||||
property var resetCalls: []
|
||||
property bool displayBlocked: false
|
||||
|
||||
function recordReset(name: string): void {
|
||||
const next = root.resetCalls.slice();
|
||||
next.push(name);
|
||||
root.resetCalls = next;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
SystemSettings.displayBusy = function() { return false; };
|
||||
SystemSettings.readDisplays = function() { return DesktopPreferences.get("displays"); };
|
||||
SystemSettings.protectDisplays = function(value) {
|
||||
root.recordReset("display.protect");
|
||||
return DesktopPreferences.set("displays", value);
|
||||
};
|
||||
SystemSettings.setDisplayBlocked = function(blocked) {
|
||||
root.recordReset("display.block:" + blocked);
|
||||
root.displayBlocked = blocked;
|
||||
};
|
||||
SystemSettings.reloadKeybinds = function() { root.recordReset("keybinds.reload"); };
|
||||
SystemSettings.keybindsReloading = function() { return false; };
|
||||
SystemSettings.applyWallpaper = function(path) { root.recordReset("wallpaper.set:" + path); };
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "settings-system-test"
|
||||
|
||||
@@ -52,7 +79,14 @@ ShellRoot {
|
||||
});
|
||||
}
|
||||
|
||||
function restoreDefaults(): void { SystemSettings.restoreDefaults(); }
|
||||
function restoreDefaults(): bool {
|
||||
root.resetCalls = [];
|
||||
return SystemSettings.restoreDefaults();
|
||||
}
|
||||
|
||||
function resetState(): string {
|
||||
return JSON.stringify({ calls: root.resetCalls, displayBlocked: root.displayBlocked });
|
||||
}
|
||||
|
||||
function panelAllowed(panel: string): bool {
|
||||
return SystemSettings.isGnomePanelAllowed(panel);
|
||||
|
||||
Reference in New Issue
Block a user