disabled the ability to change the protocol/server when a vpn connection is active

This commit is contained in:
vladimir.kuznetsov 2023-10-16 22:57:12 +05:00
parent e01b1db706
commit 9eb23e38bd
5 changed files with 41 additions and 23 deletions

View file

@ -119,13 +119,17 @@
<name>HomeContainersListView</name>
<message>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="58"/>
<source>Unable change protocol while there is an active connection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="69"/>
<source>The selected protocol is not supported on the current platform</source>
<translation>Выбранный протокол не поддерживается на данном устройстве</translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="76"/>
<source>Reconnect via VPN Procotol: </source>
<translation>Переподключение через VPN протокол: </translation>
<translation type="vanished">Переподключение через VPN протокол: </translation>
</message>
</context>
<context>
@ -267,6 +271,11 @@ Already installed containers were found on the server. All installed containers
<source>Servers</source>
<translation>Серверы</translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="480"/>
<source>Unable change server while there is an active connection</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PageProtocolAwgSettings</name>

View file

@ -130,13 +130,17 @@
<name>HomeContainersListView</name>
<message>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="58"/>
<source>Unable change protocol while there is an active connection</source>
<translation>Невозможно изменить протокол при наличии активного соединения</translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="69"/>
<source>The selected protocol is not supported on the current platform</source>
<translation></translation>
</message>
<message>
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="76"/>
<source>Reconnect via VPN Procotol: </source>
<translation>VPN基于协议: </translation>
<translation type="vanished">VPN基于协议: </translation>
</message>
</context>
<context>
@ -301,6 +305,11 @@ Already installed containers were found on the server. All installed containers
<source>Servers</source>
<translation></translation>
</message>
<message>
<location filename="../ui/qml/Pages2/PageHome.qml" line="480"/>
<source>Unable change server while there is an active connection</source>
<translation>Невозможно изменить сервер при наличии активного соединения</translation>
</message>
</context>
<context>
<name>PageProtocolAwgSettings</name>

View file

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

View file

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

View file

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