serversModel cleanup (#599)
This commit is contained in:
parent
a32952fde6
commit
b3943ae5e3
32 changed files with 255 additions and 240 deletions
|
@ -179,13 +179,12 @@ PageType {
|
|||
rootButtonTextTopMargin: 8
|
||||
rootButtonTextBottomMargin: 8
|
||||
|
||||
text: ServersModel.defaultContainerName
|
||||
text: ServersModel.defaultServerDefaultContainerName
|
||||
textColor: "#0E0E11"
|
||||
headerText: qsTr("VPN protocol")
|
||||
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
|
||||
|
||||
rootButtonClickedFunction: function() {
|
||||
ServersModel.currentlyProcessedIndex = serversMenuContent.currentIndex
|
||||
containersDropDown.open()
|
||||
}
|
||||
|
||||
|
@ -197,22 +196,23 @@ PageType {
|
|||
Connections {
|
||||
target: ServersModel
|
||||
|
||||
function onCurrentlyProcessedServerIndexChanged() {
|
||||
function onDefaultServerIndexChanged() {
|
||||
updateContainersModelFilters()
|
||||
}
|
||||
}
|
||||
|
||||
function updateContainersModelFilters() {
|
||||
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
|
||||
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
|
||||
if (ServersModel.isDefaultServerHasWriteAccess()) {
|
||||
proxyDefaultServerContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
|
||||
} else {
|
||||
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
|
||||
proxyDefaultServerContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
|
||||
}
|
||||
}
|
||||
|
||||
model: SortFilterProxyModel {
|
||||
id: proxyContainersModel
|
||||
sourceModel: ContainersModel
|
||||
id: proxyDefaultServerContainersModel
|
||||
sourceModel: DefaultServerContainersModel
|
||||
|
||||
sorters: [
|
||||
RoleSorter { roleName: "isInstalled"; sortOrder: Qt.DescendingOrder }
|
||||
]
|
||||
|
@ -308,21 +308,7 @@ PageType {
|
|||
Layout.fillWidth: true
|
||||
|
||||
text: name
|
||||
descriptionText: {
|
||||
var fullDescription = ""
|
||||
if (hasWriteAccess) {
|
||||
if (SettingsController.isAmneziaDnsEnabled()
|
||||
&& ServersModel.isAmneziaDnsContainerInstalled(index)) {
|
||||
fullDescription += "Amnezia DNS | "
|
||||
}
|
||||
} else {
|
||||
if (containsAmneziaDns) {
|
||||
fullDescription += "Amnezia DNS | "
|
||||
}
|
||||
}
|
||||
|
||||
return fullDescription += serverDescription
|
||||
}
|
||||
descriptionText: serverDescription
|
||||
|
||||
checked: index === serversMenuContent.currentIndex
|
||||
checkable: !ConnectionController.isConnected
|
||||
|
@ -337,7 +323,6 @@ PageType {
|
|||
|
||||
serversMenuContent.currentIndex = index
|
||||
|
||||
ServersModel.currentlyProcessedIndex = index
|
||||
ServersModel.defaultIndex = index
|
||||
}
|
||||
|
||||
|
@ -358,7 +343,7 @@ PageType {
|
|||
z: 1
|
||||
|
||||
onClicked: function() {
|
||||
ServersModel.currentlyProcessedIndex = index
|
||||
ServersModel.processedIndex = index
|
||||
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
||||
drawer.close()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue