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

View File

@@ -140,6 +140,16 @@ PageType {
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() {
cipherDropDown.text = selectedText
cipher = cipherDropDown.text
@@ -147,13 +157,14 @@ PageType {
}
Component.onCompleted: {
cipherDropDown.text = cipher
updateSelectedIndex()
}
}
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipherDropDown.text) {
selectedIndex = i
}
}
Connections {
target: listView.model
function onDataChanged() {
cipherListView.updateSelectedIndex()
}
}
}

View File

@@ -192,6 +192,16 @@ PageType {
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() {
hashDropDown.text = selectedText
hash = hashDropDown.text
@@ -199,13 +209,14 @@ PageType {
}
Component.onCompleted: {
hashDropDown.text = hash
updateSelectedIndex()
}
}
for (var i = 0; i < hashListView.model.count; i++) {
if (hashListView.model.get(i).name === hashDropDown.text) {
currentIndex = i
}
}
Connections {
target: listView.model
function onDataChanged() {
hashListView.updateSelectedIndex()
}
}
}
@@ -242,6 +253,16 @@ PageType {
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() {
cipherDropDown.text = selectedText
cipher = cipherDropDown.text
@@ -249,13 +270,14 @@ PageType {
}
Component.onCompleted: {
cipherDropDown.text = cipher
updateSelectedIndex()
}
}
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipherDropDown.text) {
currentIndex = i
}
}
Connections {
target: listView.model
function onDataChanged() {
cipherListView.updateSelectedIndex()
}
}
}

View File

@@ -109,6 +109,16 @@ PageType {
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() {
cipherDropDown.text = selectedText
cipher = cipherDropDown.text
@@ -116,13 +126,14 @@ PageType {
}
Component.onCompleted: {
cipherDropDown.text = cipher
updateSelectedIndex()
}
}
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipherDropDown.text) {
currentIndex = i
}
}
Connections {
target: listView.model
function onDataChanged() {
cipherListView.updateSelectedIndex()
}
}
}