fix: fixed switcher behavior (#1801)

This commit is contained in:
vkamn
2025-08-20 13:01:09 +08:00
committed by GitHub
parent beb1c6dbf2
commit 8dc2a4b76c
6 changed files with 11 additions and 11 deletions

View File

@@ -155,7 +155,7 @@ Switch {
function handleSwitch(event) { function handleSwitch(event) {
if (!event.isAutoRepeat) { if (!event.isAutoRepeat) {
root.checked = !root.checked root.checked = !root.checked
root.checkedChanged() root.toggled()
} }
event.accepted = true event.accepted = true
} }

View File

@@ -153,7 +153,7 @@ PageType {
text: qsTr("Auto-negotiate encryption") text: qsTr("Auto-negotiate encryption")
checked: autoNegotiateEncryprion checked: autoNegotiateEncryprion
onCheckedChanged: { onToggled: function() {
if (checked !== autoNegotiateEncryprion) { if (checked !== autoNegotiateEncryprion) {
autoNegotiateEncryprion = checked autoNegotiateEncryprion = checked
} }
@@ -320,7 +320,7 @@ PageType {
text: qsTr("Additional client configuration commands") text: qsTr("Additional client configuration commands")
onCheckedChanged: { onToggled: function() {
if (!checked) { if (!checked) {
additionalClientCommands = "" additionalClientCommands = ""
} }
@@ -357,7 +357,7 @@ PageType {
text: qsTr("Additional server configuration commands") text: qsTr("Additional server configuration commands")
onCheckedChanged: { onToggled: function() {
if (!checked) { if (!checked) {
additionalServerCommands = "" additionalServerCommands = ""
} }

View File

@@ -66,7 +66,7 @@ PageType {
text: qsTr("Allow application screenshots") text: qsTr("Allow application screenshots")
checked: SettingsController.isScreenshotsEnabled() checked: SettingsController.isScreenshotsEnabled()
onCheckedChanged: { onToggled: function() {
if (checked !== SettingsController.isScreenshotsEnabled()) { if (checked !== SettingsController.isScreenshotsEnabled()) {
SettingsController.toggleScreenshotsEnabled(checked) SettingsController.toggleScreenshotsEnabled(checked)
} }
@@ -109,7 +109,7 @@ PageType {
descriptionText: qsTr("Launch the application every time the device is starts") descriptionText: qsTr("Launch the application every time the device is starts")
checked: SettingsController.isAutoStartEnabled() checked: SettingsController.isAutoStartEnabled()
onCheckedChanged: { onToggled: function() {
if (checked !== SettingsController.isAutoStartEnabled()) { if (checked !== SettingsController.isAutoStartEnabled()) {
SettingsController.toggleAutoStart(checked) SettingsController.toggleAutoStart(checked)
} }
@@ -132,7 +132,7 @@ PageType {
descriptionText: qsTr("Connect to VPN on app start") descriptionText: qsTr("Connect to VPN on app start")
checked: SettingsController.isAutoConnectEnabled() checked: SettingsController.isAutoConnectEnabled()
onCheckedChanged: { onToggled: function() {
if (checked !== SettingsController.isAutoConnectEnabled()) { if (checked !== SettingsController.isAutoConnectEnabled()) {
SettingsController.toggleAutoConnect(checked) SettingsController.toggleAutoConnect(checked)
} }
@@ -158,7 +158,7 @@ PageType {
opacity: enabled ? 1.0 : 0.5 opacity: enabled ? 1.0 : 0.5
checked: SettingsController.isStartMinimizedEnabled() checked: SettingsController.isStartMinimizedEnabled()
onCheckedChanged: { onToggled: function() {
if (checked !== SettingsController.isStartMinimizedEnabled()) { if (checked !== SettingsController.isStartMinimizedEnabled()) {
SettingsController.toggleStartMinimized(checked) SettingsController.toggleStartMinimized(checked)
} }

View File

@@ -66,7 +66,7 @@ PageType {
descriptionText: qsTr("If AmneziaDNS is installed on the server") descriptionText: qsTr("If AmneziaDNS is installed on the server")
checked: SettingsController.isAmneziaDnsEnabled() checked: SettingsController.isAmneziaDnsEnabled()
onCheckedChanged: { onToggled: function() {
if (checked !== SettingsController.isAmneziaDnsEnabled()) { if (checked !== SettingsController.isAmneziaDnsEnabled()) {
SettingsController.toggleAmneziaDns(checked) SettingsController.toggleAmneziaDns(checked)
} }

View File

@@ -64,7 +64,7 @@ PageType {
checked: SettingsController.isLoggingEnabled checked: SettingsController.isLoggingEnabled
onCheckedChanged: { onToggled: function() {
if (checked !== SettingsController.isLoggingEnabled) { if (checked !== SettingsController.isLoggingEnabled) {
SettingsController.isLoggingEnabled = checked SettingsController.isLoggingEnabled = checked
} }

View File

@@ -86,7 +86,7 @@ PageType {
visible: PageController.isStartPageVisible() visible: PageController.isStartPageVisible()
checked: SettingsController.isLoggingEnabled checked: SettingsController.isLoggingEnabled
onCheckedChanged: { onToggled: function() {
if (checked !== SettingsController.isLoggingEnabled) { if (checked !== SettingsController.isLoggingEnabled) {
SettingsController.isLoggingEnabled = checked SettingsController.isLoggingEnabled = checked
} }