diff options
-rw-r--r-- | editorpage.cpp | 3 | ||||
-rw-r--r-- | gpgwin.cpp | 34 | ||||
-rw-r--r-- | verifynotification.cpp | 14 | ||||
-rw-r--r-- | verifynotification.h | 3 |
4 files changed, 38 insertions, 16 deletions
diff --git a/editorpage.cpp b/editorpage.cpp index f6c6504..e1e5939 100644 --- a/editorpage.cpp +++ b/editorpage.cpp @@ -60,14 +60,11 @@ void EditorPage::setFilePath(const QString &filePath) void EditorPage::showNotificationWidget(QWidget *widget, const char *className) { widget->setProperty(className,true); - qDebug() << "bla2" << widget->property(className); - mainLayout->addWidget(widget); } void EditorPage::hideNoteByClass(const char *className) { - qDebug() << "length:" << this->children().length(); QList<QWidget *> widgets = findChildren<QWidget *>(); foreach(QWidget * widget, widgets) { @@ -726,9 +726,10 @@ int GpgWin::isSigned(const QByteArray &text) { void GpgWin::verify() { + QByteArray text = edit->curTextPage()->toPlainText().toAscii(); // TODO: toUtf8() here? preventNoDataErr(&text); - + QString *verifyDetailText = new QString(); int textIsSigned = isSigned(text); gpgme_signature_t sign = mCtx->verify(text); @@ -739,6 +740,7 @@ void GpgWin::verify() } VerifyNotification *vn = new VerifyNotification(mCtx,this); + //vn->keysNotInList->clear(); QString verifyLabelText; switch (textIsSigned) { @@ -750,10 +752,11 @@ void GpgWin::verify() bool unknownKeyFound=false; while (sign) { if (gpg_err_code(sign->status) == 9) { - verifyLabelText.append("Key with keyid "); - verifyLabelText.append(sign->fpr); - qDebug() << "sign->fpr:" << sign->fpr; - verifyLabelText.append(" not present."); + verifyLabelText.append("Key with keyid "+QString(sign->fpr)+" not present."); + + verifyDetailText->append("Message signed by: \n"); + verifyDetailText->append("Key with keyid "+QString(sign->fpr)+" not present."); + *vn->keysNotInList << sign->fpr; vn->setProperty("keyNotFound", true); unknownKeyFound=true; @@ -763,19 +766,30 @@ void GpgWin::verify() if ( email == "<>" ) { email=""; } - verifyLabelText.append(name); - verifyLabelText.append(email); - verifyLabelText.append(gpg_strerror(sign->status)); + verifyDetailText->append("Message successfully verified for: \n"); + verifyDetailText->append("Name: "+name+"\n"); + verifyDetailText->append("EMail: "+email); + + verifyLabelText.append(name+email); +// verifyLabelText.append(gpg_strerror(sign->status)); vn->setProperty("keyFound", true); } - verifyLabelText.append(".\n"); - qDebug() << "sig summary: " << sign->summary; + verifyLabelText.append("\n"); + verifyDetailText->append("\nFingerprint: "); + verifyDetailText->append(sign->fpr); + verifyDetailText->append("\nsig status: "); + verifyDetailText->append(gpg_strerror(sign->status)); + verifyDetailText->append("\nsig validity reason: "); +// verifyDetailText->append(sign->validity_reason); + verifyDetailText->append(gpgme_strerror(sign->validity_reason)); + verifyDetailText->append("\n\n"); qDebug() << "sig fingerprint: " << sign->fpr; qDebug() << "sig status: " << sign->status << " - " << gpg_err_code(sign->status) << " - " << gpg_strerror(sign->status); qDebug() << "sig validity: " << sign->validity; qDebug() << "sig validity reason: " << sign->validity_reason << " - " << gpg_err_code(sign->validity_reason) << " - " << gpgme_strerror(sign->validity_reason); sign = sign->next; } + vn->setVerifyDetailText(*verifyDetailText); if (unknownKeyFound) { vn->addImportAction(); } else { diff --git a/verifynotification.cpp b/verifynotification.cpp index b96615a..f7d46fe 100644 --- a/verifynotification.cpp +++ b/verifynotification.cpp @@ -27,9 +27,19 @@ VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) : QPushButton *verifyButton = new QPushButton("Details",this); verifyButton->setMenu(detailMenu); notificationWidgetLayout->addWidget(verifyButton); + + verifyDetailText = new QString(); +} + +void VerifyNotification::setVerifyDetailText (QString text) +{ + verifyDetailText->clear(); + verifyDetailText->append(text); + return; } -void VerifyNotification::importFromKeyserver(){ +void VerifyNotification::importFromKeyserver() +{ KeyServerImportDialog *importDialog =new KeyServerImportDialog(mCtx,this); foreach (QString keyid, *keysNotInList) { importDialog->import(keyid); @@ -55,6 +65,6 @@ void VerifyNotification::removeImportAction() void VerifyNotification::showVerifyDetails() { - QMessageBox::information(this,tr("Details"),tr("key verified"),QMessageBox::Cancel | QMessageBox::Ok); + QMessageBox::information(this,tr("Details"),QString(*verifyDetailText), QMessageBox::Ok); return; } diff --git a/verifynotification.h b/verifynotification.h index d1c5bf9..54e0e22 100644 --- a/verifynotification.h +++ b/verifynotification.h @@ -22,6 +22,7 @@ public: void addImportAction(); void removeImportAction(); QStringList *keysNotInList; + void setVerifyDetailText(QString text); signals: @@ -36,6 +37,6 @@ private: QHBoxLayout *notificationWidgetLayout; QAction *importFromKeyserverAct; QAction *showVerifyDetailsAct; + QString *verifyDetailText; }; - #endif // VERIFYNOTIFICATION_H |