Warning, /network/neochat/src/qml/GroupChatDrawerHeader.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.Layouts
0007 import org.kde.kirigami as Kirigami
0008 import org.kde.kirigamiaddons.labs.components as KirigamiComponents
0009 
0010 import org.kde.neochat
0011 
0012 ColumnLayout {
0013     id: root
0014     /**
0015      * @brief The current room that user is viewing.
0016      */
0017     required property NeoChatRoom room
0018 
0019     Layout.fillWidth: true
0020 
0021     RowLayout {
0022         Layout.fillWidth: true
0023         Layout.leftMargin: Kirigami.Units.largeSpacing
0024         Layout.topMargin: Kirigami.Units.largeSpacing
0025         Layout.bottomMargin: Kirigami.Units.largeSpacing
0026 
0027         spacing: Kirigami.Units.largeSpacing
0028 
0029         KirigamiComponents.Avatar {
0030             Layout.preferredWidth: Kirigami.Units.iconSizes.large
0031             Layout.preferredHeight: Kirigami.Units.iconSizes.large
0032 
0033             name: root.room ? root.room.displayName : ""
0034             source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : ""
0035 
0036             Rectangle {
0037                 visible: room.usesEncryption
0038                 color: Kirigami.Theme.backgroundColor
0039 
0040                 width: Kirigami.Units.gridUnit
0041                 height: Kirigami.Units.gridUnit
0042 
0043                 anchors {
0044                     bottom: parent.bottom
0045                     right: parent.right
0046                 }
0047 
0048                 radius: Math.round(width / 2)
0049 
0050                 Kirigami.Icon {
0051                     source: "channel-secure-symbolic"
0052                     anchors.fill: parent
0053                 }
0054             }
0055         }
0056 
0057         ColumnLayout {
0058             Layout.fillWidth: true
0059             Layout.alignment: Qt.AlignVCenter
0060             spacing: 0
0061 
0062             Kirigami.Heading {
0063                 Layout.fillWidth: true
0064                 text: root.room ? root.room.displayName : i18n("No name")
0065                 textFormat: Text.PlainText
0066                 wrapMode: Text.Wrap
0067             }
0068 
0069             Kirigami.SelectableLabel {
0070                 Layout.fillWidth: true
0071                 font: Kirigami.Theme.smallFont
0072                 textFormat: TextEdit.PlainText
0073                 visible: root.room && root.room.canonicalAlias
0074                 text: root.room && root.room.canonicalAlias ? root.room.canonicalAlias : ""
0075             }
0076         }
0077     }
0078 
0079     Kirigami.SelectableLabel {
0080         Layout.fillWidth: true
0081         Layout.leftMargin: Kirigami.Units.largeSpacing
0082         Layout.rightMargin: Kirigami.Units.largeSpacing
0083 
0084         visible: text.length > 0
0085 
0086         text: root.room && root.room.topic ? root.room.topic.replace(replaceLinks, "<a href=\"$1\">$1</a>") : ""
0087         readonly property var replaceLinks: /(http[s]?:\/\/[^ \r\n]*)/g
0088         textFormat: TextEdit.MarkdownText
0089         wrapMode: Text.Wrap
0090         onLinkActivated: link => UrlHelper.openUrl(link)
0091     }
0092 }