added the ability to restore settings from backup on the initial screen

- fixed the display of services in the settings for mobile devices
This commit is contained in:
vladimir.kuznetsov 2023-09-01 00:48:58 +05:00
parent cbcf187814
commit b58295d1d6
8 changed files with 48 additions and 13 deletions

View file

@ -81,5 +81,5 @@ QString FileUtilites::getFileName(QString fileName)
return fileName; return fileName;
#endif #endif
return QUrl(FileUtilites::getFileName(fileName)).toLocalFile(); return QUrl(fileName).toLocalFile();
} }

View file

@ -53,6 +53,12 @@ ListView {
checkable: isInstalled checkable: isInstalled
checked: isDefault checked: isDefault
onPressed: function(mouse) {
if (!isSupported) {
PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform"))
}
}
onClicked: { onClicked: {
if (checked) { if (checked) {
isDefault = true isDefault = true

View file

@ -32,16 +32,16 @@ Item {
} }
function getWriteAccessProtocolsListFilters() { function getWriteAccessProtocolsListFilters() {
return [vpnTypeFilter, supportedFilter] return [vpnTypeFilter]
} }
function getReadAccessProtocolsListFilters() { function getReadAccessProtocolsListFilters() {
return [vpnTypeFilter, supportedFilter, installedFilter] return [vpnTypeFilter, installedFilter]
} }
function getWriteAccessServicesListFilters() { function getWriteAccessServicesListFilters() {
return [serviceTypeFilter, supportedFilter] return [serviceTypeFilter
} }
function getReadAccessServicesListFilters() { function getReadAccessServicesListFilters() {
return [serviceTypeFilter, supportedFilter, installedFilter] return [serviceTypeFilter, installedFilter]
} }
} }

View file

@ -22,7 +22,7 @@ PageType {
if (isInstalledContainerFound) { if (isInstalledContainerFound) {
message = qsTr("All installed containers have been added to the application") message = qsTr("All installed containers have been added to the application")
} else { } else {
message = qsTr("No installed containers found") message = qsTr("No new installed containers found")
} }
PageController.showErrorMessage(message) PageController.showErrorMessage(message)

View file

@ -241,8 +241,10 @@ PageType {
buttonImageSource: "qrc:/images/controls/plus.svg" buttonImageSource: "qrc:/images/controls/plus.svg"
clickedFunc: function() { clickedFunc: function() {
PageController.showBusyIndicator(true)
SitesController.addSite(textFieldText) SitesController.addSite(textFieldText)
textFieldText = "" textFieldText = ""
PageController.showBusyIndicator(false)
} }
} }
@ -312,8 +314,10 @@ PageType {
currentFile: StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/sites" currentFile: StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/sites"
defaultSuffix: ".json" defaultSuffix: ".json"
onAccepted: { onAccepted: {
PageController.showBusyIndicator(true)
SitesController.exportSites(saveFileDialog.currentFile.toString()) SitesController.exportSites(saveFileDialog.currentFile.toString())
moreActionsDrawer.close() moreActionsDrawer.close()
PageController.showBusyIndicator(false)
} }
} }
} }
@ -394,9 +398,11 @@ PageType {
acceptLabel: qsTr("Open sites file") acceptLabel: qsTr("Open sites file")
nameFilters: [ "Sites files (*.json)" ] nameFilters: [ "Sites files (*.json)" ]
onAccepted: { onAccepted: {
PageController.showBusyIndicator(true)
SitesController.importSites(openFileDialog.selectedFile.toString(), replaceExistingSites) SitesController.importSites(openFileDialog.selectedFile.toString(), replaceExistingSites)
importSitesDrawer.close() importSitesDrawer.close()
moreActionsDrawer.close() moreActionsDrawer.close()
PageController.showBusyIndicator(false)
} }
} }
} }

View file

@ -65,7 +65,7 @@ It's okay as long as it's from someone you trust.")
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
text: qsTr("File with connection settings") text: qsTr("File with connection settings or backup")
rightImageSource: "qrc:/images/controls/chevron-right.svg" rightImageSource: "qrc:/images/controls/chevron-right.svg"
leftImageSource: "qrc:/images/controls/folder-open.svg" leftImageSource: "qrc:/images/controls/folder-open.svg"
@ -76,10 +76,16 @@ It's okay as long as it's from someone you trust.")
FileDialog { FileDialog {
id: fileDialog id: fileDialog
acceptLabel: qsTr("Open config file") acceptLabel: qsTr("Open config file")
nameFilters: [ "Config files (*.vpn *.ovpn *.conf)" ] nameFilters: [ "Config or backup files (*.vpn *.ovpn *.conf *.backup)" ]
onAccepted: { onAccepted: {
ImportController.extractConfigFromFile(fileDialog.selectedFile.toString()) if (fileDialog.selectedFile.toString().indexOf(".backup") != -1) {
goToPage(PageEnum.PageSetupWizardViewConfig) PageController.showBusyIndicator(true)
SettingsController.restoreAppConfig(fileDialog.selectedFile.toString())
PageController.showBusyIndicator(false)
} else {
ImportController.extractConfigFromFile(fileDialog.selectedFile.toString())
goToPage(PageEnum.PageSetupWizardViewConfig)
}
} }
} }
} }

View file

@ -19,6 +19,19 @@ PageType {
function onGoToPageViewConfig() { function onGoToPageViewConfig() {
goToPage(PageEnum.PageSetupWizardViewConfig) goToPage(PageEnum.PageSetupWizardViewConfig)
} }
function onShowBusyIndicator(visible) {
busyIndicator.visible = visible
}
}
Connections {
target: SettingsController
function onRestoreBackupFinished() {
PageController.showNotificationMessage(qsTr("Settings restored from backup file"))
PageController.replaceStartPage()
}
} }
FlickableType { FlickableType {
@ -93,4 +106,10 @@ PageType {
id: connectionTypeSelection id: connectionTypeSelection
} }
} }
BusyIndicatorType {
id: busyIndicator
anchors.centerIn: parent
z: 1
}
} }

View file

@ -47,9 +47,7 @@ Window {
function onReplaceStartPage() { function onReplaceStartPage() {
var pagePath = PageController.getInitialPage() var pagePath = PageController.getInitialPage()
while (rootStackView.depth > 1) { rootStackView.clear()
rootStackView.pop()
}
PageController.updateNavigationBarColor(PageController.getInitialPageNavigationBarColor()) PageController.updateNavigationBarColor(PageController.getInitialPageNavigationBarColor())
rootStackView.replace(pagePath, { "objectName" : pagePath }) rootStackView.replace(pagePath, { "objectName" : pagePath })
} }