Warning, /network/tokodon/src/content/ui/StatusDelegate/InlineIdentityInfo.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 import QtQuick
0005 import org.kde.kirigami 2 as Kirigami
0006 import QtQuick.Controls 2 as QQC2
0007 import QtQuick.Layouts
0008 import org.kde.kirigamiaddons.components 1 as KirigamiComponents
0009 
0010 import org.kde.tokodon
0011 import org.kde.tokodon.private
0012 
0013 // Used everywhere, is a component with an Avatar, some labels and such smashed together
0014 RowLayout {
0015     id: root
0016 
0017     required property var identity
0018     required property bool secondary
0019     property bool admin: false
0020     property string ip
0021     readonly property alias avatar: avatar
0022 
0023     spacing: Kirigami.Units.mediumSpacing
0024 
0025     signal clicked()
0026 
0027     KirigamiComponents.AvatarButton {
0028         id: avatar
0029 
0030         Layout.alignment: admin ? Qt.AlignCenter : Qt.AlignTop
0031         Layout.rowSpan: 5
0032 
0033         source: root.identity.avatarUrl
0034         cache: true
0035         text: i18n("View Profile")
0036         onClicked: if (!admin) {
0037             Navigation.openAccount(root.identity.id);
0038             root.clicked();
0039         }
0040         name: root.identity.displayName
0041     }
0042 
0043     ColumnLayout {
0044         id: layout
0045 
0046         Layout.fillWidth: true
0047 
0048         spacing: 0
0049         clip: true
0050 
0051         Kirigami.Heading {
0052             level: 4
0053             font.pixelSize: Config.defaultFont.pixelSize + 2
0054             font.pointSize: -1
0055             text: root.identity.displayNameHtml
0056             type: Kirigami.Heading.Type.Primary
0057             color: root.secondary ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor
0058             verticalAlignment: Text.AlignTop
0059             elide: Text.ElideRight
0060             textFormat: Text.RichText
0061             maximumLineCount: 1
0062 
0063             Layout.fillWidth: true
0064 
0065             MouseArea {
0066                 anchors.fill: parent
0067                 cursorShape: Qt.PointingHandCursor
0068                 onClicked: avatar.clicked()
0069             }
0070         }
0071 
0072         QQC2.Label {
0073             font.pixelSize: Config.defaultFont.pixelSize + 1
0074             elide: Text.ElideRight
0075             color: Kirigami.Theme.disabledTextColor
0076             text: `@${root.identity.account}`
0077             verticalAlignment: Text.AlignTop
0078             maximumLineCount: 1
0079 
0080             Layout.fillWidth: true
0081 
0082             MouseArea {
0083                 anchors.fill: parent
0084                 cursorShape: Qt.PointingHandCursor
0085                 onClicked: avatar.clicked()
0086             }
0087         }
0088         Kirigami.Heading {
0089             id: emailHeading
0090             level: 4
0091             text: root.ip ? root.ip : ""
0092             visible: admin && root.ip
0093             type: Kirigami.Heading.Type.Secondary
0094             verticalAlignment: Text.AlignTop
0095             elide: Text.ElideRight
0096             maximumLineCount: 1
0097 
0098             Layout.fillWidth: true
0099         }
0100     }
0101 }