mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 02:45:38 +00:00
Set the Okular Form additional actions from the poppler Form additional actions
This commit is contained in:
parent
cfc158977f
commit
20a81c9de0
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue