mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Many more changes for #89
This commit is contained in:
parent
3cc3a76b23
commit
a7eeeb4f55
18 changed files with 310 additions and 236 deletions
|
|
@ -1,7 +1,5 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
||||
|
||||
import { PgpUserStore } from 'Stores/User/Pgp';
|
||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
|
||||
|
|
@ -15,12 +13,15 @@ import { ViewOpenPgpKeyPopupView } from 'View/Popup/ViewOpenPgpKey';
|
|||
|
||||
export class OpenPgpUserSettings /*extends AbstractViewSettings*/ {
|
||||
constructor() {
|
||||
this.openpgpkeys = PgpUserStore.openpgpkeys;
|
||||
this.openpgpkeysPublic = PgpUserStore.openpgpkeysPublic;
|
||||
this.openpgpkeysPrivate = PgpUserStore.openpgpkeysPrivate;
|
||||
this.gnupgkeys = PgpUserStore.gnupgKeys;
|
||||
|
||||
this.openpgpkeysPublic = PgpUserStore.openpgpPublicKeys;
|
||||
this.openpgpkeysPrivate = PgpUserStore.openpgpPrivateKeys;
|
||||
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.canOpenPGP = !!PgpUserStore.openpgpKeyring;
|
||||
// this.canOpenPGP = Settings.capa(Capa.OpenPGP);
|
||||
|
||||
this.allowDraftAutosave = SettingsUserStore.allowDraftAutosave;
|
||||
|
||||
this.allowDraftAutosave.subscribe(value => Remote.saveSetting('AllowDraftAutosave', value ? 1 : 0))
|
||||
|
|
@ -47,20 +48,7 @@ export class OpenPgpUserSettings /*extends AbstractViewSettings*/ {
|
|||
deleteOpenPgpKey(openPgpKeyToRemove) {
|
||||
if (openPgpKeyToRemove && openPgpKeyToRemove.deleteAccess()) {
|
||||
this.openPgpKeyForDeletion(null);
|
||||
|
||||
if (openPgpKeyToRemove && PgpUserStore.openpgpKeyring) {
|
||||
const findedItem = PgpUserStore.openpgpkeys.find(key => openPgpKeyToRemove === key);
|
||||
if (findedItem) {
|
||||
PgpUserStore.openpgpkeys.remove(findedItem);
|
||||
delegateRunOnDestroy(findedItem);
|
||||
|
||||
PgpUserStore.openpgpKeyring[findedItem.isPrivate ? 'privateKeys' : 'publicKeys'].removeForId(findedItem.guid);
|
||||
|
||||
PgpUserStore.openpgpKeyring.store();
|
||||
}
|
||||
|
||||
PgpUserStore.reloadOpenPgpKeys();
|
||||
}
|
||||
PgpUserStore.deleteKey(openPgpKeyToRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue