Put available encrypt and sign options in corresponding menu options as title

This commit is contained in:
the-djmaze 2024-04-01 02:09:23 +02:00
parent 9b309c31bd
commit f6b440adef
2 changed files with 12 additions and 9 deletions

View file

@ -336,6 +336,9 @@ export class ComposePopupView extends AbstractViewPopup {
canMailvelope: () => this.encryptOptions.includes('Mailvelope'),
canSign: () => this.signOptions().length,
encryptOptionsText: () => this.encryptOptions().join(', '),
signOptionsText: () => this.signOptions().map(o => o[0]).join(', '),
identitiesOptions: () =>
IdentityUserStore.map(item => ({
item: item,
@ -1396,13 +1399,6 @@ export class ComposePopupView extends AbstractViewPopup {
OpenPGPUserStore.hasPublicKeyForEmails(recipients)
&& options.push('OpenPGP');
if (await MailvelopeUserStore.hasPublicKeyForEmails(recipients)) {
options.push('Mailvelope');
} else {
'mailvelope' === this.viewArea() && this.bodyArea();
// this.dropMailvelope();
}
const count = recipients.length,
identity = this.currentIdentity(),
from = (identity.smimeKey() && identity.smimeCertificate()) ? identity.email() : null;
@ -1412,6 +1408,13 @@ export class ComposePopupView extends AbstractViewPopup {
|| SMimeUserStore.find(certificate => email == certificate.emailAddress && certificate.smimeencrypt)
).length
&& options.push('S/MIME');
if (await MailvelopeUserStore.hasPublicKeyForEmails(recipients)) {
options.push('Mailvelope');
} else {
'mailvelope' === this.viewArea() && this.bodyArea();
// this.dropMailvelope();
}
}
console.dir({encryptOptions:options});

View file

@ -61,13 +61,13 @@
</a>
</li>
<li data-bind="toggle: doSign, visible: canSign">
<a>
<a data-bind="attr:{title: signOptionsText}">
<i class="fontastic" data-bind="text: doSign() ? '☑' : '☐'"></i>
<span data-icon="✍" data-i18n="CRYPTO/SIGN"></span>
</a>
</li>
<li data-bind="toggle: doEncrypt, visible: canEncrypt">
<a>
<a data-bind="attr:{title: encryptOptionsText}">
<i class="fontastic" data-bind="text: doEncrypt() || 'mailvelope' == viewArea() ? '☑' : '☐'"></i>
<span data-icon="🔒" data-i18n="CRYPTO/ENCRYPT"></span>
</a>