Added popup to confirm actions "Clear server from Amnesia software" and "Forget this server"

This commit is contained in:
vladimir.kuznetsov 2023-01-27 10:25:14 +03:00
parent ee609f3e8f
commit 051a2a3ef2
4 changed files with 85 additions and 4 deletions

View file

@ -70,7 +70,7 @@ QList<DockerContainer> ContainerProps::allContainers()
QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
{
return {
{DockerContainer::None, "Unknown (Old version)"},
{DockerContainer::None, "Not installed"},
{DockerContainer::OpenVpn, "OpenVPN"},
{DockerContainer::ShadowSocks, "OpenVpn over ShadowSocks"},
{DockerContainer::Cloak, "OpenVpn over Cloak"},

View file

@ -163,5 +163,6 @@
<file>images/svg/control_point_black_24dp.svg</file>
<file>images/svg/settings_suggest_black_24dp.svg</file>
<file>server_scripts/website_tor/Dockerfile</file>
<file>ui/qml/Controls/PopupWithQuestion.qml</file>
</qresource>
</RCC>

View file

@ -0,0 +1,55 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Popup {
id: root
property string questionText
property string yesText: "yes"
property string noText: "no"
property var yesFunc
property var noFunc
anchors.centerIn: Overlay.overlay
modal: true
closePolicy: Popup.NoAutoClose
width: parent.width - 20
ColumnLayout {
width: parent.width
Text {
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
wrapMode: Text.WordWrap
font.pixelSize: 16
text: questionText
}
RowLayout {
BlueButtonType {
id: yesButton
Layout.fillWidth: true
text: yesText
onClicked: {
root.enabled = false
if (yesFunc && typeof yesFunc === "function") {
yesFunc()
}
root.enabled = true
}
}
BlueButtonType {
id: noButton
Layout.fillWidth: true
text: noText
onClicked: {
if (noFunc && typeof noFunc === "function") {
noFunc()
}
}
}
}
}
}

View file

@ -93,24 +93,49 @@ PageBase {
ServerSettingsLogic.onPushButtonClearClientCacheClicked()
}
}
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
text: ServerSettingsLogic.pushButtonClearText
visible: ServerSettingsLogic.pushButtonClearVisible
onClicked: {
popupClearServer.open()
}
}
PopupWithQuestion {
id: popupClearServer
questionText: "Attention! All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted. Continue?"
yesFunc: function() {
ServerSettingsLogic.onPushButtonClearServer()
close()
}
noFunc: function() {
close()
}
}
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
text: qsTr("Forget this server")
onClicked: {
ServerSettingsLogic.onPushButtonForgetServer()
popupForgetServer.open()
}
}
PopupWithQuestion {
id: popupForgetServer
questionText: "Attention! Something will happen. Continue?"
yesFunc: function() {
ServerSettingsLogic.onPushButtonForgetServer()
close()
}
noFunc: function() {
close()
}
}
}
}