Warning, /network/neochat/src/qml/DirectChatDrawerHeader.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Controls as QQC2
0007 import QtQuick.Layouts
0008 import org.kde.kirigami as Kirigami
0009 import org.kde.kirigamiaddons.labs.components as KirigamiComponents
0010 
0011 import org.kde.neochat
0012 
0013 ColumnLayout {
0014     id: root
0015 
0016     /**
0017      * @brief The current room that user is viewing.
0018      */
0019     required property NeoChatRoom room
0020 
0021     Layout.fillWidth: true
0022     Layout.alignment: Qt.AlignVCenter
0023     spacing: 0
0024 
0025     Item {
0026         Layout.fillWidth: true
0027         Layout.preferredHeight: Kirigami.Units.largeSpacing * 2
0028     }
0029 
0030     QQC2.AbstractButton {
0031         Layout.preferredWidth: Math.round(Kirigami.Units.gridUnit * 3.5)
0032         Layout.preferredHeight: Math.round(Kirigami.Units.gridUnit * 3.5)
0033         Layout.alignment: Qt.AlignHCenter
0034 
0035         onClicked: {
0036             RoomManager.resolveResource(root.room.directChatRemoteUser.id, "mention");
0037         }
0038 
0039         contentItem: KirigamiComponents.Avatar {
0040             name: root.room ? root.room.displayName : ""
0041             source: root.room ? ("image://mxc/" + root.room.avatarMediaId) : ""
0042 
0043             Rectangle {
0044                 visible: root.room.usesEncryption
0045                 color: Kirigami.Theme.backgroundColor
0046 
0047                 width: Kirigami.Units.gridUnit
0048                 height: Kirigami.Units.gridUnit
0049                 anchors.bottom: parent.bottom
0050                 anchors.right: parent.right
0051 
0052                 radius: Math.round(width / 2)
0053 
0054                 Kirigami.Icon {
0055                     source: "channel-secure-symbolic"
0056                     anchors.fill: parent
0057                 }
0058             }
0059         }
0060     }
0061 
0062     Kirigami.Heading {
0063         Layout.fillWidth: true
0064         type: Kirigami.Heading.Type.Primary
0065         wrapMode: QQC2.Label.Wrap
0066         text: root.room.displayName
0067         textFormat: Text.PlainText
0068         horizontalAlignment: Text.AlignHCenter
0069     }
0070 }