diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-02-17 00:07:28 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2013-02-17 00:07:28 +0000 |
commit | f9402e46ae5ae018558e843e68fd2119a42a316c (patch) | |
tree | 0349caa842f07761d9b89cfde0ba313c2a30af8d | |
parent | first step to get verify notification done (diff) | |
download | gpg4usb-f9402e46ae5ae018558e843e68fd2119a42a316c.tar.gz gpg4usb-f9402e46ae5ae018558e843e68fd2119a42a316c.zip |
one more step on notifications
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@1014 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | verifynotification.cpp | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/verifynotification.cpp b/verifynotification.cpp index 2865c80..5e10640 100644 --- a/verifynotification.cpp +++ b/verifynotification.cpp @@ -98,7 +98,7 @@ bool VerifyNotification::slotRefresh() QByteArray text = mTextpage->toPlainText().toUtf8(); mCtx->preventNoDataErr(&text); - int textIsSigned = mCtx->textIsSigned(text); + //int textIsSigned = mCtx->textIsSigned(text); //gpgme_signature_t sign = mCtx->verify(text); @@ -196,6 +196,10 @@ void VerifyNotification::slotVerifyDone(int result) sender()->deleteLater(); Q_ASSERT(verify != NULL); + QByteArray text = mTextpage->toPlainText().toUtf8(); + mCtx->preventNoDataErr(&text); + int textIsSigned = mCtx->textIsSigned(text); + QString verifyLabelText; verify_label_status verifyStatus=VERIFY_ERROR_CRITICAL; @@ -241,6 +245,40 @@ void VerifyNotification::slotVerifyDone(int result) verifyLabelText.append("<"+key.email+">"); } verifyStatus = VERIFY_ERROR_OK; + } else if (msg.startsWith(QLatin1String("UNEXPECTED")) || + msg.startsWith(QLatin1String("NODATA"))) { + + // verifyStatus=VERIFY_ERROR_CRITICAL; + // verifyLabelText.append("no sig found"); + + //textIsSigned = 3; + //verifyStatus=VERIFY_ERROR_CRITICAL; + + verifyLabelText.append("No signature found "); + + /*GpgKey key = mCtx->getKeyById(sign->fpr); + verifyLabelText.append(key.name); + if (!key.email.isEmpty()) { + verifyLabelText.append("<"+key.email+">"); + }*/ + } else if (msg.startsWith(QLatin1String("BADSIG"))) { + + int sigpos = msg.indexOf( ' ', 7); + // name not used...? + QString name = msg.mid(sigpos + 1).replace(QLatin1Char('<'), QLatin1String("<")); + QString id = msg.mid(7, sigpos - 7); + + qDebug() << "id:" << id << "|name:" << name; + + textIsSigned = 3; + verifyStatus=VERIFY_ERROR_CRITICAL; + GpgKey key = mCtx->getKeyById(id); + verifyLabelText.append(key.name); + if (!key.email.isEmpty()) { + verifyLabelText.append("<"+key.email+">"); + } + break; + } } @@ -249,6 +287,25 @@ void VerifyNotification::slotVerifyDone(int result) //getReport(messages); } + switch (textIsSigned) + { + case 3: + { + verifyLabelText.prepend(tr("Error validating signature by: ")); + break; + } + case 2: + { + verifyLabelText.prepend(tr("Text was completely signed by: ")); + break; + } + case 1: + { + verifyLabelText.prepend(tr("Text was partially signed by: ")); + break; + } + } + verifyLabelText.remove(verifyLabelText.length()-1,1); this->setVerifyLabel(verifyLabelText,verifyStatus); |