diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-02-16 21:23:35 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-02-16 21:23:35 +0000 |
commit | 01a33ab31f5bb3bff4fe46baefd1ed0cf98f9f16 (patch) | |
tree | 370b1b3647390b1d1d22f662ba323d76c99bf27a /gpgcontext.cpp | |
parent | really restart app, if changes in settingsdialog need this (diff) | |
download | gpg4usb-01a33ab31f5bb3bff4fe46baefd1ed0cf98f9f16.tar.gz gpg4usb-01a33ab31f5bb3bff4fe46baefd1ed0cf98f9f16.zip |
cleaned up gpgcontext
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@1012 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'gpgcontext.cpp')
-rw-r--r-- | gpgcontext.cpp | 117 |
1 files changed, 1 insertions, 116 deletions
diff --git a/gpgcontext.cpp b/gpgcontext.cpp index 6278785..d2109e2 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -39,33 +39,6 @@ namespace GpgME */ GpgContext::GpgContext() { - /** get application path */ - QString appPath = qApp->applicationDirPath(); - - /** The function `gpgme_check_version' must be called before any other - * function in the library, because it initializes the thread support - * subsystem in GPGME. (from the info page) */ - -#ifdef Q_WS_WIN - gpgBin = appPath + "/bin/gpg.exe"; - gpgKeys = appPath + "/keydb"; -#endif -#ifdef Q_WS_MAC - gpgBin = appPath + "/bin/gpg-mac.app"; - - gpgKeys = appPath + "/keydb"; - - qDebug() << "gpg bin:" << gpgBin; - qDebug() << "gpg keydb: " << gpgKeys; -#endif -#ifdef Q_WS_X11 - gpgBin = appPath + "/bin/gpg"; - gpgKeys = appPath + "/keydb"; -#endif - - QStringList args; - args << "--homedir" << gpgKeys << "--list-keys"; - connect(this,SIGNAL(keyDBChanged()),this,SLOT(slotRefreshKeyList())); slotRefreshKeyList(); } @@ -77,91 +50,10 @@ GpgContext::~GpgContext() } -/** Import Key from QByteArray - * - */ -/*GpgImportInformation GpgContext::importKey(QByteArray inBuffer) -{ - GpgImportInformation *importInformation = new GpgImportInformation(); - err = gpgme_data_new_from_mem(&in, inBuffer.data(), inBuffer.size(), 1); - checkErr(err); - err = gpgme_op_import(mCtx, in); - gpgme_import_result_t result; - - result = gpgme_op_import_result(mCtx); - if (result->unchanged){ - importInformation->unchanged = result->unchanged; - } - if (result->considered){ - importInformation->considered = result->considered; - } - if (result->no_user_id){ - importInformation->no_user_id = result->no_user_id; - } - if (result->imported){ - importInformation->imported = result->imported; - } - if (result->imported_rsa){ - importInformation->imported_rsa = result->imported_rsa; - } - if (result->unchanged){ - importInformation->unchanged = result->unchanged; - } - if (result->new_user_ids){ - importInformation->new_user_ids = result->new_user_ids; - } - if (result->new_sub_keys){ - importInformation->new_sub_keys = result->new_sub_keys; - } - if (result->new_signatures){ - importInformation->new_signatures = result->new_signatures; - } - if (result->new_revocations){ - importInformation->new_revocations =result->new_revocations; - } - if (result->secret_read){ - importInformation->secret_read = result->secret_read; - } - if (result->secret_imported){ - importInformation->secret_imported = result->secret_imported; - } - if (result->secret_unchanged){ - importInformation->secret_unchanged = result->secret_unchanged; - } - if (result->not_imported){ - importInformation->not_imported = result->not_imported; - } - gpgme_import_status_t status = result->imports; - while (status != NULL) { - GpgImportedKey key; - key.importStatus = status->status; - key.fpr = status->fpr; - importInformation->importedKeys.append(key); - status=status->next; - } - checkErr(err); - emit keyDBChanged(); - gpgme_data_release(in); - return *importInformation; -}*/ - KgpgCore::KgpgKey GpgContext::getKeyDetails(QString uid) { KgpgCore::KgpgKeyList keys; - - // try secret - //KgpgCore::KgpgKeyList keys = KgpgInterface::readSecretKeys(QStringList() << uid); - //if(keys.empty()) { - // ok try public - keys = KgpgInterface::readPublicKeys(QStringList() << uid); - // that should not happen - /*if(keys.empty()) { - qDebug() << "error, no key with uid" << uid; - return ; - }*/ - - //} - + keys = KgpgInterface::readPublicKeys(QStringList() << uid); KgpgCore::KgpgKey key = keys.first(); return key; @@ -174,9 +66,6 @@ KgpgCore::KgpgKey GpgContext::getKeyDetails(QString uid) { GpgKeyList GpgContext::listKeys() { - //KgpgInterface::readPublicKeys(); - - GpgKeyList keys; foreach(KgpgCore::KgpgKey kkey, KgpgInterface::readPublicKeys()) { @@ -276,7 +165,6 @@ void GpgContext::slotRefreshKeyList() { */ GpgKey GpgContext::getKeyByFpr(QString fpr) { - //GpgKeyList list = this->listKeys(); foreach (GpgKey key, mKeyList) { if(key.fpr == fpr) { return key; @@ -291,7 +179,6 @@ GpgKey GpgContext::getKeyByFpr(QString fpr) { */ GpgKey GpgContext::getKeyById(QString id) { - //GpgKeyList list = this->listKeys(); foreach (GpgKey key, mKeyList) { if(key.id == id) { return key; @@ -301,8 +188,6 @@ GpgKey GpgContext::getKeyById(QString id) { return GpgKey(); } - - void GpgContext::emitKeyDBChanged() { emit keyDBChanged(); } |