diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-09-29 14:37:38 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-09-29 14:37:38 +0000 |
commit | 4616cb5a2bd91236595e98d5f8e16b2fa9cd84a7 (patch) | |
tree | a95076bcd9b0bddfa85daed38faa5512397b6e15 | |
parent | textedit is editable after hitting escape after having no found match in find... (diff) | |
download | gpg4usb-4616cb5a2bd91236595e98d5f8e16b2fa9cd84a7.tar.gz gpg4usb-4616cb5a2bd91236595e98d5f8e16b2fa9cd84a7.zip |
remove gpgme dependencies, cleanup
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@969 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rwxr-xr-x | aboutdialog.cpp | 2 | ||||
-rwxr-xr-x | fileencryptiondialog.cpp | 6 | ||||
-rw-r--r-- | gpg4usb.pro | 17 | ||||
-rw-r--r-- | gpgcontext.cpp | 489 | ||||
-rw-r--r-- | gpgcontext.h | 35 | ||||
-rw-r--r-- | keygenthread.cpp | 34 | ||||
-rw-r--r-- | keygenthread.h | 56 | ||||
-rw-r--r-- | keylist.cpp | 5 | ||||
-rwxr-xr-x | keymgmt.cpp | 8 | ||||
-rw-r--r-- | mainwindow.cpp | 6 | ||||
-rw-r--r-- | verifykeydetailbox.cpp | 3 |
11 files changed, 26 insertions, 635 deletions
diff --git a/aboutdialog.cpp b/aboutdialog.cpp index 68d79b7..824483f 100755 --- a/aboutdialog.cpp +++ b/aboutdialog.cpp @@ -59,7 +59,7 @@ InfoTab::InfoTab(QWidget *parent) "at our <a href=\"http://gpg4usb.cpunk.de/contact.php\">" "contact page</a> or send a mail to our<br/> mailing list at" " <a href=\"mailto:[email protected]\">[email protected]</a>.") + tr("<br><br> Built with Qt ") + qVersion() - + tr(" and GPGME ") + GpgME::GpgContext::getGpgmeVersion() +"</center>"); + + "</center>"); QGridLayout *layout = new QGridLayout(); QLabel *pixmapLabel = new QLabel(); diff --git a/fileencryptiondialog.cpp b/fileencryptiondialog.cpp index af05a24..2eb25ca 100755 --- a/fileencryptiondialog.cpp +++ b/fileencryptiondialog.cpp @@ -187,10 +187,12 @@ void FileEncryptionDialog::executeAction() QByteArray *outBuffer = new QByteArray(); infile.close(); if ( mAction == Encrypt ) { - if (! mCtx->encrypt(mKeyList->getChecked(), inBuffer, outBuffer)) return; + // TODO + // if (! mCtx->encrypt(mKeyList->getChecked(), inBuffer, outBuffer)) return; } if ( mAction == Decrypt ) { - if (! mCtx->decrypt(inBuffer, outBuffer)) return; + // TODO + // if (! mCtx->decrypt(inBuffer, outBuffer)) return; } // TODO: with kgpg diff --git a/gpg4usb.pro b/gpg4usb.pro index 8443ead..bf53903 100644 --- a/gpg4usb.pro +++ b/gpg4usb.pro @@ -8,8 +8,7 @@ TEMPLATE = app # mac:TARGET = start_mac DESTDIR = release DEPENDPATH += . -INCLUDEPATH += . \ - ./include +INCLUDEPATH += . #DEFINES += GPG4USB_NON_PORTABLE @@ -26,7 +25,6 @@ HEADERS += attachments.h \ keyimportdetaildialog.h \ mime.h \ keygendialog.h \ - keygenthread.h \ keydetailsdialog.h \ keylist.h \ keymgmt.h \ @@ -87,7 +85,6 @@ SOURCES += attachments.cpp \ keyimportdetaildialog.cpp \ mime.cpp \ keygendialog.cpp \ - keygenthread.cpp \ keydetailsdialog.cpp \ keylist.cpp \ keymgmt.cpp \ @@ -140,18 +137,6 @@ SOURCES += attachments.cpp \ RC_FILE = gpg4usb.rc RESOURCES = gpg4usb.qrc - -# comment out line below for static building -LIBS += -lgpgme \ - -lgpg-error \ - -# comment in for static buildding in windows -#INCLUDEPATH += ./winbuild/include -#LIBS +=./winbuild/lib/libgpgme.a ./winbuild/lib/libgpg-error.a - -#INCLUDEPATH += ./macbuild/include -#LIBS +=./macbuild/lib/libgpgme.a ./macbuild/lib/libgpg-error.a - DEFINES += _FILE_OFFSET_BITS=64 TRANSLATIONS = release/ts/gpg4usb_en.ts \ diff --git a/gpgcontext.cpp b/gpgcontext.cpp index 2d98372..259332e 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -66,31 +66,21 @@ GpgContext::GpgContext() QStringList args; args << "--homedir" << gpgKeys << "--list-keys"; -/* QProcess gpg; - gpg.setProcessChannelMode(QProcess::MergedChannels); - gpg.start(gpgBin, args); - - gpg.waitForFinished(-1); - - qDebug() << "huhu" << gpg.readAll(); -*/ connect(this,SIGNAL(keyDBChanged()),this,SLOT(refreshKeyList())); refreshKeyList(); } /** Destructor - * Release gpgme-context */ GpgContext::~GpgContext() { - //if (mCtx) gpgme_release(mCtx); - //mCtx = 0; + } /** Import Key from QByteArray * */ -GpgImportInformation GpgContext::importKey(QByteArray inBuffer) +/*GpgImportInformation GpgContext::importKey(QByteArray inBuffer) { GpgImportInformation *importInformation = new GpgImportInformation(); err = gpgme_data_new_from_mem(&in, inBuffer.data(), inBuffer.size(), 1); @@ -153,47 +143,7 @@ GpgImportInformation GpgContext::importKey(QByteArray inBuffer) emit keyDBChanged(); gpgme_data_release(in); return *importInformation; -} - -/** Generate New Key with values params - * - */ -void GpgContext::generateKey(QString *params) -{ - err = gpgme_op_genkey(mCtx, params->toAscii().data(), NULL, NULL); - checkErr(err); - emit keyDBChanged(); -} - -/** Export Key to QByteArray - * - */ -bool GpgContext::exportKeys(QStringList *uidList, QByteArray *outBuffer) -{ - size_t read_bytes; - gpgme_data_t out = 0; - outBuffer->resize(0); - - if (uidList->count() == 0) { - QMessageBox::critical(0, "Export Keys Error", "No Keys Selected"); - return false; - } - - for (int i = 0; i < uidList->count(); i++) { - err = gpgme_data_new(&out); - checkErr(err); - - err = gpgme_op_export(mCtx, uidList->at(i).toAscii().constData(), 0, out); - checkErr(err); - - read_bytes = gpgme_data_seek(out, 0, SEEK_END); - - err = readToBuffer(out, outBuffer); - checkErr(err); - gpgme_data_release(out); - } - return true; -} +}*/ KgpgCore::KgpgKey GpgContext::getKeyDetails(QString uid) { @@ -255,255 +205,6 @@ GpgKeyList GpgContext::listKeys() return keys; } -/** Delete keys - */ - -void GpgContext::deleteKeys(QStringList *uidList) -{ - QString tmp; - gpgme_key_t key; - - foreach(tmp, *uidList) { - gpgme_op_keylist_start(mCtx, tmp.toAscii().constData(), 0); - gpgme_op_keylist_next(mCtx, &key); - gpgme_op_keylist_end(mCtx); - gpgme_op_delete(mCtx, key, 1); - } - emit keyDBChanged(); -} - -/** Encrypt inBuffer for reciepients-uids, write - * result to outBuffer - */ -bool GpgContext::encrypt(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer) -{ - - /*gpgme_data_t in = 0, out = 0; - outBuffer->resize(0); - - if (uidList->count() == 0) { - QMessageBox::critical(0, tr("No Key Selected"), tr("No Key Selected")); - return false; - } - - //gpgme_encrypt_result_t e_result; - gpgme_key_t recipients[uidList->count()+1]; - - // get key for user - for (int i = 0; i < uidList->count(); i++) { - // the last 0 is for public keys, 1 would return private keys - gpgme_op_keylist_start(mCtx, uidList->at(i).toAscii().constData(), 0); - gpgme_op_keylist_next(mCtx, &recipients[i]); - gpgme_op_keylist_end(mCtx); - } - //Last entry in array has to be NULL - recipients[uidList->count()] = NULL; - - //If the last parameter isnt 0, a private copy of data is made - if (mCtx) { - err = gpgme_data_new_from_mem(&in, inBuffer.data(), inBuffer.size(), 1); - checkErr(err); - if (!err) { - err = gpgme_data_new(&out); - checkErr(err); - if (!err) { - err = gpgme_op_encrypt(mCtx, recipients, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); - checkErr(err); - if (!err) { - err = readToBuffer(out, outBuffer); - checkErr(err); - } - } - } - } - // unref all keys - for (int i = 0; i <= uidList->count(); i++) { - gpgme_key_unref(recipients[i]); - } - if (in) { - gpgme_data_release(in); - } - if (out) { - gpgme_data_release(out); - } - return (err == GPG_ERR_NO_ERROR);*/ - QStringList options; - KGpgEncrypt::EncryptOptions opts = KGpgEncrypt::DefaultEncryption; - - //KGpgEncrypt *encr = new KGpgEncrypt(this, uidList, toPlainText(), opts, options); - //encr->start(); - //connect(encr, SIGNAL(done(int)), SLOT(slotEncodeUpdate(int))); -} - - - -/** Decrypt QByteAarray, return QByteArray - * mainly from http://basket.kde.org/ (kgpgme.cpp) - */ -bool GpgContext::decrypt(const QByteArray &inBuffer, QByteArray *outBuffer) -{ - gpgme_data_t in = 0, out = 0; - gpgme_decrypt_result_t result = 0; - QString errorString; - - outBuffer->resize(0); - if (mCtx) { - err = gpgme_data_new_from_mem(&in, inBuffer.data(), inBuffer.size(), 1); - checkErr(err); - if (!err) { - err = gpgme_data_new(&out); - checkErr(err); - if (!err) { - err = gpgme_op_decrypt(mCtx, in, out); - checkErr(err); - - if(gpg_err_code(err) == GPG_ERR_DECRYPT_FAILED) { - errorString.append(gpgErrString(err)).append("<br>"); - result = gpgme_op_decrypt_result(mCtx); - checkErr(result->recipients->status); - errorString.append(gpgErrString(result->recipients->status)).append("<br>"); - errorString.append(tr("<br>No private key with id %1 present in keyring").arg(result->recipients->keyid)); - } else { - errorString.append(gpgErrString(err)).append("<br>"); - } - - if (!err) { - result = gpgme_op_decrypt_result(mCtx); - if (result->unsupported_algorithm) { - QMessageBox::critical(0, tr("Unsupported algorithm"), result->unsupported_algorithm); - } else { - err = readToBuffer(out, outBuffer); - checkErr(err); - } - } - } - } - } - if (gpg_err_code(err) != GPG_ERR_NO_ERROR && gpg_err_code(err) != GPG_ERR_CANCELED) { - QMessageBox::critical(0, tr("Error decrypting:"), errorString); - return false; - } - - if (! settings.value("general/rememberPassword").toBool()) { - clearPasswordCache(); - } - - if (in) { - gpgme_data_release(in); - } - if (out) { - gpgme_data_release(out); - } - return (err == GPG_ERR_NO_ERROR); -} - -/** Read gpgme-Data to QByteArray - * mainly from http://basket.kde.org/ (kgpgme.cpp) - */ -#define BUF_SIZE (32 * 1024) -gpgme_error_t GpgContext::readToBuffer(gpgme_data_t in, QByteArray *outBuffer) -{ - int ret; - gpgme_error_t err = GPG_ERR_NO_ERROR; - - ret = gpgme_data_seek(in, 0, SEEK_SET); - if (ret) { - err = gpgme_err_code_from_errno(errno); - checkErr(err, "failed dataseek in readToBuffer"); - } else { - char *buf = new char[BUF_SIZE + 2]; - - if (buf) { - while ((ret = gpgme_data_read(in, buf, BUF_SIZE)) > 0) { - uint size = outBuffer->size(); - outBuffer->resize(size + ret); - memcpy(outBuffer->data() + size, buf, ret); - } - if (ret < 0) { - err = gpgme_err_code_from_errno(errno); - checkErr(err, "failed data_read in readToBuffer"); - } - delete[] buf; - } - } - return err; -} - -/** The Passphrase window, if not provided by env-Var GPG_AGENT_INFO - * originally copied from http://basket.kde.org/ (kgpgme.cpp), but modified - */ -gpgme_error_t GpgContext::passphraseCb(void *hook, const char *uid_hint, - const char *passphrase_info, - int last_was_bad, int fd) -{ - GpgContext *gpg = static_cast<GpgContext*>(hook); - return gpg->passphrase(uid_hint, passphrase_info, last_was_bad, fd); -} - -gpgme_error_t GpgContext::passphrase(const char *uid_hint, - const char * /*passphrase_info*/, - int last_was_bad, int fd) -{ - gpgme_error_t returnValue = GPG_ERR_CANCELED; - QString passwordDialogMessage; - QString gpgHint = QString::fromUtf8(uid_hint); - bool result; -#ifdef _WIN32 - DWORD written; - HANDLE hd = (HANDLE)fd; -#endif - - if (last_was_bad) { - passwordDialogMessage += "<i>"+tr("Wrong password")+".</i><br><br>\n\n"; - clearPasswordCache(); - } - - /** if uid provided */ - if (!gpgHint.isEmpty()) { - // remove UID, leave only username & email - gpgHint.remove(0, gpgHint.indexOf(" ")); - passwordDialogMessage += "<b>"+tr("Enter Password for")+"</b><br>" + gpgHint + "<br>"; - } - - if (mPasswordCache.isEmpty()) { - QString password = QInputDialog::getText(QApplication::activeWindow(), tr("Enter Password"), - passwordDialogMessage, QLineEdit::Password, - "", &result); - - if (result) mPasswordCache = password.toAscii(); - } else { - result = true; - } - - if (result) { - -#ifndef _WIN32 - if (write(fd, mPasswordCache.data(), mPasswordCache.length()) == -1) { - qDebug() << "something is terribly broken"; - } -#else - WriteFile(hd, mPasswordCache.data(), mPasswordCache.length(), &written, 0); -#endif - - returnValue = GPG_ERR_NO_ERROR; - } - -#ifndef _WIN32 - if (write(fd, "\n", 1) == -1) { - qDebug() << "something is terribly broken"; - } -#else - WriteFile(hd, "\n", 1, &written, 0); - - /* program will hang on cancel if hd not closed */ - if(!result) { - CloseHandle(hd); - } -#endif - - return returnValue; -} - /** also from kgpgme.cpp, seems to clear password from mem */ void GpgContext::clearPasswordCache() { @@ -513,186 +214,6 @@ void GpgContext::clearPasswordCache() } } -// error-handling -int GpgContext::checkErr(gpgme_error_t err, QString comment) const -{ - //if (err != GPG_ERR_NO_ERROR && err != GPG_ERR_CANCELED) { - if (err != GPG_ERR_NO_ERROR) { - qDebug() << "[Error " << comment << "] Source: " << gpgme_strsource(err) << " String: " << gpgErrString(err); - } - return err; -} - -int GpgContext::checkErr(gpgme_error_t err) const -{ - //if (err != GPG_ERR_NO_ERROR && err != GPG_ERR_CANCELED) { - if (err != GPG_ERR_NO_ERROR) { - qDebug() << "[Error] Source: " << gpgme_strsource(err) << " String: " << gpgErrString(err); - } - return err; -} - -QString GpgContext::gpgErrString(gpgme_error_t err) { - return QString::fromUtf8(gpgme_strerror(err)); -} - -/** export private key, TODO errohandling, e.g. like in seahorse (seahorse-gpg-op.c) **/ - -void GpgContext::exportSecretKey(QString uid, QByteArray *outBuffer) -{ - // export private key to outBuffer - QStringList arguments; - arguments << "--armor" << "--export-secret-key" << uid; - QByteArray *err = new QByteArray(); - executeGpgCommand(arguments, outBuffer, err); - - // append public key to outBuffer - QByteArray *pubKey = new QByteArray(); - QStringList keyList; - keyList.append(uid); - exportKeys(&keyList,pubKey); - outBuffer->append(*pubKey); -} - -/** return type should be gpgme_error_t*/ -void GpgContext::executeGpgCommand(QStringList arguments, QByteArray *stdOut, QByteArray *stdErr) -{ - gpgme_engine_info_t engine = gpgme_ctx_get_engine_info(mCtx); - - QStringList args; - args << "--homedir" << engine->home_dir << "--batch" << arguments; - - QProcess gpg; - gpg.start(engine->file_name, args); - gpg.waitForFinished(); - - *stdOut = gpg.readAllStandardOutput(); - *stdErr = gpg.readAllStandardError(); -} - -/*** - * TODO: return type should contain: - * -> list of sigs - * -> valid - * -> errors - */ -gpgme_signature_t GpgContext::verify(QByteArray inBuffer) { - - int error=0; - gpgme_data_t in; - gpgme_error_t err; - gpgme_signature_t sign; - gpgme_verify_result_t result; - - err = gpgme_data_new_from_mem(&in, inBuffer.data(), inBuffer.size(), 1); - checkErr(err); - - err = gpgme_op_verify (mCtx, in, NULL, in); - error = checkErr(err); - - if (error != 0) { - return NULL; - } - - result = gpgme_op_verify_result (mCtx); - sign = result->signatures; - return sign; -} - -/*** - * return type should contain: - * -> list of sigs - * -> valid - * -> decrypted message - */ -//void GpgContext::decryptVerify(QByteArray in) { - -/* gpgme_error_t err; - gpgme_data_t in, out; - - gpgme_decrypt_result_t decrypt_result; - gpgme_verify_result_t verify_result; - - err = gpgme_op_decrypt_verify (mCtx, in, out); - decrypt_result = gpgme_op_decrypt_result (mCtx); - - verify_result = gpgme_op_verify_result (mCtx); - */ -//} - -bool GpgContext::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer ) { - - gpgme_error_t err; - gpgme_data_t in, out; - gpgme_sign_result_t result; - - if (uidList->count() == 0) { - QMessageBox::critical(0, tr("Key Selection"), tr("No Private Key Selected")); - return false; - } - - // at start or end? - gpgme_signers_clear(mCtx); - - //gpgme_encrypt_result_t e_result; - gpgme_key_t signers[uidList->count()+1]; - - - // TODO: do we really need array? adding one key in loop should be ok - for (int i = 0; i < uidList->count(); i++) { - // the last 0 is for public keys, 1 would return private keys - gpgme_op_keylist_start(mCtx, uidList->at(i).toAscii().constData(), 0); - gpgme_op_keylist_next(mCtx, &signers[i]); - gpgme_op_keylist_end(mCtx); - - err = gpgme_signers_add (mCtx, signers[i]); - checkErr(err); - } - - err = gpgme_data_new_from_mem(&in, inBuffer.data(), inBuffer.size(), 1); - checkErr(err); - err = gpgme_data_new (&out); - checkErr(err); - - /* - `GPGME_SIG_MODE_NORMAL' - A normal signature is made, the output includes the plaintext - and the signature. - - `GPGME_SIG_MODE_DETACH' - A detached signature is made. - - `GPGME_SIG_MODE_CLEAR' - A clear text signature is made. The ASCII armor and text - mode settings of the context are ignored. - */ - - err = gpgme_op_sign (mCtx, in, out, GPGME_SIG_MODE_CLEAR); - checkErr (err); - - if (err == GPG_ERR_CANCELED) { - return false; - } - - if (err != GPG_ERR_NO_ERROR) { - QMessageBox::critical(0, tr("Error signing:"), QString::fromUtf8(gpgme_strerror(err))); - return false; - } - - result = gpgme_op_sign_result (mCtx); - err = readToBuffer(out, outBuffer); - checkErr (err); - - gpgme_data_release(in); - gpgme_data_release(out); - - if (! settings.value("general/rememberPassword").toBool()) { - clearPasswordCache(); - } - - return (err == GPG_ERR_NO_ERROR); -} - /* * if there is no '\n' before the PGP-Begin-Block, but for example a whitespace, * GPGME doesn't recognise the Message as encrypted. This function adds '\n' @@ -769,9 +290,7 @@ GpgKey GpgContext::getKeyById(QString id) { return GpgKey(); } -QString GpgContext::getGpgmeVersion() { - return QString(gpgme_check_version(NULL)); -} + void GpgContext::emitKeyDBChanged() { emit keyDBChanged(); diff --git a/gpgcontext.h b/gpgcontext.h index 388c957..358f040 100644 --- a/gpgcontext.h +++ b/gpgcontext.h @@ -25,7 +25,6 @@ #include "gpgconstants.h" #include <locale.h> #include <errno.h> -#include <gpgme.h> #include <QLinkedList> #include <QtGui> #include "kgpg/core/kgpgkey.h" @@ -109,21 +108,10 @@ class GpgContext : public QObject public: GpgContext(); // Constructor ~GpgContext(); // Destructor - GpgImportInformation importKey(QByteArray inBuffer); - bool exportKeys(QStringList *uidList, QByteArray *outBuffer); - void generateKey(QString *params); GpgKeyList listKeys(); - void deleteKeys(QStringList *uidList); - bool encrypt(QStringList *uidList, const QByteArray &inBuffer, - QByteArray *outBuffer); - bool decrypt(const QByteArray &inBuffer, QByteArray *outBuffer); void clearPasswordCache(); - void exportSecretKey(QString uid, QByteArray *outBuffer); - //gpgme_key_t getKeyDetails(QString uid); KgpgCore::KgpgKey getKeyDetails(QString uid); - gpgme_signature_t verify(QByteArray in); -// void decryptVerify(QByteArray in); - bool sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer ); + /** * @details If text contains PGP-message, put a linebreak before the message, * so that gpgme can decrypt correctly @@ -137,9 +125,6 @@ public: void emitKeyDBChanged(); - static QString gpgErrString(gpgme_error_t err); - static QString getGpgmeVersion(); - /** * @brief * @@ -158,28 +143,10 @@ private slots: void refreshKeyList(); private: - gpgme_ctx_t mCtx; - gpgme_data_t in, out; - gpgme_error_t err; - gpgme_error_t readToBuffer(gpgme_data_t in, QByteArray *outBuffer); QByteArray mPasswordCache; QSettings settings; bool debug; GpgKeyList mKeyList; - int checkErr(gpgme_error_t err) const; - int checkErr(gpgme_error_t err, QString comment) const; - - static gpgme_error_t passphraseCb(void *hook, const char *uid_hint, - const char *passphrase_info, - int last_was_bad, int fd); - gpgme_error_t passphrase(const char *uid_hint, - const char *passphrase_info, - int last_was_bad, int fd); - - void executeGpgCommand(QStringList arguments, - QByteArray *stdOut, - QByteArray *stdErr); - QString gpgBin; QString gpgKeys; diff --git a/keygenthread.cpp b/keygenthread.cpp deleted file mode 100644 index c558877..0000000 --- a/keygenthread.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * keygenthread.cpp - * - * Copyright 2008 gpg4usb-team <[email protected]> - * - * This file is part of gpg4usb. - * - * Gpg4usb is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Gpg4usb is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with gpg4usb. If not, see <http://www.gnu.org/licenses/> - */ - -#include "keygenthread.h" - -KeyGenThread::KeyGenThread(QString keyGenParams, GpgME::GpgContext *ctx) -{ - this->keyGenParams = keyGenParams; - this->mCtx = ctx; - abort = false; -} - -void KeyGenThread::run() -{ - mCtx->generateKey(&keyGenParams); -} diff --git a/keygenthread.h b/keygenthread.h deleted file mode 100644 index 358989c..0000000 --- a/keygenthread.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * keygenthread.h - * - * Copyright 2008 gpg4usb-team <[email protected]> - * - * This file is part of gpg4usb. - * - * Gpg4usb is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Gpg4usb is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with gpg4usb. If not, see <http://www.gnu.org/licenses/> - */ - -#ifndef __KEYGENTHREAD_H__ -#define __KEYGENTHREAD_H__ - -#include "gpgcontext.h" -#include <qthread.h> -#include <iostream> -#include <string> -#include <cmath> -#include <QtGui> - -QT_BEGIN_NAMESPACE -class QMessageBox; -QT_END_NAMESPACE - -class KeyGenThread : public QThread -{ - Q_OBJECT - -public: - KeyGenThread(QString keyGenParams, GpgME::GpgContext *ctx); - -signals: - void keyGenerated(); - -private: - QString keyGenParams; - GpgME::GpgContext *mCtx; - bool abort; - QMutex mutex; - -protected: - void run(); - -}; -#endif // __KEYGENTHREAD_H__ diff --git a/keylist.cpp b/keylist.cpp index 204e346..d5c9d61 100644 --- a/keylist.cpp +++ b/keylist.cpp @@ -260,8 +260,9 @@ void KeyList::markKeys(QStringList *keyIds) void KeyList::importKeys(QByteArray inBuffer) { - GpgImportInformation result = mCtx->importKey(inBuffer); - new KeyImportDetailDialog(mCtx, result, this); +// TODO +// GpgImportInformation result = mCtx->importKey(inBuffer); +// new KeyImportDetailDialog(mCtx, result, this); } void KeyList::uploadKeyToServer(QByteArray *keys) diff --git a/keymgmt.cpp b/keymgmt.cpp index be17e48..cf04cc3 100755 --- a/keymgmt.cpp +++ b/keymgmt.cpp @@ -295,7 +295,8 @@ void KeyMgmt::showKeyDetails() void KeyMgmt::exportKeyToFile() { - QByteArray *keyArray = new QByteArray(); +// TODO +/* QByteArray *keyArray = new QByteArray(); if (!mCtx->exportKeys(mKeyList->getChecked(), keyArray)) { return; } @@ -311,17 +312,20 @@ void KeyMgmt::exportKeyToFile() file.close(); delete keyArray; emit statusBarChanged(QString(tr("key(s) exported"))); +*/ } void KeyMgmt::exportKeyToClipboard() { - QByteArray *keyArray = new QByteArray(); +// TODO +/* QByteArray *keyArray = new QByteArray(); QClipboard *cb = QApplication::clipboard(); if (!mCtx->exportKeys(mKeyList->getChecked(), keyArray)) { return; } cb->setText(*keyArray); delete keyArray; +*/ } void KeyMgmt::generateKeyDialog() diff --git a/mainwindow.cpp b/mainwindow.cpp index b556dda..2f5722e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1083,9 +1083,11 @@ void MainWindow::refreshKeysFromKeyserver() void MainWindow::uploadKeyToServer() { QByteArray *keyArray = new QByteArray(); - mCtx->exportKeys(mKeyList->getSelected(), keyArray); - mKeyList->uploadKeyToServer(keyArray); + // TODO: + //mCtx->exportKeys(mKeyList->getSelected(), keyArray); + + //mKeyList->uploadKeyToServer(keyArray); } void MainWindow::fileEncrypt() diff --git a/verifykeydetailbox.cpp b/verifykeydetailbox.cpp index 62574da..968d1f1 100644 --- a/verifykeydetailbox.cpp +++ b/verifykeydetailbox.cpp @@ -74,7 +74,8 @@ VerifyKeyDetailBox::VerifyKeyDetailBox(QWidget *parent, GpgME::GpgContext* ctx, grid->addWidget(new QLabel(key.name), 0, 1); grid->addWidget(new QLabel(key.email), 1, 1); - grid->addWidget(new QLabel(gpg_strerror(signature->status)), 2, 1); + // TODO + //grid->addWidget(new QLabel(gpg_strerror(signature->status)), 2, 1); grid->addWidget(new QLabel(beautifyFingerprint(key.fpr)), 3, 1); break; |