Explicit room parameter DirectChatDrawerHeader
Create explicit room parameter and reference it in DirectChatDrawerHeader
This commit is contained in:
committed by
Tobias Fella
parent
5adffddbd8
commit
e7fa3ad524
@@ -11,6 +11,13 @@ import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
|||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current room that user is viewing.
|
||||||
|
*/
|
||||||
|
required property NeoChatRoom room
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@@ -26,15 +33,15 @@ ColumnLayout {
|
|||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
RoomManager.visitUser(room.getUser(room.directChatRemoteUser.id).object, "mention")
|
RoomManager.visitUser(root.room.getUser(root.room.directChatRemoteUser.id).object, "mention")
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: KirigamiComponents.Avatar {
|
contentItem: KirigamiComponents.Avatar {
|
||||||
name: room ? room.displayName : ""
|
name: root.room ? root.room.displayName : ""
|
||||||
source: room ? ("image://mxc/" + room.avatarMediaId) : ""
|
source: root.room ? ("image://mxc/" + root.room.avatarMediaId) : ""
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: room.usesEncryption
|
visible: root.room.usesEncryption
|
||||||
color: Kirigami.Theme.backgroundColor
|
color: Kirigami.Theme.backgroundColor
|
||||||
|
|
||||||
width: Kirigami.Units.gridUnit
|
width: Kirigami.Units.gridUnit
|
||||||
@@ -56,7 +63,7 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
type: Kirigami.Heading.Type.Primary
|
type: Kirigami.Heading.Type.Primary
|
||||||
wrapMode: QQC2.Label.Wrap
|
wrapMode: QQC2.Label.Wrap
|
||||||
text: room.displayName
|
text: root.room.displayName
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,7 +249,9 @@ QQC2.ScrollView {
|
|||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: directChatDrawerHeader
|
id: directChatDrawerHeader
|
||||||
DirectChatDrawerHeader {}
|
DirectChatDrawerHeader {
|
||||||
|
room: root.room
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onRoomChanged: {
|
onRoomChanged: {
|
||||||
|
|||||||
Reference in New Issue
Block a user