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