diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-09-14 21:08:10 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-09-14 21:08:10 +0000 |
commit | 116a832ed24908061c43c813e64c68ac96284070 (patch) | |
tree | 82de0fa271c590aae20795671cbff8cd177999e5 | |
parent | set modal and parent for key details dialog. left margin for verifynotificati... (diff) | |
download | gpg4usb-116a832ed24908061c43c813e64c68ac96284070.tar.gz gpg4usb-116a832ed24908061c43c813e64c68ac96284070.zip |
bautify fingerprints in verifydetails and verifynotification
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@533 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | gpgwin.cpp | 19 | ||||
-rw-r--r-- | gpgwin.h | 7 | ||||
-rw-r--r-- | verifydetailsdialog.cpp | 13 | ||||
-rw-r--r-- | verifydetailsdialog.h | 6 |
5 files changed, 30 insertions, 17 deletions
@@ -17,6 +17,8 @@ Release 0.3.1 - check class / includes [DONE] - keydetailsdialog should have a parent [DONE] - Verifynotification margin left [DONE] +- remove doubled functions (e.g. beautifyfingerprint and keymgmt functions like import) +- take care of warnings in compiling BUGS: - Sometimes two or more stars are shown at modified documents @@ -724,7 +724,6 @@ void GpgWin::verify() } VerifyNotification *vn = new VerifyNotification(this, mCtx, mKeyList, sign); - //VerifyDetailsDialog *vd = new VerifyDetailsDialog(this, mCtx, mKeyList, sign); //vn->keysNotInList->clear(); QString verifyLabelText; bool unknownKeyFound=false; @@ -736,10 +735,9 @@ void GpgWin::verify() case GPG_ERR_NO_PUBKEY: { verifyStatus=VERIFY_ERROR_WARN; - verifyLabelText.append(tr("Key not present with Fingerprint: ")+QString(sign->fpr)); + verifyLabelText.append(tr("Key not present with Fingerprint: ")+beautifyFingerprint(QString(sign->fpr))); *vn->keysNotInList << sign->fpr; unknownKeyFound=true; - vn->addVerifyDetailLabel(tr("Key not present in keylist: ")+QString(sign->fpr),VERIFY_ERROR_WARN, false); break; } case GPG_ERR_NO_ERROR: @@ -750,17 +748,12 @@ void GpgWin::verify() if (!email.isEmpty()) { verifyLabelText.append("<"+email+">"); } - vn->addVerifyDetailLabel(tr("Name: ")+name+"\n"+tr("EMail: ")+email+"\n"+tr("Fingerprint: ")+QString(sign->fpr),VERIFY_ERROR_OK, false); break; } default: { verifyStatus=VERIFY_ERROR_WARN; - vn->addVerifyDetailLabel(tr("Key with Fingerprint: ")+ - QString(sign->fpr)+"\n"+tr("Signature status: ")+gpg_strerror(sign->status)+"\n" - +tr("Signature validity reason: ")+QString(gpgme_strerror(sign->validity_reason)), - VERIFY_ERROR_WARN, false); - verifyLabelText.append(tr("Error for key with fingerprint ")+QString(sign->fpr)); + verifyLabelText.append(tr("Error for key with fingerprint ")+beautifyFingerprint(QString(sign->fpr))); break; } } @@ -888,3 +881,11 @@ void GpgWin::cleanDoubleLinebreaks() { content.replace("\n\n", "\n"); edit->fillTextEditWithText(content); } + +QString GpgWin::beautifyFingerprint(QString fingerprint){ + uint len = fingerprint.length(); + if ((len > 0) && (len % 4 == 0)) + for (uint n = 0; 4 *(n + 1) < len; ++n) + fingerprint.insert(5 * n + 4, ' '); + return fingerprint; +} @@ -251,6 +251,13 @@ private: */ int isSigned(const QByteArray &text); + /** + * @details Put a space after every four chars of fingerprint. + * + * @param fingerprint + */ + QString beautifyFingerprint(QString fingerprint); + TextEdit *edit; /** TODO */ QMenu *fileMenu; /** Submenu for file-operations*/ QMenu *editMenu; /** Submenu for text-operations*/ diff --git a/verifydetailsdialog.cpp b/verifydetailsdialog.cpp index 02090fc..accc2bf 100644 --- a/verifydetailsdialog.cpp +++ b/verifydetailsdialog.cpp @@ -62,7 +62,7 @@ QGroupBox* VerifyDetailsDialog::addDetailBox( gpgme_signature_t signature ) { 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(beautifyFingerprint(signature->fpr)), 2, 1); grid->addWidget(new QLabel("OK"), 3, 1); @@ -79,10 +79,17 @@ QGroupBox* VerifyDetailsDialog::addDetailBox( gpgme_signature_t signature ) { } } - - QGroupBox *sbox = new QGroupBox(tr("Key")); sbox->setLayout(grid); return sbox; } + +QString VerifyDetailsDialog::beautifyFingerprint(QString fingerprint) +{ + uint len = fingerprint.length(); + if ((len > 0) && (len % 4 == 0)) + for (uint n = 0; 4 *(n + 1) < len; ++n) + fingerprint.insert(5 * n + 4, ' '); + return fingerprint; +} diff --git a/verifydetailsdialog.h b/verifydetailsdialog.h index b5978fe..0678ad0 100644 --- a/verifydetailsdialog.h +++ b/verifydetailsdialog.h @@ -15,11 +15,7 @@ private: QGroupBox* addDetailBox( gpgme_signature_t signature ); GpgME::Context* mCtx; KeyList* mKeyList; - -signals: - -public slots: - + QString beautifyFingerprint(QString fingerprint); }; #endif // __VERIFYDETAILSDIALOG_H__ |