2019-12-03 07:29:29 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
2020-02-04 07:19:42 +11:00
|
|
|
import SortFilterProxyModel 0.2
|
2019-12-03 07:29:29 +11:00
|
|
|
import ".."
|
|
|
|
import "../Base"
|
|
|
|
|
|
|
|
Column {
|
2020-02-13 21:58:13 +11:00
|
|
|
id: accountRooms
|
2020-02-04 07:19:42 +11:00
|
|
|
// visible: account.opacity > 0
|
2019-12-03 07:29:29 +11:00
|
|
|
|
|
|
|
|
|
|
|
property string userId: model.id
|
|
|
|
readonly property HListView view: ListView.view
|
2020-02-13 21:58:13 +11:00
|
|
|
readonly property int listIndex: index
|
2020-03-08 00:45:52 +11:00
|
|
|
readonly property bool noFilterResults:
|
|
|
|
mainPane.filter && roomList.model.count === 0
|
2019-12-03 07:29:29 +11:00
|
|
|
|
2020-02-13 08:58:24 +11:00
|
|
|
readonly property alias account: account
|
|
|
|
readonly property alias collapsed: account.collapsed
|
|
|
|
readonly property alias roomList: roomList
|
|
|
|
|
2019-12-03 07:29:29 +11:00
|
|
|
|
|
|
|
Account {
|
|
|
|
id: account
|
|
|
|
width: parent.width
|
2020-02-13 21:58:13 +11:00
|
|
|
view: accountRooms.view
|
2020-02-04 07:19:42 +11:00
|
|
|
|
2020-03-08 00:45:52 +11:00
|
|
|
opacity: collapsed || noFilterResults ?
|
|
|
|
theme.mainPane.account.collapsedOpacity : 1
|
2019-12-03 07:29:29 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
HListView {
|
|
|
|
id: roomList
|
|
|
|
width: parent.width
|
2020-03-08 00:45:52 +11:00
|
|
|
height: contentHeight
|
2019-12-03 07:29:29 +11:00
|
|
|
interactive: false
|
|
|
|
|
2020-03-10 20:38:28 +11:00
|
|
|
model: HSortFilterProxyModel {
|
2020-02-13 21:58:13 +11:00
|
|
|
sourceModel: ModelStore.get(accountRooms.userId, "rooms")
|
2019-12-03 07:29:29 +11:00
|
|
|
|
2020-02-04 07:19:42 +11:00
|
|
|
filters: [
|
|
|
|
ExpressionFilter {
|
|
|
|
expression: ! account.collapsed
|
|
|
|
enabled: ! mainPane.filter
|
|
|
|
},
|
2019-12-03 07:29:29 +11:00
|
|
|
|
2020-02-04 07:19:42 +11:00
|
|
|
ExpressionFilter {
|
|
|
|
expression: utils.filterMatches(
|
|
|
|
mainPane.filter, model.display_name,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2019-12-03 07:29:29 +11:00
|
|
|
|
|
|
|
delegate: Room {
|
|
|
|
width: roomList.width
|
2020-02-13 21:58:13 +11:00
|
|
|
userId: accountRooms.userId
|
2019-12-03 07:29:29 +11:00
|
|
|
}
|
|
|
|
|
2020-02-13 08:58:24 +11:00
|
|
|
highlight: null // managed by the AccountRoomsList
|
|
|
|
|
2020-03-10 20:38:28 +11:00
|
|
|
|
2020-03-10 21:07:09 +11:00
|
|
|
readonly property bool hasActiveRoom:
|
|
|
|
window.uiState.page === "Pages/Chat/Chat.qml" &&
|
|
|
|
window.uiState.pageProperties.userId === userId
|
|
|
|
|
|
|
|
readonly property var activeRoomIndex:
|
|
|
|
hasActiveRoom ?
|
|
|
|
model.findIndex(window.uiState.pageProperties.roomId) : null
|
|
|
|
|
|
|
|
|
2020-03-10 20:38:28 +11:00
|
|
|
Binding on currentIndex {
|
|
|
|
value:
|
2020-03-10 21:07:09 +11:00
|
|
|
roomList.hasActiveRoom ?
|
|
|
|
(
|
|
|
|
roomList.activeRoomIndex === null ?
|
|
|
|
-1 : roomList.activeRoomIndex
|
|
|
|
) : -1
|
2020-03-10 20:38:28 +11:00
|
|
|
|
|
|
|
when: ! view.detachedCurrentIndex
|
|
|
|
}
|
|
|
|
|
2020-02-04 07:19:42 +11:00
|
|
|
Behavior on height { HNumberAnimation {} }
|
2019-12-03 07:29:29 +11:00
|
|
|
}
|
|
|
|
}
|