moment/src/gui/Chat/Banners/InviteBanner.qml

52 lines
1.3 KiB
QML
Raw Normal View History

import QtQuick 2.12
import "../../Base"
Banner {
2019-12-09 05:25:31 -04:00
property string inviterId: chat.roomInfo.inviter
property string inviterName: chat.roomInfo.inviter_name
property string inviterAvatar: chat.roomInfo.inviter_avatar
color: theme.chat.inviteBanner.background
2019-04-28 11:01:38 -04:00
avatar.userId: inviterId
avatar.displayName: inviterName
avatar.mxc: inviterAvatar
labelText: qsTr("%1 invited you to this room").arg(
utils.coloredNameHtml(inviterName, inviterId)
)
buttonModel: [
{
name: "accept",
text: qsTr("Join"),
2019-07-18 04:23:23 -04:00
iconName: "invite-accept",
2019-08-28 18:21:13 -04:00
iconColor: theme.colors.positiveBackground
},
{
name: "decline",
text: qsTr("Decline"),
2019-07-18 04:23:23 -04:00
iconName: "invite-decline",
2019-08-28 18:21:13 -04:00
iconColor: theme.colors.negativeBackground
}
]
buttonCallbacks: ({
accept: button => {
button.loading = true
py.callClientCoro(
2019-12-09 05:25:31 -04:00
chat.userId, "join", [chat.roomId], () => {
button.loading = false
})
},
decline: button => {
button.loading = true
py.callClientCoro(
2019-12-09 05:25:31 -04:00
chat.userId, "room_leave", [chat.roomId], () => {
button.loading = false
})
}
})
}