Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 20a81c9d authored by Albert Astals Cid's avatar Albert Astals Cid

Set the Okular Form additional actions from the poppler Form additional actions

parent cfc15897
......@@ -27,6 +27,17 @@ int main()
}
" HAVE_POPPLER_0_50)
check_cxx_source_compiles("
#include <poppler-qt5.h>
#include <poppler-form.h>
int main()
{
Poppler::FormFieldButton *ff = 0;
Poppler::Link *l = ff->additionalAction(Poppler::FormField::CalculateField);
return 0;
}
" HAVE_POPPLER_0_53)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-okular-poppler.h
......
......@@ -12,3 +12,6 @@
/* Defined if we have the 0.50 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_50 1
/* Defined if we have the 0.53 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_53 1
......@@ -17,15 +17,23 @@
extern Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink);
#ifdef HAVE_POPPLER_0_53
#define SET_ACTIONS \
setActivationAction( createLinkFromPopplerLink( field->activationAction() ) ); \
setAdditionalAction( Okular::FormField::FieldModified, createLinkFromPopplerLink( field->additionalAction( Poppler::FormField::FieldModified ) ) ); \
setAdditionalAction( Okular::FormField::FormatField, createLinkFromPopplerLink( field->additionalAction( Poppler::FormField::FormatField ) ) ); \
setAdditionalAction( Okular::FormField::ValidateField, createLinkFromPopplerLink( field->additionalAction( Poppler::FormField::ValidateField ) ) ); \
setAdditionalAction( Okular::FormField::CalculateField, createLinkFromPopplerLink( field->additionalAction( Poppler::FormField::CalculateField ) ) );
#else
#define SET_ACTIONS \
setActivationAction( createLinkFromPopplerLink( field->activationAction() ) );
#endif
PopplerFormFieldButton::PopplerFormFieldButton( Poppler::FormFieldButton * field )
: Okular::FormFieldButton(), m_field( field )
{
m_rect = Okular::NormalizedRect::fromQRectF( m_field->rect() );
Poppler::Link *aAction = field->activationAction();
if ( aAction )
{
setActivationAction( createLinkFromPopplerLink( aAction ) );
}
SET_ACTIONS
}
PopplerFormFieldButton::~PopplerFormFieldButton()
......@@ -102,11 +110,7 @@ PopplerFormFieldText::PopplerFormFieldText( Poppler::FormFieldText * field )
: Okular::FormFieldText(), m_field( field )
{
m_rect = Okular::NormalizedRect::fromQRectF( m_field->rect() );
Poppler::Link *aAction = field->activationAction();
if ( aAction )
{
setActivationAction( createLinkFromPopplerLink( aAction ) );
}
SET_ACTIONS
}
PopplerFormFieldText::~PopplerFormFieldText()
......@@ -198,11 +202,7 @@ PopplerFormFieldChoice::PopplerFormFieldChoice( Poppler::FormFieldChoice * field
: Okular::FormFieldChoice(), m_field( field )
{
m_rect = Okular::NormalizedRect::fromQRectF( m_field->rect() );
Poppler::Link *aAction = field->activationAction();
if ( aAction )
{
setActivationAction( createLinkFromPopplerLink( aAction ) );
}
SET_ACTIONS
}
PopplerFormFieldChoice::~PopplerFormFieldChoice()
......
......@@ -309,6 +309,9 @@ QPair<Okular::Movie*, Okular::EmbeddedFile*> createMovieFromPopplerRichMedia( co
*/
Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
{
if (!popplerLink)
return nullptr;
Okular::Action *link = 0;
const Poppler::LinkGoto *popplerLinkGoto;
const Poppler::LinkExecute *popplerLinkExecute;
......
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