Improve Settings -> OpenPGP to show available features

This commit is contained in:
the-djmaze 2022-01-24 16:47:53 +01:00
parent ce971de919
commit 8635771537
3 changed files with 16 additions and 7 deletions

View file

@ -11,6 +11,9 @@ import { AddOpenPgpKeyPopupView } from 'View/Popup/AddOpenPgpKey';
import { NewOpenPgpKeyPopupView } from 'View/Popup/NewOpenPgpKey';
import { ViewOpenPgpKeyPopupView } from 'View/Popup/ViewOpenPgpKey';
import { Capa } from 'Common/Enums';
import { Settings } from 'Common/Globals';
export class OpenPgpUserSettings /*extends AbstractViewSettings*/ {
constructor() {
this.gnupgkeys = PgpUserStore.gnupgKeys;
@ -19,8 +22,10 @@ export class OpenPgpUserSettings /*extends AbstractViewSettings*/ {
this.openpgpkeysPrivate = PgpUserStore.openpgpPrivateKeys;
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
this.canOpenPGP = !!PgpUserStore.openpgpKeyring;
// this.canOpenPGP = Settings.capa(Capa.OpenPGP);
// this.canOpenPGP = !!PgpUserStore.openpgpKeyring;
this.canOpenPGP = Settings.capa(Capa.OpenPGP);
// this.canGnuPG = !!PgpUserStore.gnupgKeyring;
this.canGnuPG = Settings.capa(Capa.GnuPG);
this.canMailvelope = !!window.mailvelope;
this.allowDraftAutosave = SettingsUserStore.allowDraftAutosave;

View file

@ -168,7 +168,7 @@ export const PgpUserStore = new class {
* @returns {boolean}
*/
isSupported() {
return !!(window.openpgp || window.mailvelope);
return !!(window.openpgp || window.mailvelope || Settings.capa(Capa.GnuPG));
}
gnupgImportKey(key, callback) {

View file

@ -3,7 +3,7 @@
<i class="icon-list-add"></i>
<span data-i18n="SETTINGS_OPEN_PGP/BUTTON_ADD_OPEN_PGP_KEY"></span>
</button>
<!-- ko if: canOpenPGP -->
<!-- ko if: canOpenPGP || canGnuPG -->
&nbsp;&nbsp;
<div style="display: inline-block" data-i18n="[title]SETTINGS_OPEN_PGP/GENERATE_ONLY_HTTPS">
<button class="btn" data-bind="click: generateOpenPgpKey">
@ -26,7 +26,8 @@
</div>
<br />
<h1>GnuPG</h1>
<!-- ko if: canGnuPG -->
<div class="legend">GnuPG</div>
<table class="table table-hover list-table">
<tbody data-bind="foreach: gnupgkeys, i18nUpdate: gnupgkeys">
<tr class="open-pgp-key-item">
@ -42,8 +43,10 @@
</tr>
</tbody>
</table>
<!-- /ko -->
<h1>OpenPGP.js</h1>
<!-- ko if: canOpenPGP -->
<div class="legend">OpenPGP.js</div>
<table class="table table-hover list-table">
<tbody data-bind="foreach: openpgpkeysPrivate, i18nUpdate: openpgpkeysPrivate">
<tr class="open-pgp-key-item">
@ -83,8 +86,9 @@
</tr>
</tbody>
</table>
<!-- /ko -->
<!-- ko if: canMailvelope -->
<h1>Mailvelope</h1>
<div class="legend">Mailvelope</div>
<div id="mailvelope-settings" style="height:40em"></div>
<!-- /ko -->