2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-08-18 17:27:00 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import "../Base"
|
2020-03-31 06:03:35 +11:00
|
|
|
import "../Base/HTile"
|
2019-08-18 17:27:00 +10:00
|
|
|
|
2020-04-27 04:20:45 +10:00
|
|
|
HTile {
|
2019-12-03 07:29:29 +11:00
|
|
|
id: account
|
2020-04-27 04:20:45 +10:00
|
|
|
implicitHeight: theme.baseElementsHeight
|
2020-04-28 13:49:36 +10:00
|
|
|
backgroundColor: theme.accountView.account.background
|
2020-04-27 04:20:45 +10:00
|
|
|
padded: false
|
2019-08-18 17:27:00 +10:00
|
|
|
|
2020-03-31 06:03:35 +11:00
|
|
|
contentItem: ContentRow {
|
|
|
|
tile: account
|
2019-08-24 00:53:54 +10:00
|
|
|
|
2020-03-31 06:03:35 +11:00
|
|
|
HUserAvatar {
|
|
|
|
id: avatar
|
2020-04-30 04:00:02 +10:00
|
|
|
userId: accountModel.id
|
|
|
|
displayName: accountModel.display_name
|
|
|
|
mxc: accountModel.avatar_url
|
2020-04-27 04:20:45 +10:00
|
|
|
radius: 0
|
2020-05-01 15:22:08 +10:00
|
|
|
compact: account.compact
|
2019-12-03 07:29:29 +11:00
|
|
|
}
|
2019-08-20 00:28:49 +10:00
|
|
|
|
2020-03-31 06:03:35 +11:00
|
|
|
TitleLabel {
|
2020-04-30 04:00:02 +10:00
|
|
|
text: accountModel.display_name || accountModel.id
|
2020-03-31 06:03:35 +11:00
|
|
|
color:
|
|
|
|
hovered ?
|
2020-04-30 04:00:02 +10:00
|
|
|
utils.nameColor(
|
|
|
|
accountModel.display_name || accountModel.id.substring(1),
|
|
|
|
) :
|
2020-04-28 13:49:36 +10:00
|
|
|
theme.accountView.account.name
|
2019-08-20 00:28:49 +10:00
|
|
|
|
2020-03-31 06:03:35 +11:00
|
|
|
Behavior on color { HColorAnimation {} }
|
|
|
|
}
|
2020-02-13 21:58:13 +11:00
|
|
|
|
2020-03-13 13:16:33 +11:00
|
|
|
HButton {
|
|
|
|
id: addChat
|
|
|
|
iconItem.small: true
|
|
|
|
icon.name: "add-chat"
|
|
|
|
backgroundColor: "transparent"
|
|
|
|
toolTip.text: qsTr("Add new chat")
|
|
|
|
onClicked: pageLoader.showPage(
|
2020-04-30 04:00:02 +10:00
|
|
|
"AddChat/AddChat", {userId: accountModel.id},
|
2020-03-13 13:16:33 +11:00
|
|
|
)
|
2019-11-07 21:44:53 +11:00
|
|
|
|
2020-03-13 13:16:33 +11:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.maximumWidth:
|
|
|
|
account.width >= 100 * theme.uiScale ? implicitWidth : 0
|
2019-11-07 21:44:53 +11:00
|
|
|
|
2020-04-27 04:20:45 +10:00
|
|
|
HShortcut {
|
|
|
|
enabled: isCurrent
|
|
|
|
sequences: window.settings.keys.addNewChat
|
|
|
|
onActivated: addChat.clicked()
|
2020-03-13 13:16:33 +11:00
|
|
|
}
|
|
|
|
}
|
2019-08-18 17:27:00 +10:00
|
|
|
}
|
2020-03-31 06:03:35 +11:00
|
|
|
|
2020-05-01 19:21:50 +10:00
|
|
|
contextMenu: AccountContextMenu { userId: accountModel.id }
|
2020-03-31 06:03:35 +11:00
|
|
|
|
2020-04-27 04:20:45 +10:00
|
|
|
onLeftClicked: {
|
2020-03-31 06:03:35 +11:00
|
|
|
pageLoader.showPage(
|
2020-04-30 04:00:02 +10:00
|
|
|
"AccountSettings/AccountSettings", { "userId": accountModel.id }
|
2020-03-31 06:03:35 +11:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-30 04:00:02 +10:00
|
|
|
property var accountModel
|
2020-04-27 04:20:45 +10:00
|
|
|
property bool isCurrent: false
|
2020-03-31 06:03:35 +11:00
|
|
|
|
|
|
|
|
2020-04-27 04:20:45 +10:00
|
|
|
HShortcut {
|
|
|
|
enabled: isCurrent
|
|
|
|
sequences: window.settings.keys.accountSettings
|
|
|
|
onActivated: leftClicked()
|
|
|
|
}
|
2019-08-18 17:27:00 +10:00
|
|
|
}
|