diff options
author | Saturneric <[email protected]> | 2021-05-26 16:54:30 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-05-26 16:54:30 +0000 |
commit | f134e08858a14ed4b0284802c968a48bcfbeb6ef (patch) | |
tree | 4670bcc2ef5191559e9adb0e12e95cb4c3cee77d /src/gpg/GpgContext.cpp | |
parent | Fix the error and adjust the way the pop-up window pops up after the key is g... (diff) | |
download | GpgFrontend-f134e08858a14ed4b0284802c968a48bcfbeb6ef.tar.gz GpgFrontend-f134e08858a14ed4b0284802c968a48bcfbeb6ef.zip |
Improve the key information update mechanism
Signed-off-by: Saturneric <[email protected]>
Diffstat (limited to 'src/gpg/GpgContext.cpp')
-rw-r--r-- | src/gpg/GpgContext.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/gpg/GpgContext.cpp b/src/gpg/GpgContext.cpp index c73d3d65..3e6a9350 100644 --- a/src/gpg/GpgContext.cpp +++ b/src/gpg/GpgContext.cpp @@ -98,8 +98,10 @@ namespace GpgME { debug = false; } - connect(this, SIGNAL(signalKeyDBChanged()), this, SLOT(slotRefreshKeyList()), Qt::DirectConnection); - connect(this, SIGNAL(signalKeyUpdated(QString)), this, SLOT(slotUpdateKeyList(QString))); + connect(this, SIGNAL(signalKeyDBChanged()), + this, SLOT(slotRefreshKeyList()), Qt::DirectConnection); + connect(this, SIGNAL(signalKeyUpdated(QString)), + this, SLOT(slotUpdateKeyList(QString)), Qt::DirectConnection); slotRefreshKeyList(); } @@ -947,7 +949,22 @@ namespace GpgME { void GpgContext::slotUpdateKeyList(QString key_id) { auto it = mKeyMap.find(key_id); if (it != mKeyMap.end()) { - it.value()->parse(it.value()->key_refer); + gpgme_key_t new_key_refer; + auto gpgmeErr = gpgme_get_key(mCtx, key_id.toUtf8().constData(), &new_key_refer, 0); + + if(gpgme_err_code(gpgmeErr) == GPG_ERR_EOF) { + gpgmeErr = gpgme_get_key(mCtx, key_id.toUtf8().constData(), &new_key_refer, 1); + + if(gpgme_err_code(gpgmeErr) == GPG_ERR_EOF) { + throw std::runtime_error("key_id not found in key database"); + } + + } + + if(new_key_refer != nullptr) { + it.value()->swapKeyRefer(new_key_refer); + } + } } |