feature: added share vpn key to subscription settings page

This commit is contained in:
vladimir.kuznetsov 2025-02-12 12:43:11 +07:00
parent 07baf0ed65
commit db3164223a
12 changed files with 147 additions and 52 deletions

View file

@ -22,7 +22,11 @@ DrawerType2 {
property string headerText
property string configContentHeaderText
property string contentVisible
property string shareButtonText: qsTr("Share")
property string copyButtonText: qsTr("Copy")
property bool showSettingsButtonVisible: true
property bool contentVisible
property string configExtension: ".vpn"
property string configCaption: qsTr("Save AmneziaVPN config")
@ -80,7 +84,7 @@ DrawerType2 {
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("Share")
text: root.shareButtonText
leftImageSource: "qrc:/images/controls/share-2.svg"
clickedFunc: function() {
@ -116,7 +120,7 @@ DrawerType2 {
textColor: AmneziaStyle.color.paleGray
borderWidth: 1
text: qsTr("Copy")
text: root.copyButtonText
leftImageSource: "qrc:/images/controls/copy.svg"
Keys.onReturnPressed: { copyConfigTextButton.clicked() }
@ -153,6 +157,8 @@ DrawerType2 {
Layout.leftMargin: 16
Layout.rightMargin: 16
visible: root.showSettingsButtonVisible
defaultColor: AmneziaStyle.color.transparent
hoveredColor: AmneziaStyle.color.translucentWhite
pressedColor: AmneziaStyle.color.sheerWhite

View file

@ -160,6 +160,20 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
shareConnectionDrawer.headerText = qsTr("Amnezia Premium subscription key")
shareConnectionDrawer.openTriggered()
shareConnectionDrawer.contentVisible = false
shareConnectionDrawer.showSettingsButtonVisible = false;
shareConnectionDrawer.shareButtonText = qsTr("Save VPN key to file")
shareConnectionDrawer.copyButtonText = qsTr("Copy VPN key")
PageController.showBusyIndicator(true)
ApiConfigsController.prepareVpnKeyExport()
PageController.showBusyIndicator(false)
}
}
@ -292,4 +306,10 @@ PageType {
}
}
}
ShareConnectionDrawer {
id: shareConnectionDrawer
anchors.fill: parent
}
}