aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/details/VerifyDetailsDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/details/VerifyDetailsDialog.cpp')
-rw-r--r--src/ui/dialog/details/VerifyDetailsDialog.cpp59
1 files changed, 25 insertions, 34 deletions
diff --git a/src/ui/dialog/details/VerifyDetailsDialog.cpp b/src/ui/dialog/details/VerifyDetailsDialog.cpp
index 307d404a..5981a8ef 100644
--- a/src/ui/dialog/details/VerifyDetailsDialog.cpp
+++ b/src/ui/dialog/details/VerifyDetailsDialog.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2021 Saturneric
+ * Copyright (C) 2021 Saturneric <[email protected]>
*
* This file is part of GpgFrontend.
*
@@ -20,7 +20,7 @@
* the gpg4usb project, which is under GPL-3.0-or-later.
*
* All the source code of GpgFrontend was modified and released by
- * Saturneric<[email protected]> starting on May 12, 2021.
+ * Saturneric <[email protected]> starting on May 12, 2021.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
@@ -28,14 +28,15 @@
#include "VerifyDetailsDialog.h"
-#include <boost/format.hpp>
+#include "core/GpgModel.h"
+#include "ui/widgets/VerifyKeyDetailBox.h"
namespace GpgFrontend::UI {
VerifyDetailsDialog::VerifyDetailsDialog(QWidget* parent, GpgError error,
GpgVerifyResult result)
- : QDialog(parent), m_result_(std::move(result)), error_(error) {
- this->setWindowTitle(_("Signatures Details"));
+ : QDialog(parent), m_result_(result), error_(error) {
+ this->setWindowTitle(tr("Signatures Details"));
main_layout_ = new QHBoxLayout();
this->setLayout(main_layout_);
@@ -47,7 +48,7 @@ VerifyDetailsDialog::VerifyDetailsDialog(QWidget* parent, GpgError error,
void VerifyDetailsDialog::slot_refresh() {
m_vbox_ = new QWidget();
- auto* mVboxLayout = new QVBoxLayout(m_vbox_);
+ auto* m_vbox_layout = new QVBoxLayout(m_vbox_);
main_layout_->addWidget(m_vbox_);
// Button Box for close button
@@ -55,47 +56,37 @@ void VerifyDetailsDialog::slot_refresh() {
connect(button_box_, &QDialogButtonBox::rejected, this,
&VerifyDetailsDialog::close);
- auto sign = m_result_->signatures;
+ auto signatures = m_result_.GetSignature();
- if (sign == nullptr) {
- mVboxLayout->addWidget(new QLabel(_("No valid input found")));
- mVboxLayout->addWidget(button_box_);
+ if (signatures.empty()) {
+ m_vbox_layout->addWidget(new QLabel(tr("No valid input found")));
+ m_vbox_layout->addWidget(button_box_);
return;
}
// Get timestamp of signature of current text
- QDateTime timestamp;
-#ifdef GPGFRONTEND_GUI_QT6
- timestamp.setSecsSinceEpoch(sign->timestamp);
-#else
- timestamp.setTime_t(sign->timestamp);
-#endif
+ QDateTime timestamp = signatures[0].GetCreateTime();
// Set the title widget depending on sign status
- if (gpg_err_code(sign->status) == GPG_ERR_BAD_SIGNATURE) {
- mVboxLayout->addWidget(new QLabel(_("Error Validating signature")));
+ if (gpg_err_code(signatures[0].GetStatus()) == GPG_ERR_BAD_SIGNATURE) {
+ m_vbox_layout->addWidget(new QLabel(tr("Error Validating signature")));
} else if (input_signature_ != nullptr) {
- const auto info = (boost::format(_("File was signed on %1%")) %
- QLocale::system().toString(timestamp).toStdString())
- .str() +
- "<br/>" + _("It Contains") + ": " + "<br/><br/>";
- mVboxLayout->addWidget(new QLabel(info.c_str()));
+ const auto info =
+ tr("File was signed on %1").arg(QLocale().toString(timestamp)) +
+ "<br/>" + tr("It Contains") + ": " + "<br/><br/>";
+ m_vbox_layout->addWidget(new QLabel(info));
} else {
- const auto info = (boost::format(_("Signed on %1%")) %
- QLocale::system().toString(timestamp).toStdString())
- .str() +
- "<br/>" + _("It Contains") + ": " + "<br/><br/>";
- mVboxLayout->addWidget(new QLabel(info.c_str()));
+ const auto info = tr("Signed on %1").arg(QLocale().toString(timestamp)) +
+ "<br/>" + tr("It Contains") + ": " + "<br/><br/>";
+ m_vbox_layout->addWidget(new QLabel(info));
}
// Add information box for every single key
- while (sign) {
- GpgSignature signature(sign);
- auto* sign_box = new VerifyKeyDetailBox(signature, this);
- sign = sign->next;
- mVboxLayout->addWidget(sign_box);
+ for (const auto& signature : signatures) {
+ auto* detail_box = new VerifyKeyDetailBox(signature, this);
+ m_vbox_layout->addWidget(detail_box);
}
- mVboxLayout->addWidget(button_box_);
+ m_vbox_layout->addWidget(button_box_);
}
} // namespace GpgFrontend::UI \ No newline at end of file