Commit bb6bee53 authored by Joao Oliveira's avatar Joao Oliveira Committed by Albert Astals Cid

Added support for the full name of fields, which is used in the JavaScript

parent 238fa979
Pipeline #6342 passed with stage
in 20 minutes and 54 seconds
......@@ -86,6 +86,14 @@ class OKULARCORE_EXPORT FormField
*/
virtual QString uiName() const = 0;
/**
* The fully qualified name of the field, is used in the JavaScript
* scripts.
*
* @since 1.9
*/
virtual QString fullyQualifiedName() const = 0;
/**
* Whether the field is read-only.
*/
......
......@@ -211,7 +211,7 @@ static KJSObject docGetField( KJSContext *context, void *object,
QLinkedList< Okular::FormField * >::const_iterator ffIt = pageFields.constBegin(), ffEnd = pageFields.constEnd();
for ( ; ffIt != ffEnd; ++ffIt )
{
if ( (*ffIt)->name() == cName )
if ( (*ffIt)->fullyQualifiedName() == cName )
{
return JSField::wrapField( context, *ffIt, *pIt );
}
......@@ -280,7 +280,7 @@ static KJSObject docGetNthFieldName( KJSContext *ctx, void *object,
{
const auto ffIt = pageFields.begin() + numField;
return KJSString( (*ffIt)->name() );
return KJSString( (*ffIt)->fullyQualifiedName() );
}
numField -= pageFields.size();
......
......@@ -63,7 +63,7 @@ static KJSObject fieldGetDoc( KJSContext *context, void * )
static KJSObject fieldGetName( KJSContext *, void *object )
{
const FormField *field = reinterpret_cast< FormField * >( object );
return KJSString( field->name() );
return KJSString( field->fullyQualifiedName() );
}
// Field.readonly (getter)
......@@ -275,8 +275,8 @@ static KJSObject fieldButtonGetIcon( KJSContext *ctx, void *object,
FormField *field = reinterpret_cast< FormField * >( object );
KJSObject fieldObject;
fieldObject.setProperty( ctx, OKULAR_NAME, field->name() );
g_buttonCache->insert( field->name(), field );
fieldObject.setProperty( ctx, OKULAR_NAME, field->fullyQualifiedName() );
g_buttonCache->insert( field->fullyQualifiedName(), field );
return fieldObject;
}
......
......@@ -77,6 +77,11 @@ QString PopplerFormFieldButton::uiName() const
return m_field->uiName();
}
QString PopplerFormFieldButton::fullyQualifiedName() const
{
return m_field->fullyQualifiedName();
}
bool PopplerFormFieldButton::isReadOnly() const
{
return m_field->isReadOnly();
......@@ -211,6 +216,11 @@ QString PopplerFormFieldText::uiName() const
return m_field->uiName();
}
QString PopplerFormFieldText::fullyQualifiedName() const
{
return m_field->fullyQualifiedName();
}
bool PopplerFormFieldText::isReadOnly() const
{
return m_field->isReadOnly();
......@@ -341,6 +351,11 @@ QString PopplerFormFieldChoice::uiName() const
return m_field->uiName();
}
QString PopplerFormFieldChoice::fullyQualifiedName() const
{
return m_field->fullyQualifiedName();
}
bool PopplerFormFieldChoice::isReadOnly() const
{
return m_field->isReadOnly();
......@@ -492,6 +507,11 @@ QString PopplerFormFieldSignature::uiName() const
return m_field->uiName();
}
QString PopplerFormFieldSignature::fullyQualifiedName() const
{
return m_field->fullyQualifiedName();
}
bool PopplerFormFieldSignature::isReadOnly() const
{
return m_field->isReadOnly();
......
......@@ -25,6 +25,7 @@ class PopplerFormFieldButton : public Okular::FormFieldButton
int id() const override;
QString name() const override;
QString uiName() const override;
QString fullyQualifiedName() const override;
bool isReadOnly() const override;
void setReadOnly( bool value ) override;
bool isVisible() const override;
......@@ -66,6 +67,7 @@ class PopplerFormFieldText : public Okular::FormFieldText
int id() const override;
QString name() const override;
QString uiName() const override;
QString fullyQualifiedName() const override;
bool isReadOnly() const override;
void setReadOnly( bool value ) override;
bool isVisible() const override;
......@@ -101,6 +103,7 @@ class PopplerFormFieldChoice : public Okular::FormFieldChoice
int id() const override;
QString name() const override;
QString uiName() const override;
QString fullyQualifiedName() const override;
bool isReadOnly() const override;
void setReadOnly( bool value ) override;
bool isVisible() const override;
......@@ -138,6 +141,7 @@ class PopplerFormFieldSignature : public Okular::FormFieldSignature
int id() const override;
QString name() const override;
QString uiName() const override;
QString fullyQualifiedName() const override;
bool isReadOnly() const override;
bool isVisible() const override;
......
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