Fix room list highlight when going to account page

Correctly set it when going to an account settings or add chat page by
using the account context menu, the add chat button or keybinds.
This commit is contained in:
miruka 2020-07-10 10:29:32 -04:00
parent 5abdc1f779
commit 199940ab19
4 changed files with 33 additions and 9 deletions

View File

@ -6,7 +6,6 @@ import ".."
import "../Base"
import "../Base/HTile"
Rectangle {
implicitHeight: accountList.count >= 2 ? accountList.contentHeight : 0
color: theme.mainPane.accountBar.background
@ -50,6 +49,8 @@ Rectangle {
expand.visible: false
onLeftClicked: roomList.goToAccount(model.id)
onWentToAccountPage:
roomList.currentIndex = roomList.accountIndice[model.id]
}
highlight: Item {

View File

@ -13,7 +13,8 @@ HMenu {
property string presence
property string statusMsg
onOpened: statusText.forceActiveFocus()
signal wentToAccountPage()
function setPresence(presence, statusMsg=undefined) {
@ -21,6 +22,9 @@ HMenu {
}
onOpened: statusText.forceActiveFocus()
HLabeledItem {
id: statusMsgLabel
enabled: presence && presence !== "offline"
@ -103,15 +107,21 @@ HMenu {
HMenuItem {
icon.name: "account-settings"
text: qsTr("Account settings")
onTriggered: pageLoader.showPage(
onTriggered: {
pageLoader.showPage(
"AccountSettings/AccountSettings", { "userId": userId },
)
wentToAccountPage()
}
}
HMenuItem {
icon.name: "menu-add-chat"
text: qsTr("Add new chat")
onTriggered: pageLoader.showPage("AddChat/AddChat", {userId: userId})
onTriggered: {
pageLoader.showPage("AddChat/AddChat", {userId: userId})
wentToAccountPage()
}
}
HMenuItem {

View File

@ -72,6 +72,13 @@ HTile {
HColumnLayout {
id: title
text: model.display_name || model.id
color:
hovered ?
utils.nameColor(
model.display_name || model.id.substring(1),
) :
theme.mainPane.listView.account.name
TitleLabel {
text: model.display_name || model.id
@ -112,9 +119,10 @@ HTile {
icon.name: "add-chat"
backgroundColor: "transparent"
toolTip.text: qsTr("Add new chat")
onClicked: pageLoader.showPage(
"AddChat/AddChat", {userId: model.id},
)
onClicked: {
pageLoader.showPage("AddChat/AddChat", {userId: model.id})
account.wentToAccountPage()
}
leftPadding: theme.spacing
rightPadding: theme.spacing / 1.75
@ -168,6 +176,7 @@ HTile {
model.presence_support || model.presence === "offline" ?
model.presence :
null
onWentToAccountPage: account.wentToAccountPage()
}
@ -184,6 +193,8 @@ HTile {
readonly property alias addChat: addChat
readonly property alias expand: expand
signal wentToAccountPage()
function setCollapse(collapse) {
window.uiState.collapseAccounts[model.id] = collapse

View File

@ -33,6 +33,8 @@ HListView {
onLeftClicked: showItemAtIndex(model.index)
onCollapsedChanged:
if (wantedUserId === model.id) startCorrectItemSearch()
onWentToAccountPage: roomList.currentIndex = model.index
}
}