Warning, /pim/merkuro/src/mail/qml/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 org.kde.kirigami 2.14 as Kirigami
0008 import QtQuick.Controls 2.15 as QQC2
0009 
0010 QQC2.AbstractButton {
0011     id: root
0012 
0013     property string name
0014     property string type
0015     property alias actionIcon: actionButton.icon.name
0016     property alias actionTooltip: actionButton.text
0017     signal execute;
0018     signal publicKeyImport;
0019 
0020     Kirigami.Theme.colorSet: Kirigami.Theme.Button
0021     Kirigami.Theme.inherit: false
0022 
0023     background: Rectangle {
0024         id: background
0025         color: Kirigami.Theme.backgroundColor
0026         border.color: Kirigami.Theme.disabledTextColor
0027         radius: 3
0028     }
0029 
0030     leftPadding: Kirigami.Units.smallSpacing
0031     rightPadding: Kirigami.Units.smallSpacing
0032     topPadding: Kirigami.Units.smallSpacing
0033     bottomPadding: Kirigami.Units.smallSpacing
0034     contentItem: RowLayout {
0035         id: content
0036         spacing: Kirigami.Units.smallSpacing
0037 
0038         Rectangle {
0039             color: Kirigami.Theme.backgroundColor
0040             Layout.preferredHeight: Kirigami.Units.gridUnit
0041             Layout.preferredWidth: Kirigami.Units.gridUnit
0042             Kirigami.Icon {
0043                 anchors.verticalCenter: parent.verticalCenter
0044                 height: Kirigami.Units.gridUnit
0045                 width: Kirigami.Units.gridUnit
0046                 source: root.icon.name
0047             }
0048         }
0049         QQC2.Label {
0050             text: root.name
0051         }
0052         QQC2.ToolButton {
0053             visible: root.type === "application/pgp-keys"
0054             icon.name: 'gpg'
0055             onClicked: root.publicKeyImport()
0056 
0057             text: i18nc("@action:button", "Import key")
0058             display: QQC2.ToolButton.IconOnly
0059 
0060             QQC2.ToolTip.visible: hovered
0061             QQC2.ToolTip.text: text
0062             QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0063         }
0064         QQC2.ToolButton {
0065             id: actionButton
0066             onClicked: root.execute()
0067             display: QQC2.ToolButton.IconOnly
0068             QQC2.ToolTip.visible: hovered
0069             QQC2.ToolTip.text: text
0070             QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0071         }
0072     }
0073 }