mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Added options to Identity for PGP sign and encrypt #89
This commit is contained in:
parent
4c84c6cdfc
commit
c72c2dbaa4
6 changed files with 65 additions and 46 deletions
|
|
@ -21,6 +21,9 @@ export class IdentityModel extends AbstractModel {
|
|||
signature: '',
|
||||
signatureInsertBefore: false,
|
||||
|
||||
pgpSign: false,
|
||||
pgpEncrypt: false,
|
||||
|
||||
askDelete: false
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,7 +346,13 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
|
||||
sendSuccessButSaveError: value => !value && this.savedErrorDesc(''),
|
||||
|
||||
currentIdentity: value => value && this.from(value.formattedName()),
|
||||
currentIdentity: value => {
|
||||
if (value) {
|
||||
this.from(value.formattedName());
|
||||
this.pgpEncrypt(value.pgpEncrypt/* || SettingsUserStore.pgpEncrypt()*/);
|
||||
this.pgpSign(value.pgpSign/* || SettingsUserStore.pgpSign()*/);
|
||||
}
|
||||
},
|
||||
|
||||
from: value => {
|
||||
this.canPgpSign(false);
|
||||
|
|
@ -1389,14 +1395,6 @@ export class ComposePopupView extends AbstractViewPopup {
|
|||
});
|
||||
}
|
||||
|
||||
togglePgpSign() {
|
||||
this.pgpSign(!this.pgpSign()/* && this.canPgpSign()*/);
|
||||
}
|
||||
|
||||
togglePgpEncrypt() {
|
||||
this.pgpEncrypt(!this.pgpEncrypt()/* && this.canPgpEncrypt()*/);
|
||||
}
|
||||
|
||||
async getMessageRequestParams(sSaveFolder, draft)
|
||||
{
|
||||
let Text = this.oEditor.getData().trim(),
|
||||
|
|
|
|||
|
|
@ -15,22 +15,10 @@ export class IdentityPopupView extends AbstractViewPopup {
|
|||
super('Identity');
|
||||
|
||||
addObservablesTo(this, {
|
||||
id: '',
|
||||
identity: null,
|
||||
edit: false,
|
||||
|
||||
label: '',
|
||||
labelFocused: false,
|
||||
|
||||
email: '',
|
||||
name: '',
|
||||
nameFocused: false,
|
||||
|
||||
replyTo: '',
|
||||
bcc: '',
|
||||
|
||||
signature: '',
|
||||
signatureInsertBefore: false,
|
||||
|
||||
submitRequest: false,
|
||||
submitError: ''
|
||||
});
|
||||
|
|
@ -43,11 +31,12 @@ export class IdentityPopupView extends AbstractViewPopup {
|
|||
|
||||
submitForm(form) {
|
||||
if (!this.submitRequest() && form.reportValidity()) {
|
||||
this.signature?.__fetchEditorValue?.();
|
||||
let identity = this.identity();
|
||||
identity.signature?.__fetchEditorValue?.();
|
||||
this.submitRequest(true);
|
||||
const data = new FormData(form);
|
||||
data.set('Id', this.id());
|
||||
data.set('Signature', this.signature());
|
||||
data.set('Id', identity.id());
|
||||
data.set('Signature', identity.signature());
|
||||
Remote.request('IdentityUpdate', iError => {
|
||||
this.submitRequest(false);
|
||||
if (iError) {
|
||||
|
|
@ -67,7 +56,6 @@ export class IdentityPopupView extends AbstractViewPopup {
|
|||
onShow(identity) {
|
||||
this.submitRequest(false);
|
||||
this.submitError('');
|
||||
|
||||
if (identity) {
|
||||
this.edit(true);
|
||||
} else {
|
||||
|
|
@ -75,17 +63,10 @@ export class IdentityPopupView extends AbstractViewPopup {
|
|||
identity = new IdentityModel;
|
||||
identity.id(Jua.randomId());
|
||||
}
|
||||
this.id(identity.id() || '');
|
||||
this.label(identity.label() || '');
|
||||
this.name(identity.name());
|
||||
this.email(identity.email());
|
||||
this.replyTo(identity.replyTo());
|
||||
this.bcc(identity.bcc());
|
||||
this.signature(identity.signature());
|
||||
this.signatureInsertBefore(identity.signatureInsertBefore());
|
||||
this.identity(identity);
|
||||
}
|
||||
|
||||
afterShow() {
|
||||
this.id() ? this.labelFocused(true) : this.nameFocused(true);
|
||||
this.identity().id() ? this.labelFocused(true) : this.nameFocused(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ class Identity implements \JsonSerializable
|
|||
|
||||
private bool $bSignatureInsertBefore = false;
|
||||
|
||||
private bool $bPgpEncrypt = false;
|
||||
private bool $bPgpSign = false;
|
||||
|
||||
function __construct(string $sId = '', string $sEmail = '')
|
||||
{
|
||||
$this->sId = $sId;
|
||||
|
|
@ -89,7 +92,8 @@ class Identity implements \JsonSerializable
|
|||
$this->sBcc = !empty($aData['Bcc']) ? $aData['Bcc'] : '';
|
||||
$this->sSignature = !empty($aData['Signature']) ? $aData['Signature'] : '';
|
||||
$this->bSignatureInsertBefore = !empty($aData['SignatureInsertBefore']);
|
||||
|
||||
$this->bPgpEncrypt = !empty($aData['PgpEncrypt']);
|
||||
$this->bPgpSign = !empty($aData['PgpSign']);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +111,9 @@ class Identity implements \JsonSerializable
|
|||
'ReplyTo' => $this->sReplyTo,
|
||||
'Bcc' => $this->sBcc,
|
||||
'Signature' => $this->sSignature,
|
||||
'SignatureInsertBefore' => $this->bSignatureInsertBefore
|
||||
'SignatureInsertBefore' => $this->bSignatureInsertBefore,
|
||||
'PgpEncrypt' => $this->bPgpEncrypt,
|
||||
'PgpSign' => $this->bPgpSign
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +129,9 @@ class Identity implements \JsonSerializable
|
|||
'replyTo' => $this->sReplyTo,
|
||||
'bcc' => $this->sBcc,
|
||||
'signature' => $this->sSignature,
|
||||
'signatureInsertBefore' => $this->bSignatureInsertBefore
|
||||
'signatureInsertBefore' => $this->bSignatureInsertBefore,
|
||||
'pgpEncrypt' => $this->bPgpEncrypt,
|
||||
'pgpSign' => $this->bPgpSign
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,13 +60,13 @@
|
|||
<span data-i18n="COMPOSE/BUTTON_MARK_AS_IMPORTANT"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li data-bind="click: togglePgpSign, visible: canPgpSign">
|
||||
<li data-bind="toggle: pgpSign, visible: canPgpSign">
|
||||
<a>
|
||||
<i class="fontastic" data-bind="text: pgpSign() ? '☑' : '☐'"></i>
|
||||
<span data-icon="✍" data-i18n="OPENPGP/LABEL_SIGN"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li data-bind="click: togglePgpEncrypt, visible: canPgpEncrypt">
|
||||
<li data-bind="toggle: pgpEncrypt, visible: canPgpEncrypt">
|
||||
<a>
|
||||
<i class="fontastic" data-bind="text: pgpEncrypt() || 'mailvelope' == viewArea() ? '☑' : '☐'"></i>
|
||||
<span data-icon="🔒" data-i18n="OPENPGP/LABEL_ENCRYPT"></span>
|
||||
|
|
@ -137,10 +137,10 @@
|
|||
<div style="display:flex">
|
||||
<div class="btn-group" style="flex-grow:1"></div>
|
||||
<div class="btn-group">
|
||||
<a class="btn fontastic" data-bind="click: togglePgpSign, visible: canPgpSign, css: {'btn-success': pgpSign()}" data-i18n="[title]OPENPGP/LABEL_SIGN">
|
||||
<a class="btn fontastic" data-bind="toggle: pgpSign, visible: canPgpSign, css: {'btn-success': pgpSign()}" data-i18n="[title]OPENPGP/LABEL_SIGN">
|
||||
✍
|
||||
</a>
|
||||
<a class="btn fontastic" data-bind="click: togglePgpEncrypt, visible: canPgpEncrypt, css: {'btn-success': pgpEncrypt() || 'mailvelope' == viewArea()}" data-i18n="[title]OPENPGP/LABEL_ENCRYPT">
|
||||
<a class="btn fontastic" data-bind="toggle: pgpEncrypt, visible: canPgpEncrypt, css: {'btn-success': pgpEncrypt() || 'mailvelope' == viewArea()}" data-i18n="[title]OPENPGP/LABEL_ENCRYPT">
|
||||
🔒
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@
|
|||
<span data-bind="text: submitError"></span>
|
||||
</div>
|
||||
|
||||
<div class="tabs">
|
||||
<div class="tabs" data-bind="with: identity">
|
||||
<input type="radio" name="identitytabs" id="tab-identity" checked>
|
||||
<label data-i18n="SETTINGS_LABELS/GENERAL" for="tab-identity" role="tab" aria-selected="true" aria-controls="panel1" tabindex="0"></label>
|
||||
<div class="form-horizontal tab-content" role="tabpanel" aria-hidden="false">
|
||||
<div class="control-group">
|
||||
<label data-i18n="POPUPS_IDENTITY/LABEL"></label>
|
||||
<div>
|
||||
<input name="Label" type="text" class="input-xlarge" autofocus="" required=""
|
||||
<input name="Label" type="text" class="input-xlarge" autofocus=""
|
||||
autocomplete="off" autocorrect="off" autocapitalize="off"
|
||||
data-bind="value: label, hasfocus: labelFocused">
|
||||
data-bind="value: label, hasfocus: $root.labelFocused">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
<label data-i18n="GLOBAL/NAME"></label>
|
||||
<input name="Name" type="text" class="input-xlarge"
|
||||
autocomplete="off" autocorrect="off" autocapitalize="off"
|
||||
data-bind="value: name, hasfocus: nameFocused">
|
||||
data-bind="value: name, hasfocus: $root.nameFocused">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -67,6 +67,35 @@
|
|||
autocomplete="off" autocorrect="off" autocapitalize="off"
|
||||
data-bind="value: bcc">
|
||||
</div>
|
||||
|
||||
<div class="legend" data-i18n="CONTACTS/TAB_CRYPTO"></div>
|
||||
<div data-bind="component: {
|
||||
name: 'Checkbox',
|
||||
params: {
|
||||
label: 'OPENPGP/LABEL_SIGN',
|
||||
value: pgpSign,
|
||||
name: 'PgpSign'
|
||||
}
|
||||
}"></div>
|
||||
<div data-bind="component: {
|
||||
name: 'Checkbox',
|
||||
params: {
|
||||
label: 'OPENPGP/LABEL_ENCRYPT',
|
||||
value: pgpEncrypt,
|
||||
name: 'PgpEncrypt'
|
||||
}
|
||||
}"></div>
|
||||
<!--
|
||||
<div class="control-group">
|
||||
<label data-i18n="OPENPGP/LABEL_ENCRYPT"></label>
|
||||
<select name="PgpEncrypt" data-bind="value: pgpEncrypt">
|
||||
<option value="Ask" data-i18n="CONTACTS/ASK"></option>
|
||||
<option value="Never" data-i18n="CONTACTS/NEVER"></option>
|
||||
<option value="Always" data-i18n="CONTACTS/ALWAYS"></option>
|
||||
<option value="IfPossible" data-i18n="CONTACTS/ALWAYS_IF_POSSIBLE"></option>
|
||||
</select>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue