Fix room at index 0 not highlightable

This commit is contained in:
miruka 2020-03-10 06:07:09 -04:00
parent 89ee4c2361
commit 8d594e3e83
3 changed files with 25 additions and 15 deletions

View File

@ -2,7 +2,6 @@
## Before release
- Fix highlighted account/room in MainPane
- nio ClientTimeout
- Default theme?
- Name

View File

@ -61,14 +61,22 @@ Column {
highlight: null // managed by the AccountRoomsList
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
Binding on currentIndex {
value:
window.uiState.page === "Pages/Chat/Chat.qml" &&
window.uiState.pageProperties.userId === userId ?
roomList.model.findIndex(window.uiState.pageProperties.roomId)
|| -1 :
-1
roomList.hasActiveRoom ?
(
roomList.activeRoomIndex === null ?
-1 : roomList.activeRoomIndex
) : -1
when: ! view.detachedCurrentIndex
}

View File

@ -59,6 +59,15 @@ HListView {
readonly property Room selectedRoom:
currentItem ? currentItem.roomList.currentItem : null
readonly property bool hasActiveAccount:
window.uiState.page === "Pages/Chat/Chat.qml" ||
window.uiState.page === "Pages/AddChat/AddChat.qml" ||
window.uiState.page === "Pages/AccountSettings/AccountSettings.qml"
readonly property var activeAccountIndex:
hasActiveAccount ?
model.findIndex(window.uiState.pageProperties.userId) : null
function previous() {
detachedCurrentIndex = true
@ -198,14 +207,8 @@ HListView {
Binding on currentIndex {
value:
[
"Pages/Chat/Chat.qml",
"Pages/AddChat/AddChat.qml",
"Pages/AccountSettings/AccountSettings.qml",
].includes(window.uiState.page) ?
model.findIndex(window.uiState.pageProperties.userId) || -1 :
-1
hasActiveAccount ?
(activeAccountIndex === null ? -1 : activeAccountIndex) : -1
when: ! detachedCurrentIndex
}