diff --git a/core/document.cpp b/core/document.cpp index 564fc1c3d..38ac1d9bf 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -2701,6 +2701,12 @@ bool Document::canConfigurePrinter() const return false; } +void Document::sign() +{ + if (d->m_generator->canSign()) + d->m_generator->sign(); +} + DocumentInfo Document::documentInfo() const { QSet keys; diff --git a/core/document.h b/core/document.h index d2bfa2b29..7cd78732d 100644 --- a/core/document.h +++ b/core/document.h @@ -1052,6 +1052,8 @@ public Q_SLOTS: */ void reloadDocument() const; + void sign(); + /** * Returns the part of document covered by the given signature @p info. * diff --git a/core/generator.h b/core/generator.h index 8dcb6b006..63d69c5b2 100644 --- a/core/generator.h +++ b/core/generator.h @@ -307,6 +307,10 @@ public: */ virtual bool canGeneratePixmap() const; + virtual bool canSign() const { return false; } + + virtual void sign() { return; } + /** * This method can be called to trigger the generation of * a new pixmap as described by @p request. diff --git a/generators/poppler/generator_pdf.h b/generators/poppler/generator_pdf.h index 64f2c5b24..c96e14df3 100644 --- a/generators/poppler/generator_pdf.h +++ b/generators/poppler/generator_pdf.h @@ -100,6 +100,9 @@ public: bool save(const QString &fileName, SaveOptions options, QString *errorText) override; Okular::AnnotationProxy *annotationProxy() const override; + bool canSign() const override {return true;} + void sign() override { return; } + protected: SwapBackingFileResult swapBackingFile(QString const &newFileName, QVector &newPagesVector) override; bool doCloseDocument() override; diff --git a/part/pageviewannotator.cpp b/part/pageviewannotator.cpp index 869f433db..78987f833 100644 --- a/part/pageviewannotator.cpp +++ b/part/pageviewannotator.cpp @@ -921,6 +921,9 @@ QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::E annotation->setAuthor(Okular::Settings::identityAuthor()); m_document->addPageAnnotation(m_lockedItem->pageNumber(), annotation); + if (signatureMode()) + m_document->sign(); + if (annotation->openDialogAfterCreation()) m_pageView->openAnnotationWindow(annotation, m_lockedItem->pageNumber()); }