Warning, /plasma-mobile/raven/src/contents/ui/mailpartview/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.raven 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 string type
0017     property bool autoLoadImages: false
0018 
0019     property string searchString
0020     property int contentHeight: textEdit.height
0021 
0022     onSearchStringChanged: {
0023         //This is a workaround because otherwise the view will not take the ViewHighlighter changes into account.
0024         textEdit.text = root.content
0025     }
0026 
0027     QQC2.TextArea {
0028         id: textEdit
0029         objectName: "textView"
0030         background: Item {}
0031         readOnly: true
0032         textFormat: TextEdit.RichText
0033         padding: 0
0034 
0035         anchors {
0036             top: parent.top
0037             left: parent.left
0038             right: parent.right
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: Qt.openUrlExternally(link)
0044         
0045         wrapMode: TextEdit.WordWrap
0046 
0047         //Kube.ViewHighlighter {
0048         //    textDocument: textEdit.textDocument
0049         //    searchString: root.searchString
0050         //}
0051     }
0052 }