diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-09-08 21:00:02 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-09-08 21:00:02 +0000 |
commit | 747751c6e6fee5495a43f2f60b985fbf96cb2550 (patch) | |
tree | 62f565e82cddcfc50d75ac40fb559ae7830f85a1 | |
parent | only use private keys to sign and print adequate message, if no private key i... (diff) | |
download | gpg4usb-747751c6e6fee5495a43f2f60b985fbf96cb2550.tar.gz gpg4usb-747751c6e6fee5495a43f2f60b985fbf96cb2550.zip |
beautified verifydetail-dialog and create doxygen-docu for private methods
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@528 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | Doxyfile | 4 | ||||
-rw-r--r-- | gpgwin.cpp | 64 |
2 files changed, 42 insertions, 26 deletions
@@ -314,12 +314,12 @@ EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. -EXTRACT_PRIVATE = NO +EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. -EXTRACT_STATIC = NO +EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. @@ -731,7 +731,7 @@ void GpgWin::verify() verify_label_status verifyStatus=VERIFY_ERROR_OK; QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here? preventNoDataErr(&text); - QString *verifyDetailText = new QString(); + QString verifyDetailText; int textIsSigned = isSigned(text); gpgme_signature_t sign = mCtx->verify(text); @@ -744,15 +744,6 @@ void GpgWin::verify() VerifyNotification *vn = new VerifyNotification(mCtx,this); //vn->keysNotInList->clear(); QString verifyLabelText; - switch (textIsSigned) - { - case 2: verifyLabelText=tr("Text is completly signed by the following key(s): "); - verifyDetailText->append(tr("Text is completly signed by the following key(s): ")+" \n\n"); - break; - case 1: verifyLabelText=tr("Text is partially signed by the following key(s): "); - verifyDetailText->append(tr("Text is partially signed by the following key(s): ")+" \n\n"); - break; - } bool unknownKeyFound=false; while (sign) { @@ -760,20 +751,22 @@ void GpgWin::verify() switch (gpg_err_code(sign->status)) { case GPG_ERR_NO_PUBKEY: + { verifyStatus=VERIFY_ERROR_WARN; verifyLabelText.append(tr("Key not present with Fingerprint: ")+QString(sign->fpr)); - *vn->keysNotInList << sign->fpr; vn->setProperty("keyNotFound", true); unknownKeyFound=true; - verifyDetailText->append(tr("Key not present:")); - //verifyDetailText->append(tr("Signature status: ")+gpg_strerror(sign->status)+"\nsig validity reason: "+QString(gpgme_strerror(sign->validity_reason))+"\n"); + verifyDetailText.append(tr("Key not present in keylist: ")+QString(sign->fpr)+"\n\n"); break; - default: + } + case GPG_ERR_NO_ERROR: + { + qDebug() << "GPG_ERR_NO_ERR"; QString name = mKeyList->getKeyNameByFpr(sign->fpr); QString email =mKeyList->getKeyEmailByFpr(sign->fpr); - qDebug() << email; - verifyDetailText->append(tr("Name: ")+name+"\n"+tr("EMail: ")+email); + verifyDetailText.append(tr("Name: ")+name+"\n"+tr("EMail: ")+email+"\n"); + verifyDetailText.append(tr("Fingerprint: ")+QString(sign->fpr)+"\n\n"); verifyLabelText.append(name); if (!email.isEmpty()) { verifyLabelText.append("<"+email+">"); @@ -781,7 +774,16 @@ void GpgWin::verify() vn->setProperty("keyFound", true); break; } - verifyDetailText->append(tr("\nFingerprint: ")+QString(sign->fpr)+"\n\n"); + default: + { + qDebug() << "switch default"; + verifyDetailText.append(tr("Key with Fingerprint: ")+QString(sign->fpr)+"\n"); + verifyDetailText.append(tr("Signature status: ")+gpg_strerror(sign->status)+"\n"); + verifyDetailText.append(tr("Signature validity reason: ")+QString(gpgme_strerror(sign->validity_reason))+"\n"); + verifyLabelText.append(tr("Error for key with fingerprint ")+QString(sign->fpr)); + break; + } + } verifyLabelText.append("\n"); qDebug() << "sig fingerprint: " << sign->fpr; qDebug() << "sig status: " << sign->status << " - " << gpg_err_code(sign->status) << " - " << gpg_strerror(sign->status); @@ -790,19 +792,33 @@ void GpgWin::verify() qDebug() << "timestamp: " << sign->timestamp; sign = sign->next; } - verifyDetailText->prepend("Text was signed on: "+timestamp.toString(Qt::SystemLocaleShortDate)+"\n\n"); - vn->setVerifyDetailText(*verifyDetailText); - // If an unknown key is found, enable the importfromkeyserveraction - if (unknownKeyFound) { - vn->showImportAction(true); - } else { - vn->showImportAction(false); + switch (textIsSigned) + { + case 2: + { + verifyLabelText.prepend(tr("Text is completly signed by: ")); + verifyDetailText.prepend(tr("Text was completly signed on %1 by:\n\n").arg(timestamp.toString(Qt::SystemLocaleShortDate))); + break; } + case 1: + { + verifyLabelText.prepend(tr("Text is partially signed by: ")); + verifyDetailText.prepend(tr("Text was partially signed on %1 by:\n\n").arg(timestamp.toString(Qt::SystemLocaleShortDate))); + break; + } + } + + // If an unknown key is found, enable the importfromkeyserveraction + vn->showImportAction(unknownKeyFound); // Remove the last linebreak verifyLabelText.remove(verifyLabelText.length()-1,1); + verifyDetailText.remove(verifyDetailText.length()-1,1); + vn->setVerifyLabel(verifyLabelText,verifyStatus); + vn->setVerifyDetailText(verifyDetailText); + edit->curPage()->showNotificationWidget(vn, "verifyNotification"); } |