mirror of
https://invent.kde.org/graphics/okular
synced 2024-07-05 00:58:46 +00:00
Use the poppler version includes instead of check_cxx_source_compiles
This commit is contained in:
parent
913d437822
commit
44304b32a5
|
@ -15,8 +15,6 @@
|
|||
#include <core/form.h>
|
||||
#include <core/page.h>
|
||||
|
||||
#include "../generators/poppler/config-okular-poppler.h"
|
||||
|
||||
class FormatTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include <core/page.h>
|
||||
#include <qtestcase.h>
|
||||
|
||||
#include "../generators/poppler/config-okular-poppler.h"
|
||||
|
||||
class KeystrokeTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include <core/page.h>
|
||||
#include <core/script/event_p.h>
|
||||
|
||||
#include "../generators/poppler/config-okular-poppler.h"
|
||||
|
||||
class MessageBoxHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include "../settings.h"
|
||||
#include "closedialoghelper.h"
|
||||
|
||||
#include "../generators/poppler/config-okular-poppler.h"
|
||||
|
||||
#include <KActionCollection>
|
||||
#include <KConfigDialog>
|
||||
#include <KParts/OpenUrlArguments>
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include <core/form.h>
|
||||
#include <core/page.h>
|
||||
|
||||
#include "../generators/poppler/config-okular-poppler.h"
|
||||
|
||||
class VisibilityTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -5,81 +5,6 @@ add_subdirectory( conf )
|
|||
|
||||
set(CMAKE_REQUIRED_LIBRARIES Poppler::Qt5 Qt5::Core Qt5::Gui)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <poppler-form.h>
|
||||
int main()
|
||||
{
|
||||
Poppler::FormFieldChoice *ffc = nullptr;
|
||||
ffc->choicesWithExportValues();
|
||||
return 0;
|
||||
}
|
||||
" HAVE_POPPLER_0_87)
|
||||
|
||||
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)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <poppler-qt5.h>
|
||||
#include <poppler-form.h>
|
||||
int main()
|
||||
{
|
||||
Poppler::PDFConverter::NewSignatureData pData;
|
||||
pData.setSignatureLeftText(QString());
|
||||
}
|
||||
" HAVE_POPPLER_FANCY_SIGNATURE)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <poppler-qt5.h>
|
||||
int main()
|
||||
{
|
||||
Poppler::Document *doc = Poppler::Document::load(\"\", nullptr, nullptr);
|
||||
doc->xrefWasReconstructed();
|
||||
return 0;
|
||||
}
|
||||
" HAVE_POPPLER_RECONSTRUCTION_CALLBACK)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <poppler-qt5.h>
|
||||
#include <poppler-form.h>
|
||||
int main()
|
||||
{
|
||||
int a = Poppler::FormFieldSignature::ValidateWithoutOCSPRevocationCheck;
|
||||
return 0;
|
||||
}
|
||||
" HAVE_POPPLER_21_10)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <poppler-qt5.h>
|
||||
#include <poppler-form.h>
|
||||
int main()
|
||||
{
|
||||
auto us = Poppler::FormFieldSignature::UnsignedSignature;
|
||||
Poppler::PDFConverter::NewSignatureData pData;
|
||||
pData.setDocumentOwnerPassword(QByteArray());
|
||||
}
|
||||
" HAVE_POPPLER_22_02)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <poppler-qt5.h>
|
||||
#include <poppler-form.h>
|
||||
int main()
|
||||
{
|
||||
(void)Poppler::LinkAction::SaveAs;
|
||||
}
|
||||
" HAVE_POPPLER_22_04)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config-okular-poppler.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
)
|
||||
|
|
|
@ -280,7 +280,7 @@ static void setSharedAnnotationPropertiesToPopplerAnnotation(const Okular::Annot
|
|||
popplerAnnotation->setModificationDate(okularAnnotation->modificationDate());
|
||||
}
|
||||
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
static void setPopplerStampAnnotationCustomImage(const Poppler::Page *page, Poppler::StampAnnotation *pStampAnnotation, const Okular::StampAnnotation *oStampAnnotation)
|
||||
{
|
||||
const QSize size = page->pageSize();
|
||||
|
@ -348,7 +348,7 @@ static void updatePopplerAnnotationFromOkularAnnotation(const Okular::HighlightA
|
|||
pHighlightAnnotation->setHighlightQuads(pQuads);
|
||||
}
|
||||
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
static void updatePopplerAnnotationFromOkularAnnotation(const Okular::StampAnnotation *oStampAnnotation, Poppler::StampAnnotation *pStampAnnotation, const Poppler::Page *page)
|
||||
{
|
||||
setPopplerStampAnnotationCustomImage(page, pStampAnnotation, oStampAnnotation);
|
||||
|
@ -420,7 +420,7 @@ static Poppler::Annotation *createPopplerAnnotationFromOkularAnnotation(const Ok
|
|||
return pHighlightAnnotation;
|
||||
}
|
||||
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
static Poppler::Annotation *createPopplerAnnotationFromOkularAnnotation(const Okular::StampAnnotation *oStampAnnotation, Poppler::Page *page)
|
||||
{
|
||||
Poppler::StampAnnotation *pStampAnnotation = new Poppler::StampAnnotation();
|
||||
|
@ -483,7 +483,7 @@ void PopplerAnnotationProxy::notifyAddition(Okular::Annotation *okl_ann, int pag
|
|||
ppl_ann = createPopplerAnnotationFromOkularAnnotation(static_cast<Okular::HighlightAnnotation *>(okl_ann));
|
||||
break;
|
||||
case Okular::Annotation::AStamp:
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
{
|
||||
bool wasDenyWriteEnabled = okl_ann->flags() & Okular::Annotation::DenyWrite;
|
||||
|
||||
|
@ -516,7 +516,7 @@ void PopplerAnnotationProxy::notifyAddition(Okular::Annotation *okl_ann, int pag
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
okl_ann->setFlags(okl_ann->flags() | Okular::Annotation::ExternallyDrawn);
|
||||
#else
|
||||
// Poppler doesn't render StampAnnotations yet
|
||||
|
@ -595,7 +595,7 @@ void PopplerAnnotationProxy::notifyModification(const Okular::Annotation *okl_an
|
|||
case Poppler::Annotation::AStamp: {
|
||||
const Okular::StampAnnotation *okl_stampann = static_cast<const Okular::StampAnnotation *>(okl_ann);
|
||||
Poppler::StampAnnotation *ppl_stampann = static_cast<Poppler::StampAnnotation *>(ppl_ann);
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
Poppler::Page *ppl_page = ppl_doc->page(page);
|
||||
updatePopplerAnnotationFromOkularAnnotation(okl_stampann, ppl_stampann, ppl_page);
|
||||
delete ppl_page;
|
||||
|
@ -630,9 +630,9 @@ void PopplerAnnotationProxy::notifyRemoval(Okular::Annotation *okl_ann, int page
|
|||
|
||||
Poppler::Page *ppl_page = ppl_doc->page(page);
|
||||
annotationsOnOpenHash->remove(okl_ann);
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
if (okl_ann->subType() == Okular::Annotation::AStamp) {
|
||||
deletedStampsAnnotationAppearance[static_cast<Okular::StampAnnotation *>(okl_ann)] = std::move(ppl_ann->annotationAppearance());
|
||||
deletedStampsAnnotationAppearance[static_cast<Okular::StampAnnotation *>(okl_ann)] = ppl_ann->annotationAppearance();
|
||||
}
|
||||
#endif
|
||||
ppl_page->removeAnnotation(ppl_ann); // Also destroys ppl_ann
|
||||
|
@ -1070,7 +1070,7 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *p
|
|||
break;
|
||||
}
|
||||
case Poppler::Annotation::AStamp:
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
externallyDrawn = true;
|
||||
#endif
|
||||
tieToOkularAnn = true;
|
||||
|
@ -1097,7 +1097,7 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *p
|
|||
if (externallyDrawn) {
|
||||
okularAnnotation->setFlags(okularAnnotation->flags() | Okular::Annotation::ExternallyDrawn);
|
||||
}
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
if (okularAnnotation->subType() == Okular::Annotation::SubType::AStamp) {
|
||||
Okular::StampAnnotation *oStampAnn = static_cast<Okular::StampAnnotation *>(okularAnnotation);
|
||||
Poppler::StampAnnotation *pStampAnn = static_cast<Poppler::StampAnnotation *>(popplerAnnotation);
|
||||
|
|
|
@ -12,12 +12,13 @@
|
|||
|
||||
#include <poppler-annotation.h>
|
||||
#include <poppler-qt5.h>
|
||||
#include <poppler-version.h>
|
||||
#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
|
||||
|
||||
#include <QMutex>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "config-okular-poppler.h"
|
||||
#include "core/annotations.h"
|
||||
|
||||
extern Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *popplerAnnotation, const Poppler::Page &popplerPage, bool *doDelete);
|
||||
|
@ -37,7 +38,7 @@ private:
|
|||
Poppler::Document *ppl_doc;
|
||||
QMutex *mutex;
|
||||
QHash<Okular::Annotation *, Poppler::Annotation *> *annotationsOnOpenHash;
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
std::unordered_map<Okular::StampAnnotation *, std::unique_ptr<Poppler::AnnotationAppearance>> deletedStampsAnnotationAppearance;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/* Defined if we have the 0.87 version of the Poppler library */
|
||||
#cmakedefine HAVE_POPPLER_0_87 1
|
||||
|
||||
/* Defined if we have the pdf signature feature in the Poppler library */
|
||||
#cmakedefine HAVE_POPPLER_SIGNING 1
|
||||
|
||||
/* Defined if we have the pdf fancy signature feature in the Poppler library */
|
||||
#cmakedefine HAVE_POPPLER_FANCY_SIGNATURE 1
|
||||
|
||||
/* Defined if we have Poppler version that notifies for XRef Table reconstruction */
|
||||
#cmakedefine HAVE_POPPLER_RECONSTRUCTION_CALLBACK 1
|
||||
|
||||
/* Defined if we have the 21.10 version of the Poppler library or later */
|
||||
#cmakedefine HAVE_POPPLER_21_10 1
|
||||
|
||||
/* Defined if we have the 22.02 version of the Poppler library or later */
|
||||
#cmakedefine HAVE_POPPLER_22_02 1
|
||||
|
||||
/* Defined if we have the 22.04 version of the Poppler library or later */
|
||||
#cmakedefine HAVE_POPPLER_22_04 1
|
|
@ -268,7 +268,7 @@ PopplerFormFieldChoice::PopplerFormFieldChoice(std::unique_ptr<Poppler::FormFiel
|
|||
m_id = m_field->id();
|
||||
SET_ACTIONS
|
||||
|
||||
#ifdef HAVE_POPPLER_0_87
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(0, 87, 0)
|
||||
QMap<QString, QString> values;
|
||||
const auto fieldChoicesWithExportValues = m_field->choicesWithExportValues();
|
||||
for (const QPair<QString, QString> &value : fieldChoicesWithExportValues) {
|
||||
|
@ -396,7 +396,7 @@ PopplerFormFieldSignature::PopplerFormFieldSignature(std::unique_ptr<Poppler::Fo
|
|||
m_rect = Okular::NormalizedRect::fromQRectF(m_field->rect());
|
||||
m_id = m_field->id();
|
||||
int validateOptions = Poppler::FormFieldSignature::ValidateVerifyCertificate;
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
if (!PDFSettings::checkOCSPServers()) {
|
||||
validateOptions = validateOptions | Poppler::FormFieldSignature::ValidateWithoutOCSPRevocationCheck;
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ PopplerFormFieldSignature::SignatureType PopplerFormFieldSignature::signatureTyp
|
|||
return Okular::FormFieldSignature::AdbePkcs7detached;
|
||||
case Poppler::FormFieldSignature::EtsiCAdESdetached:
|
||||
return Okular::FormFieldSignature::EtsiCAdESdetached;
|
||||
#ifdef HAVE_POPPLER_22_02
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(22, 2, 0)
|
||||
case Poppler::FormFieldSignature::UnsignedSignature:
|
||||
return Okular::FormFieldSignature::UnsignedSignature;
|
||||
#endif
|
||||
|
@ -470,7 +470,7 @@ const Okular::SignatureInfo &PopplerFormFieldSignature::signatureInfo() const
|
|||
|
||||
bool PopplerFormFieldSignature::sign(const Okular::NewSignatureData &oData, const QString &newPath) const
|
||||
{
|
||||
#ifdef HAVE_POPPLER_22_02
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(22, 2, 0)
|
||||
Poppler::PDFConverter::NewSignatureData pData;
|
||||
PDFGenerator::okularToPoppler(oData, &pData);
|
||||
return m_field->sign(newPath, pData) == Poppler::FormFieldSignature::SigningSuccess;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#define _OKULAR_GENERATOR_PDF_FORMFIELDS_H_
|
||||
|
||||
#include "core/form.h"
|
||||
#include <config-okular-poppler.h>
|
||||
#include <poppler-form.h>
|
||||
|
||||
class PopplerFormFieldButton : public Okular::FormFieldButton
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
|
||||
#include "pdfsettings.h"
|
||||
|
||||
#include <config-okular-poppler.h>
|
||||
|
||||
#include <poppler-media.h>
|
||||
#include <poppler-version.h>
|
||||
|
||||
|
@ -380,7 +378,7 @@ static Okular::DocumentAction::DocumentActionType popplerToOkular(Poppler::LinkA
|
|||
return Okular::DocumentAction::Close;
|
||||
case Poppler::LinkAction::Print:
|
||||
return Okular::DocumentAction::Print;
|
||||
#ifdef HAVE_POPPLER_22_04
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(22, 04, 0)
|
||||
case Poppler::LinkAction::SaveAs:
|
||||
return Okular::DocumentAction::SaveAs;
|
||||
#endif
|
||||
|
@ -633,7 +631,7 @@ PDFGenerator::PDFGenerator(QObject *parent, const QVariantList &args)
|
|||
// You only need to do it once not for each of the documents but it is cheap enough
|
||||
// so doing it all the time won't hurt either
|
||||
Poppler::setDebugErrorFunction(PDFGeneratorPopplerDebugFunction, QVariant());
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
if (!PDFSettings::useDefaultCertDB()) {
|
||||
Poppler::setNSSDir(QUrl(PDFSettings::dBCertificatePath()).toLocalFile());
|
||||
}
|
||||
|
@ -694,7 +692,7 @@ Okular::Document::OpenResult PDFGenerator::init(QVector<Okular::Page *> &pagesVe
|
|||
}
|
||||
|
||||
xrefReconstructed = false;
|
||||
#ifdef HAVE_POPPLER_RECONSTRUCTION_CALLBACK
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 6, 0)
|
||||
if (pdfdoc->xrefWasReconstructed()) {
|
||||
xrefReconstructionHandler();
|
||||
} else {
|
||||
|
@ -1357,7 +1355,7 @@ QByteArray PDFGenerator::requestFontData(const Okular::FontInfo &font)
|
|||
return pdfdoc->fontData(fi);
|
||||
}
|
||||
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
void PDFGenerator::okularToPoppler(const Okular::NewSignatureData &oData, Poppler::PDFConverter::NewSignatureData *pData)
|
||||
{
|
||||
pData->setCertNickname(oData.certNickname());
|
||||
|
@ -1365,14 +1363,14 @@ void PDFGenerator::okularToPoppler(const Okular::NewSignatureData &oData, Popple
|
|||
pData->setPage(oData.page());
|
||||
const QString datetime = QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm:ss t"));
|
||||
pData->setSignatureText(i18n("Signed by: %1\n\nDate: %2", oData.certSubjectCommonName(), datetime));
|
||||
#ifdef HAVE_POPPLER_FANCY_SIGNATURE
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 6, 0)
|
||||
pData->setSignatureLeftText(oData.certSubjectCommonName());
|
||||
#endif
|
||||
const Okular::NormalizedRect bRect = oData.boundingRectangle();
|
||||
pData->setBoundingRectangle({bRect.left, bRect.top, bRect.width(), bRect.height()});
|
||||
pData->setFontColor(Qt::black);
|
||||
pData->setBorderColor(Qt::black);
|
||||
#ifdef HAVE_POPPLER_22_02
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(22, 2, 0)
|
||||
pData->setDocumentOwnerPassword(oData.documentPassword().toLatin1());
|
||||
pData->setDocumentUserPassword(oData.documentPassword().toLatin1());
|
||||
#endif
|
||||
|
@ -1575,7 +1573,7 @@ QVariant PDFGenerator::metaData(const QString &key, const QVariant &option) cons
|
|||
return i18n("Using Poppler %1\n\nBuilt against Poppler %2", Poppler::Version::string(), QStringLiteral(POPPLER_VERSION));
|
||||
}
|
||||
} else if (key == QLatin1String("ShowStampsWarning")) {
|
||||
#ifdef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
return QStringLiteral("no");
|
||||
#else
|
||||
return QStringLiteral("yes");
|
||||
|
@ -1583,7 +1581,7 @@ QVariant PDFGenerator::metaData(const QString &key, const QVariant &option) cons
|
|||
} else if (key == QLatin1String("DocumentHasPassword")) {
|
||||
return pdfdoc->isEncrypted() ? QStringLiteral("yes") : QStringLiteral("no");
|
||||
} else if (key == QLatin1String("CanSignDocumentWithPassword")) {
|
||||
#ifdef HAVE_POPPLER_22_02
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(22, 2, 0)
|
||||
return QStringLiteral("yes");
|
||||
#else
|
||||
return QStringLiteral("no");
|
||||
|
@ -2019,7 +2017,7 @@ Okular::AnnotationProxy *PDFGenerator::annotationProxy() const
|
|||
|
||||
bool PDFGenerator::canSign() const
|
||||
{
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
return Poppler::hasNSSSupport();
|
||||
#else
|
||||
return false;
|
||||
|
@ -2028,7 +2026,7 @@ bool PDFGenerator::canSign() const
|
|||
|
||||
bool PDFGenerator::sign(const Okular::NewSignatureData &oData, const QString &rFilename)
|
||||
{
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
// save to tmp file - poppler doesn't like overwriting in-place
|
||||
QTemporaryFile tf(QFileInfo(rFilename).absolutePath() + QLatin1String("/okular_XXXXXX.pdf"));
|
||||
tf.setAutoRemove(false);
|
||||
|
@ -2062,7 +2060,7 @@ bool PDFGenerator::sign(const Okular::NewSignatureData &oData, const QString &rF
|
|||
|
||||
Okular::CertificateStore *PDFGenerator::certificateStore() const
|
||||
{
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
if (!certStore) {
|
||||
certStore = new PopplerCertificateStore();
|
||||
}
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
#define _OKULAR_GENERATOR_PDF_H_
|
||||
|
||||
//#include "synctex/synctex_parser.h"
|
||||
#include <config-okular-poppler.h>
|
||||
|
||||
#include <poppler-qt5.h>
|
||||
#include <poppler-version.h>
|
||||
|
||||
#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
|
||||
|
||||
#include <QBitArray>
|
||||
#include <QPointer>
|
||||
|
@ -108,7 +110,7 @@ public:
|
|||
|
||||
QByteArray requestFontData(const Okular::FontInfo &font) override;
|
||||
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
static void okularToPoppler(const Okular::NewSignatureData &oData, Poppler::PDFConverter::NewSignatureData *pData);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ PDFSettingsWidget::PDFSettingsWidget(QWidget *parent)
|
|||
: QWidget(parent)
|
||||
{
|
||||
m_pdfsw.setupUi(this);
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
if (Poppler::hasNSSSupport()) {
|
||||
m_pdfsw.loadSignaturesButton->hide();
|
||||
|
||||
|
@ -68,7 +68,7 @@ PDFSettingsWidget::PDFSettingsWidget(QWidget *parent)
|
|||
m_pdfsw.loadSignaturesButton->hide();
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_POPPLER_21_10
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 10, 0)
|
||||
m_pdfsw.kcfg_CheckOCSPServers->hide();
|
||||
#endif
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ bool PDFSettingsWidget::event(QEvent *e)
|
|||
if (m_tree && e->type() == QEvent::Paint && !m_certificatesAsked) {
|
||||
m_certificatesAsked = true;
|
||||
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
PopplerCertificateStore st;
|
||||
bool userCancelled;
|
||||
const QList<Okular::CertificateInfo *> certs = st.signingCertificates(&userCancelled);
|
||||
|
|
|
@ -48,7 +48,7 @@ QString PopplerCertificateInfo::subjectInfo(PopplerCertificateInfo::EntityInfoKe
|
|||
|
||||
QString PopplerCertificateInfo::nickName() const
|
||||
{
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
return m_info.nickName();
|
||||
#else
|
||||
return i18n("Not Available");
|
||||
|
@ -134,7 +134,7 @@ QByteArray PopplerCertificateInfo::certificateData() const
|
|||
|
||||
bool PopplerCertificateInfo::checkPassword(const QString &password) const
|
||||
{
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
return m_info.checkPassword(password);
|
||||
#else
|
||||
Q_UNUSED(password);
|
||||
|
@ -264,7 +264,7 @@ const Okular::CertificateInfo &PopplerSignatureInfo::certificateInfo() const
|
|||
return *m_certfiticateInfo;
|
||||
}
|
||||
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
PopplerCertificateStore::~PopplerCertificateStore() = default;
|
||||
|
||||
QList<Okular::CertificateInfo *> PopplerCertificateStore::signingCertificates(bool *userCancelled) const
|
||||
|
@ -280,7 +280,7 @@ QList<Okular::CertificateInfo *> PopplerCertificateStore::signingCertificates(bo
|
|||
|
||||
const QVector<Poppler::CertificateInfo> certs = Poppler::getAvailableSigningCertificates();
|
||||
QList<Okular::CertificateInfo *> vReturnCerts;
|
||||
for (auto cert : certs) {
|
||||
for (const auto &cert : certs) {
|
||||
vReturnCerts.append(new PopplerCertificateInfo(cert));
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
#define _OKULAR_GENERATOR_PDF_SIGNATUREUTILS_H_
|
||||
|
||||
#include <poppler-form.h>
|
||||
#include <poppler-version.h>
|
||||
#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
|
||||
|
||||
#include "core/signatureutils.h"
|
||||
|
||||
#include <config-okular-poppler.h>
|
||||
|
||||
class PopplerCertificateInfo : public Okular::CertificateInfo
|
||||
{
|
||||
public:
|
||||
|
@ -63,12 +63,12 @@ private:
|
|||
Okular::CertificateInfo *m_certfiticateInfo;
|
||||
};
|
||||
|
||||
#ifdef HAVE_POPPLER_SIGNING
|
||||
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
||||
|
||||
class PopplerCertificateStore : public Okular::CertificateStore
|
||||
{
|
||||
public:
|
||||
~PopplerCertificateStore();
|
||||
~PopplerCertificateStore() override;
|
||||
|
||||
QList<Okular::CertificateInfo *> signingCertificates(bool *userCancelled) const override;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user