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:
Mitternacht822
2026-04-08 08:45:51 +04:00
committed by GitHub
parent ad14847eb5
commit 493ee22883
2 changed files with 3 additions and 1 deletions

View File

@@ -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()
}

View File

@@ -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