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 showFavoritesOnly: false
property bool showDefaultAddress: false property bool showDefaultAddress: false
property bool showLdapContacts: false property bool showLdapContacts: false
property bool searchOnInitialization: false
property var listProxy: MagicSearchProxy{} property var listProxy: MagicSearchProxy{}
@ -116,7 +117,7 @@ ListView {
showLdapContacts: mainItem.showLdapContacts showLdapContacts: mainItem.showLdapContacts
sourceFlags: mainItem.sourceFlags sourceFlags: mainItem.sourceFlags
onInitialized: { onInitialized: {
magicSearchProxy.forceUpdate() if(mainItem.searchOnInitialization) magicSearchProxy.forceUpdate()
} }
} }

View file

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

View file

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