mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-03 22:35:45 +02:00
smartlist: keep focus when clearing the search field
- the focus should be grabbed when selecting another view or conversation Change-Id: I41ab6a7a743615269c4dde01b5503a3ae21a836d Gitlab: #110
This commit is contained in:
parent
43094bad8b
commit
ac3b8b821d
4 changed files with 2 additions and 20 deletions
|
@ -27,12 +27,6 @@ Rectangle {
|
||||||
|
|
||||||
signal contactSearchBarTextChanged(string text)
|
signal contactSearchBarTextChanged(string text)
|
||||||
|
|
||||||
// Hack - there is no real way now to make TextField lose its focus,
|
|
||||||
// unless transfer it to other component.
|
|
||||||
function clearFocus() {
|
|
||||||
fakeFocus.forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearText() {
|
function clearText() {
|
||||||
contactSearchBar.clear()
|
contactSearchBar.clear()
|
||||||
fakeFocus.forceActiveFocus()
|
fakeFocus.forceActiveFocus()
|
||||||
|
|
|
@ -29,10 +29,8 @@ ListView {
|
||||||
signal needToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState)
|
signal needToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState)
|
||||||
signal needToSelectItems(string conversationUid)
|
signal needToSelectItems(string conversationUid)
|
||||||
signal needToDeselectItems
|
signal needToDeselectItems
|
||||||
signal needToGrabFocus
|
|
||||||
|
|
||||||
signal needToShowChatView(string accountId, string convUid)
|
signal needToShowChatView(string accountId, string convUid)
|
||||||
signal currentIndexIsChanged
|
|
||||||
signal forceUpdatePotentialInvalidItem
|
signal forceUpdatePotentialInvalidItem
|
||||||
|
|
||||||
// Refresh all items within the model.
|
// Refresh all items within the model.
|
||||||
|
@ -81,10 +79,6 @@ ListView {
|
||||||
function onUpdateSmartList() { updateListView() }
|
function onUpdateSmartList() { updateListView() }
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
|
||||||
root.currentIndexIsChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
delegate: ConversationSmartListViewItemDelegate {
|
delegate: ConversationSmartListViewItemDelegate {
|
||||||
|
|
|
@ -42,7 +42,7 @@ ItemDelegate {
|
||||||
|
|
||||||
|
|
||||||
// When currentIndex is -1, deselect items, if not, change select item
|
// When currentIndex is -1, deselect items, if not, change select item
|
||||||
function onCurrentIndexIsChanged() {
|
function onCurrentIndexChanged() {
|
||||||
if (conversationSmartListView.currentIndex === -1
|
if (conversationSmartListView.currentIndex === -1
|
||||||
|| conversationSmartListView.currentIndex !== index) {
|
|| conversationSmartListView.currentIndex !== index) {
|
||||||
itemSmartListBackground.color = Qt.binding(function () {
|
itemSmartListBackground.color = Qt.binding(function () {
|
||||||
|
@ -55,7 +55,6 @@ ItemDelegate {
|
||||||
1.8) : JamiTheme.releaseColor
|
1.8) : JamiTheme.releaseColor
|
||||||
})
|
})
|
||||||
conversationSmartListView.needToSelectItems(UID)
|
conversationSmartListView.needToSelectItems(UID)
|
||||||
conversationSmartListView.needToGrabFocus()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,7 @@ Rectangle {
|
||||||
// For contact request conv to be focused correctly.
|
// For contact request conv to be focused correctly.
|
||||||
function setCurrentUidSmartListModelIndex() {
|
function setCurrentUidSmartListModelIndex() {
|
||||||
conversationSmartListView.currentIndex
|
conversationSmartListView.currentIndex
|
||||||
= conversationSmartListView.model.currentUidSmartListModelIndex(
|
= conversationSmartListView.model.currentUidSmartListModelIndex()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePendingRequestCount() {
|
function updatePendingRequestCount() {
|
||||||
|
@ -205,10 +204,6 @@ Rectangle {
|
||||||
isAudioOnly, callState)
|
isAudioOnly, callState)
|
||||||
}
|
}
|
||||||
|
|
||||||
onNeedToGrabFocus: {
|
|
||||||
contactSearchBar.clearFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
ConversationsAdapter.setQmlObject(this)
|
ConversationsAdapter.setQmlObject(this)
|
||||||
conversationSmartListView.currentIndex = -1
|
conversationSmartListView.currentIndex = -1
|
||||||
|
|
Loading…
Add table
Reference in a new issue