Skip to content

Commit

Permalink
added the ability to restore settings from backup on the initial screen
Browse files Browse the repository at this point in the history
- fixed the display of services in the settings for mobile devices
  • Loading branch information
Nethius committed Aug 31, 2023
1 parent cbcf187 commit b58295d
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/fileUtilites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ QString FileUtilites::getFileName(QString fileName)
return fileName;
#endif

return QUrl(FileUtilites::getFileName(fileName)).toLocalFile();
return QUrl(fileName).toLocalFile();
}
6 changes: 6 additions & 0 deletions client/ui/qml/Components/HomeContainersListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ ListView {
checkable: isInstalled
checked: isDefault

onPressed: function(mouse) {
if (!isSupported) {
PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform"))
}
}

onClicked: {
if (checked) {
isDefault = true
Expand Down
8 changes: 4 additions & 4 deletions client/ui/qml/Filters/ContainersModelFilters.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ Item {
}

function getWriteAccessProtocolsListFilters() {
return [vpnTypeFilter, supportedFilter]
return [vpnTypeFilter]
}
function getReadAccessProtocolsListFilters() {
return [vpnTypeFilter, supportedFilter, installedFilter]
return [vpnTypeFilter, installedFilter]
}

function getWriteAccessServicesListFilters() {
return [serviceTypeFilter, supportedFilter]
return [serviceTypeFilter
}
function getReadAccessServicesListFilters() {
return [serviceTypeFilter, supportedFilter, installedFilter]
return [serviceTypeFilter, installedFilter]
}
}
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSettingsServerData.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PageType {
if (isInstalledContainerFound) {
message = qsTr("All installed containers have been added to the application")
} else {
message = qsTr("No installed containers found")
message = qsTr("No new installed containers found")
}

PageController.showErrorMessage(message)
Expand Down
6 changes: 6 additions & 0 deletions client/ui/qml/Pages2/PageSettingsSplitTunneling.qml
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,10 @@ PageType {
buttonImageSource: "qrc:/images/controls/plus.svg"

clickedFunc: function() {
PageController.showBusyIndicator(true)
SitesController.addSite(textFieldText)
textFieldText = ""
PageController.showBusyIndicator(false)
}
}

Expand Down Expand Up @@ -312,8 +314,10 @@ PageType {
currentFile: StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/sites"
defaultSuffix: ".json"
onAccepted: {
PageController.showBusyIndicator(true)
SitesController.exportSites(saveFileDialog.currentFile.toString())
moreActionsDrawer.close()
PageController.showBusyIndicator(false)
}
}
}
Expand Down Expand Up @@ -394,9 +398,11 @@ PageType {
acceptLabel: qsTr("Open sites file")
nameFilters: [ "Sites files (*.json)" ]
onAccepted: {
PageController.showBusyIndicator(true)
SitesController.importSites(openFileDialog.selectedFile.toString(), replaceExistingSites)
importSitesDrawer.close()
moreActionsDrawer.close()
PageController.showBusyIndicator(false)
}
}
}
Expand Down
14 changes: 10 additions & 4 deletions client/ui/qml/Pages2/PageSetupWizardConfigSource.qml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ It's okay as long as it's from someone you trust.")
Layout.fillWidth: true
Layout.topMargin: 16

text: qsTr("File with connection settings")
text: qsTr("File with connection settings or backup")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
leftImageSource: "qrc:/images/controls/folder-open.svg"

Expand All @@ -76,10 +76,16 @@ It's okay as long as it's from someone you trust.")
FileDialog {
id: fileDialog
acceptLabel: qsTr("Open config file")
nameFilters: [ "Config files (*.vpn *.ovpn *.conf)" ]
nameFilters: [ "Config or backup files (*.vpn *.ovpn *.conf *.backup)" ]
onAccepted: {
ImportController.extractConfigFromFile(fileDialog.selectedFile.toString())
goToPage(PageEnum.PageSetupWizardViewConfig)
if (fileDialog.selectedFile.toString().indexOf(".backup") != -1) {
PageController.showBusyIndicator(true)
SettingsController.restoreAppConfig(fileDialog.selectedFile.toString())
PageController.showBusyIndicator(false)
} else {
ImportController.extractConfigFromFile(fileDialog.selectedFile.toString())
goToPage(PageEnum.PageSetupWizardViewConfig)
}
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions client/ui/qml/Pages2/PageSetupWizardStart.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ PageType {
function onGoToPageViewConfig() {
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 {
Expand Down Expand Up @@ -93,4 +106,10 @@ PageType {
id: connectionTypeSelection
}
}

BusyIndicatorType {
id: busyIndicator
anchors.centerIn: parent
z: 1
}
}
4 changes: 1 addition & 3 deletions client/ui/qml/main2.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ Window {

function onReplaceStartPage() {
var pagePath = PageController.getInitialPage()
while (rootStackView.depth > 1) {
rootStackView.pop()
}
rootStackView.clear()
PageController.updateNavigationBarColor(PageController.getInitialPageNavigationBarColor())
rootStackView.replace(pagePath, { "objectName" : pagePath })
}
Expand Down

0 comments on commit b58295d

Please sign in to comment.