Filtering → hide accounts with no matching rooms
This commit is contained in:
@@ -29,7 +29,6 @@ HColumnLayout {
|
||||
HListView {
|
||||
id: accountList
|
||||
clip: true
|
||||
model: ModelStore.get("accounts")
|
||||
currentIndex:
|
||||
roomList.currentIndex === -1 ?
|
||||
-1 :
|
||||
@@ -40,6 +39,63 @@ HColumnLayout {
|
||||
-1,
|
||||
)
|
||||
|
||||
model: HFilterModel {
|
||||
model: ModelStore.get("accounts")
|
||||
acceptItem: item =>
|
||||
! roomFilter || item.id in roomList.sectionIndice
|
||||
|
||||
delegate: HTileDelegate {
|
||||
id: tile
|
||||
width: accountList.width
|
||||
backgroundColor:
|
||||
theme.accountsBar.accountList.account.background
|
||||
|
||||
topPadding: (accountList.width - avatar.width) / 4
|
||||
bottomPadding: topPadding
|
||||
leftPadding: 0
|
||||
rightPadding: leftPadding
|
||||
|
||||
contentItem: Item {
|
||||
implicitHeight: avatar.height
|
||||
|
||||
HUserAvatar {
|
||||
id: avatar
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
userId: model.id
|
||||
displayName: model.display_name
|
||||
mxc: model.avatar_url
|
||||
// compact: tile.compact
|
||||
|
||||
radius:
|
||||
theme.accountsBar.accountList.account.avatarRadius
|
||||
}
|
||||
|
||||
MessageIndicator {
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
indicatorTheme:
|
||||
theme.accountView.account.unreadIndicator
|
||||
unreads: model.total_unread
|
||||
mentions: model.total_mentions
|
||||
}
|
||||
}
|
||||
|
||||
contextMenu: AccountContextMenu { userId: model.id }
|
||||
|
||||
onLeftClicked: {
|
||||
model.id in roomList.sectionIndice ?
|
||||
roomList.goToAccount(model.id) :
|
||||
pageLoader.showPage("AddChat/AddChat", {userId: model.id})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onRoomFilterChanged: refilterAll()
|
||||
|
||||
readonly property string roomFilter: roomList.filter
|
||||
}
|
||||
|
||||
highlight: Item {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
@@ -56,49 +112,6 @@ HColumnLayout {
|
||||
}
|
||||
}
|
||||
|
||||
delegate: HTileDelegate {
|
||||
id: tile
|
||||
width: accountList.width
|
||||
backgroundColor: theme.accountsBar.accountList.account.background
|
||||
|
||||
topPadding: (accountList.width - avatar.width) / 4
|
||||
bottomPadding: topPadding
|
||||
leftPadding: 0
|
||||
rightPadding: leftPadding
|
||||
|
||||
contentItem: Item {
|
||||
implicitHeight: avatar.height
|
||||
|
||||
HUserAvatar {
|
||||
id: avatar
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
userId: model.id
|
||||
displayName: model.display_name
|
||||
mxc: model.avatar_url
|
||||
// compact: tile.compact
|
||||
|
||||
radius: theme.accountsBar.accountList.account.avatarRadius
|
||||
}
|
||||
|
||||
MessageIndicator {
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
indicatorTheme: theme.accountView.account.unreadIndicator
|
||||
unreads: model.total_unread
|
||||
mentions: model.total_mentions
|
||||
}
|
||||
}
|
||||
|
||||
contextMenu: AccountContextMenu { userId: model.id }
|
||||
|
||||
onLeftClicked: {
|
||||
model.id in roomList.sectionIndice ?
|
||||
roomList.goToAccount(model.id) :
|
||||
pageLoader.showPage("AddChat/AddChat", {userId: model.id})
|
||||
}
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
|
Reference in New Issue
Block a user