mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
chore: block vless toggle while active connection (#2318)
* fix: prevent disabled SwitcherType from toggling via keyboard * fix: disabled vless option toggle while connection is active
This commit is contained in:
@@ -153,7 +153,7 @@ Switch {
|
||||
Keys.onSpacePressed: event => handleSwitch(event)
|
||||
|
||||
function handleSwitch(event) {
|
||||
if (!event.isAutoRepeat) {
|
||||
if (root.enabled && !event.isAutoRepeat) {
|
||||
root.checked = !root.checked
|
||||
root.toggled()
|
||||
}
|
||||
|
||||
@@ -259,6 +259,7 @@ PageType {
|
||||
id: switcher
|
||||
|
||||
readonly property bool isVlessProtocol: ApiConfigsController.isVlessProtocol()
|
||||
readonly property bool isProtocolSwitchBlocked: ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 24
|
||||
@@ -266,6 +267,7 @@ PageType {
|
||||
Layout.leftMargin: 16
|
||||
|
||||
visible: ApiAccountInfoModel.data("isProtocolSelectionSupported")
|
||||
enabled: !switcher.isProtocolSwitchBlocked
|
||||
|
||||
text: qsTr("Use VLESS protocol")
|
||||
checked: switcher.isVlessProtocol
|
||||
|
||||
Reference in New Issue
Block a user