1
0

qml: Preferences: add "Security" section

Adds a separate "Security" section to the qml preferences which contains
security related toggles so the Preferences are less mixed up.
This commit is contained in:
f321x
2026-01-20 12:48:53 +01:00
parent ac99463e4f
commit f8c44886f4

View File

@@ -157,6 +157,92 @@ Pane {
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
Switch {
id: syncLabels
onCheckedChanged: {
if (activeFocus)
AppController.setPluginEnabled('labels', checked)
}
}
Label {
Layout.fillWidth: true
text: qsTr('Synchronize labels')
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
Switch {
id: psbtNostr
onCheckedChanged: {
if (activeFocus)
AppController.setPluginEnabled('psbt_nostr', checked)
}
}
Label {
Layout.fillWidth: true
text: qsTr('Nostr Cosigner')
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
Switch {
id: setMaxBrightnessOnQrDisplay
onCheckedChanged: {
if (activeFocus)
Config.setMaxBrightnessOnQrDisplay = checked
}
}
Label {
Layout.fillWidth: true
text: qsTr('Set display to max brightness when displaying QR codes')
wrapMode: Text.Wrap
}
}
PrefsHeading {
Layout.columnSpan: 2
text: qsTr('Security')
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
property bool noWalletPassword: Daemon.currentWallet ? Daemon.currentWallet.verifyPassword('') : true
enabled: Daemon.currentWallet && !noWalletPassword
Switch {
id: paymentAuthentication
// showing the toggle as checked even if the wallet has no password would be misleading
checked: Config.paymentAuthentication && !(Daemon.currentWallet && parent.noWalletPassword)
onCheckedChanged: {
if (activeFocus) {
// will request authentication when checked = false
console.log('paymentAuthentication: ' + checked)
Config.paymentAuthentication = checked;
}
}
}
Label {
Layout.fillWidth: true
text: qsTr('Request authentication for payments')
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
@@ -214,79 +300,16 @@ Pane {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
property bool noWalletPassword: Daemon.currentWallet ? Daemon.currentWallet.verifyPassword('') : true
enabled: Daemon.currentWallet && !noWalletPassword
Switch {
id: paymentAuthentication
// showing the toggle as checked even if the wallet has no password would be misleading
checked: Config.paymentAuthentication && !(Daemon.currentWallet && parent.noWalletPassword)
onCheckedChanged: {
if (activeFocus) {
// will request authentication when checked = false
console.log('paymentAuthentication: ' + checked)
Config.paymentAuthentication = checked;
}
}
}
Label {
Layout.fillWidth: true
text: qsTr('Payment authentication')
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
Switch {
id: syncLabels
id: disableScreenshots
onCheckedChanged: {
if (activeFocus)
AppController.setPluginEnabled('labels', checked)
Config.alwaysAllowScreenshots = !checked
}
}
Label {
Layout.fillWidth: true
text: qsTr('Synchronize labels')
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
Switch {
id: psbtNostr
onCheckedChanged: {
if (activeFocus)
AppController.setPluginEnabled('psbt_nostr', checked)
}
}
Label {
Layout.fillWidth: true
text: qsTr('Nostr Cosigner')
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
Switch {
id: setMaxBrightnessOnQrDisplay
onCheckedChanged: {
if (activeFocus)
Config.setMaxBrightnessOnQrDisplay = checked
}
}
Label {
Layout.fillWidth: true
text: qsTr('Set display to max brightness when displaying QR codes')
text: qsTr('Protect secrets from screenshots')
wrapMode: Text.Wrap
}
}
@@ -463,24 +486,6 @@ Pane {
wrapMode: Text.Wrap
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
Switch {
id: alwaysAllowScreenshots
onCheckedChanged: {
if (activeFocus)
Config.alwaysAllowScreenshots = checked
}
}
Label {
Layout.fillWidth: true
text: qsTr('Always allow screenshots')
wrapMode: Text.Wrap
}
}
}
}
}
@@ -498,7 +503,7 @@ Pane {
freezeReusedAddressUtxos.checked = Config.freezeReusedAddressUtxos
useTrampolineRouting.checked = !Config.useGossip
enableDebugLogs.checked = Config.enableDebugLogs
alwaysAllowScreenshots.checked = Config.alwaysAllowScreenshots
disableScreenshots.checked = !Config.alwaysAllowScreenshots
setMaxBrightnessOnQrDisplay.checked = Config.setMaxBrightnessOnQrDisplay
useRecoverableChannels.checked = Config.useRecoverableChannels
syncLabels.checked = AppController.isPluginEnabled('labels')