aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpg/GpgContext.cpp23
-rw-r--r--src/gpg/GpgKey.cpp11
-rw-r--r--src/ui/keypair_details/KeyPairUIDTab.cpp5
3 files changed, 33 insertions, 6 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);
+ }
+
}
}
diff --git a/src/gpg/GpgKey.cpp b/src/gpg/GpgKey.cpp
index 99972eee..bcacc8c3 100644
--- a/src/gpg/GpgKey.cpp
+++ b/src/gpg/GpgKey.cpp
@@ -28,8 +28,6 @@ void GpgKey::parse(gpgme_key_t key) {
if(key == nullptr) return;
-
-
good = true;
key_refer = key;
gpgme_key_ref(key_refer);
@@ -257,3 +255,12 @@ GpgKey::~GpgKey() {
GpgKey::GpgKey(gpgme_key_t key) {
parse(key);
}
+
+void GpgKey::swapKeyRefer(gpgme_key_t key) {
+
+ if(key == nullptr) return;
+
+ gpgme_key_unref(key_refer);
+ key_refer = nullptr;
+ parse(key);
+}
diff --git a/src/ui/keypair_details/KeyPairUIDTab.cpp b/src/ui/keypair_details/KeyPairUIDTab.cpp
index e10912fc..9e045daf 100644
--- a/src/ui/keypair_details/KeyPairUIDTab.cpp
+++ b/src/ui/keypair_details/KeyPairUIDTab.cpp
@@ -40,8 +40,11 @@ KeyPairUIDTab::KeyPairUIDTab(GpgME::GpgContext *ctx, const GpgKey &key, QWidget
connect(mCtx, SIGNAL(signalKeyDBChanged()), this, SLOT(slotRefreshUIDList()));
connect(mCtx, SIGNAL(signalKeyDBChanged()), this, SLOT(slotRefreshSigList()));
+
+ connect(mCtx, SIGNAL(signalKeyUpdated(QString)), this, SLOT(slotRefreshUIDList()));
+ connect(mCtx, SIGNAL(signalKeyUpdated(QString)), this, SLOT(slotRefreshSigList()));
+
connect(uidList, SIGNAL(itemSelectionChanged()), this, SLOT(slotRefreshSigList()));
-// connect(addSigButton, SIGNAL(clicked(bool)), this, SLOT(slotAddSign()));
slotRefreshUIDList();
slotRefreshSigList();