From 20e391cf1c7f6d83307ae7a7f7fbf4a83be8096b Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Sat, 16 Apr 2022 02:02:38 +0200 Subject: [PATCH] Added: show GnuPG import/delete key error --- dev/Stores/User/GnuPG.js | 18 +++++++++++------- dev/View/Popup/OpenPgpImport.js | 4 +++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dev/Stores/User/GnuPG.js b/dev/Stores/User/GnuPG.js index be05406c1..6352c8789 100644 --- a/dev/Stores/User/GnuPG.js +++ b/dev/Stores/User/GnuPG.js @@ -52,11 +52,15 @@ export const GnuPGUserStore = new class { if (key.askDelete()) { Remote.request('GnupgDeleteKey', (iError, oData) => { - if (oData && oData.Result) { - if (isPrivate) { - this.privateKeys.remove(key); - } else { - this.publicKeys.remove(key); + if (oData) { + if (iError) { + alert(oData.ErrorMessage); + } else if (oData.Result) { + if (isPrivate) { + this.privateKeys.remove(key); + } else { + this.publicKeys.remove(key); + } } } }, { @@ -107,8 +111,8 @@ export const GnuPGUserStore = new class { importKey(key, callback) { Remote.request('GnupgImportKey', (iError, oData) => { - if (oData && oData.Result) { -// this.gnupgKeyring = oData.Result; + if (oData && oData.Result/* && (oData.Result.imported || oData.Result.secretimported)*/) { + this.loadKeyrings(); } callback && callback(iError, oData); }, { diff --git a/dev/View/Popup/OpenPgpImport.js b/dev/View/Popup/OpenPgpImport.js index e9fb4d195..8ade6d47a 100644 --- a/dev/View/Popup/OpenPgpImport.js +++ b/dev/View/Popup/OpenPgpImport.js @@ -48,7 +48,9 @@ export class OpenPgpImportPopupView extends AbstractViewPopup { match = reg.exec(keyTrimmed); if (match && 0 < count) { if (match[0] && match[1] && match[2] && match[1] === match[2]) { - this.saveGnuPG() && GnuPGUserStore.isSupported() && GnuPGUserStore.importKey(this.key()); + this.saveGnuPG() && GnuPGUserStore.isSupported() && GnuPGUserStore.importKey(this.key(), (iError, oData) => { + iError && alert(oData.ErrorMessage); + }); OpenPGPUserStore.isSupported() && OpenPGPUserStore.importKey(this.key()); }