fix(settings) fix toggle button for change password screen

Updates #13898
This commit is contained in:
Stefan 2024-03-14 21:04:15 +02:00 committed by Stefan Dunca
parent 69312aed29
commit db6e24e4c3
2 changed files with 37 additions and 3 deletions

View File

@ -37,6 +37,23 @@ SplitView {
signal storeToKeychainError(errorDescription: string)
signal storeToKeychainSuccess()
}
function tryStoreToKeyChain(errorDescription) {
if (generateMacKeyChainStoreError.checked) {
privacyModule.storeToKeychainError(errorDescription)
} else {
privacyModule.storeToKeychainSuccess()
privacyModule.passwordChanged(true, "")
}
}
function tryRemoveFromKeyChain() {
if (generateMacKeyChainStoreError.checked) {
privacyModule.storeToKeychainError(errorDescription)
} else {
privacyModule.storeToKeychainSuccess()
}
}
}
property QtObject localAccountSettings: QtObject {
@ -54,7 +71,11 @@ SplitView {
logsView.logText: logs.logText
RowLayout {
Switch {
id: generateMacKeyChainStoreError
text: "Generate key chain error"
checked: false
}
}
}
}

View File

@ -25,15 +25,20 @@ SettingsContentBase {
readonly property bool biometricsEnabled: localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store
readonly property StatusSwitch biometricsSwitch: titleRowComponentLoader.item.switchItem
readonly property Connections privacyStoreConnections: Connections {
target: Qt.platform.os === Constants.mac ? root.privacyStore.privacyModule : null
function onStoreToKeychainError(errorDescription: string) {
biometricsSwitch.checked = Qt.binding(() => { return biometricsSwitch.currentStoredValue })
root.biometricsSwitch.checked = Qt.binding(() => {
return root.biometricsSwitch.currentStoredValue
})
}
function onStoreToKeychainSuccess() {
biometricsSwitch.checked = Qt.binding(() => { return biometricsSwitch.currentStoredValue })
root.biometricsSwitch.checked = Qt.binding(() => {
return root.biometricsSwitch.currentStoredValue
})
}
}
@ -43,14 +48,22 @@ SettingsContentBase {
implicitWidth: 226
implicitHeight: 38
visible: (Qt.platform.os === Constants.mac)
property StatusSwitch switchItem: biometricsSwitch
StatusSwitch {
id: biometricsSwitch
LayoutMirroring.enabled: true
LayoutMirroring.childrenInherit: true
text: qsTr("Enable biometrics")
textColor: Theme.palette.baseColor1
property bool currentStoredValue: false
checked: root.biometricsEnabled
onToggled: {
currentStoredValue = checked
enableBiometricsPopup.open();
}
StatusToolTip {