Files
amnezia-client/client/ui/qml/Pages/Share/PageShareProtoOpenVPN.qml
T

107 lines
3.0 KiB
QML
Raw Normal View History

2021-11-06 13:47:52 +03:00
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import ProtocolEnum 1.0
import "../"
import "../../Controls"
import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.OpenVpn
BackButton {
id: back
}
Caption {
id: caption
text: qsTr("Share OpenVPN Settings")
}
2021-11-15 18:17:28 +03:00
Flickable {
id: fl
width: root.width
2021-11-06 13:47:52 +03:00
anchors.top: caption.bottom
anchors.topMargin: 20
2021-11-15 18:17:28 +03:00
anchors.bottom: root.bottom
2021-11-06 13:47:52 +03:00
anchors.bottomMargin: 20
2021-11-15 18:17:28 +03:00
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
2021-11-06 13:47:52 +03:00
2021-11-15 18:17:28 +03:00
contentHeight: content.height
clip: true
2021-11-06 13:47:52 +03:00
2021-11-15 18:17:28 +03:00
ColumnLayout {
id: content
enabled: logic.pageEnabled
2021-11-17 15:01:48 +03:00
anchors.top: parent.top
2021-11-15 18:17:28 +03:00
anchors.left: parent.left
anchors.right: parent.right
2021-11-06 13:47:52 +03:00
2021-11-15 18:17:28 +03:00
LabelType {
id: lb_desc
Layout.fillWidth: true
Layout.topMargin: 10
2021-11-06 13:47:52 +03:00
2021-11-15 18:17:28 +03:00
horizontalAlignment: Text.AlignHCenter
2021-11-06 13:47:52 +03:00
2021-11-15 18:17:28 +03:00
wrapMode: Text.Wrap
text: qsTr("New encryption keys pair will be generated.")
}
ShareConnectionButtonType {
Layout.topMargin: 20
Layout.fillWidth: true
Layout.preferredHeight: 40
text: genConfigProcess ? generatingConfigText : generateConfigText
onClicked: {
enabled = false
genConfigProcess = true
ShareConnectionLogic.onPushButtonShareOpenVpnGenerateClicked()
genConfigProcess = false
enabled = true
}
}
TextAreaType {
id: tfShareCode
Layout.topMargin: 20
Layout.preferredHeight: 200
Layout.fillWidth: true
textArea.readOnly: true
textArea.verticalAlignment: Text.AlignTop
textArea.text: ShareConnectionLogic.textEditShareOpenVpnCodeText
visible: tfShareCode.textArea.length > 0
}
ShareConnectionButtonCopyType {
Layout.preferredHeight: 40
Layout.fillWidth: true
copyText: tfShareCode.textArea.text
}
ShareConnectionButtonType {
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
width: parent.width - 60
2021-11-06 13:47:52 +03:00
text: Qt.platform.os === "android" ? qsTr("Share") : qsTr("Save to file")
2021-11-15 18:17:28 +03:00
enabled: tfShareCode.textArea.length > 0
visible: tfShareCode.textArea.length > 0
2021-11-13 16:09:08 +03:00
2021-11-15 18:17:28 +03:00
onClicked: {
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "amnezia_for_openvpn.ovpn", "*.ovpn", tfShareCode.textArea.text)
2021-11-15 18:17:28 +03:00
}
}
2021-11-06 13:47:52 +03:00
}
}
}