Start call with pressing enter when entering a name/address in the magic search (Mantis-0013965; #ISERE-11)

This commit is contained in:
Gaelle Braud 2026-02-05 18:21:38 +01:00
parent b6f465f9a0
commit 23bb9c13a4
2 changed files with 22 additions and 1 deletions

View file

@ -97,6 +97,20 @@ Flickable {
return index != -1
}
function getFirstContact() {
if (mainItem.showFavorites) {
var firstContact = favoritesList.itemAtIndex(0)
if (firstContact !== null) return firstContact
}
var firstContact = contactsList.itemAtIndex(0)
if (firstContact !== null) return firstContact
if (!mainItem.hideSuggestions) {
var firstContact = suggestionsList.itemAtIndex(0)
if (firstContact !== null) return firstContact
}
return null
}
function resetSelections() {
mainItem.highlightedContact = null
favoritesList.currentIndex = -1

View file

@ -243,7 +243,14 @@ Item {
}
KeyNavigation.down: contactList //contactLoader.item?.count > 0 || !contactLoader.item?.footerItem? contactLoader.item : contactLoader.item?.footerItem
KeyNavigation.up: contactList //contactLoader.item?.footerItem ? contactLoader.item?.footerItem : contactLoader.item
Keys.onPressed: (event) => {
event.accepted = false
var firstContact = contactList.getFirstContact()
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return && firstContact.searchResultItem) {
console.log("Enter pressed from magic search bar, calling", firstContact.searchResultItem.core.defaultAddress)
mainWindow.startCallWithContact(firstContact.searchResultItem, false)
}
}
Popup {
id: listPopup
width: magicSearchBar.width