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
parent 5985fcb971
commit 3cef50c2ca
2 changed files with 37 additions and 3 deletions

View File

@ -37,6 +37,23 @@ SplitView {
signal storeToKeychainError(errorDescription: string) signal storeToKeychainError(errorDescription: string)
signal storeToKeychainSuccess() 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 { property QtObject localAccountSettings: QtObject {
@ -54,7 +71,11 @@ SplitView {
logsView.logText: logs.logText logsView.logText: logs.logText
RowLayout { 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 bool biometricsEnabled: localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store
readonly property StatusSwitch biometricsSwitch: titleRowComponentLoader.item.switchItem
readonly property Connections privacyStoreConnections: Connections { readonly property Connections privacyStoreConnections: Connections {
target: Qt.platform.os === Constants.mac ? root.privacyStore.privacyModule : null target: Qt.platform.os === Constants.mac ? root.privacyStore.privacyModule : null
function onStoreToKeychainError(errorDescription: string) { function onStoreToKeychainError(errorDescription: string) {
biometricsSwitch.checked = Qt.binding(() => { return biometricsSwitch.currentStoredValue }) root.biometricsSwitch.checked = Qt.binding(() => {
return root.biometricsSwitch.currentStoredValue
})
} }
function onStoreToKeychainSuccess() { 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 implicitWidth: 226
implicitHeight: 38 implicitHeight: 38
visible: (Qt.platform.os === Constants.mac) visible: (Qt.platform.os === Constants.mac)
property StatusSwitch switchItem: biometricsSwitch
StatusSwitch { StatusSwitch {
id: biometricsSwitch id: biometricsSwitch
LayoutMirroring.enabled: true LayoutMirroring.enabled: true
LayoutMirroring.childrenInherit: true LayoutMirroring.childrenInherit: true
text: qsTr("Enable biometrics") text: qsTr("Enable biometrics")
textColor: Theme.palette.baseColor1 textColor: Theme.palette.baseColor1
property bool currentStoredValue: false
checked: root.biometricsEnabled checked: root.biometricsEnabled
onToggled: { onToggled: {
currentStoredValue = checked
enableBiometricsPopup.open(); enableBiometricsPopup.open();
} }
StatusToolTip { StatusToolTip {