Warning, /plasma/plasma-desktop/desktoppackage/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
0009 import QtQuick.Controls 2.4 as QQC2
0010 import QtQuick.Layouts 1.3
0011 
0012 import org.kde.plasma.plasmoid 2.0
0013 import org.kde.kirigami 2.20 as Kirigami
0014 import org.kde.kcmutils as KCM
0015 
0016 /**
0017  * A copy of Kirigami.AboutPage adapted to KPluginMetadata instead of KAboutData
0018  */
0019 KCM.SimpleKCM {
0020     id: page
0021     title: i18n("About")
0022 
0023     property var metaData: Plasmoid.metaData
0024 
0025     Component {
0026         id: personDelegate
0027 
0028         RowLayout {
0029             height: implicitHeight + (Kirigami.Units.smallSpacing * 2)
0030 
0031             spacing: Kirigami.Units.smallSpacing * 2
0032             Kirigami.Icon {
0033                 width: Kirigami.Units.iconSizes.smallMedium
0034                 height: width
0035                 source: "user"
0036             }
0037             QQC2.Label {
0038                 text: modelData.name
0039                 textFormat: Text.PlainText
0040             }
0041             Row {
0042                 // Group action buttons together
0043                 spacing: 0
0044                 QQC2.ToolButton {
0045                     visible: modelData.emailAddress
0046                     width: height
0047                     icon.name: "mail-sent"
0048 
0049                     display: QQC2.AbstractButton.IconOnly
0050                     text: i18nd("plasma_shell_org.kde.plasma.desktop", "Send an email to %1", modelData.emailAddress)
0051 
0052                     QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0053                     QQC2.ToolTip.visible: hovered
0054                     QQC2.ToolTip.text: text
0055 
0056                     onClicked: Qt.openUrlExternally("mailto:%1".arg(modelData.emailAddress))
0057                 }
0058                 QQC2.ToolButton {
0059                     visible: modelData.webAddress
0060                     width: height
0061                     icon.name: "globe"
0062 
0063                     display: QQC2.AbstractButton.IconOnly
0064                     text: i18ndc("plasma_shell_org.kde.plasma.desktop", "@info:tooltip %1 url", "Open website %1", modelData.webAddress)
0065 
0066                     QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0067                     QQC2.ToolTip.visible: hovered
0068                     QQC2.ToolTip.text: modelData.webAddress
0069 
0070                     onClicked: Qt.openUrlExternally(modelData.webAddress)
0071                 }
0072             }
0073         }
0074     }
0075 
0076     Component {
0077         id: licenseComponent
0078 
0079         Kirigami.OverlaySheet {
0080             property alias text: licenseLabel.text
0081 
0082             onClosed: destroy()
0083 
0084             Kirigami.SelectableLabel {
0085                 id: licenseLabel
0086                 implicitWidth: Math.max(Kirigami.Units.gridUnit * 25, Math.round(page.width / 2), contentWidth)
0087                 wrapMode: Text.WordWrap
0088             }
0089 
0090             Component.onCompleted: open();
0091         }
0092     }
0093 
0094     Item {
0095         height: childrenRect.height
0096 
0097         ColumnLayout {
0098             anchors.horizontalCenter: parent.horizontalCenter
0099             spacing: Kirigami.Units.largeSpacing
0100 
0101             GridLayout {
0102                 columns: 2
0103                 Layout.fillWidth: true
0104 
0105                 Kirigami.Icon {
0106                     Layout.rowSpan: 2
0107                     Layout.preferredHeight: Kirigami.Units.iconSizes.huge
0108                     Layout.preferredWidth: height
0109                     Layout.maximumWidth: page.width / 3;
0110                     Layout.rightMargin: Kirigami.Units.largeSpacing
0111                     source: page.metaData.iconName || page.metaData.pluginId
0112                     fallback: "application-x-plasma"
0113                 }
0114 
0115                 Kirigami.Heading {
0116                     Layout.fillWidth: true
0117                     text: page.metaData.name + " " + page.metaData.version
0118                     textFormat: Text.PlainText
0119                 }
0120 
0121                 Kirigami.Heading {
0122                     Layout.fillWidth: true
0123                     Layout.maximumWidth: Kirigami.Units.gridUnit * 15
0124                     level: 2
0125                     wrapMode: Text.WordWrap
0126                     text: page.metaData.description
0127                     textFormat: Text.PlainText
0128                 }
0129             }
0130 
0131             Kirigami.Separator {
0132                 Layout.fillWidth: true
0133             }
0134 
0135             Kirigami.Heading {
0136                 Layout.topMargin: Kirigami.Units.smallSpacing
0137                 text: i18nd("plasma_shell_org.kde.plasma.desktop", "Copyright")
0138                 textFormat: Text.PlainText
0139             }
0140 
0141             ColumnLayout {
0142                 spacing: Kirigami.Units.smallSpacing
0143                 Layout.leftMargin: Kirigami.Units.smallSpacing
0144 
0145                 QQC2.Label {
0146                     text: page.metaData.copyrightText
0147                     textFormat: Text.PlainText
0148                     visible: text.length > 0
0149                 }
0150                 Kirigami.UrlButton {
0151                     url: page.metaData.website
0152                     visible: url.length > 0
0153                 }
0154 
0155                 RowLayout {
0156                     spacing: Kirigami.Units.smallSpacing
0157                     QQC2.Label {
0158                         text: i18nd("plasma_shell_org.kde.plasma.desktop", "License:")
0159                         textFormat: Text.PlainText
0160                     }
0161                     Kirigami.LinkButton {
0162                         text: page.metaData.license
0163                         Accessible.description: i18ndc("plasma_shell_org.kde.plasma.desktop", "@info:whatsthis", "View license text")
0164                         onClicked: {
0165                             licenseComponent.incubateObject(page.Window.window.contentItem, {
0166                                 "text": page.metaData.licenseText,
0167                                 "title": page.metaData.license,
0168                             }, Qt.Asynchronous);
0169                         }
0170                     }
0171                 }
0172             }
0173 
0174             Kirigami.Heading {
0175                 Layout.fillWidth: true
0176                 Layout.topMargin: Kirigami.Units.smallSpacing
0177                 text: i18nd("plasma_shell_org.kde.plasma.desktop", "Authors")
0178                 textFormat: Text.PlainText
0179                 visible: page.metaData.authors.length > 0
0180             }
0181             Repeater {
0182                 model: page.metaData.authors
0183                 delegate: personDelegate
0184             }
0185 
0186             Kirigami.Heading {
0187                 height: visible ? implicitHeight : 0
0188                 Layout.topMargin: Kirigami.Units.smallSpacing
0189                 text: i18nd("plasma_shell_org.kde.plasma.desktop", "Credits")
0190                 textFormat: Text.PlainText
0191                 visible: repCredits.count > 0
0192             }
0193             Repeater {
0194                 id: repCredits
0195                 model: page.metaData.otherContributors
0196                 delegate: personDelegate
0197             }
0198 
0199             Kirigami.Heading {
0200                 height: visible ? implicitHeight : 0
0201                 Layout.topMargin: Kirigami.Units.smallSpacing
0202                 text: i18nd("plasma_shell_org.kde.plasma.desktop", "Translators")
0203                 textFormat: Text.PlainText
0204                 visible: repTranslators.count > 0
0205             }
0206             Repeater {
0207                 id: repTranslators
0208                 model: page.metaData.translators
0209                 delegate: personDelegate
0210             }
0211 
0212             Item {
0213                 Layout.fillWidth: true
0214             }
0215 
0216             QQC2.Button {
0217                 Layout.alignment: Qt.AlignHCenter
0218 
0219                 icon.name: "tools-report-bug"
0220                 text: i18nd("plasma_shell_org.kde.plasma.desktop", "Report a Bug…")
0221 
0222                 visible: page.metaData.bugReportUrl.length > 0
0223 
0224                 onClicked: Qt.openUrlExternally(page.metaData.bugReportUrl)
0225             }
0226         }
0227     }
0228 }