Skip to content
Snippets Groups Projects
Commit ac3b8b82 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

smartlist: keep focus when clearing the search field

- the focus should be grabbed when selecting another view or
  conversation

Change-Id: I41ab6a7a743615269c4dde01b5503a3ae21a836d
Gitlab: #110
parent 43094bad
No related branches found
No related tags found
No related merge requests found
...@@ -27,12 +27,6 @@ Rectangle { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment