diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-09-12 22:42:28 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-09-12 22:42:28 +0000 |
commit | 715a3a80bda633f38fb26df5599a01abd08b85db (patch) | |
tree | a9214e03df2e6d0c10ae80d077232bb3310e6eef | |
parent | show details in different colours in verfiy detail dialog, further commenting... (diff) | |
download | gpg4usb-715a3a80bda633f38fb26df5599a01abd08b85db.tar.gz gpg4usb-715a3a80bda633f38fb26df5599a01abd08b85db.zip |
changed verifydetailsdialog, updated todo
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@531 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | gpg4usb.pro | 6 | ||||
-rw-r--r-- | gpgwin.cpp | 5 | ||||
-rw-r--r-- | gpgwin.h | 1 | ||||
-rw-r--r-- | verifydetailsdialog.cpp | 88 | ||||
-rw-r--r-- | verifydetailsdialog.h | 25 | ||||
-rw-r--r-- | verifynotification.cpp | 9 | ||||
-rw-r--r-- | verifynotification.h | 5 |
8 files changed, 135 insertions, 8 deletions
@@ -15,6 +15,8 @@ Release 0.3.1 - umlaute are not handled correctly in signing [DONE] - beautify icons for verify and sign - check class / includes [DONE] +- keydetailsdialog should have a parent +- Verifynotification margin left BUGS: - Sometimes two or more stars are shown at modified documents @@ -22,6 +24,8 @@ BUGS: - show, if message is partially verified(how)? Release 0.3.2 +- Wizard on first start (Create Key, Import from older gpg4usb, import from gnupg) +- GPLv3 - check and add missing statusbar messages - set mainwindow-statusbar text via signal - more doku on building gpg4usb (especially on windows) diff --git a/gpg4usb.pro b/gpg4usb.pro index ef8e2a1..e43c645 100644 --- a/gpg4usb.pro +++ b/gpg4usb.pro @@ -30,7 +30,8 @@ HEADERS += attachments.h \ editorpage.h \ quitdialog.h \ keyserverimportdialog.h \ - verifynotification.h + verifynotification.h \ + verifydetailsdialog.h SOURCES += attachments.cpp \ context.cpp \ gpgwin.cpp \ @@ -47,7 +48,8 @@ SOURCES += attachments.cpp \ editorpage.cpp \ quitdialog.cpp \ keyserverimportdialog.cpp \ - verifynotification.cpp + verifynotification.cpp \ + verifydetailsdialog.cpp RC_FILE = gpg4usb.rc # comment out line below for static building @@ -245,7 +245,7 @@ void GpgWin::createActions() signAct = new QAction(tr("&Sign"), this); signAct->setIcon(QIcon(iconPath + "signature.png")); - signAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S)); + signAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); signAct->setToolTip(tr("Sign Message")); connect(signAct, SIGNAL(triggered()), this, SLOT(sign())); @@ -723,7 +723,8 @@ void GpgWin::verify() return; } - VerifyNotification *vn = new VerifyNotification(mCtx,this); + VerifyNotification *vn = new VerifyNotification(this, mCtx, mKeyList, sign); + //VerifyDetailsDialog *vd = new VerifyDetailsDialog(this, mCtx, mKeyList, sign); //vn->keysNotInList->clear(); QString verifyLabelText; bool unknownKeyFound=false; @@ -33,6 +33,7 @@ #include "fileencryptiondialog.h" #include "settingsdialog.h" #include "verifynotification.h" +#include "verifydetailsdialog.h" class QMainWindow; class QPlainTextEdit; diff --git a/verifydetailsdialog.cpp b/verifydetailsdialog.cpp new file mode 100644 index 0000000..02090fc --- /dev/null +++ b/verifydetailsdialog.cpp @@ -0,0 +1,88 @@ +#include "verifydetailsdialog.h" + +VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgME::Context* ctx, KeyList* keyList, gpgme_signature_t signature) : + QDialog(parent) +{ + this->mCtx = ctx; + this->mKeyList = keyList; + + QVBoxLayout* mVbox = new QVBoxLayout(); + + QDateTime timestamp; + timestamp.setTime_t(signature->timestamp); + + mVbox->addWidget(new QLabel(tr("Text was completly signed on %1 by:\n").arg(timestamp.toString(Qt::SystemLocaleShortDate)))); + + while (signature) { + QGroupBox* sbox = addDetailBox(signature); + signature = signature->next; + mVbox->addWidget(sbox); + } + + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); + + mVbox->addWidget(buttonBox); + + this->setLayout(mVbox); + this->setWindowTitle(tr("Signaturedetails")); + this->show(); + + exec(); +} + +QGroupBox* VerifyDetailsDialog::addDetailBox( gpgme_signature_t signature ) { + + QGridLayout *grid = new QGridLayout(); + + switch (gpg_err_code(signature->status)) + { + case GPG_ERR_NO_PUBKEY: + { + //verifyStatus=VERIFY_ERROR_WARN; + //vn->addVerifyDetailLabel(tr("Key not present in keylist: ")+QString(signature->fpr),VERIFY_ERROR_WARN, false); + grid->addWidget(new QLabel(tr("Status:")), 0, 0); + grid->addWidget(new QLabel(tr("Fingerprint:")), 1, 0); + grid->addWidget(new QLabel("Key not present in keylist"), 0, 1); + grid->addWidget(new QLabel(signature->fpr), 1, 1); + + break; + } + case GPG_ERR_NO_ERROR: + { + /*QString name = mKeyList->getKeyNameByFpr(signature->fpr); + QString email =mKeyList->getKeyEmailByFpr(signature->fpr); + vn->addVerifyDetailLabel(tr("Name: ")+name+"\n"+tr("EMail: ")+email+"\n"+tr("Fingerprint: ")+QString(signature->fpr),VERIFY_ERROR_OK, false); + break;*/ + + grid->addWidget(new QLabel(tr("Name:")), 0, 0); + grid->addWidget(new QLabel(tr("EMail:")), 1, 0); + grid->addWidget(new QLabel(tr("Fingerprint:")), 2, 0); + grid->addWidget(new QLabel(tr("Status:")), 3, 0); + + grid->addWidget(new QLabel(mKeyList->getKeyNameByFpr(signature->fpr)), 0, 1); + grid->addWidget(new QLabel(mKeyList->getKeyEmailByFpr(signature->fpr)), 1, 1); + grid->addWidget(new QLabel(signature->fpr), 2, 1); + grid->addWidget(new QLabel("OK"), 3, 1); + + + } + default: + { + //verifyStatus=VERIFY_ERROR_WARN; + /*vn->addVerifyDetailLabel(tr("Key with Fingerprint: ")+ + QString(signature->fpr)+"\n"+tr("Signature status: ")+gpg_strerror(signature->status)+"\n" + +tr("Signature validity reason: ")+QString(gpgme_strerror(signature->validity_reason)), + VERIFY_ERROR_WARN, false); + */ + break; + } + } + + + + QGroupBox *sbox = new QGroupBox(tr("Key")); + sbox->setLayout(grid); + return sbox; + +} diff --git a/verifydetailsdialog.h b/verifydetailsdialog.h new file mode 100644 index 0000000..58fd4f0 --- /dev/null +++ b/verifydetailsdialog.h @@ -0,0 +1,25 @@ +#ifndef VERIFYDETAILSDIALOG_H +#define VERIFYDETAILSDIALOG_H + +#include "context.h" +#include "keylist.h" +#include <QDialog> + +class VerifyDetailsDialog : public QDialog +{ + Q_OBJECT +public: + explicit VerifyDetailsDialog(QWidget *parent, GpgME::Context* ctx, KeyList* mKeyList, gpgme_signature_t signature); + +private: + QGroupBox* addDetailBox( gpgme_signature_t signature ); + GpgME::Context* mCtx; + KeyList* mKeyList; + +signals: + +public slots: + +}; + +#endif // VERIFYDETAILSDIALOG_H diff --git a/verifynotification.cpp b/verifynotification.cpp index a13bcc8..eec65f7 100644 --- a/verifynotification.cpp +++ b/verifynotification.cpp @@ -21,10 +21,12 @@ #include "verifynotification.h" -VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) : +VerifyNotification::VerifyNotification(QWidget *parent, GpgME::Context *ctx, KeyList *keyList, gpgme_signature_t sign ) : QWidget(parent) { mCtx = ctx; + mKeyList = keyList; + mSignature = sign; verifyLabel = new QLabel(this); importFromKeyserverAct = new QAction(tr("Import missing key from Keyserver"), this); @@ -93,7 +95,7 @@ void VerifyNotification::showImportAction(bool visible) void VerifyNotification::showVerifyDetails() { - QDialog *verifyDetailsDialog = new QDialog(this); + /*QDialog *verifyDetailsDialog = new QDialog(this); // QLabel *label = new QLabel(*verifyDetailText); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); connect(buttonBox, SIGNAL(rejected()), verifyDetailsDialog, SLOT(close())); @@ -122,5 +124,6 @@ void VerifyNotification::showVerifyDetails() verifyDetailsDialog->show(); //QMessageBox::information(this,tr("Details"),QString(*verifyDetailText), QMessageBox::Ok); - return; + return;*/ + new VerifyDetailsDialog(this, mCtx, mKeyList, mSignature); } diff --git a/verifynotification.h b/verifynotification.h index f641b05..7b79a0d 100644 --- a/verifynotification.h +++ b/verifynotification.h @@ -24,6 +24,7 @@ #include "keyserverimportdialog.h" #include "context.h" +#include "verifydetailsdialog.h" #include <gpgme.h> #include <QWidget> @@ -58,7 +59,7 @@ public: * @param ctx The GPGme-Context * @param parent The parent widget */ - explicit VerifyNotification(GpgME::Context *ctx,QWidget *parent = 0 ); + explicit VerifyNotification(QWidget *parent, GpgME::Context *ctx, KeyList *keyList, gpgme_signature_t sign); /** * @details Set the text and background-color of verify notification. * @@ -104,6 +105,8 @@ private: QPushButton *detailsButton; /** Button shown in verifynotification */ QLabel *verifyLabel; /** Label holding the text shown in verifyNotification */ GpgME::Context *mCtx; /** GpgME Context */ + KeyList *mKeyList; + gpgme_signature_t mSignature; QHBoxLayout *notificationWidgetLayout; /** Layout for verify-notification */ QVBoxLayout *verifyDetailListLayout; /** Layout for verify-detail-dialog */ QVector<QString> verifyDetailStringVector; /** Vector containing the text for labels in verifydetaildialog */ |