Skip to content
Snippets Groups Projects
Select Git revision
  • f81dc754c177b9c683abe87c2b217e2d6b8e50dc
  • master default protected
  • stable/20250718.0
  • nightly/20250718.0
  • nightly/20250714.0
  • beta/202507141552
  • beta/202506161038
  • stable/20250613.0
  • nightly/20250613.0
  • beta/202506101658
  • stable/20250610.0
  • nightly/20250610.0
  • beta/202506091027
  • beta/202506061543
  • nightly/20250605.0
  • beta/202506051039
  • beta/202506051002
  • beta/202506041611
  • beta/202506041335
  • beta/202505231812
  • stable/20250523.0
  • nightly/20250523.0
22 results

ReplyToRow.qml

Blame
  • Sébastien Blin's avatar
    Sébastien Blin authored
    Else, the text was overflowing
    
    Change-Id: Idd27682d612cc35fce045967025df49ad1a1a202
    f81dc754
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ReplyToRow.qml 3.53 KiB
    /*
     * Copyright (C) 2022 Savoir-faire Linux Inc.
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 3 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     */
    
    import QtQuick
    import QtQuick.Controls
    import QtQuick.Layouts
    
    import net.jami.Adapters 1.1
    import net.jami.Constants 1.1
    
    Item {
        id: root
        anchors.right: isOutgoing ? parent.right : undefined
    
        visible: ReplyTo !== ""
        width: visible ? replyToRow.width : 0
        height: replyToRow.height + replyToRow.anchors.topMargin
    
        Component.onCompleted: {
            // Make sure we show the original post
            // In the future, we may just want to load the previous interaction of the thread
            // and not show it, but for now we can simplify.
            if (ReplyTo !== "")
                MessagesAdapter.loadConversationUntil(ReplyTo)
        }
    
        MouseArea {
    
            z: 2
            anchors.fill: parent
            RowLayout {
                id: replyToRow
                anchors.top: parent.top
                anchors.topMargin: JamiTheme.preferredMarginSize / 2
    
                property bool isSelf: ReplyToAuthor === CurrentAccount.uri || ReplyToAuthor === ""
    
                Label {
                    id: replyTo
    
                    text: JamiStrings.inReplyTo
    
                    color: UtilsAdapter.luma(bubble.color) ?
                        JamiTheme.chatviewTextColorLight :
                        JamiTheme.chatviewTextColorDark
                    font.pointSize: JamiTheme.textFontSize
                    font.kerning: true
                    font.bold: true
                    Layout.leftMargin: JamiTheme.preferredMarginSize
                }
    
                Avatar {
                    id: avatarReply
    
                    Layout.preferredWidth: JamiTheme.avatarReadReceiptSize
                    Layout.preferredHeight: JamiTheme.avatarReadReceiptSize
    
                    showPresenceIndicator: false
    
                    imageId: {
                        if (replyToRow.isSelf)
                            return CurrentAccount.id
                        return ReplyToAuthor
                    }
                    mode: replyToRow.isSelf ? Avatar.Mode.Account : Avatar.Mode.Contact
                }
    
                Text {
                    id: body
                    Layout.maximumWidth: JamiTheme.preferredFieldWidth - JamiTheme.preferredMarginSize
                    Layout.rightMargin: JamiTheme.preferredMarginSize
    
                    TextMetrics {
                        id: metrics
                        elide: Text.ElideRight
                        elideWidth: JamiTheme.preferredFieldWidth - JamiTheme.preferredMarginSize
                        text: ReplyToBody
                    }
    
                    textFormat: Text.MarkdownText
                    text: metrics.elidedText
    
                    color:  UtilsAdapter.luma(bubble.color) ?
                        JamiTheme.chatviewTextColorLight :
                        JamiTheme.chatviewTextColorDark
                    font.pointSize: JamiTheme.textFontSize
                    font.kerning: true
                    font.bold: true
                }
            }
    
            onClicked: function(mouse) {
                CurrentConversation.scrollToMsg(ReplyTo)
            }
        }
    }