Fix filter members field after switching room

This commit is contained in:
miruka 2019-05-16 15:47:14 -04:00
parent 5ab13e3e16
commit 1c24edb166
2 changed files with 15 additions and 0 deletions

View File

@ -340,6 +340,14 @@ class Client(QObject):
return self.nio.room_contains_unverified(room_id)
@pyqtSlot(str, str, result=str)
def getMemberFilter(self, room_category: str, room_id: str) -> str:
return self.manager.backend.accounts[self.userId]\
.roomCategories[room_category]\
.rooms[room_id]\
.sortedMembers.filter
@pyqtSlot(str, str, str)
def setMemberFilter(self, room_category: str, room_id: str, pattern: str
) -> None:

View File

@ -31,6 +31,13 @@ HColumnLayout {
placeholderText: qsTr("Filter members")
backgroundColor: HStyle.sidePane.filterRooms.background
// Without this, if the user types in the field, changes of room, then
// comes back, the field will be empty but the filter still applied.
Component.onCompleted:
text = Backend.clients.get(chatPage.userId).getMemberFilter(
chatPage.category, chatPage.roomId
)
onTextChanged: Backend.clients.get(chatPage.userId).setMemberFilter(
chatPage.category, chatPage.roomId, text
)