aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gpgcontext.cpp14
-rw-r--r--gpgcontext.h4
2 files changed, 14 insertions, 4 deletions
diff --git a/gpgcontext.cpp b/gpgcontext.cpp
index c06b4b5..14ee25b 100644
--- a/gpgcontext.cpp
+++ b/gpgcontext.cpp
@@ -96,6 +96,8 @@ GpgContext::GpgContext()
debug = false;
}
+ connect(this,SIGNAL(keyDBChanged()),this,SLOT(refreshKeyList()));
+ refreshKeyList();
}
/** Destructor
@@ -741,13 +743,17 @@ QString GpgContext::beautifyFingerprint(QString fingerprint)
return fingerprint;
}
+void GpgContext::refreshKeyList() {
+ mKeyList = this->listKeys();
+}
+
/**
* note: privkey status is not returned
*/
GpgKey GpgContext::getKeyByFpr(QString fpr) {
- GpgKeyList list = this->listKeys();
- foreach (GpgKey key, list) {
+ //GpgKeyList list = this->listKeys();
+ foreach (GpgKey key, mKeyList) {
if(key.fpr == fpr) {
return key;
}
@@ -762,8 +768,8 @@ GpgKey GpgContext::getKeyByFpr(QString fpr) {
*/
GpgKey GpgContext::getKeyById(QString id) {
- GpgKeyList list = this->listKeys();
- foreach (GpgKey key, list) {
+ //GpgKeyList list = this->listKeys();
+ foreach (GpgKey key, mKeyList) {
if(key.id == id) {
return key;
}
diff --git a/gpgcontext.h b/gpgcontext.h
index b442142..54ddb12 100644
--- a/gpgcontext.h
+++ b/gpgcontext.h
@@ -149,6 +149,9 @@ public:
signals:
void keyDBChanged();
+private slots:
+ void refreshKeyList();
+
private:
gpgme_ctx_t mCtx;
gpgme_data_t in, out;
@@ -157,6 +160,7 @@ private:
QByteArray mPasswordCache;
QSettings settings;
bool debug;
+ GpgKeyList mKeyList;
int checkErr(gpgme_error_t err) const;
int checkErr(gpgme_error_t err, QString comment) const;