Skip to content

Commit

Permalink
qml, component: Correct ProxySettings behaviour
Browse files Browse the repository at this point in the history
Making the option switches work to enable and disable
the IP Address and Port fields (Proxy and Tor - ValueInput)
accordingly to the user's intentions.
  • Loading branch information
pablomartin4btc committed Mar 22, 2024
1 parent be965bf commit b9ac128
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/qml/components/ProxySettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ ColumnLayout {
}
Separator { Layout.fillWidth: true }
Setting {
id: defaultProxyEnable
Layout.fillWidth: true
header: qsTr("Enable")
actionItem: OptionSwitch {}
actionItem: OptionSwitch {
onCheckedChanged: {
if (checked == false) {
defaultProxy.state = "DISABLED"
} else {
defaultProxy.state = "ACTIVE"
}
}
}
onClicked: {
loadedItem.toggle()
loadedItem.toggled()
Expand All @@ -33,6 +42,8 @@ ColumnLayout {
id: defaultProxy
Layout.fillWidth: true
header: qsTr("IP and Port")
errorText: qsTr("Invalid IP address or port format. Please use the format '255.255.255.255:65535'.")
state: !defaultProxyEnable.loadedItem.checked ? "DISABLED" : "ACTIVE"
actionItem: ValueInput {
parentState: defaultProxy.state
description: "127.0.0.1:9050"
Expand All @@ -55,9 +66,18 @@ ColumnLayout {
}
Separator { Layout.fillWidth: true }
Setting {
id: torProxyEnable
Layout.fillWidth: true
header: qsTr("Enable")
actionItem: OptionSwitch {}
actionItem: OptionSwitch {
onCheckedChanged: {
if (checked == false) {
torProxy.state = "DISABLED"
} else {
torProxy.state = "ACTIVE"
}
}
}
description: qsTr("When disabled, Tor connections will use the default proxy (if enabled).")
onClicked: {
loadedItem.toggle()
Expand All @@ -69,6 +89,8 @@ ColumnLayout {
id: torProxy
Layout.fillWidth: true
header: qsTr("IP and Port")
errorText: qsTr("Invalid IP address or port format. Please use the format '255.255.255.255:65535'.")
state: !torProxyEnable.loadedItem.checked ? "DISABLED" : "ACTIVE"
actionItem: ValueInput {
parentState: torProxy.state
description: "127.0.0.1:9050"
Expand Down

0 comments on commit b9ac128

Please sign in to comment.