diff options
author | Saturneric <[email protected]> | 2021-10-02 14:08:50 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-10-02 14:16:27 +0000 |
commit | 3c65d087eeee687ac01af2e80f3dd538f9a2c230 (patch) | |
tree | 1e860dc6343c1897e2224a002f2ca44c574381b3 /src/ui/VerifyDetailsDialog.cpp | |
parent | The basic functions of the core pass the test. (diff) | |
download | GpgFrontend-3c65d087eeee687ac01af2e80f3dd538f9a2c230.tar.gz GpgFrontend-3c65d087eeee687ac01af2e80f3dd538f9a2c230.zip |
UI Framework Modified.
Diffstat (limited to 'src/ui/VerifyDetailsDialog.cpp')
-rw-r--r-- | src/ui/VerifyDetailsDialog.cpp | 93 |
1 files changed, 51 insertions, 42 deletions
diff --git a/src/ui/VerifyDetailsDialog.cpp b/src/ui/VerifyDetailsDialog.cpp index 3462ad69..f06c31a4 100644 --- a/src/ui/VerifyDetailsDialog.cpp +++ b/src/ui/VerifyDetailsDialog.cpp @@ -24,60 +24,69 @@ #include "ui/VerifyDetailsDialog.h" -VerifyDetailsDialog::VerifyDetailsDialog(QWidget *parent, GpgFrontend::GpgContext *ctx, KeyList *keyList, gpg_error_t error, - gpgme_verify_result_t result) : - QDialog(parent), mCtx(ctx), mKeyList(keyList), sign(result->signatures), error(error) { +namespace GpgFrontend::UI { +VerifyDetailsDialog::VerifyDetailsDialog(QWidget* parent, + KeyList* keyList, + GpgError error, + GpgVerifyResult result) + : QDialog(parent), + mKeyList(keyList), + mResult(std::move(result)), + error(error) { + this->setWindowTitle(tr("Signature Details")); - this->setWindowTitle(tr("Signature Details")); + mainLayout = new QHBoxLayout(); + this->setLayout(mainLayout); - connect(mCtx, SIGNAL(signalKeyInfoChanged()), this, SLOT(slotRefresh())); - mainLayout = new QHBoxLayout(); - this->setLayout(mainLayout); + slotRefresh(); - slotRefresh(); - - this->exec(); + this->exec(); } void VerifyDetailsDialog::slotRefresh() { + mVbox = new QWidget(); + auto* mVboxLayout = new QVBoxLayout(mVbox); + mainLayout->addWidget(mVbox); - mVbox = new QWidget(); - auto *mVboxLayout = new QVBoxLayout(mVbox); - mainLayout->addWidget(mVbox); + // Button Box for close button + buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); - // Button Box for close button - buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); + mVboxLayout->addWidget(new QLabel(tr("Status: ") + gpgme_strerror(error))); - mVboxLayout->addWidget(new QLabel(tr("Status: ") + gpgme_strerror(error))); + auto sign = mResult->signatures; - if (sign == nullptr) { - mVboxLayout->addWidget(new QLabel(tr("No valid input found"))); - mVboxLayout->addWidget(buttonBox); - return; - } + if (sign == nullptr) { + mVboxLayout->addWidget(new QLabel(tr("No valid input found"))); + mVboxLayout->addWidget(buttonBox); + return; + } - // Get timestamp of signature of current text - QDateTime timestamp; - timestamp.setTime_t(sign->timestamp); + // Get timestamp of signature of current text + QDateTime timestamp; + timestamp.setTime_t(sign->timestamp); - // 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 != nullptr) { - mVboxLayout->addWidget(new QLabel( - tr("File was signed on %1 <br/> It Contains:<br/><br/>").arg(QLocale::system().toString(timestamp)))); - } else { - mVboxLayout->addWidget(new QLabel(tr("Signed on %1 <br/> It Contains:<br /><br/>").arg( - QLocale::system().toString(timestamp)))); - } - // Add informationbox for every single key - while (sign) { - auto *sbox = new VerifyKeyDetailBox(this, mCtx, mKeyList, sign); - sign = sign->next; - mVboxLayout->addWidget(sbox); - } + // 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 != nullptr) { + mVboxLayout->addWidget( + new QLabel(tr("File was signed on %1 <br/> It Contains:<br/><br/>") + .arg(QLocale::system().toString(timestamp)))); + } else { + mVboxLayout->addWidget( + new QLabel(tr("Signed on %1 <br/> It Contains:<br /><br/>") + .arg(QLocale::system().toString(timestamp)))); + } + // Add information box for every single key + while (sign) { + auto* sign_box = new VerifyKeyDetailBox(this, mKeyList, sign); + sign = sign->next; + mVboxLayout->addWidget(sign_box); + } - mVboxLayout->addWidget(buttonBox); + mVboxLayout->addWidget(buttonBox); } + +} // namespace GpgFrontend::UI
\ No newline at end of file |