diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2014-01-03 22:23:23 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2014-01-03 22:23:23 +0000 |
commit | 7b516ff4cf154dee119b24d4bed40c5646f5f10f (patch) | |
tree | 64eaf7a12f05fd881e7e766c7244f1164a103f89 /verifydetailsdialog.cpp | |
parent | branch 0.3.3 (diff) | |
parent | changed digest algo to sha512 (described under http://www.apache.org/dev/open... (diff) | |
download | gpg4usb-7b516ff4cf154dee119b24d4bed40c5646f5f10f.tar.gz gpg4usb-7b516ff4cf154dee119b24d4bed40c5646f5f10f.zip |
moved branch 0.3.2-1 to 0.3.3
git-svn-id: http://cpunk.de/svn/src/gpg4usb/branches/0.3.3@1084 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'verifydetailsdialog.cpp')
-rw-r--r-- | verifydetailsdialog.cpp | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/verifydetailsdialog.cpp b/verifydetailsdialog.cpp index 55fb567..a8e53e6 100644 --- a/verifydetailsdialog.cpp +++ b/verifydetailsdialog.cpp @@ -21,15 +21,12 @@ #include "verifydetailsdialog.h" -VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgME::GpgContext* ctx, KeyList* keyList, QByteArray* inputData, QByteArray* inputSignature) : +VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgME::GpgContext* ctx, KeyList* keyList, QTextEdit *edit) : QDialog(parent) { mCtx = ctx; mKeyList = keyList; - //mTextpage = edit; - mInputData = inputData; - mInputSignature = inputSignature; - + mTextpage = edit; this->setWindowTitle(tr("Signaturedetails")); connect(mCtx, SIGNAL(keyDBChanged()), this, SLOT(refresh())); @@ -50,25 +47,10 @@ void VerifyDetailsDialog::refresh() 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; - 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; - } + QByteArray text = mTextpage->toPlainText().toUtf8(); + mCtx->preventNoDataErr(&text); + gpgme_signature_t sign = mCtx->verify(text); // Get timestamp of signature of current text QDateTime timestamp; @@ -77,19 +59,17 @@ void VerifyDetailsDialog::refresh() // 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(*mInputData)) + switch (mCtx->textIsSigned(text)) { case 2: { - mVboxLayout->addWidget(new QLabel(tr("Text was completely signed on <br/> %1 by:<br/>").arg(timestamp.toString(Qt::SystemLocaleLongDate)))); + mVboxLayout->addWidget(new QLabel(tr("Text was completely signed on\n %1 by:\n").arg(timestamp.toString(Qt::SystemLocaleLongDate)))); break; } case 1: { - mVboxLayout->addWidget(new QLabel(tr("Text was partially signed on <br/> %1 by:<br/>").arg(timestamp.toString(Qt::SystemLocaleLongDate)))); + mVboxLayout->addWidget(new QLabel(tr("Text was partially signed on\n %1 by:\n").arg(timestamp.toString(Qt::SystemLocaleLongDate)))); break; } } @@ -101,5 +81,8 @@ void VerifyDetailsDialog::refresh() mVboxLayout->addWidget(sbox); } + // Button Box for close button + buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); mVboxLayout->addWidget(buttonBox); } |