From 5b24ce3f27531da4cc63707c5010e746f7c5dcef Mon Sep 17 00:00:00 2001 From: ubbo Date: Sun, 30 Sep 2012 14:42:54 +0000 Subject: more verifyparsing from kgpgme, kind of works in verifydetailsdialog now git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@990 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgcontext.cpp | 29 ++++++++++++++++++++++------- gpgcontext.h | 2 +- verifydetailsdialog.cpp | 2 +- verifykeydetailbox.cpp | 2 +- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/gpgcontext.cpp b/gpgcontext.cpp index abc9d03..959e8e9 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -173,7 +173,7 @@ KgpgCore::KgpgKey GpgContext::getKeyDetails(QString uid) { GpgKeyList GpgContext::listKeys() { - KgpgInterface::readPublicKeys(); + //KgpgInterface::readPublicKeys(); GpgKeyList keys; @@ -313,12 +313,11 @@ sigTimeMessage(const QString &sigtime) if (!stamp.isValid()) return QString(); -/* return tr("first argument is formatted date, second argument is formatted time", - "The signature was created at %1 %2", - KGlobal::locale()->formatDate(stamp.date(), KLocale::LongDate), - KGlobal::locale()->formatTime(stamp.time(), KLocale::LongDate)) + - QLatin1String("
");*/ - return "todo"; + return QObject::tr("The signature was created at %1 %2") + .arg(stamp.date().toString()) + .arg(stamp.time().toString() + QLatin1String("
") + , "first argument is formatted date, second argument is formatted time"); + } QString GpgContext::getReport(const QStringList &log) @@ -346,6 +345,22 @@ QString GpgContext::getReport(const QStringList &log) const QStringList vsig = msg.mid(9).split(QLatin1Char(' '), QString::SkipEmptyParts); Q_ASSERT(vsig.count() >= 10); + //result += vsig[9]; + + GpgKey key = getKeyByFpr(vsig[9]); + + // ignore for now if this is signed with the primary id (vsig[0] == vsig[9]) or not + if (key.email.isEmpty()) { + result += tr("Good signature from:
%1
Key ID: %2
") + .arg(key.name).arg(vsig[9]); + } else { + result += tr("Good signature from: NAME , Key ID: HEXID", + "Good signature from:
%1 <%2>
Key ID: %3
") + .arg(key.name).arg(key.email).arg(vsig[9]); + } + result += sigTimeMessage(vsig[2]); + + /* const KGpgKeyNode *node = model->findKeyNode(vsig[9]); if (node != NULL) { diff --git a/gpgcontext.h b/gpgcontext.h index d04034b..dc0edee 100644 --- a/gpgcontext.h +++ b/gpgcontext.h @@ -137,7 +137,7 @@ public: int textIsSigned(const QByteArray &text); static QString beautifyFingerprint(QString fingerprint); - static QString getReport(const QStringList &log); + QString getReport(const QStringList &log); signals: void keyDBChanged(); diff --git a/verifydetailsdialog.cpp b/verifydetailsdialog.cpp index a45521d..e603712 100644 --- a/verifydetailsdialog.cpp +++ b/verifydetailsdialog.cpp @@ -119,7 +119,7 @@ void VerifyDetailsDialog::slotVerifyDone(int result) { qDebug() << "vm: " << mess; }*/ - QString report = GpgME::GpgContext::getReport(verify->getMessages()); + QString report = mCtx->getReport(verify->getMessages()); mVboxLayout->addWidget(new QLabel(report)); diff --git a/verifykeydetailbox.cpp b/verifykeydetailbox.cpp index 521d122..103be21 100644 --- a/verifykeydetailbox.cpp +++ b/verifykeydetailbox.cpp @@ -27,7 +27,7 @@ VerifyKeyDetailBox::VerifyKeyDetailBox(QWidget *parent, GpgME::GpgContext* ctx, this->mCtx = ctx; this->mKeyList = keyList; //this->fpr=signature->fpr; - qDebug() << "dbsig report: " << GpgME::GpgContext::getReport(signature.getMessages()); + //qDebug() << "dbsig report: " << GpgME::GpgContext::getReport(signature.getMessages()); QGridLayout *grid = new QGridLayout(); // TODO -- cgit v1.2.3