1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

plugins: fix set ToggleSetting not saving

fixes #541
This commit is contained in:
bbedward
2025-10-24 13:12:16 -04:00
parent 0918412916
commit cf4a6969d3

View File

@@ -14,14 +14,23 @@ Row {
width: parent.width
spacing: Theme.spacingM
Component.onCompleted: {
property bool isInitialized: false
function loadValue() {
const settings = findSettings()
if (settings) {
value = settings.loadValue(settingKey, defaultValue)
if (settings && settings.pluginService) {
const loadedValue = settings.loadValue(settingKey, defaultValue)
value = loadedValue
isInitialized = true
}
}
Component.onCompleted: {
loadValue()
}
onValueChanged: {
if (!isInitialized) return
const settings = findSettings()
if (settings) {
settings.saveValue(settingKey, value)