Skip to content

Commit f8488f7

Browse files
committed
Show signature type in signature pane
1 parent 61c8f07 commit f8488f7

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

core/form.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,8 @@ class OKULARCORE_EXPORT FormFieldSignature : public FormField
567567
AdbePkcs7detached,
568568
EtsiCAdESdetached,
569569
UnknownType,
570-
UnsignedSignature ///< The signature field has not been signed yet. @since 22.04
570+
UnsignedSignature, ///< The signature field has not been signed yet. @since 22.04
571+
G10cPgpSignatureDetached, ///< Poppler/okular extension of pgp signature \since 25.04
571572
};
572573

573574
~FormFieldSignature() override;

generators/poppler/formfields.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,14 @@ PopplerFormFieldSignature::SignatureType PopplerFormFieldSignature::signatureTyp
488488
return Okular::FormFieldSignature::EtsiCAdESdetached;
489489
case Poppler::FormFieldSignature::UnsignedSignature:
490490
return Okular::FormFieldSignature::UnsignedSignature;
491-
default:
491+
case Poppler::FormFieldSignature::UnknownSignatureType:
492492
return Okular::FormFieldSignature::UnknownType;
493+
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(25, 02, 90)
494+
case Poppler::FormFieldSignature::G10cPgpSignatureDetached:
495+
return Okular::FormFieldSignature::G10cPgpSignatureDetached;
496+
#endif
493497
}
498+
return Okular::FormFieldSignature::UnknownType;
494499
}
495500

496501
Okular::SignatureInfo PopplerFormFieldSignature::signatureInfo() const

gui/signaturemodel.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "core/signatureutils.h"
2424

2525
struct SignatureItem {
26-
enum DataType { Root, RevisionInfo, ValidityStatus, CertificateStatus, SigningTime, Reason, Location, FieldInfo };
26+
enum DataType { Root, RevisionInfo, ValidityStatus, CertificateStatus, SigningTime, Reason, Location, FieldInfo, SignatureType };
2727

2828
SignatureItem();
2929
SignatureItem(SignatureItem *parent, const Okular::FormFieldSignature *form, DataType type, int page);
@@ -179,6 +179,26 @@ void SignatureModelPrivate::notifySetup(const QVector<Okular::Page *> &pages, in
179179

180180
auto childItem4 = new SignatureItem(parentItem, sf, SignatureItem::FieldInfo, pageNumber);
181181
childItem4->displayString = i18n("Field: %1 on page %2", sf->name(), pageNumber + 1);
182+
auto signatureType = [sf] {
183+
switch (sf->signatureType()) {
184+
case Okular::FormFieldSignature::G10cPgpSignatureDetached:
185+
return i18nc("Signature type", "PGP Signature");
186+
case Okular::FormFieldSignature::AdbePkcs7detached:
187+
return i18nc("Signature type", "Adobe PKCS7");
188+
case Okular::FormFieldSignature::AdbePkcs7sha1:
189+
return i18nc("Signature type", "Adobe PKCS7 Sha1");
190+
case Okular::FormFieldSignature::EtsiCAdESdetached:
191+
return i18nc("Signature type", "ETSI CAdES");
192+
case Okular::FormFieldSignature::UnknownType:
193+
return i18nc("Signature type", "Unknown");
194+
case Okular::FormFieldSignature::UnsignedSignature:
195+
return i18nc("Signature type", "Unsigned signature");
196+
}
197+
return QString {};
198+
}();
199+
200+
auto childItem5 = new SignatureItem(parentItem, nullptr, SignatureItem::SignatureType, pageNumber);
201+
childItem5->displayString = i18n("Signature Type: %1", signatureType);
182202

183203
++revNumber;
184204
}

0 commit comments

Comments
 (0)