Commit e3f5df31 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid
Browse files

Signature: Don't show "Reason: Not Available" if there's no signing reason

Reason in this context is
    (Optional) The reason for the signing, such as ( I agree ... ).

But since it's not really obvious what it means, showing
  Reason: Not Available
is probably more weird to users than simply not showing it at all
parent ff5f4cbc
Pipeline #59255 skipped
......@@ -141,8 +141,11 @@ void SignatureModelPrivate::notifySetup(const QVector<Okular::Page *> &pages, in
auto childItem2 = new SignatureItem(parentItem, nullptr, SignatureItem::SigningTime, currentPage);
childItem2->displayString = i18n("Signing Time: %1", info.signingTime().toString(Qt::DefaultLocaleLongDate));
auto childItem3 = new SignatureItem(parentItem, nullptr, SignatureItem::Reason, currentPage);
childItem3->displayString = i18n("Reason: %1", !info.reason().isEmpty() ? info.reason() : i18n("Not Available"));
const QString reason = info.reason();
if (!reason.isEmpty()) {
auto childItem3 = new SignatureItem(parentItem, nullptr, SignatureItem::Reason, currentPage);
childItem3->displayString = i18n("Reason: %1", reason);
}
auto childItem4 = new SignatureItem(parentItem, sf, SignatureItem::FieldInfo, currentPage);
childItem4->displayString = i18n("Field: %1 on page %2", sf->name(), currentPage + 1);
......
......@@ -46,7 +46,7 @@ SignaturePropertiesDialog::SignaturePropertiesDialog(Okular::Document *doc, cons
const QString signerName = getValidDisplayString(signatureInfo.signerName());
const QString signingTime = getValidDisplayString(signatureInfo.signingTime().toString(Qt::DefaultLocaleLongDate));
const QString signingLocation = getValidDisplayString(signatureInfo.location());
const QString signingReason = getValidDisplayString(signatureInfo.reason());
const QString signingReason = signatureInfo.reason();
// signature validation status
QString modificationSummary;
......@@ -76,7 +76,9 @@ SignaturePropertiesDialog::SignaturePropertiesDialog(Okular::Document *doc, cons
extraInfoFormLayout->setLabelAlignment(Qt::AlignLeft);
extraInfoFormLayout->addRow(i18n("Signed By:"), new QLabel(signerName));
extraInfoFormLayout->addRow(i18n("Signing Time:"), new QLabel(signingTime));
extraInfoFormLayout->addRow(i18n("Reason:"), new QLabel(signingReason));
if (!signingReason.isEmpty()) {
extraInfoFormLayout->addRow(i18n("Reason:"), new QLabel(signingReason));
}
extraInfoFormLayout->addRow(i18n("Location:"), new QLabel(signingLocation));
// keep width of column 1 same
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment