aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-08-02 17:33:07 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-08-02 17:33:07 +0000
commit7e3502ff7410597a29a25e7f8c6b8307ac40f7f5 (patch)
tree15ec9009de7bf947dd65fe034f0fe6b81ca862e4
parentset homedir (diff)
downloadgpg4usb-7e3502ff7410597a29a25e7f8c6b8307ac40f7f5.tar.gz
gpg4usb-7e3502ff7410597a29a25e7f8c6b8307ac40f7f5.zip
mark private keys works again
git-svn-id: http://cpunk.de/svn/src/gpg4usb/branches/0.3.2-mac@926 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--gpgcontext.cpp52
1 files changed, 6 insertions, 46 deletions
diff --git a/gpgcontext.cpp b/gpgcontext.cpp
index b430513..e6666f3 100644
--- a/gpgcontext.cpp
+++ b/gpgcontext.cpp
@@ -207,6 +207,8 @@ gpgme_key_t GpgContext::getKeyDetails(QString uid)
return key;
}
+
+
/** List all availabe Keys (VERY much like kgpgme)
*/
GpgKeyList GpgContext::listKeys()
@@ -230,58 +232,16 @@ GpgKeyList GpgContext::listKeys()
keys.append(key);
}
-/* GPGProc process(this, gpgBin);
- process <<
- QLatin1String("--with-colons") <<
- QLatin1String("--with-fingerprint") <<
- QLatin1String("--fixed-list-mode") <<
- QLatin1String("--list-keys");
-
- process.setOutputChannelMode(KProcess::MergedChannels);
-
- process.start();
- process.waitForFinished(-1);*/
-
-
- //while (item == process->)
-// return readPublicKeysProcess(process, NULL);
-
- //TODO dont run the loop more often than necessary
- // list all keys ( the 0 is for all )
-
-/* while (!(err = gpgme_op_keylist_next(mCtx, &key))) {
- GpgKey gpgkey;
-
- if (!key->subkeys)
- continue;
-
- gpgkey.id = key->subkeys->keyid;
- gpgkey.fpr = key->subkeys->fpr;
- gpgkey.expired = (key->expired != 0);
- gpgkey.revoked = (key->revoked != 0);
-
- if (key->uids) {
- gpgkey.name = QString::fromUtf8(key->uids->name);
- gpgkey.email = QString::fromUtf8(key->uids->email);
- }
- keys.append(gpgkey);
- gpgme_key_unref(key);
- }*/
-
- // list only private keys ( the 1 does )
-/* while (!(err = gpgme_op_keylist_next(mCtx, &key))) {
- if (!key->subkeys)
- continue;
+ foreach(KgpgCore::KgpgKey skey, KgpgInterface::readSecretKeys()) {
// iterate keys, mark privates
GpgKeyList::iterator it = keys.begin();
while (it != keys.end()) {
- if (key->subkeys->keyid == it->id.toStdString())
+ if (skey.id() == it->id) {
it->privkey = true;
+ }
it++;
}
-
- gpgme_key_unref(key);
- }*/
+ }
return keys;
}