diff options
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | gpgwin.cpp | 7 | ||||
-rw-r--r-- | verifynotification.cpp | 26 | ||||
-rw-r--r-- | verifynotification.h | 6 |
4 files changed, 38 insertions, 3 deletions
@@ -33,7 +33,7 @@ attachments: - key should blink short in keylist after import - show keys which verified message in different colour - css - +- save the last used directory in open file dialog BUGS: - Sometimes two or more stars are shown at modified documents @@ -747,6 +747,7 @@ void GpgWin::verify() case 1: verifyLabelText="Message is partially signed by: "; break; } + bool unknownKeyFound=false; while (sign) { if (gpg_err_code(sign->status) == 9) { verifyLabelText.append("Key with keyid "); @@ -755,6 +756,7 @@ void GpgWin::verify() verifyLabelText.append(" not present."); *vn->keysNotInList << sign->fpr; vn->setProperty("keyNotFound", true); + unknownKeyFound=true; } else { QString name = mKeyList->getKeyNameByFpr(sign->fpr); QString email = "<"+mKeyList->getKeyEmailByFpr(sign->fpr)+">"; @@ -774,6 +776,11 @@ void GpgWin::verify() qDebug() << "sig validity reason: " << sign->validity_reason << " - " << gpg_err_code(sign->validity_reason) << " - " << gpgme_strerror(sign->validity_reason); sign = sign->next; } + if (unknownKeyFound) { + vn->addImportAction(); + } else { + vn->removeImportAction(); + } // Remove the last linebreak verifyLabelText.remove(verifyLabelText.length()-1,1); diff --git a/verifynotification.cpp b/verifynotification.cpp index b9db071..b96615a 100644 --- a/verifynotification.cpp +++ b/verifynotification.cpp @@ -13,11 +13,16 @@ VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) : this->setLayout(notificationWidgetLayout); - QAction *importFromKeyserverAct = new QAction(tr("Import missing key from Keyserver"), this); + importFromKeyserverAct = new QAction(tr("Import missing key from Keyserver"), this); connect(importFromKeyserverAct, SIGNAL(triggered()), this, SLOT(importFromKeyserver())); - QMenu *detailMenu = new QMenu(this); + showVerifyDetailsAct = new QAction(tr("Show detailed verify information"), this); + connect(showVerifyDetailsAct, SIGNAL(triggered()), this, SLOT(showVerifyDetails())); + + detailMenu = new QMenu(this); + detailMenu->addAction(showVerifyDetailsAct); detailMenu->addAction(importFromKeyserverAct); + importFromKeyserverAct->setVisible(false); keysNotInList = new QStringList(); QPushButton *verifyButton = new QPushButton("Details",this); verifyButton->setMenu(detailMenu); @@ -36,3 +41,20 @@ void VerifyNotification::setVerifyLabel(QString text) verifyLabel->setText(text); return; } + +void VerifyNotification::addImportAction() +{ + importFromKeyserverAct->setVisible(true); + return; +} +void VerifyNotification::removeImportAction() +{ + importFromKeyserverAct->setVisible(false); + return; +} + +void VerifyNotification::showVerifyDetails() +{ + QMessageBox::information(this,tr("Details"),tr("key verified"),QMessageBox::Cancel | QMessageBox::Ok); + return; +} diff --git a/verifynotification.h b/verifynotification.h index 2c069b7..d1c5bf9 100644 --- a/verifynotification.h +++ b/verifynotification.h @@ -19,17 +19,23 @@ class VerifyNotification : public QWidget public: explicit VerifyNotification(GpgME::Context *ctx,QWidget *parent = 0 ); void setVerifyLabel(QString text); + void addImportAction(); + void removeImportAction(); QStringList *keysNotInList; signals: public slots: void importFromKeyserver(); + void showVerifyDetails(); private: + QMenu *detailMenu; QLabel *verifyLabel; GpgME::Context *mCtx; QHBoxLayout *notificationWidgetLayout; + QAction *importFromKeyserverAct; + QAction *showVerifyDetailsAct; }; #endif // VERIFYNOTIFICATION_H |