Warning, /plasma/plasma-sdk/plasmoidviewer/qmlpackages/shell/contents/configuration/AboutPlugin.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2018 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *  SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de>
0004  *
0005  *  SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 import QtQuick 2.4
0009 import QtQuick.Controls 2.4 as QQC2
0010 import QtQuick.Layouts 1.3
0011 
0012 import org.kde.kirigami 2.6 as Kirigami
0013 import org.kde.plasma.plasmoid 2.0
0014 
0015 /**
0016  * A copy of Kirigami.AboutPage adapted to KPluginMetadata instead of KAboutData
0017  */
0018 Kirigami.ScrollablePage {
0019     id: page
0020     title: i18n("About")
0021 
0022     Component {
0023         id: personDelegate
0024 
0025         RowLayout {
0026             height: implicitHeight + (Kirigami.Units.smallSpacing * 2)
0027 
0028             spacing: Kirigami.Units.smallSpacing * 2
0029             Kirigami.Icon {
0030                 width: Kirigami.Units.iconSizes.smallMedium
0031                 height: width
0032                 source: "user"
0033             }
0034             QQC2.Label {
0035                 text: modelData.name
0036             }
0037             Row {
0038                 // Group action buttons together
0039                 spacing: 0
0040                 QQC2.ToolButton {
0041                     visible: modelData.emailAddress
0042                     width: height
0043                     icon.name: "mail-sent"
0044                     QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0045                     QQC2.ToolTip.visible: hovered
0046                     QQC2.ToolTip.text: i18nd("plasma_shell_org.kde.plasma.desktop", "Send an email to %1", modelData.emailAddress)
0047                     onClicked: Qt.openUrlExternally("mailto:%1".arg(modelData.emailAddress))
0048                 }
0049                 QQC2.ToolButton {
0050                     visible: modelData.webAddress
0051                     width: height
0052                     icon.name: "globe"
0053                     QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0054                     QQC2.ToolTip.visible: hovered
0055                     QQC2.ToolTip.text: modelData.webAddress
0056                     onClicked: Qt.openUrlExternally(modelData.webAddress)
0057                 }
0058             }
0059         }
0060     }
0061 
0062     Kirigami.FormLayout {
0063         id: form
0064         GridLayout {
0065             columns: 2
0066             Layout.fillWidth: true
0067 
0068             Kirigami.Icon {
0069                 Layout.rowSpan: 2
0070                 Layout.preferredHeight: Kirigami.Units.iconSizes.huge
0071                 Layout.preferredWidth: height
0072                 Layout.maximumWidth: page.width / 3;
0073                 Layout.rightMargin: Kirigami.Units.largeSpacing
0074                 source: Plasmoid.metaData.iconName || Plasmoid.metaData.pluginId
0075                 fallback: "application-x-plasma"
0076             }
0077             Kirigami.Heading {
0078                 Layout.fillWidth: true
0079                 text: Plasmoid.metaData.name + " " + Plasmoid.metaData.version
0080             }
0081             Kirigami.Heading {
0082                 Layout.fillWidth: true
0083                 level: 2
0084                 wrapMode: Text.WordWrap
0085                 text: Plasmoid.metaData.description
0086             }
0087         }
0088 
0089         Kirigami.Separator {
0090             Layout.fillWidth: true
0091         }
0092 
0093         Kirigami.Heading {
0094             Kirigami.FormData.isSection: true
0095             text: i18nd("plasma_shell_org.kde.plasma.desktop", "Copyright")
0096         }
0097         QQC2.Label {
0098             Layout.leftMargin: Kirigami.Units.gridUnit
0099             text: Plasmoid.metaData.extraInformation
0100             visible: text.length > 0
0101         }
0102         QQC2.Label {
0103             Layout.leftMargin: Kirigami.Units.gridUnit
0104             text: Plasmoid.metaData.copyrightText
0105             visible: text.length > 0
0106         }
0107         Kirigami.UrlButton {
0108             Layout.leftMargin: Kirigami.Units.gridUnit
0109             url: Plasmoid.metaData.website
0110             visible: url.length > 0
0111         }
0112 
0113         RowLayout {
0114             Layout.leftMargin: Kirigami.Units.smallSpacing
0115             QQC2.Label { text: i18nd("plasma_shell_org.kde.plasma.desktop", "License:") }
0116             Kirigami.LinkButton {
0117                 text: Plasmoid.metaData.license
0118                 onClicked: {
0119                     licenseSheet.text = Plasmoid.metaData.licenseText
0120                     licenseSheet.title = Plasmoid.metaData.license
0121                     licenseSheet.open()
0122                 }
0123             }
0124         }
0125         Kirigami.Heading {
0126             Layout.fillWidth: true
0127             Kirigami.FormData.isSection: visible
0128             text: i18nd("plasma_shell_org.kde.plasma.desktop", "Authors")
0129             visible: Plasmoid.metaData.authors.length > 0
0130         }
0131         Repeater {
0132             model: Plasmoid.metaData.authors
0133             delegate: personDelegate
0134         }
0135         Kirigami.Heading {
0136             height: visible ? implicitHeight : 0
0137             Kirigami.FormData.isSection: visible
0138             text: i18nd("plasma_shell_org.kde.plasma.desktop", "Credits")
0139             visible: repCredits.count > 0
0140         }
0141         Repeater {
0142             id: repCredits
0143             model: Plasmoid.metaData.otherContributors
0144             delegate: personDelegate
0145         }
0146         Kirigami.Heading {
0147             height: visible ? implicitHeight : 0
0148             Kirigami.FormData.isSection: visible
0149             text: i18nd("plasma_shell_org.kde.plasma.desktop", "Translators")
0150             visible: repTranslators.count > 0
0151         }
0152         Repeater {
0153             id: repTranslators
0154             model: Plasmoid.metaData.translators
0155             delegate: personDelegate
0156         }
0157     }
0158     QQC2.Dialog {
0159         id: licenseSheet
0160         property alias text: licenseLabel.text
0161 
0162         width: 0.75 * parent.width
0163         height: 0.75 * parent.height
0164 
0165         x: Math.round((parent.width - width) / 2)
0166         y: Kirigami.Units.smallSpacing
0167 
0168         leftPadding: 0
0169         rightPadding: 0
0170         bottomPadding: 0
0171         topPadding: Kirigami.Units.smallSpacing
0172         topInset: Kirigami.Units.smallSpacing
0173 
0174         contentItem: QQC2.ScrollView {
0175             id: scroll
0176             Component.onCompleted: background.visible = true
0177             Flickable {
0178                 id: flickable
0179                 contentWidth: width
0180                 contentHeight: licenseLabel.contentHeight
0181                 clip: true
0182                 QQC2.Label {
0183                     id: licenseLabel
0184                     width: parent.width
0185                     x: Math.max(0, (width - contentWidth)/2)
0186                     wrapMode: Text.WordWrap
0187                 }
0188             }
0189         }
0190     }
0191 }
0192