5import QtQuick.Controls as QQC2
8import org.kde.kirigami as Kirigami
9import org.kde.kirigamiaddons.formcard 1.0 as FormCard
10import org.kde.kidentitymanagement 1.0
19 function _index(model, keyUse) {
20 return cryptographyEditorBackend.indexForIdentity(model, identity, keyUse).row
23 function _updateComboIndices() {
24 combinedPgpModeCheckBox.updateChecked();
25 combinedSmimeModeCheckBox.updateChecked();
27 pgpSigningOrCombinedDelegate.updateIndex();
28 pgpEncryptionDelegate.updateIndex();
29 smimeSigningOrCombinedDelegate.updateIndex();
30 smimeEncryptionDelegate.updateIndex();
33 required
property var identity
34 onIdentityChanged: _updateComboIndices()
35 required property var cryptographyEditorBackend
37 Component.onCompleted: _updateComboIndices()
40 id: pgpSigningOrCombinedDelegate
42 function updateIndex() {
43 currentIndex = root._index(cryptographyEditorBackend.openPgpKeyListModel, KeyUseTypes.KeySigningUse);
46 readonly
property bool combinedMode: combinedPgpModeCheckBox.checked
48 text: combinedMode ?
i18ndc(
"libkpimidentities6",
"@label",
"OpenPGP key") :
i18ndc(
"libkpimidentities6",
"@label",
"OpenPGP signing key")
49 model: cryptographyEditorBackend.openPgpKeyListModel
51 valueRole:
"keyByteArray"
53 root.identity.pgpSigningKey = currentValue;
56 root.identity.pgpEncryptionKey = currentValue;
57 pgpEncryptionDelegate.updateIndex();
63 above: combinedPgpModeCheckBox; below: pgpSigningOrCombinedDelegate
67 id: combinedPgpModeCheckBox
69 function updateChecked() {
70 const pgpEncryptionKey = root.cryptographyEditorBackend.stringFromKeyByteArray(root.identity.pgpEncryptionKey);
71 const pgpSigningKey = root.cryptographyEditorBackend.stringFromKeyByteArray(root.identity.pgpSigningKey);
72 checked = pgpEncryptionKey === pgpSigningKey;
75 text:
i18ndc(
"libkpimidentities6",
"@label",
"Use same OpenPGP key for encryption and signing")
81 const pgpEncryptionKey = root.cryptographyEditorBackend.stringFromKeyByteArray(root.identity.pgpEncryptionKey);
82 const pgpSigningKey = root.cryptographyEditorBackend.stringFromKeyByteArray(root.identity.pgpSigningKey);
85 if (pgpEncryptionKey !== pgpSigningKey) {
86 root.identity.pgpEncryptionKey = root.identity.pgpSigningKey;
92 below: combinedPgpModeCheckBox
93 above: pgpEncryptionDelegate
94 visible: pgpEncryptionDelegate.visible
98 id: pgpEncryptionDelegate
100 function updateIndex() {
101 currentIndex = root._index(cryptographyEditorBackend.openPgpKeyListModel, KeyUseTypes.KeyEncryptionUse);
104 text:
i18ndc(
"libkpimidentities6",
"@label",
"OpenPGP encryption key")
105 model: cryptographyEditorBackend.openPgpKeyListModel
107 valueRole: "keyByteArray"
108 onActivated: root.identity.pgpEncryptionKey = currentValue
109 visible: !combinedPgpModeCheckBox.checked
113 above: smimeSigningOrCombinedDelegate
114 below: pgpEncryptionDelegate.visible ? pgpEncryptionDelegate : combinedPgpModeCheckBox
118 id: smimeSigningOrCombinedDelegate
120 function updateIndex() {
121 currentIndex = root._index(cryptographyEditorBackend.smimeKeyListModel, KeyUseTypes.KeySigningUse);
124 property bool combinedMode: combinedSmimeModeCheckBox.checked
126 text:
i18ndc(
"libkpimidentities6",
"@label",
"S/MIME signing key")
127 model: cryptographyEditorBackend.smimeKeyListModel
129 valueRole: "keyByteArray"
131 root.identity.smimeSigningKey = currentValue;
134 root.identity.smimeEncryptionKey = currentValue;
135 smimeEncryptionDelegate.updateIndex();
140 FormCard.FormDelegateSeparator { above: combinedSmimeModeCheckBox; below: smimeSigningOrCombinedDelegate }
143 id: combinedSmimeModeCheckBox
145 function updateChecked() {
146 const smimeEncryptionKey = root.cryptographyEditorBackend.stringFromKeyByteArray(root.identity.smimeEncryptionKey);
147 const smimeSigningKey = root.cryptographyEditorBackend.stringFromKeyByteArray(root.identity.smimeSigningKey);
148 checked = smimeEncryptionKey === smimeSigningKey;
151 text:
i18ndc(
"libkpimidentities6",
"@label",
"Use same S/MIME key for encryption and signing")
157 const smimeEncryptionKey = root.cryptographyEditorBackend.stringFromKeyByteArray(root.identity.smimeEncryptionKey);
158 const smimeSigningKey = root.cryptographyEditorBackend.stringFromKeyByteArray(root.identity.smimeSigningKey);
161 if (smimeEncryptionKey !== smimeSigningKey) {
162 root.identity.smimeEncryptionKey = root.identity.smimeSigningKey;
168 above: smimeEncryptionDelegate
169 below: combinedSmimeModeCheckBox
170 visible: !combinedSmimeModeCheckBox.checked
174 id: smimeEncryptionDelegate
176 function updateIndex() {
177 currentIndex = root._index(cryptographyEditorBackend.smimeKeyListModel, KeyUseTypes.KeyEncryptionUse);
180 text:
i18ndc(
"libkpimidentities6",
"@label",
"S/MIME encryption key")
181 model: cryptographyEditorBackend.smimeKeyListModel
183 valueRole: "keyByteArray"
184 onActivated: root.identity.smimeEncryptionKey = currentValue
185 visible: !combinedSmimeModeCheckBox.checked
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)