fix(PrivacyView): [re-add] Fix relations between switch and line sensor

Fixes #4674

The part about profile image was already refactpred/fixed
This commit is contained in:
Jonathan Rainville 2022-02-04 15:49:16 -05:00
parent 723613a5e0
commit 5d0eb942b0
2 changed files with 23 additions and 7 deletions

View File

@ -8,7 +8,6 @@ QtObject {
// Module Properties // Module Properties
property bool mnemonicBackedUp: privacyModule.mnemonicBackedUp property bool mnemonicBackedUp: privacyModule.mnemonicBackedUp
property bool messagesFromContactsOnly: privacyModule.messagesFromContactsOnly
function getLinkPreviewWhitelist() { function getLinkPreviewWhitelist() {
return root.privacyModule.getLinkPreviewWhitelist() return root.privacyModule.getLinkPreviewWhitelist()

View File

@ -157,11 +157,16 @@ Item {
StatusQControls.StatusSwitch { StatusQControls.StatusSwitch {
id: switch1 id: switch1
checked: !localAccountSensitiveSettings.onlyShowContactsProfilePics checked: !localAccountSensitiveSettings.onlyShowContactsProfilePics
onClicked: { onCheckedChanged: {
if (localAccountSensitiveSettings.onlyShowContactsProfilePics === checked) {
localAccountSensitiveSettings.onlyShowContactsProfilePics = !checked localAccountSensitiveSettings.onlyShowContactsProfilePics = !checked
} }
} }
}
] ]
sensor.onClicked: {
switch1.checked = !switch1.checked
}
} }
StatusListItem { StatusListItem {
@ -176,11 +181,16 @@ Item {
StatusQControls.StatusSwitch { StatusQControls.StatusSwitch {
id: switch2 id: switch2
checked: localAccountSensitiveSettings.displayChatImages checked: localAccountSensitiveSettings.displayChatImages
onClicked: { onCheckedChanged: {
if (localAccountSensitiveSettings.displayChatImages !== checked) {
localAccountSensitiveSettings.displayChatImages = checked localAccountSensitiveSettings.displayChatImages = checked
} }
} }
}
] ]
sensor.onClicked: {
switch2.checked = !switch2.checked
}
} }
StatusBaseText { StatusBaseText {
@ -255,11 +265,18 @@ Item {
components: [ components: [
StatusQControls.StatusSwitch { StatusQControls.StatusSwitch {
id: switch3 id: switch3
checked: !root.privacyStore.messagesFromContactsOnly checked: !root.privacyStore.privacyModule.messagesFromContactsOnly
onCheckedChanged: {
// messagesFromContactsOnly needs to be accessed from the module (view),
// because otherwise doing `messagesFromContactsOnly = value` only changes the bool property on QML
if (root.privacyStore.privacyModule.messagesFromContactsOnly === checked) {
root.privacyStore.privacyModule.messagesFromContactsOnly = !checked
}
}
} }
] ]
sensor.onClicked: { sensor.onClicked: {
switch3.checked = root.privacyStore.messagesFromContactsOnly = !switch3.checked switch3.checked = !switch3.checked
} }
} }
} }