Warning, /pim/mimetreeparser/src/quick/qml/private/TextPart.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2016 Michael Bohlender <michael.bohlender@kdemail.net>
0002 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick 2.7
0006 import QtQuick.Controls 2.15 as QQC2
0007 
0008 import org.kde.pim.mimetreeparser 1.0
0009 import org.kde.kirigami 2.19 as Kirigami
0010 
0011 Item {
0012     id: root
0013 
0014     property string content
0015     property bool embedded: true
0016     property bool autoLoadImages: false
0017 
0018     property string searchString
0019     property int contentHeight: textEdit.height
0020 
0021     onSearchStringChanged: {
0022         //This is a workaround because otherwise the view will not take the ViewHighlighter changes into account.
0023         textEdit.text = root.content
0024     }
0025 
0026     QQC2.TextArea {
0027         id: textEdit
0028         objectName: "textView"
0029         background: null
0030         readOnly: true
0031         textFormat: TextEdit.RichText
0032         wrapMode: TextEdit.Wrap
0033         padding: 0
0034 
0035         anchors {
0036             left: parent.left
0037             right: parent.right
0038             top: parent.top
0039         }
0040 
0041         text: content.substring(0, 100000).replace(/\u00A0/g,' ') //The TextEdit deals poorly with messages that are too large.
0042         color: embedded ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor
0043         onLinkActivated: link => Qt.openUrlExternally(link)
0044 
0045         onHoveredLinkChanged: if (hoveredLink.length > 0) {
0046             applicationWindow().hoverLinkIndicator.text = hoveredLink;
0047         } else {
0048             applicationWindow().hoverLinkIndicator.text = "";
0049         }
0050 
0051         //Kube.ViewHighlighter {
0052         //    textDocument: textEdit.textDocument
0053         //    searchString: root.searchString
0054         //}
0055     }
0056 }