mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-24 18:35:37 +00:00
Field readOnly applies to the user but not to JS
This commit is contained in:
parent
1fd2004aa3
commit
19be15b6a5
|
@ -41,8 +41,6 @@ class Okular::ExecutorKJSPrivate
|
|||
}
|
||||
~ExecutorKJSPrivate()
|
||||
{
|
||||
JSField::clearCachedFields();
|
||||
|
||||
delete m_interpreter;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,6 @@ using namespace Okular;
|
|||
|
||||
static KJSPrototype *g_fieldProto;
|
||||
|
||||
typedef QHash< FormField *, KJSObject > FormCache;
|
||||
Q_GLOBAL_STATIC( FormCache, g_fieldCache )
|
||||
|
||||
// Field.doc
|
||||
static KJSObject fieldGetDoc( KJSContext *context, void * )
|
||||
{
|
||||
|
@ -115,16 +112,6 @@ static KJSObject fieldGetType( KJSContext *, void *object )
|
|||
static KJSObject fieldGetValue( KJSContext *context, void *object )
|
||||
{
|
||||
FormField *field = reinterpret_cast< FormField * >( object );
|
||||
if ( field->isReadOnly() )
|
||||
{
|
||||
KJSObject value = g_fieldCache->value( field );
|
||||
if ( g_fieldCache.exists() && g_fieldCache->contains( field ) )
|
||||
value = g_fieldCache->value( field );
|
||||
else
|
||||
value = KJSString("");
|
||||
qCDebug(OkularCoreDebug) << "Getting the value of a readonly field" << field->name() << ":" << value.toString( context );
|
||||
return value;
|
||||
}
|
||||
|
||||
switch ( field->type() )
|
||||
{
|
||||
|
@ -159,14 +146,6 @@ static void fieldSetValue( KJSContext *context, void *object, KJSObject value )
|
|||
{
|
||||
FormField *field = reinterpret_cast< FormField * >( object );
|
||||
|
||||
if ( field->isReadOnly() )
|
||||
{
|
||||
// ### throw exception?
|
||||
qCDebug(OkularCoreDebug) << "Trying to change the readonly field" << field->name() << "to" << value.toString( context );
|
||||
g_fieldCache->insert( field, value );
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( field->type() )
|
||||
{
|
||||
case FormField::FormButton:
|
||||
|
@ -219,11 +198,3 @@ KJSObject JSField::wrapField( KJSContext *ctx, FormField *field, Page *page )
|
|||
f.setProperty( ctx, QStringLiteral("page"), page->number() );
|
||||
return f;
|
||||
}
|
||||
|
||||
void JSField::clearCachedFields()
|
||||
{
|
||||
if ( g_fieldCache.exists() )
|
||||
{
|
||||
g_fieldCache->clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ class JSField
|
|||
public:
|
||||
static void initType( KJSContext *ctx );
|
||||
static KJSObject wrapField( KJSContext *ctx, FormField *field, Page *page );
|
||||
static void clearCachedFields();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue