Commit 62a4c63f authored by Thorsten Behrens's avatar Thorsten Behrens Committed by Albert Astals Cid
Browse files

Conditionalize code to Poppler signing feature flag

parent f37de4fe
......@@ -17,9 +17,11 @@ int main()
check_cxx_source_compiles("
#include <poppler-qt5.h>
#include <poppler-form.h>
int main()
{
auto f = &Poppler::PDFConverter::sign;
auto g = &Poppler::setNSSDir;
}
" HAVE_POPPLER_SIGNING)
......@@ -38,10 +40,14 @@ set(okularGenerator_poppler_PART_SRCS
generator_pdf.cpp
formfields.cpp
annots.cpp
certificatetools.cpp
pdfsignatureutils.cpp
)
if(HAVE_POPPLER_SIGNING)
set(okularGenerator_poppler_PART_SRCS
${okularGenerator_poppler_PART_SRCS} certificatetools.cpp)
endif()
ki18n_wrap_ui(okularGenerator_poppler_PART_SRCS
conf/pdfsettingswidget.ui
conf/certsettingswidget.ui
......
......@@ -397,7 +397,9 @@ PopplerFormFieldSignature::PopplerFormFieldSignature(std::unique_ptr<Poppler::Fo
{
m_rect = Okular::NormalizedRect::fromQRectF(m_field->rect());
m_id = m_field->id();
#ifdef HAVE_POPPLER_SIGNING
Poppler::setNSSDir( CertificateSettings::certificatePath() );
#endif
m_info = new PopplerSignatureInfo(m_field->validate(Poppler::FormFieldSignature::ValidateVerifyCertificate));
SET_ACTIONS
}
......
......@@ -1480,6 +1480,7 @@ void PDFGenerator::addPages(KConfigDialog *dlg)
pdfsw.setupUi(w);
dlg->addPage(w, PDFSettings::self(), i18n("PDF"), QStringLiteral("application-pdf"), i18n("PDF Backend Configuration"));
#ifdef HAVE_POPPLER_SIGNING
Ui_DlgSignaturesBase certsw;
QWidget* w2 = new QWidget(dlg);
certsw.setupUi(w2);
......@@ -1497,6 +1498,7 @@ void PDFGenerator::addPages(KConfigDialog *dlg)
QStringLiteral("CertificateTools"), SIGNAL(changed()) );
dlg->addPage(w2, CertificateSettings::self(), i18n("Certificates"), QStringLiteral("application-pkcs7-signature"), i18n("Digital Signature Certificates") );
#endif
}
bool PDFGenerator::setDocumentRenderHints()
......@@ -1915,6 +1917,7 @@ bool PDFGenerator::sign( const Okular::Annotation* pWhichAnnotation, const QStri
return true;
}
#ifdef HAVE_POPPLER_SIGNING
namespace {
struct CertificateStoreImpl : public Okular::CertificateStore
{
......@@ -1930,6 +1933,7 @@ namespace {
}
};
}
#endif
Okular::CertificateStore* PDFGenerator::getCertStore()
{
......
......@@ -50,7 +50,11 @@ QString PopplerCertificateInfo::subjectInfo(PopplerCertificateInfo::EntityInfoKe
QString PopplerCertificateInfo::nickName() const
{
#ifdef HAVE_POPPLER_SIGNING
return m_info.nickName();
#else
return i18n("Not Available");
#endif
}
QDateTime PopplerCertificateInfo::validityStart() const
......
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