Avoid to make search on initialization.

For ContactPage : start the search on openning.
Remove suggestion title if no one.
This commit is contained in:
Julien Wadel 2024-11-06 18:28:01 +01:00
parent bebea4e7c8
commit ab4acc8f03
3 changed files with 16 additions and 12 deletions

View file

@ -27,6 +27,7 @@ ListView {
property bool showFavoritesOnly: false
property bool showDefaultAddress: false
property bool showLdapContacts: false
property bool searchOnInitialization: false
property var listProxy: MagicSearchProxy{}
@ -116,7 +117,7 @@ ListView {
showLdapContacts: mainItem.showLdapContacts
sourceFlags: mainItem.sourceFlags
onInitialized: {
magicSearchProxy.forceUpdate()
if(mainItem.searchOnInitialization) magicSearchProxy.forceUpdate()
}
}

View file

@ -148,8 +148,8 @@ FocusScope {
}
}
ColumnLayout {
visible: contactList.contentHeight > 0
spacing: 18 * DefaultStyle.dp
visible: contactList.contentHeight > 0
Text {
text: qsTr("Contacts")
font {
@ -171,6 +171,7 @@ FocusScope {
}
ColumnLayout {
spacing: 18 * DefaultStyle.dp
visible: searchList.count > 0
Text {
text: qsTr("Suggestions")
font {

View file

@ -284,6 +284,7 @@ AbstractMainPage {
Layout.preferredHeight: contentHeight
Control.ScrollBar.vertical.visible: false
showFavoritesOnly: true
searchOnInitialization: true
contactMenuVisible: true
searchBarText: searchBar.text
listProxy: allFriends
@ -331,23 +332,18 @@ AbstractMainPage {
}
ContactListView{
id: contactList
onCountChanged: {
if (initialFriendToDisplay.length !== 0) {
if (selectContact(initialFriendToDisplay) != -1) initialFriendToDisplay = ""
}
}
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
Control.ScrollBar.vertical.visible: false
hoverEnabled: mainItem.leftPanelEnabled
contactMenuVisible: true
searchOnInitialization: true
highlightFollowsCurrentItem: true
searchBarText: searchBar.text
listProxy: allFriends
Connections {
target: contactList.model
function onFriendCreated(index) {
contactList.currentIndex = index
onCountChanged: {
if (initialFriendToDisplay.length !== 0) {
if (selectContact(initialFriendToDisplay) != -1) initialFriendToDisplay = ""
}
}
onSelectedContactChanged: {
@ -359,6 +355,12 @@ AbstractMainPage {
onContactDeletionRequested: (contact) => {
mainItem.deleteContact(contact)
}
Connections {
target: contactList.model
function onFriendCreated(index) {
contactList.currentIndex = index
}
}
}
}
}
@ -916,4 +918,4 @@ AbstractMainPage {
}
}
}
}
}