From 493ee228835ea5e3f908a30be364a11debe12025 Mon Sep 17 00:00:00 2001 From: Mitternacht822 <208699442+Mitternacht822@users.noreply.github.com> Date: Wed, 8 Apr 2026 08:45:51 +0400 Subject: [PATCH] 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 --- client/ui/qml/Controls2/SwitcherType.qml | 2 +- client/ui/qml/Pages2/PageSettingsApiServerInfo.qml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/ui/qml/Controls2/SwitcherType.qml b/client/ui/qml/Controls2/SwitcherType.qml index 4b41fc26b..b2500b538 100644 --- a/client/ui/qml/Controls2/SwitcherType.qml +++ b/client/ui/qml/Controls2/SwitcherType.qml @@ -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() } diff --git a/client/ui/qml/Pages2/PageSettingsApiServerInfo.qml b/client/ui/qml/Pages2/PageSettingsApiServerInfo.qml index d711ab923..a8a70493d 100644 --- a/client/ui/qml/Pages2/PageSettingsApiServerInfo.qml +++ b/client/ui/qml/Pages2/PageSettingsApiServerInfo.qml @@ -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