diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-11-03 21:50:14 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-11-03 21:50:14 +0000 |
commit | 439fa5fdc0271d8876cb55746ea2f0a1b2503ca7 (patch) | |
tree | 9d0697d1a96ba45b1ab6a49c8d8515ff190d1def /gpgcontext.cpp | |
parent | newtab slot works again (diff) | |
download | gpg4usb-439fa5fdc0271d8876cb55746ea2f0a1b2503ca7.tar.gz gpg4usb-439fa5fdc0271d8876cb55746ea2f0a1b2503ca7.zip |
secret key details
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@997 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'gpgcontext.cpp')
-rw-r--r-- | gpgcontext.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/gpgcontext.cpp b/gpgcontext.cpp index 959e8e9..6278785 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -147,10 +147,11 @@ GpgContext::~GpgContext() KgpgCore::KgpgKey GpgContext::getKeyDetails(QString uid) { + KgpgCore::KgpgKeyList keys; // try secret - KgpgCore::KgpgKeyList keys = KgpgInterface::readSecretKeys(QStringList() << uid); - if(keys.empty()) { + //KgpgCore::KgpgKeyList keys = KgpgInterface::readSecretKeys(QStringList() << uid); + //if(keys.empty()) { // ok try public keys = KgpgInterface::readPublicKeys(QStringList() << uid); // that should not happen @@ -159,7 +160,7 @@ KgpgCore::KgpgKey GpgContext::getKeyDetails(QString uid) { return ; }*/ - } + //} KgpgCore::KgpgKey key = keys.first(); return key; @@ -177,9 +178,8 @@ GpgKeyList GpgContext::listKeys() GpgKeyList keys; - KgpgCore::KgpgKeyList kl = KgpgInterface::readPublicKeys(); - foreach(KgpgCore::KgpgKey kkey, kl) { + foreach(KgpgCore::KgpgKey kkey, KgpgInterface::readPublicKeys()) { GpgKey key; key.email = kkey.email(); //key.expired = kkey.expirationDate().toString(); @@ -205,6 +205,17 @@ GpgKeyList GpgContext::listKeys() return keys; } +// TODO: do we really need to call gpg or could we use an already existing list +bool GpgContext::isSecretKey(QString uid) { + + foreach(KgpgCore::KgpgKey skey, KgpgInterface::readSecretKeys()) { + if(skey.id() == uid) return true; + } + + return false; + +} + /** also from kgpgme.cpp, seems to clear password from mem */ void GpgContext::clearPasswordCache() { |