diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-11-21 20:12:54 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-11-21 20:12:54 +0000 |
commit | 91a80136a55db9c0e2dc63c98d0a5da838cd1998 (patch) | |
tree | 0d82ca8e7a3be17257358a792aabf32980615620 | |
parent | also strike out revoked keys in keylist (diff) | |
download | gpg4usb-91a80136a55db9c0e2dc63c98d0a5da838cd1998.tar.gz gpg4usb-91a80136a55db9c0e2dc63c98d0a5da838cd1998.zip |
added dialog after key import
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@645 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | gpg4usb.pro | 10 | ||||
-rw-r--r-- | gpgcontext.cpp | 15 | ||||
-rw-r--r-- | gpgcontext.h | 3 | ||||
-rwxr-xr-x | keymgmt.cpp | 11 | ||||
-rwxr-xr-x | keymgmt.h | 2 |
6 files changed, 34 insertions, 10 deletions
@@ -27,6 +27,9 @@ Release 0.3.2 - dropdown from menubar instead of dialog for file-cryption (files->encrypt,decrypt) - encrypt and sign, decrypt and verify (?) +BUGS: +- import key toolbar dropdown shows text, even if only icon should be shown + Release 0.3.3 - create revocation file on key generation - optionally open new tab after encryption/decrytion diff --git a/gpg4usb.pro b/gpg4usb.pro index 1c17f92..07c023e 100644 --- a/gpg4usb.pro +++ b/gpg4usb.pro @@ -18,13 +18,14 @@ QT += network HEADERS += attachments.h \ gpgcontext.h \ mainwindow.h \ - keylist.h \ - keymgmt.h \ fileencryptiondialog.h \ + importdetaildialog.h \ mime.h \ keygendialog.h \ keygenthread.h \ keydetailsdialog.h \ + keylist.h \ + keymgmt.h \ settingsdialog.h \ attachmenttablemodel.h \ textedit.h \ @@ -40,13 +41,14 @@ SOURCES += attachments.cpp \ gpgcontext.cpp \ mainwindow.cpp \ main.cpp \ - keylist.cpp \ - keymgmt.cpp \ fileencryptiondialog.cpp \ + importdetaildialog.cpp \ mime.cpp \ keygendialog.cpp \ keygenthread.cpp \ keydetailsdialog.cpp \ + keylist.cpp \ + keymgmt.cpp \ settingsdialog.cpp \ attachmenttablemodel.cpp \ textedit.cpp \ diff --git a/gpgcontext.cpp b/gpgcontext.cpp index 77856f9..46edbe8 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -35,7 +35,6 @@ namespace GpgME */ GpgContext::GpgContext() { - /** get application path */ QString appPath = qApp->applicationDirPath(); @@ -103,14 +102,18 @@ GpgContext::~GpgContext() /** Import Key from QByteArray * */ -void GpgContext::importKey(QByteArray inBuffer) +gpgme_import_result_t GpgContext::importKey(QByteArray inBuffer) { 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); checkErr(err); gpgme_data_release(in); - emit keyDBChanged(); + return result; } /** Generate New Key with values params @@ -166,6 +169,11 @@ gpgme_key_t GpgContext::getKeyDetails(QString uid) return key; } +void GpgContext::sendKeyDBChanged() +{ + emit keyDBChanged(); +} + /** List all availabe Keys (VERY much like kgpgme) */ GpgKeyList GpgContext::listKeys() @@ -187,6 +195,7 @@ GpgKeyList GpgContext::listKeys() 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 = key->uids->name; diff --git a/gpgcontext.h b/gpgcontext.h index 3e9e760..be43764 100644 --- a/gpgcontext.h +++ b/gpgcontext.h @@ -63,7 +63,7 @@ class GpgContext : public QObject public: GpgContext(); // Constructor ~GpgContext(); // Destructor - void importKey(QByteArray inBuffer); + gpgme_import_result_t importKey(QByteArray inBuffer); bool exportKeys(QStringList *uidList, QByteArray *outBuffer); void generateKey(QString *params); GpgKeyList listKeys(); @@ -95,6 +95,7 @@ public: */ int textIsSigned(const QByteArray &text); QString beautifyFingerprint(QString fingerprint); + void sendKeyDBChanged(); signals: void keyDBChanged(); diff --git a/keymgmt.cpp b/keymgmt.cpp index 2250996..c186b34 100755 --- a/keymgmt.cpp +++ b/keymgmt.cpp @@ -155,6 +155,13 @@ void KeyMgmt::createToolBars() } +void KeyMgmt::importKeys(QByteArray inBuffer) +{ + gpgme_import_result_t result = mCtx->importKey(inBuffer); + new ImportDetailDialog(mCtx, mKeyList, result, this); + mCtx->sendKeyDBChanged(); +} + void KeyMgmt::importKeyFromFile() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open Key"), "", tr("Key Files") + " (*.asc *.txt);;"+tr("Keyring files")+" (*.gpg);;All Files (*)"); @@ -166,7 +173,7 @@ void KeyMgmt::importKeyFromFile() } QByteArray inBuffer = file.readAll(); - mCtx->importKey(inBuffer); + importKeys(inBuffer); } } @@ -179,7 +186,7 @@ void KeyMgmt::importKeyFromKeyServer() void KeyMgmt::importKeyFromClipboard() { QClipboard *cb = QApplication::clipboard(); - mCtx->importKey(cb->text(QClipboard::Clipboard).toAscii()); + importKeys(cb->text(QClipboard::Clipboard).toAscii()); } void KeyMgmt::deleteSelectedKeys() @@ -25,6 +25,7 @@ #include "keylist.h" #include "keygenthread.h" #include "keydetailsdialog.h" +#include "importdetaildialog.h" #include "keyserverimportdialog.h" #include "keygendialog.h" #include <QtGui> @@ -52,6 +53,7 @@ public slots: void importKeyFromFile(); void importKeyFromClipboard(); void importKeyFromKeyServer(); + void importKeys(QByteArray inBuffer); void exportKeyToFile(); void exportKeyToClipboard(); void deleteSelectedKeys(); |