aboutsummaryrefslogtreecommitdiffstats
path: root/verifydetailsdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--verifydetailsdialog.cpp58
1 files changed, 40 insertions, 18 deletions
diff --git a/verifydetailsdialog.cpp b/verifydetailsdialog.cpp
index 9a18090..aec1f73 100644
--- a/verifydetailsdialog.cpp
+++ b/verifydetailsdialog.cpp
@@ -21,27 +21,59 @@
#include "verifydetailsdialog.h"
-VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgME::Context* ctx, KeyList* keyList, gpgme_signature_t signature) :
+VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgME::Context* ctx, KeyList* keyList, QPlainTextEdit *edit) :
QDialog(parent)
{
mCtx = ctx;
mKeyList = keyList;
+ mTextpage = edit;
+ this->setWindowTitle(tr("Signaturedetails"));
connect(mCtx, SIGNAL(keyDBChanged()), this, SLOT(refresh()));
mVbox = new QVBoxLayout();
+ this->setLayout(mVbox);
+ refresh();
+
+ this->exec();
+}
- // Timestamp of creation of the signature
+void VerifyDetailsDialog::refresh()
+{
+ // At first claer all children widgets
+ QList<QLabel *> allChildren = mVbox->findChildren<QLabel *>();
+ foreach (QLabel *label,allChildren) {
+ label->close();
+ }
+
+ // Get signature information of current text
+ QByteArray text = mTextpage->toPlainText().toAscii(); // TODO: toUtf8() here?
+ mCtx->preventNoDataErr(&text);
+ gpgme_signature_t sign = mCtx->verify(text);
+
+ // Get timestamp of signature of current text
QDateTime timestamp;
- timestamp.setTime_t(signature->timestamp);
+ timestamp.setTime_t(sign->timestamp);
- // Information for general verify information
- mVbox->addWidget(new QLabel(tr("Text was completly signed on %1 by:\n").arg(timestamp.toString(Qt::SystemLocaleShortDate))));
+ // Set the title widget depending on sign status
+ switch (mCtx->textIsSigned(text))
+ {
+ case 2:
+ {
+ mVbox->addWidget(new QLabel(tr("Text was completly signed on %1 by:\n").arg(timestamp.toString(Qt::SystemLocaleShortDate))));
+ break;
+ }
+ case 1:
+ {
+ mVbox->addWidget(new QLabel(tr("Text was partially signed on %1 by:\n").arg(timestamp.toString(Qt::SystemLocaleShortDate))));
+ break;
+ }
+ }
// Add informationbox for every single key
- while (signature) {
- VerifyKeyDetailBox *sbox = new VerifyKeyDetailBox(this,mCtx,mKeyList,signature);
- signature = signature->next;
+ while (sign) {
+ VerifyKeyDetailBox *sbox = new VerifyKeyDetailBox(this,mCtx,mKeyList,sign);
+ sign = sign->next;
mVbox->addWidget(sbox);
}
@@ -49,14 +81,4 @@ VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgME::Context* ctx, K
buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
mVbox->addWidget(buttonBox);
-
- this->setLayout(mVbox);
- this->setWindowTitle(tr("Signaturedetails"));
- this->show();
- this->exec();
-}
-
-void VerifyDetailsDialog::refresh()
-{
- qDebug() << "refresh detail dialog";
}