diff options
-rw-r--r-- | TODO | 17 | ||||
-rw-r--r-- | gpgcontext.cpp | 62 | ||||
-rw-r--r-- | gpgcontext.h | 47 | ||||
-rw-r--r-- | keyimportdetaildialog.cpp | 49 | ||||
-rw-r--r-- | keyimportdetaildialog.h | 4 | ||||
-rwxr-xr-x | keymgmt.cpp | 3 | ||||
-rw-r--r-- | wizard.cpp | 1 |
7 files changed, 131 insertions, 52 deletions
@@ -6,9 +6,15 @@ Release 0.3.2 - context.cpp -> gpgcontext.cpp [DONE] - show keyrings (files with .gpg) in import from file dialog too [DONE] - dropdown from menubar instead of dialog for import [DONE] +- Change file encryption to single dialog for en- and decryption [DONE] +- Zoom In/Out [DONE] +- keyimport from keyserver dialog should show reason for strike out [DONE] - add file operation toolbar (open, save, new) (per default off) [DONE] +- dropdown from menubar instead of dialog for file-cryption (files->encrypt,decrypt) [DONE] - strike out revoked keys in keylist and add warning to keydetails [DONE] - put quote and double line break removale to "special edit" operation toolbar (icons for double linebreaks missing) [DONE] +- Change "remove double line breaks" to "remove spacing" [DONE] + - icon from "line spacing icon" [DONE] - Wizard on first start (Create Key, Import from keys older gpg4usb, import from gnupg) [DONE] - import conf from old gpg4usb - remember GNUPGHOME in main.cpp @@ -24,22 +30,16 @@ Release 0.3.2 - understandable message if no matching private key found for decryption (no data error) - investigate in adding a offline help system [DONE] - have a look on the format -- keyimport from keyserver dialog should show reason for strike out [DONE] - key import should be more verbose: [DONE] - show message, which keys are imported [DONE] - if import failed, because no key was found [DONE] - - if key is already in keyring + - if key is already in keyring [DONE] - for now done just for import from file and clipboard - - BUG: Also show details, when key is really new + - BUG: Also show details, when key is really new [DONE] - show message, when key export is successful (statusbar) -- dropdown from menubar instead of dialog for file-cryption (files->encrypt,decrypt) - encrypt and sign, decrypt and verify (?) -- Zoom In/Out [DONE] - Add buttonto copy fingerprint to clipboard in details dialog - remove whitespaces on copy -- Change "remove double line breaks" to "remove spacing" [DONE] - - icon from "line spacing icon" [DONE] -- Change file encryption to single dialog for en- and decryption [DONE] - Add default key functionality - fix translation file for "SettingsDialog" as it says two times English, and the comment is on the wrong one. @@ -47,6 +47,7 @@ BUGS: - import key toolbar dropdown shows text, even if only icon should be shown - investigate special characters in passphrase in windows - no importdetails are shown for new keys + Release 0.3.3 - create revocation file on key generation - optionally open new tab after encryption/decrytion diff --git a/gpgcontext.cpp b/gpgcontext.cpp index 4b33146..a388199 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -102,18 +102,69 @@ GpgContext::~GpgContext() /** Import Key from QByteArray * */ -gpgme_import_result_t 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); 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 result; + return *importInformation; } /** Generate New Key with values params @@ -169,11 +220,6 @@ 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() diff --git a/gpgcontext.h b/gpgcontext.h index dfd9cb3..92e0613 100644 --- a/gpgcontext.h +++ b/gpgcontext.h @@ -54,6 +54,50 @@ public: typedef QLinkedList< GpgKey > GpgKeyList; +class GpgImportedKey +{ +public: + QString fpr; + int importStatus; +}; + +typedef QLinkedList< GpgImportedKey > GpgImportedKeyList; + +class GpgImportInformation +{ +public: + GpgImportInformation() { + considered = 0; + no_user_id = 0; + imported = 0; + imported_rsa = 0; + unchanged = 0; + new_user_ids = 0; + new_sub_keys = 0; + new_signatures = 0; + new_revocations = 0; + secret_read = 0; + secret_imported = 0; + secret_unchanged = 0; + not_imported = 0; + } + + int considered; + int no_user_id; + int imported; + int imported_rsa; + int unchanged; + int new_user_ids; + int new_sub_keys; + int new_signatures; + int new_revocations; + int secret_read; + int secret_imported; + int secret_unchanged; + int not_imported; + GpgImportedKeyList importedKeys; +}; + namespace GpgME { @@ -64,7 +108,7 @@ class GpgContext : public QObject public: GpgContext(); // Constructor ~GpgContext(); // Destructor - gpgme_import_result_t importKey(QByteArray inBuffer); + GpgImportInformation importKey(QByteArray inBuffer); bool exportKeys(QStringList *uidList, QByteArray *outBuffer); void generateKey(QString *params); GpgKeyList listKeys(); @@ -96,7 +140,6 @@ public: */ int textIsSigned(const QByteArray &text); QString beautifyFingerprint(QString fingerprint); - void sendKeyDBChanged(); signals: void keyDBChanged(); diff --git a/keyimportdetaildialog.cpp b/keyimportdetaildialog.cpp index 2708cdf..fb457ad 100644 --- a/keyimportdetaildialog.cpp +++ b/keyimportdetaildialog.cpp @@ -21,14 +21,14 @@ #include "keyimportdetaildialog.h" -KeyImportDetailDialog::KeyImportDetailDialog(GpgME::GpgContext* ctx, KeyList* keyList, gpgme_import_result_t result, QWidget *parent) +KeyImportDetailDialog::KeyImportDetailDialog(GpgME::GpgContext* ctx, KeyList* keyList, GpgImportInformation result, QWidget *parent) : QDialog(parent) { mCtx = ctx; mKeyList = keyList; mResult = result; // If no key for import found, just ahow a message - if (mResult->considered == 0) { + if (mResult.considered == 0) { QMessageBox::information(0, tr("Key import details"), tr("No keys found to import")); return; } @@ -52,46 +52,43 @@ void KeyImportDetailDialog::createGeneralInfoBox() generalInfoBoxLayout = new QGridLayout(generalInfoBox); generalInfoBoxLayout->addWidget(new QLabel(tr("Considered:")),1,0); - generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult->considered)),1,1); + generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult.considered)),1,1); int row=2; - if (mResult->unchanged){ + if (mResult.unchanged != 0){ generalInfoBoxLayout->addWidget(new QLabel(tr("Unchanged:")),row,0); - generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult->unchanged)),row,1); + generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult.unchanged)),row,1); row++; } - if (mResult->imported){ + if (mResult.imported != 0){ generalInfoBoxLayout->addWidget(new QLabel(tr("Imported:")),row,0); - generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult->imported)),row,1); + generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult.imported)),row,1); row++; } - if (mResult->not_imported){ + if (mResult.not_imported != 0){ generalInfoBoxLayout->addWidget(new QLabel(tr("Not imported:")),row,0); - generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult->not_imported)),row,1); + generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult.not_imported)),row,1); row++; } - if (mResult->secret_read){ + if (mResult.secret_read != 0){ generalInfoBoxLayout->addWidget(new QLabel(tr("Private read:")),row,0); - generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult->secret_read)),row,1); + generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult.secret_read)),row,1); row++; } - if (mResult->secret_imported){ + if (mResult.secret_imported != 0){ generalInfoBoxLayout->addWidget(new QLabel(tr("Private imported:")),row,0); - generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult->secret_imported)),row,1); + generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult.secret_imported)),row,1); row++; } - if (mResult->secret_unchanged){ + if (mResult.secret_unchanged != 0){ generalInfoBoxLayout->addWidget(new QLabel(tr("Private unchanged:")),row,0); - generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult->secret_unchanged)),row,1); + generalInfoBoxLayout->addWidget(new QLabel(QString::number(mResult.secret_unchanged)),row,1); row++; } mvbox->addWidget(generalInfoBox); } void KeyImportDetailDialog::createKeysTable() -{ - // get details for the imported keys; - gpgme_import_status_t status = mResult->imports; - +{ keysTable = new QTableWidget(this); keysTable->setRowCount(0); keysTable->setColumnCount(4); @@ -107,19 +104,13 @@ void KeyImportDetailDialog::createKeysTable() keysTable->verticalHeader()->hide(); keysTable->setHorizontalHeaderLabels(headerLabels); int row = 0; - while (status != NULL) { + foreach (GpgImportedKey impKey, mResult.importedKeys) { keysTable->setRowCount(row+1); - GpgKey key = mKeyList->getKeyByFpr(status->fpr); + GpgKey key = mKeyList->getKeyByFpr(impKey.fpr); keysTable->setItem(row, 0, new QTableWidgetItem(key.name)); keysTable->setItem(row, 1, new QTableWidgetItem(key.email)); keysTable->setItem(row, 2, new QTableWidgetItem(key.id)); - - qDebug() << "Keystatus: " << status->status; - // Set status of key - -// keysTable->setItem(row, 3, new QTableWidgetItem(QString::number(status->status))); - keysTable->setItem(row,3,new QTableWidgetItem(getStatusString(status->status))); - status=status->next; + keysTable->setItem(row,3,new QTableWidgetItem(getStatusString(impKey.importStatus))); row++; } mvbox->addWidget(keysTable); @@ -128,7 +119,7 @@ void KeyImportDetailDialog::createKeysTable() QString KeyImportDetailDialog::getStatusString(int keyStatus) { QString statusString; - // if key is private + // keystatus is greater than 15, if key is private if (keyStatus > 15) { statusString.append(tr("private")); keyStatus=keyStatus-16; diff --git a/keyimportdetaildialog.h b/keyimportdetaildialog.h index 6857364..fce813e 100644 --- a/keyimportdetaildialog.h +++ b/keyimportdetaildialog.h @@ -35,7 +35,7 @@ class KeyImportDetailDialog : public QDialog Q_OBJECT public: - KeyImportDetailDialog(GpgME::GpgContext* ctx, KeyList* keyList, gpgme_import_result_t result, QWidget *parent = 0); + KeyImportDetailDialog(GpgME::GpgContext* ctx, KeyList* keyList, GpgImportInformation result, QWidget *parent = 0); private: void createGeneralInfoBox(); @@ -53,7 +53,7 @@ private: QVBoxLayout *mvbox; QGridLayout *generalInfoBoxLayout; QGridLayout *keyInfoBoxLayout; - gpgme_import_result_t mResult; + GpgImportInformation mResult; }; #endif // __KEYIMPORTDETAILSDIALOG_H__ diff --git a/keymgmt.cpp b/keymgmt.cpp index 61cc3e6..3f1f8e9 100755 --- a/keymgmt.cpp +++ b/keymgmt.cpp @@ -157,9 +157,8 @@ void KeyMgmt::createToolBars() void KeyMgmt::importKeys(QByteArray inBuffer) { - gpgme_import_result_t result = mCtx->importKey(inBuffer); + GpgImportInformation result = mCtx->importKey(inBuffer); new KeyImportDetailDialog(mCtx, mKeyList, result, this); - mCtx->sendKeyDBChanged(); } void KeyMgmt::importKeyFromFile() @@ -209,7 +209,6 @@ bool ImportPage::importKeysFromGpg4usb() QByteArray inBuffer = secRing.readAll(); mCtx->importKey(inBuffer); } - mCtx->sendKeyDBChanged(); return true; } |