Skip to content

Commit

Permalink
fix: switch button loop bind property
Browse files Browse the repository at this point in the history
pms: Bug-292671, Bug-292673
  • Loading branch information
kegechen committed Dec 11, 2024
1 parent c275a5e commit 692a64e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/plugin-accounts/qml/AccountSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ DccObject {
property bool nopasswdLoginChecked: true
property bool isDeleteUser: false

Component.onCompleted: {
settings.autoLoginChecked = dccData.autoLogin(settings.userId)
settings.nopasswdLoginChecked = dccData.nopasswdLogin(settings.userId)
}

Component.onDestruction: {
if (isDeleteUser) {
DccApp.showPage("accounts")
Expand Down Expand Up @@ -348,13 +353,16 @@ DccObject {
visible: dccData.isAutoLoginVisable()
enabled: dccData.currentUserId() === settings.userId
page: Switch {
checked: settings.autoLoginChecked && dccData.autoLogin(settings.userId)
checked: settings.autoLoginChecked
onCheckedChanged: {
settings.autoLoginChecked = checked
if (settings.autoLoginChecked != checked)
settings.autoLoginChecked = checked

dccData.setAutoLogin(settings.userId, checked)
}
}
}

DccObject {
id: noPassword
name: settings.papaName + "noPassword"
Expand All @@ -365,9 +373,11 @@ DccObject {
visible: dccData.isNoPassWordLoginVisable()
enabled: dccData.currentUserId() === settings.userId
page: Switch {
checked: settings.nopasswdLoginChecked && dccData.nopasswdLogin(settings.userId)
checked: settings.nopasswdLoginChecked
onCheckedChanged: {
settings.nopasswdLoginChecked = checked
if (settings.nopasswdLoginChecked != checked)
settings.nopasswdLoginChecked = checked

dccData.setNopasswdLogin(settings.userId, checked)
}
}
Expand Down

0 comments on commit 692a64e

Please sign in to comment.