Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Joao Oliveira
Okular
Commits
da013338
Commit
da013338
authored
Jul 19, 2019
by
Joao Oliveira
Committed by
Albert Astals Cid
Jul 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the KJSPrototype pointers and deleted unused arguments.
parent
ad858267
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
16 deletions
+20
-16
core/script/kjs_app.cpp
core/script/kjs_app.cpp
+5
-5
core/script/kjs_display.cpp
core/script/kjs_display.cpp
+6
-4
core/script/kjs_document.cpp
core/script/kjs_document.cpp
+1
-1
core/script/kjs_field.cpp
core/script/kjs_field.cpp
+2
-2
core/script/kjs_ocg.cpp
core/script/kjs_ocg.cpp
+6
-4
No files found.
core/script/kjs_app.cpp
View file @
da013338
...
@@ -220,11 +220,11 @@ static KJSObject appSetInterval( KJSContext *ctx, void *object,
...
@@ -220,11 +220,11 @@ static KJSObject appSetInterval( KJSContext *ctx, void *object,
}
}
// app.clearInterval()
// app.clearInterval()
static
KJSObject
appClearInterval
(
KJSContext
*
ctx
,
void
*
object
,
static
KJSObject
appClearInterval
(
KJSContext
*
ctx
,
void
*
,
const
KJSArguments
&
arguments
)
const
KJSArguments
&
arguments
)
{
{
KJSObject
timerObject
=
arguments
.
at
(
0
);
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
);
QTimer
*
timer
=
g_timerCache
->
value
(
timerId
);
if
(
timer
!=
nullptr
)
if
(
timer
!=
nullptr
)
{
{
...
@@ -255,11 +255,11 @@ static KJSObject appSetTimeOut( KJSContext *ctx, void *object,
...
@@ -255,11 +255,11 @@ static KJSObject appSetTimeOut( KJSContext *ctx, void *object,
}
}
// app.clearTimeOut()
// app.clearTimeOut()
static
KJSObject
appClearTimeOut
(
KJSContext
*
ctx
,
void
*
object
,
static
KJSObject
appClearTimeOut
(
KJSContext
*
ctx
,
void
*
,
const
KJSArguments
&
arguments
)
const
KJSArguments
&
arguments
)
{
{
KJSObject
timerObject
=
arguments
.
at
(
0
);
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
);
QTimer
*
timer
=
g_timerCache
->
value
(
timerId
);
if
(
timer
!=
nullptr
)
if
(
timer
!=
nullptr
)
...
@@ -311,7 +311,7 @@ KJSObject JSApp::object( KJSContext *ctx, DocumentPrivate *doc )
...
@@ -311,7 +311,7 @@ KJSObject JSApp::object( KJSContext *ctx, DocumentPrivate *doc )
KJSObject
JSApp
::
wrapTimer
(
KJSContext
*
ctx
,
QTimer
*
timer
)
KJSObject
JSApp
::
wrapTimer
(
KJSContext
*
ctx
,
QTimer
*
timer
)
{
{
KJSObject
timerObject
=
g_appProto
->
constructObject
(
ctx
,
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
);
g_timerCache
->
insert
(
timer
->
timerId
(),
timer
);
...
...
core/script/kjs_display.cpp
View file @
da013338
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
using
namespace
Okular
;
using
namespace
Okular
;
st
d
::
unique_ptr
<
KJSPrototype
>
g_displayProto
;
st
atic
KJSPrototype
*
g_displayProto
;
// display.hidden
// display.hidden
static
KJSObject
displayGetHidden
(
KJSContext
*
,
void
*
)
static
KJSObject
displayGetHidden
(
KJSContext
*
,
void
*
)
...
@@ -47,10 +47,12 @@ static KJSObject displayGetNoPrint( KJSContext *, void * )
...
@@ -47,10 +47,12 @@ static KJSObject displayGetNoPrint( KJSContext *, void * )
void
JSDisplay
::
initType
(
KJSContext
*
ctx
)
void
JSDisplay
::
initType
(
KJSContext
*
ctx
)
{
{
if
(
g_displayProto
)
static
bool
initialized
=
false
;
if
(
initialized
)
return
;
return
;
initialized
=
true
;
g_displayProto
.
reset
(
new
KJSPrototype
);
g_displayProto
=
new
KJSPrototype
(
);
g_displayProto
->
defineProperty
(
ctx
,
QStringLiteral
(
"hidden"
),
displayGetHidden
);
g_displayProto
->
defineProperty
(
ctx
,
QStringLiteral
(
"hidden"
),
displayGetHidden
);
g_displayProto
->
defineProperty
(
ctx
,
QStringLiteral
(
"visible"
),
displayGetVisible
);
g_displayProto
->
defineProperty
(
ctx
,
QStringLiteral
(
"visible"
),
displayGetVisible
);
...
...
core/script/kjs_document.cpp
View file @
da013338
...
@@ -290,7 +290,7 @@ static KJSObject docGetNthFieldName( KJSContext *ctx, void *object,
...
@@ -290,7 +290,7 @@ static KJSObject docGetNthFieldName( KJSContext *ctx, void *object,
}
}
static
KJSObject
docGetOCGs
(
KJSContext
*
ctx
,
void
*
object
,
static
KJSObject
docGetOCGs
(
KJSContext
*
ctx
,
void
*
object
,
const
KJSArguments
&
arguments
)
const
KJSArguments
&
)
{
{
const
DocumentPrivate
*
doc
=
reinterpret_cast
<
DocumentPrivate
*
>
(
object
);
const
DocumentPrivate
*
doc
=
reinterpret_cast
<
DocumentPrivate
*
>
(
object
);
...
...
core/script/kjs_field.cpp
View file @
da013338
...
@@ -273,7 +273,7 @@ static KJSObject fieldButtonGetIcon( KJSContext *ctx, void *object,
...
@@ -273,7 +273,7 @@ static KJSObject fieldButtonGetIcon( KJSContext *ctx, void *object,
FormField
*
field
=
reinterpret_cast
<
FormField
*
>
(
object
);
FormField
*
field
=
reinterpret_cast
<
FormField
*
>
(
object
);
KJSObject
fieldObject
;
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
);
g_buttonCache
->
insert
(
field
->
name
(),
field
);
return
fieldObject
;
return
fieldObject
;
...
@@ -287,7 +287,7 @@ static KJSObject fieldButtonSetIcon( KJSContext *ctx, void *object,
...
@@ -287,7 +287,7 @@ static KJSObject fieldButtonSetIcon( KJSContext *ctx, void *object,
{
{
FormField
*
field
=
reinterpret_cast
<
FormField
*
>
(
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
)
if
(
field
->
type
()
==
Okular
::
FormField
::
FormButton
)
{
{
...
...
core/script/kjs_ocg.cpp
View file @
da013338
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
using
namespace
Okular
;
using
namespace
Okular
;
st
d
::
unique_ptr
<
KJSPrototype
>
g_OCGProto
;
st
atic
KJSPrototype
*
g_OCGProto
;
typedef
QHash
<
QPair
<
int
,
int
>
*
,
QAbstractItemModel
*
>
OCGCache
;
typedef
QHash
<
QPair
<
int
,
int
>
*
,
QAbstractItemModel
*
>
OCGCache
;
Q_GLOBAL_STATIC
(
OCGCache
,
g_OCGCache
)
Q_GLOBAL_STATIC
(
OCGCache
,
g_OCGCache
)
...
@@ -57,10 +57,12 @@ static void OCGSetState( KJSContext* ctx, void* object,
...
@@ -57,10 +57,12 @@ static void OCGSetState( KJSContext* ctx, void* object,
void
JSOCG
::
initType
(
KJSContext
*
ctx
)
void
JSOCG
::
initType
(
KJSContext
*
ctx
)
{
{
if
(
g_OCGProto
)
static
bool
initialized
=
false
;
if
(
initialized
)
return
;
return
;
initialized
=
true
;
g_OCGProto
.
reset
(
new
KJSPrototype
);
g_OCGProto
=
new
KJSPrototype
(
);
g_OCGProto
->
defineProperty
(
ctx
,
QStringLiteral
(
"state"
),
OCGGetState
,
OCGSetState
);
g_OCGProto
->
defineProperty
(
ctx
,
QStringLiteral
(
"state"
),
OCGGetState
,
OCGSetState
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment