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

Fixed the KJSPrototype pointers and deleted unused arguments.

parent ad858267
......@@ -220,11 +220,11 @@ static KJSObject appSetInterval( KJSContext *ctx, void *object,
}
// app.clearInterval()
static KJSObject appClearInterval( KJSContext *ctx, void *object,
static KJSObject appClearInterval( KJSContext *ctx, void *,
const KJSArguments &arguments )
{
KJSObject timerObject = arguments.at( 0 );
const int timerId = timerObject.property( ctx, QStringLiteral( "timerID" ).toLatin1().toBase64() ).toInt32( ctx );
const int timerId = timerObject.property( ctx, QStringLiteral("okular_timerID") ).toInt32( ctx );
QTimer *timer = g_timerCache->value( timerId );
if( timer != nullptr )
{
......@@ -255,11 +255,11 @@ static KJSObject appSetTimeOut( KJSContext *ctx, void *object,
}
// app.clearTimeOut()
static KJSObject appClearTimeOut( KJSContext *ctx, void *object,
static KJSObject appClearTimeOut( KJSContext *ctx, void *,
const KJSArguments &arguments )
{
KJSObject timerObject = arguments.at( 0 );
const int timerId = timerObject.property( ctx, QStringLiteral( "timerID" ).toLatin1().toBase64() ).toInt32( ctx );
const int timerId = timerObject.property( ctx, QStringLiteral("okular_timerID") ).toInt32( ctx );
QTimer *timer = g_timerCache->value( timerId );
if( timer != nullptr )
......@@ -311,7 +311,7 @@ KJSObject JSApp::object( KJSContext *ctx, DocumentPrivate *doc )
KJSObject JSApp::wrapTimer( KJSContext *ctx, QTimer *timer)
{
KJSObject timerObject = g_appProto->constructObject( ctx, timer );
timerObject.setProperty( ctx, QStringLiteral("timerID").toLatin1().toBase64(), timer->timerId() );
timerObject.setProperty( ctx, QStringLiteral("okular_timerID"), timer->timerId() );
g_timerCache->insert( timer->timerId(), timer );
......
......@@ -19,7 +19,7 @@
using namespace Okular;
std::unique_ptr < KJSPrototype > g_displayProto;
static KJSPrototype *g_displayProto;
// display.hidden
static KJSObject displayGetHidden( KJSContext *, void * )
......@@ -47,10 +47,12 @@ static KJSObject displayGetNoPrint( KJSContext *, void * )
void JSDisplay::initType( KJSContext *ctx )
{
if ( g_displayProto )
static bool initialized = false;
if ( initialized )
return;
initialized = true;
g_displayProto.reset(new KJSPrototype);
g_displayProto = new KJSPrototype();
g_displayProto->defineProperty( ctx, QStringLiteral("hidden"), displayGetHidden );
g_displayProto->defineProperty( ctx, QStringLiteral("visible"), displayGetVisible );
......
......@@ -290,7 +290,7 @@ static KJSObject docGetNthFieldName( KJSContext *ctx, void *object,
}
static KJSObject docGetOCGs( KJSContext *ctx, void *object,
const KJSArguments &arguments )
const KJSArguments & )
{
const DocumentPrivate *doc = reinterpret_cast< DocumentPrivate* >( object );
......
......@@ -273,7 +273,7 @@ static KJSObject fieldButtonGetIcon( KJSContext *ctx, void *object,
FormField *field = reinterpret_cast< FormField * >( object );
KJSObject fieldObject;
fieldObject.setProperty( ctx, QStringLiteral("name").toLatin1().toBase64(), field->name() );
fieldObject.setProperty( ctx, QStringLiteral("okular_name"), field->name() );
g_buttonCache->insert( field->name(), field );
return fieldObject;
......@@ -287,7 +287,7 @@ static KJSObject fieldButtonSetIcon( KJSContext *ctx, void *object,
{
FormField *field = reinterpret_cast< FormField * >( object );
const QString fieldName = arguments.at( 0 ).property( ctx, QStringLiteral("name").toLatin1().toBase64() ).toString( ctx );
const QString fieldName = arguments.at( 0 ).property( ctx, QStringLiteral("okular_name") ).toString( ctx );
if( field->type() == Okular::FormField::FormButton )
{
......
......@@ -22,7 +22,7 @@
using namespace Okular;
std::unique_ptr < KJSPrototype > g_OCGProto;
static KJSPrototype *g_OCGProto;
typedef QHash< QPair< int, int > *, QAbstractItemModel* > OCGCache;
Q_GLOBAL_STATIC( OCGCache, g_OCGCache )
......@@ -57,10 +57,12 @@ static void OCGSetState( KJSContext* ctx, void* object,
void JSOCG::initType( KJSContext *ctx )
{
if ( g_OCGProto )
static bool initialized = false;
if ( initialized )
return;
initialized = true;
g_OCGProto.reset(new KJSPrototype);
g_OCGProto = new KJSPrototype();
g_OCGProto->defineProperty( ctx, QStringLiteral("state"), OCGGetState, OCGSetState );
}
......
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