fix: checked format after changing protocol (#1937)

* fix: checked format after changing protocol

* update: improved some lines

* fix(ui): restore checkmark for connection format after switching protocol

* fix: correct a typo

* fix(ui): escape regex in client search filter

* refactor: removed redundant lines

---------

Co-authored-by: Mitternacht822 <sb@amnezia.org>
This commit is contained in:
MrMirDan
2025-11-26 06:07:24 +02:00
committed by GitHub
parent c7221832e0
commit 7b8ff1fd6e
2 changed files with 31 additions and 15 deletions

View File

@@ -311,7 +311,7 @@ PageType {
DropDownType {
id: serverSelector
signal severSelectorIndexChanged
signal serverSelectorIndexChanged
property int currentIndex: -1
Layout.fillWidth: true
@@ -348,7 +348,7 @@ PageType {
if (serverSelector.currentIndex !== serverSelectorListView.selectedIndex) {
serverSelector.currentIndex = serverSelectorListView.selectedIndex
serverSelector.severSelectorIndexChanged()
serverSelector.serverSelectorIndexChanged()
}
serverSelector.closeTriggered()
@@ -375,6 +375,8 @@ PageType {
DropDownType {
id: protocolSelector
signal protocolSelectorTextChanged
Layout.fillWidth: true
Layout.topMargin: 16
@@ -414,7 +416,7 @@ PageType {
Connections {
target: serverSelector
function onSeverSelectorIndexChanged() {
function onServerSelectorIndexChanged() {
var defaultContainer = proxyContainersModel.mapFromSource(ServersModel.getProcessedServerData("defaultContainer"))
protocolSelectorListView.selectedIndex = defaultContainer
protocolSelectorListView.positionViewAtIndex(selectedIndex, ListView.Beginning)
@@ -436,17 +438,14 @@ PageType {
fillConnectionTypeModel()
if (exportTypeSelector.currentIndex >= root.connectionTypesModel.length) {
exportTypeSelector.currentIndex = 0
exportTypeSelector.text = root.connectionTypesModel[0].name
}
if (accessTypeSelector.currentIndex === 1) {
PageController.showBusyIndicator(true)
ExportController.updateClientManagementModel(ContainersModel.getProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
PageController.showBusyIndicator(false)
}
protocolSelector.protocolSelectorTextChanged()
}
function fillConnectionTypeModel() {
@@ -499,6 +498,14 @@ PageType {
exportTypeSelector.text = exportTypeSelectorListView.selectedText
}
onModelChanged: {
if (exportTypeSelector.currentIndex >= model.length || exportTypeSelector.currentIndex < 0) {
exportTypeSelector.currentIndex = 0
}
selectedIndex = exportTypeSelector.currentIndex
exportTypeSelector.text = selectedText
}
rootWidth: root.width
imageSource: "qrc:/images/controls/check.svg"
@@ -506,16 +513,23 @@ PageType {
model: root.connectionTypesModel
currentIndex: 0
Connections {
target: protocolSelector
function onProtocolSelectorTextChanged() {
if (exportTypeSelector.currentIndex >= root.connectionTypesModel.length) {
exportTypeSelectorListView.selectedIndex = 0
exportTypeSelector.currentIndex = 0
exportTypeSelector.text = root.connectionTypesModel[0].name
}
}
}
clickedFunction: function() {
exportTypeSelector.text = exportTypeSelectorListView.selectedText
exportTypeSelector.currentIndex = exportTypeSelectorListView.selectedIndex
exportTypeSelector.closeTriggered()
}
Component.onCompleted: {
exportTypeSelector.text = exportTypeSelectorListView.selectedText
exportTypeSelector.currentIndex = exportTypeSelectorListView.selectedIndex
}
}
}
@@ -604,6 +618,8 @@ PageType {
visible: accessTypeSelector.currentIndex === 1
function escapeRe(s) { return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') }
property bool isFocusable: true
property bool freezeFilter: false
@@ -613,7 +629,7 @@ PageType {
filters: RegExpFilter {
roleName: "clientName"
enabled: !clientsListView.freezeFilter
pattern: ".*" + searchTextField.textField.text + ".*"
pattern: ".*" + clientsListView.escapeRe(searchTextField.textField.text) + ".*"
caseSensitivity: Qt.CaseInsensitive
}
}

View File

@@ -73,7 +73,7 @@ PageType {
id: serverSelector
objectName: "serverSelector"
signal severSelectorIndexChanged
signal serverSelectorIndexChanged
property int currentIndex: 0
Layout.fillWidth: true