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

77 lines
1.9 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
logic: ShareConnectionLogic
BackButton {
id: back
}
Caption {
id: caption
text: qsTr("Share OpenVPN Settings")
}
TextAreaType {
2021-11-13 16:09:08 +03:00
id: tfShareCode
2021-11-06 13:47:52 +03:00
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: pb_gen.top
anchors.bottomMargin: 20
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
textArea.readOnly: true
textArea.verticalAlignment: Text.AlignTop
textArea.text: ShareConnectionLogic.textEditShareOpenVpnCodeText
}
ShareConnectionButtonType {
id: pb_gen
anchors.bottom: pb_copy.top
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
text: ShareConnectionLogic.pushButtonShareOpenVpnGenerateText
onClicked: {
2021-11-13 16:09:08 +03:00
enabled = false
2021-11-06 13:47:52 +03:00
ShareConnectionLogic.onPushButtonShareOpenVpnGenerateClicked()
2021-11-13 16:09:08 +03:00
enabled = true
2021-11-06 13:47:52 +03:00
}
}
2021-11-13 16:09:08 +03:00
ShareConnectionButtonCopyType {
2021-11-06 13:47:52 +03:00
id: pb_copy
anchors.bottom: pb_save.top
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
2021-11-13 16:09:08 +03:00
enabled: tfShareCode.textArea.length > 0
2021-11-06 13:47:52 +03:00
}
ShareConnectionButtonType {
id: pb_save
anchors.bottom: root.bottom
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
2021-11-13 16:09:08 +03:00
text: qsTr("Save to file")
enabled: tfShareCode.textArea.length > 0
2021-11-06 13:47:52 +03:00
onClicked: {
2021-11-13 16:09:08 +03:00
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.ovpn", tfShareCode.textArea.text)
2021-11-06 13:47:52 +03:00
}
}
}