Warning, /plasma-mobile/spacebar/src/contents/ui/FullscreenPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Michael Lang <criticaltemp@protonmail.com>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 import QtQuick
0006 import QtQuick.Layouts
0007 import QtQuick.Controls as Controls
0008 
0009 import org.kde.kirigami as Kirigami
0010 
0011 import org.kde.spacebar
0012 
0013 Kirigami.ScrollablePage {
0014     id: page
0015     padding: Kirigami.Units.largeSpacing
0016     title: recipients
0017 
0018     property real pointSize: Kirigami.Theme.defaultFont.pointSize + SettingsManager.messageFontSize
0019     property string recipients: ""
0020     property string text: ""
0021     property var attachments: []
0022     property string folder: ""
0023 
0024     ColumnLayout {
0025         spacing: Kirigami.Units.largeSpacing
0026 
0027         // message contents
0028         Controls.Label {
0029             visible: !!page.text
0030             Layout.alignment: Qt.AlignHCenter
0031             Layout.maximumWidth: page.width - Kirigami.Units.largeSpacing * 2
0032             text: Utils.textToHtml(page.text)
0033             wrapMode: Text.Wrap
0034             textFormat: Text.StyledText
0035             linkColor: Kirigami.Theme.linkColor
0036             color: Kirigami.Theme.textColor
0037             font.pointSize: pointSize
0038             font.family: "Noto Sans, Noto Color Emoji"
0039         }
0040 
0041         Repeater {
0042             model: attachments
0043 
0044             Column {
0045                 Layout.alignment: Qt.AlignHCenter
0046                 spacing: Kirigami.Units.smallSpacing
0047 
0048                 property bool isImage: modelData.mimeType.indexOf("image/") >= 0
0049                 property string filePath: "file://" + folder + "/" + (modelData.fileName || "")
0050 
0051                 RowLayout {
0052                     visible: !isImage && !modelData.text
0053                     Kirigami.Icon {
0054                         source: modelData.iconName
0055                     }
0056                     Text {
0057                         text: modelData.name
0058                         color: Kirigami.Theme.textColor
0059                         font.pointSize: pointSize
0060                     }
0061                     MouseArea {
0062                         width: parent.width
0063                         height: parent.height
0064                         onDoubleClicked: Qt.openUrlExternally(filePath)
0065                     }
0066                 }
0067 
0068                 Image {
0069                     id: image
0070                     source: isImage ? filePath : ""
0071                     fillMode: Image.PreserveAspectFit
0072                     sourceSize.width: Math.round(page.width) - Kirigami.Units.largeSpacing * 2
0073                     height: Math.min(root.height * 0.8, image.implicitHeight)
0074                     cache: false
0075 
0076                     MouseArea {
0077                         anchors.fill: parent
0078                         onClicked: if (!page.flicking) {
0079                                 pageStack.layers.push("qrc:/PreviewPage.qml", {
0080                                 filePath: filePath,
0081                                 type: modelData.mimeType
0082                             } )
0083                         }
0084                     }
0085 
0086                     AnimatedImage {
0087                         source: modelData.mimeType == "image/gif" ? parent.source : ""
0088                         anchors.fill: parent
0089                         cache: false
0090                     }
0091                 }
0092 
0093                 Controls.Label {
0094                     visible: !!modelData.text
0095                     anchors.horizontalCenter: parent.horizontalCenter
0096                     width: Math.min(page.width, implicitWidth)
0097                     text: Utils.textToHtml(modelData.text)
0098                     wrapMode: Text.Wrap
0099                     textFormat: Text.StyledText
0100                     linkColor: Kirigami.Theme.linkColor
0101                     color: Kirigami.Theme.textColor
0102                     font.pointSize: pointSize
0103                     font.family: "Noto Sans, Noto Color Emoji"
0104                 }
0105             }
0106         }
0107     }
0108 }