From b097f1c0ec1f5f6bf89ec2498270f3ef258ace4f Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 8 Jun 2024 11:14:30 -0400 Subject: [PATCH] Add keyboard navigation for server selection in room search dialog This was previously not keyboard navigable at all, making it impossible to switch servers in this dialog solely with a keyboard. This patch makes it possible to do some basic selection but not deletion yet, but it's a good start. (cherry picked from commit b11d46e34a6e87948687c72c9a527a4549017ba1) --- src/qml/ServerComboBox.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qml/ServerComboBox.qml b/src/qml/ServerComboBox.qml index b5aab7c65..24aea52e9 100644 --- a/src/qml/ServerComboBox.qml +++ b/src/qml/ServerComboBox.qml @@ -45,7 +45,7 @@ QQC2.ComboBox { required property bool isDeletable text: isAddServerDelegate ? i18n("Add New Server") : url - highlighted: false + highlighted: index === root.highlightedIndex topInset: index === 0 ? Kirigami.Units.smallSpacing : Math.round(Kirigami.Units.smallSpacing / 2) bottomInset: index === ListView.view.count - 1 ? Kirigami.Units.smallSpacing : Math.round(Kirigami.Units.smallSpacing / 2) @@ -92,6 +92,13 @@ QQC2.ComboBox { onActivated: { if (currentIndex !== count - 1) { root.server = root.currentValue; + } else { + // Make sure to reset the combobox as it will display nothing if the "Add Server" item was selected. + root.currentIndex = 0; + root.server = root.currentValue; + + addServerSheet.parent = QQC2.Overlay.overlay + addServerSheet.open(); } }