aboutsummaryrefslogtreecommitdiffstats
path: root/verifydetailsdialog.cpp
diff options
context:
space:
mode:
authorUbbo Veentjer <[email protected]>2017-12-30 23:50:55 +0000
committerUbbo Veentjer <[email protected]>2017-12-30 23:50:55 +0000
commitd327c06ebb5138359e875e8f9a7ac242de45c158 (patch)
tree653664e755ddbfcc00389e2a0075a2a2386536b1 /verifydetailsdialog.cpp
parentrecommit of a06539af3448396f56a44d6859f2a54b787cdd8d (sign files integrated) (diff)
downloadgpg4usb-d327c06ebb5138359e875e8f9a7ac242de45c158.tar.gz
gpg4usb-d327c06ebb5138359e875e8f9a7ac242de45c158.zip
verify files readded (4ecc173307c8c1ed13f28b6955484a484a25402a to 7c874c55c8242baaa770c46718a5c66b3bf8284a)
Diffstat (limited to 'verifydetailsdialog.cpp')
-rw-r--r--verifydetailsdialog.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/verifydetailsdialog.cpp b/verifydetailsdialog.cpp
index 67037e0..fc9ab6c 100644
--- a/verifydetailsdialog.cpp
+++ b/verifydetailsdialog.cpp
@@ -21,12 +21,15 @@
#include "verifydetailsdialog.h"
-VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgME::GpgContext* ctx, KeyList* keyList, QTextEdit *edit) :
+VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgME::GpgContext* ctx, KeyList* keyList, QByteArray* inputData, QByteArray* inputSignature) :
QDialog(parent)
{
mCtx = ctx;
mKeyList = keyList;
- mTextpage = edit;
+ //mTextpage = edit;
+ mInputData = inputData;
+ mInputSignature = inputSignature;
+
this->setWindowTitle(tr("Signaturedetails"));
connect(mCtx, SIGNAL(keyDBChanged()), this, SLOT(slotRefresh()));
@@ -47,10 +50,25 @@ void VerifyDetailsDialog::slotRefresh()
QVBoxLayout *mVboxLayout = new QVBoxLayout(mVbox);
mainLayout->addWidget(mVbox);
+ // Button Box for close button
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
+
// Get signature information of current text
- QByteArray text = mTextpage->toPlainText().toUtf8();
- mCtx->preventNoDataErr(&text);
- gpgme_signature_t sign = mCtx->verify(text);
+ //QByteArray text = mTextpage->toPlainText().toUtf8();
+ //mCtx->preventNoDataErr(&text);
+ gpgme_signature_t sign;
+ if(mInputSignature != 0) {
+ sign = mCtx->verify(mInputData, mInputSignature);
+ } else {
+ sign = mCtx->verify(mInputData);
+ }
+
+ if(sign==0) {
+ mVboxLayout->addWidget(new QLabel(tr("No valid input found")));
+ mVboxLayout->addWidget(buttonBox);
+ return;
+ }
// Get timestamp of signature of current text
QDateTime timestamp;
@@ -59,8 +77,10 @@ void VerifyDetailsDialog::slotRefresh()
// Set the title widget depending on sign status
if(gpg_err_code(sign->status) == GPG_ERR_BAD_SIGNATURE) {
mVboxLayout->addWidget(new QLabel(tr("Error Validating signature")));
+ } else if (mInputSignature != 0) {
+ mVboxLayout->addWidget(new QLabel(tr("File was signed on <br/> %1 by:<br/>").arg(timestamp.toString(Qt::SystemLocaleLongDate))));
} else {
- switch (mCtx->textIsSigned(text))
+ switch (mCtx->textIsSigned(*mInputData))
{
case 2:
{
@@ -79,8 +99,5 @@ void VerifyDetailsDialog::slotRefresh()
mVboxLayout->addWidget(sbox);
}
- // Button Box for close button
- buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
mVboxLayout->addWidget(buttonBox);
}