Warning, /pim/kmail-account-wizard/src/apps/contents/ui/ConfigurationDelegate.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
0002 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu>
0003 // SPDX-License-Identifier: LGPL-2.0-or-later
0004
0005 import QtQuick
0006 import QtQuick.Templates as T
0007 import QtQuick.Controls as QQC2
0008 import QtQuick.Layouts
0009
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kirigamiaddons.formcard as FormCard
0012
0013 /**
0014 * Form delegate that corresponds to a checkbox.
0015 */
0016 T.RadioDelegate {
0017 id: root
0018
0019 required property string name
0020 required property string description
0021 required property string incomingHost
0022 required property var incomingTags
0023 required property string outgoingHost
0024 required property var outgoingTags
0025
0026 leftPadding: Kirigami.Units.gridUnit
0027 topPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0028 bottomPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0029 rightPadding: Kirigami.Units.gridUnit
0030
0031 implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
0032 implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
0033
0034 focusPolicy: Qt.StrongFocus
0035 hoverEnabled: true
0036
0037 background: FormCard.FormDelegateBackground { control: root }
0038
0039 Layout.fillWidth: true
0040
0041 contentItem: RowLayout {
0042 spacing: 0
0043
0044 QQC2.RadioButton {
0045 id: checkBoxItem
0046 Layout.rightMargin: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
0047 Layout.alignment: Qt.AlignTop
0048 focusPolicy: Qt.NoFocus // provided by delegate
0049
0050 onToggled: {
0051 root.toggle();
0052 root.toggled();
0053 }
0054 onClicked: root.clicked()
0055 onPressAndHold: root.pressAndHold()
0056 onDoubleClicked: root.doubleClicked()
0057
0058 enabled: root.enabled
0059 checked: root.checked
0060 }
0061
0062 ColumnLayout {
0063 Layout.fillWidth: true
0064 spacing: Kirigami.Units.smallSpacing
0065
0066 Behavior on height {
0067 NumberAnimation { duration: 400 }
0068 }
0069
0070 Kirigami.Heading {
0071 level: 4
0072 text: root.name
0073 color: root.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor
0074 elide: Text.ElideRight
0075 font.bold: true
0076 wrapMode: Text.Wrap
0077 Layout.fillWidth: true
0078 }
0079
0080 QQC2.Label {
0081 Layout.fillWidth: true
0082 text: root.description
0083 wrapMode: Text.Wrap
0084 }
0085
0086 GridLayout {
0087 id: details
0088 columns: 2
0089 visible: checkBoxItem.checked
0090
0091 QQC2.Label {
0092 font.bold: true
0093 text: i18n("Incoming")
0094 }
0095
0096 RowLayout {
0097 Repeater {
0098 model: root.incomingTags
0099 Kirigami.Chip {
0100 text: modelData
0101 enabled: false
0102 closable: false
0103 }
0104 }
0105 }
0106
0107 QQC2.Label {
0108 text: root.incomingHost
0109 Layout.columnSpan: 2
0110 }
0111
0112 QQC2.Label {
0113 font.bold: true
0114 text: i18n("Outgoing")
0115 visible: root.outgoingTags.length > 0
0116 }
0117
0118 RowLayout {
0119 Repeater {
0120 model: root.outgoingTags
0121 Kirigami.Chip {
0122 text: modelData
0123 enabled: false
0124 closable: false
0125 }
0126 }
0127 }
0128
0129 QQC2.Label {
0130 text: root.outgoingHost
0131 Layout.columnSpan: 2
0132 }
0133 }
0134 }
0135 }
0136 }
0137