Warning, /network/neochat/src/qml/ReplyPane.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.de> 0002 // SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com> 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 import QtQuick 0006 import QtQuick.Layouts 0007 import QtQuick.Controls as QQC2 0008 0009 import org.kde.kirigami as Kirigami 0010 import org.kde.kirigamiaddons.labs.components as KirigamiComponents 0011 0012 import org.kde.neochat 0013 0014 RowLayout { 0015 id: root 0016 0017 property string userName 0018 property color userColor 0019 property url userAvatar: "" 0020 property var text 0021 0022 signal cancel 0023 0024 Rectangle { 0025 id: verticalBorder 0026 0027 Layout.fillHeight: true 0028 0029 implicitWidth: Kirigami.Units.smallSpacing 0030 color: userColor 0031 } 0032 ColumnLayout { 0033 RowLayout { 0034 KirigamiComponents.Avatar { 0035 id: replyAvatar 0036 0037 implicitWidth: Kirigami.Units.iconSizes.small 0038 implicitHeight: Kirigami.Units.iconSizes.small 0039 0040 source: userAvatar 0041 name: userName 0042 color: userColor 0043 } 0044 QQC2.Label { 0045 Layout.fillWidth: true 0046 Layout.alignment: Qt.AlignLeft 0047 0048 color: userColor 0049 text: userName 0050 elide: Text.ElideRight 0051 } 0052 } 0053 QQC2.TextArea { 0054 id: textArea 0055 0056 Layout.fillWidth: true 0057 0058 leftPadding: 0 0059 rightPadding: 0 0060 topPadding: 0 0061 bottomPadding: 0 0062 text: "<style> a{color:" + Kirigami.Theme.linkColor + ";}.user-pill{}</style>" + replyTextMetrics.elidedText 0063 selectByMouse: true 0064 selectByKeyboard: true 0065 readOnly: true 0066 wrapMode: TextEdit.Wrap 0067 textFormat: TextEdit.RichText 0068 background: Item {} 0069 HoverHandler { 0070 cursorShape: textArea.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor 0071 } 0072 0073 TextMetrics { 0074 id: replyTextMetrics 0075 0076 text: root.text 0077 font: textArea.font 0078 elide: Qt.ElideRight 0079 elideWidth: textArea.width * 2 - Kirigami.Units.smallSpacing * 2 0080 } 0081 } 0082 } 0083 QQC2.ToolButton { 0084 id: cancelButton 0085 0086 Layout.alignment: Qt.AlignVCenter 0087 0088 display: QQC2.AbstractButton.IconOnly 0089 text: i18nc("@action:button", "Cancel reply") 0090 icon.name: "dialog-close" 0091 onClicked: { 0092 root.cancel(); 0093 } 0094 QQC2.ToolTip.text: text 0095 QQC2.ToolTip.visible: hovered 0096 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay 0097 } 0098 }