fix: fixed cipher selection (#2110)

This commit is contained in:
NickVs2015
2026-01-30 07:18:54 +03:00
committed by GitHub
parent b31a62c55f
commit ea5242e29b
3 changed files with 68 additions and 24 deletions
@@ -140,6 +140,16 @@ PageType {
ListElement { name : "aes-128-gcm" } ListElement { name : "aes-128-gcm" }
} }
function updateSelectedIndex() {
cipherDropDown.text = cipher
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipher) {
selectedIndex = i
break
}
}
}
clickedFunction: function() { clickedFunction: function() {
cipherDropDown.text = selectedText cipherDropDown.text = selectedText
cipher = cipherDropDown.text cipher = cipherDropDown.text
@@ -147,13 +157,14 @@ PageType {
} }
Component.onCompleted: { Component.onCompleted: {
cipherDropDown.text = cipher updateSelectedIndex()
}
}
for (var i = 0; i < cipherListView.model.count; i++) { Connections {
if (cipherListView.model.get(i).name === cipherDropDown.text) { target: listView.model
selectedIndex = i function onDataChanged() {
} cipherListView.updateSelectedIndex()
}
} }
} }
} }
@@ -192,6 +192,16 @@ PageType {
ListElement { name : qsTr("SHA1") } ListElement { name : qsTr("SHA1") }
} }
function updateSelectedIndex() {
hashDropDown.text = hash
for (var i = 0; i < hashListView.model.count; i++) {
if (hashListView.model.get(i).name === hash) {
selectedIndex = i
break
}
}
}
clickedFunction: function() { clickedFunction: function() {
hashDropDown.text = selectedText hashDropDown.text = selectedText
hash = hashDropDown.text hash = hashDropDown.text
@@ -199,13 +209,14 @@ PageType {
} }
Component.onCompleted: { Component.onCompleted: {
hashDropDown.text = hash updateSelectedIndex()
}
}
for (var i = 0; i < hashListView.model.count; i++) { Connections {
if (hashListView.model.get(i).name === hashDropDown.text) { target: listView.model
currentIndex = i function onDataChanged() {
} hashListView.updateSelectedIndex()
}
} }
} }
} }
@@ -242,6 +253,16 @@ PageType {
ListElement { name : qsTr("none") } ListElement { name : qsTr("none") }
} }
function updateSelectedIndex() {
cipherDropDown.text = cipher
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipher) {
selectedIndex = i
break
}
}
}
clickedFunction: function() { clickedFunction: function() {
cipherDropDown.text = selectedText cipherDropDown.text = selectedText
cipher = cipherDropDown.text cipher = cipherDropDown.text
@@ -249,13 +270,14 @@ PageType {
} }
Component.onCompleted: { Component.onCompleted: {
cipherDropDown.text = cipher updateSelectedIndex()
}
}
for (var i = 0; i < cipherListView.model.count; i++) { Connections {
if (cipherListView.model.get(i).name === cipherDropDown.text) { target: listView.model
currentIndex = i function onDataChanged() {
} cipherListView.updateSelectedIndex()
}
} }
} }
} }
@@ -109,6 +109,16 @@ PageType {
ListElement { name : "aes-128-gcm" } ListElement { name : "aes-128-gcm" }
} }
function updateSelectedIndex() {
cipherDropDown.text = cipher
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipher) {
selectedIndex = i
break
}
}
}
clickedFunction: function() { clickedFunction: function() {
cipherDropDown.text = selectedText cipherDropDown.text = selectedText
cipher = cipherDropDown.text cipher = cipherDropDown.text
@@ -116,13 +126,14 @@ PageType {
} }
Component.onCompleted: { Component.onCompleted: {
cipherDropDown.text = cipher updateSelectedIndex()
}
}
for (var i = 0; i < cipherListView.model.count; i++) { Connections {
if (cipherListView.model.get(i).name === cipherDropDown.text) { target: listView.model
currentIndex = i function onDataChanged() {
} cipherListView.updateSelectedIndex()
}
} }
} }
} }