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

0001 // SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
0002 // SPDX-FileCopyrightText: 2016 Michael Bohlender <michael.bohlender@kdemail.net>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick 2.15
0006 import QtQuick.Layouts 1.15
0007 import QtQuick.Controls 2.15 as QQC2
0008 
0009 import org.kde.kirigami 2.14 as Kirigami
0010 
0011 QQC2.AbstractButton {
0012     id: root
0013 
0014     property string name
0015     property string type
0016     property alias actionIcon: actionButton.icon.name
0017     property alias actionTooltip: actionButtonTooltip.text
0018     signal execute;
0019     signal publicKeyImport;
0020 
0021     Kirigami.Theme.colorSet: Kirigami.Theme.Button
0022     Kirigami.Theme.inherit: false
0023 
0024     background: Rectangle {
0025         id: background
0026         color: Kirigami.Theme.backgroundColor
0027         border.color: Kirigami.Theme.disabledTextColor
0028         radius: 3
0029     }
0030 
0031     leftPadding: Kirigami.Units.smallSpacing
0032     rightPadding: Kirigami.Units.smallSpacing
0033     topPadding: Kirigami.Units.smallSpacing
0034     bottomPadding: Kirigami.Units.smallSpacing
0035     contentItem: RowLayout {
0036         id: content
0037         spacing: Kirigami.Units.smallSpacing
0038 
0039         Rectangle {
0040             color: Kirigami.Theme.backgroundColor
0041             Layout.preferredHeight: Kirigami.Units.gridUnit
0042             Layout.preferredWidth: Kirigami.Units.gridUnit
0043             Kirigami.Icon {
0044                 anchors.verticalCenter: parent.verticalCenter
0045                 height: Kirigami.Units.gridUnit
0046                 width: Kirigami.Units.gridUnit
0047                 source: root.icon.name
0048             }
0049         }
0050         QQC2.Label {
0051             text: root.name
0052         }
0053         QQC2.ToolButton {
0054             visible: root.type === "application/pgp-keys"
0055             icon.name: 'gpg'
0056             onClicked: root.publicKeyImport()
0057             QQC2.ToolTip {
0058                 text: i18n("Import key")
0059             }
0060         }
0061         QQC2.ToolButton {
0062             id: actionButton
0063             onClicked: root.execute()
0064             QQC2.ToolTip {
0065                 id: actionButtonTooltip
0066             }
0067         }
0068     }
0069 }