From 9eb23e38bd9b31cc50794312bd7cbd8793fdce3a Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 16 Oct 2023 22:57:12 +0500 Subject: [PATCH] disabled the ability to change the protocol/server when a vpn connection is active --- client/translations/amneziavpn_ru.ts | 13 ++++++-- client/translations/amneziavpn_zh_CN.ts | 13 ++++++-- .../qml/Components/HomeContainersListView.qml | 30 +++++++------------ client/ui/qml/Controls2/CardType.qml | 2 ++ client/ui/qml/Pages2/PageHome.qml | 6 ++++ 5 files changed, 41 insertions(+), 23 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 8d9e5e92..ad2ebfbe 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -119,13 +119,17 @@ HomeContainersListView + Unable change protocol while there is an active connection + + + + The selected protocol is not supported on the current platform Выбранный протокол не поддерживается на данном устройстве - Reconnect via VPN Procotol: - Переподключение через VPN протокол: + Переподключение через VPN протокол: @@ -267,6 +271,11 @@ Already installed containers were found on the server. All installed containers Servers Серверы + + + Unable change server while there is an active connection + + PageProtocolAwgSettings diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 60e03307..0def921b 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -130,13 +130,17 @@ HomeContainersListView + Unable change protocol while there is an active connection + Невозможно изменить протокол при наличии активного соединения + + + The selected protocol is not supported on the current platform 当前平台不支持所选协议 - Reconnect via VPN Procotol: - 重连VPN基于协议: + 重连VPN基于协议: @@ -301,6 +305,11 @@ Already installed containers were found on the server. All installed containers Servers 服务器 + + + Unable change server while there is an active connection + Невозможно изменить сервер при наличии активного соединения + PageProtocolAwgSettings diff --git a/client/ui/qml/Components/HomeContainersListView.qml b/client/ui/qml/Components/HomeContainersListView.qml index 2304427f..f05b90d6 100644 --- a/client/ui/qml/Components/HomeContainersListView.qml +++ b/client/ui/qml/Components/HomeContainersListView.qml @@ -50,34 +50,26 @@ ListView { imageSource: "qrc:/images/controls/download.svg" showImage: !isInstalled - checkable: isInstalled + checkable: isInstalled && !ConnectionController.isConnected && isSupported checked: isDefault - onPressed: function(mouse) { - if (!isSupported) { - PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform")) - } - } - onClicked: { - if (checked) { - var needReconnected = false - if (!isDefault) { - needReconnected = true - } + if (ConnectionController.isConnected && isInstalled) { + PageController.showNotificationMessage(qsTr("Unable change protocol while there is an active connection")) + return + } + if (checked) { isDefault = true menuContent.currentIndex = index containersDropDown.menuVisible = false - - - if (needReconnected && (ConnectionController.isConnected || ConnectionController.isConnectionInProgress)) { - PageController.showNotificationMessage(qsTr("Reconnect via VPN Procotol: ") + name) - PageController.goToPageHome() - ConnectionController.openConnection() - } } else { + if (!isSupported && isInstalled) { + PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform")) + return + } + ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(index)) InstallController.setShouldCreateServer(false) PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings) diff --git a/client/ui/qml/Controls2/CardType.qml b/client/ui/qml/Controls2/CardType.qml index 8429acb8..32f89122 100644 --- a/client/ui/qml/Controls2/CardType.qml +++ b/client/ui/qml/Controls2/CardType.qml @@ -81,6 +81,7 @@ RadioButton { Text { text: root.headerText + wrapMode: Text.WordWrap color: "#D7D8DB" font.pixelSize: 25 font.weight: 700 @@ -110,6 +111,7 @@ RadioButton { Text { text: root.footerText + wrapMode: Text.WordWrap visible: root.footerText !== "" color: "#878B91" font.pixelSize: 13 diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index 519c17a5..d89d6be1 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -471,10 +471,16 @@ PageType { } checked: index === serversMenuContent.currentIndex + checkable: !ConnectionController.isConnected ButtonGroup.group: serversRadioButtonGroup onClicked: { + if (ConnectionController.isConnected) { + PageController.showNotificationMessage(qsTr("Unable change server while there is an active connection")) + return + } + serversMenuContent.currentIndex = index ServersModel.currentlyProcessedIndex = index