Files
amnezia-client/client/ui/qml/Pages2/PageSetupWizardConfigSource.qml
T

121 lines
3.7 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import PageEnum 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
PageType {
id: root
2023-07-25 16:56:10 +09:00
Connections {
target: ImportController
function onQrDecodingFinished() {
2023-09-06 13:37:37 +05:00
PageController.closePage()
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
2023-07-25 16:56:10 +09:00
}
}
FlickableType {
id: fl
anchors.top: parent.top
anchors.bottom: parent.bottom
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: 0
2023-06-05 15:49:10 +08:00
BackButtonType {
Layout.topMargin: 20
}
HeaderType {
Layout.fillWidth: true
Layout.topMargin: 8
Layout.rightMargin: 16
Layout.leftMargin: 16
2023-07-24 16:33:58 +09:00
headerText: qsTr("Server connection")
2024-03-06 18:34:07 +00:00
descriptionText: qsTr("Do not use connection codes from untrusted sources, as they may be created to intercept your data.")
}
Header2TextType {
Layout.fillWidth: true
Layout.topMargin: 48
Layout.rightMargin: 16
Layout.leftMargin: 16
2023-07-24 16:33:58 +09:00
text: qsTr("What do you have?")
}
LabelWithButtonType {
Layout.fillWidth: true
Layout.topMargin: 16
2023-09-06 22:20:59 +05:00
text: !ServersModel.getServersCount() ? qsTr("File with connection settings or backup") : qsTr("File with connection settings")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
leftImageSource: "qrc:/images/controls/folder-open.svg"
clickedFunction: function() {
var nameFilter = !ServersModel.getServersCount() ? "Config or backup files (*.vpn *.ovpn *.conf *.backup)" :
"Config files (*.vpn *.ovpn *.conf)"
var fileName = SystemController.getFileName(qsTr("Open config file"), nameFilter)
if (fileName !== "") {
if (ImportController.extractConfigFromFile(fileName)) {
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
}
}
}
}
DividerType {}
LabelWithButtonType {
Layout.fillWidth: true
visible: SettingsController.isCameraPresent()
2023-07-24 16:33:58 +09:00
text: qsTr("QR-code")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
leftImageSource: "qrc:/images/controls/qr-code.svg"
clickedFunction: function() {
2023-07-25 16:56:10 +09:00
ImportController.startDecodingQr()
2023-08-30 17:23:55 -04:00
if (Qt.platform.os === "ios") {
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageSetupWizardQrReader)
2023-08-30 17:23:55 -04:00
}
}
}
2023-05-22 22:11:20 +08:00
DividerType {
visible: SettingsController.isCameraPresent()
}
LabelWithButtonType {
Layout.fillWidth: true
2023-07-24 16:33:58 +09:00
text: qsTr("Key as text")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
leftImageSource: "qrc:/images/controls/text-cursor.svg"
clickedFunction: function() {
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageSetupWizardTextKey)
}
}
2023-05-22 22:11:20 +08:00
DividerType {}
}
}
}