removed the use of QFileDialog
This commit is contained in:
parent
8f6aa950cd
commit
e8862a3811
22 changed files with 224 additions and 164 deletions
|
@ -1,6 +1,9 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
|
||||
import QtCore
|
||||
|
||||
import PageEnum 1.0
|
||||
|
||||
|
@ -74,14 +77,36 @@ PageType {
|
|||
}
|
||||
|
||||
BasicButtonType {
|
||||
id: makeBackupButton
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 14
|
||||
|
||||
text: qsTr("Make a backup")
|
||||
|
||||
onClicked: {
|
||||
if (GC.isMobile()) {
|
||||
backupAppConfig("AmneziaVPN.backup")
|
||||
} else {
|
||||
saveFileDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: saveFileDialog
|
||||
acceptLabel: qsTr("Save backup file")
|
||||
nameFilters: [ "Backup files (*.backup)" ]
|
||||
fileMode: FileDialog.SaveFile
|
||||
|
||||
currentFile: StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/AmneziaVPN"
|
||||
defaultSuffix: ".backup"
|
||||
onAccepted: {
|
||||
makeBackupButton.backupAppConfig(saveFileDialog.currentFile.toString())
|
||||
}
|
||||
}
|
||||
|
||||
function backupAppConfig(fileName) {
|
||||
PageController.showBusyIndicator(true)
|
||||
SettingsController.backupAppConfig()
|
||||
SettingsController.backupAppConfig(fileName)
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
}
|
||||
|
@ -100,9 +125,18 @@ PageType {
|
|||
text: qsTr("Restore from backup")
|
||||
|
||||
onClicked: {
|
||||
PageController.showBusyIndicator(true)
|
||||
SettingsController.restoreAppConfig()
|
||||
PageController.showBusyIndicator(false)
|
||||
openFileDialog.open()
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: openFileDialog
|
||||
acceptLabel: qsTr("Open backup file")
|
||||
nameFilters: [ "Backup files (*.backup)" ]
|
||||
onAccepted: {
|
||||
PageController.showBusyIndicator(true)
|
||||
SettingsController.restoreAppConfig(openFileDialog.selectedFile.toString())
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
|
||||
import QtCore
|
||||
|
||||
import PageEnum 1.0
|
||||
|
||||
|
@ -97,7 +100,20 @@ PageType {
|
|||
|
||||
image: "qrc:/images/controls/save.svg"
|
||||
|
||||
onClicked: SettingsController.exportLogsFile()
|
||||
onClicked: fileDialog.open()
|
||||
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
acceptLabel: qsTr("Save logs")
|
||||
nameFilters: [ "Logs files (*.log)" ]
|
||||
fileMode: FileDialog.SaveFile
|
||||
|
||||
currentFile: StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/AmneziaVPN"
|
||||
defaultSuffix: ".log"
|
||||
onAccepted: {
|
||||
ExportController.saveFile(fileDialog.currentFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CaptionTextType {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
|
||||
import QtCore
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
|
@ -41,6 +44,8 @@ PageType {
|
|||
allExceptSites
|
||||
]
|
||||
|
||||
property bool replaceExistingSites
|
||||
|
||||
QtObject {
|
||||
id: onlyForwardSites
|
||||
property string name: qsTr("Only the addresses in the list must be opened via VPN")
|
||||
|
@ -295,8 +300,21 @@ PageType {
|
|||
text: qsTr("Save site list")
|
||||
|
||||
clickedFunction: function() {
|
||||
SitesController.exportSites()
|
||||
moreActionsDrawer.close()
|
||||
saveFileDialog.open()
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: saveFileDialog
|
||||
acceptLabel: qsTr("Save sites")
|
||||
nameFilters: [ "Sites files (*.json)" ]
|
||||
fileMode: FileDialog.SaveFile
|
||||
|
||||
currentFile: StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/sites"
|
||||
defaultSuffix: ".json"
|
||||
onAccepted: {
|
||||
SitesController.exportSites(saveFileDialog.currentFile.toString())
|
||||
moreActionsDrawer.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,6 +349,7 @@ PageType {
|
|||
anchors.bottom: parent.bottom
|
||||
|
||||
contentHeight: importSitesDrawerContent.height
|
||||
|
||||
ColumnLayout {
|
||||
id: importSitesDrawerContent
|
||||
|
||||
|
@ -351,9 +370,8 @@ PageType {
|
|||
text: qsTr("Replace site list")
|
||||
|
||||
clickedFunction: function() {
|
||||
SitesController.importSites(true)
|
||||
importSitesDrawer.close()
|
||||
moreActionsDrawer.close()
|
||||
root.replaceExistingSites = true
|
||||
openFileDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,13 +382,23 @@ PageType {
|
|||
text: qsTr("Add imported sites to existing ones")
|
||||
|
||||
clickedFunction: function() {
|
||||
SitesController.importSites(false)
|
||||
importSitesDrawer.close()
|
||||
moreActionsDrawer.close()
|
||||
root.replaceExistingSites = false
|
||||
openFileDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
DividerType {}
|
||||
|
||||
FileDialog {
|
||||
id: openFileDialog
|
||||
acceptLabel: qsTr("Open sites file")
|
||||
nameFilters: [ "Sites files (*.json)" ]
|
||||
onAccepted: {
|
||||
SitesController.importSites(openFileDialog.selectedFile.toString(), replaceExistingSites)
|
||||
importSitesDrawer.close()
|
||||
moreActionsDrawer.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,17 @@ It's okay as long as it's from someone you trust.")
|
|||
leftImageSource: "qrc:/images/controls/folder-open.svg"
|
||||
|
||||
clickedFunction: function() {
|
||||
ImportController.extractConfigFromFile()
|
||||
goToPage(PageEnum.PageSetupWizardViewConfig)
|
||||
fileDialog.open()
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
acceptLabel: qsTr("Open config file")
|
||||
nameFilters: [ "Config files (*.vpn *.ovpn *.conf)" ]
|
||||
onAccepted: {
|
||||
ImportController.extractConfigFromFile(fileDialog.selectedFile.toString())
|
||||
goToPage(PageEnum.PageSetupWizardViewConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue