Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Okular
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joao Oliveira
Okular
Commits
60ff2f41
Commit
60ff2f41
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 indentation, bad algebra and moved display enum to KJSDisplay
parent
da013338
Pipeline
#5596
passed with stage
in 11 minutes and 28 seconds
Changes
11
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
46 additions
and
46 deletions
+46
-46
core/document_p.h
core/document_p.h
+1
-1
core/form.h
core/form.h
+3
-14
core/script/kjs_app.cpp
core/script/kjs_app.cpp
+8
-5
core/script/kjs_app_p.h
core/script/kjs_app_p.h
+1
-2
core/script/kjs_display.cpp
core/script/kjs_display.cpp
+4
-6
core/script/kjs_display_p.h
core/script/kjs_display_p.h
+11
-0
core/script/kjs_field.cpp
core/script/kjs_field.cpp
+11
-9
core/script/kjs_ocg.cpp
core/script/kjs_ocg.cpp
+2
-4
core/script/kjs_ocg_p.h
core/script/kjs_ocg_p.h
+1
-1
generators/poppler/formfields.cpp
generators/poppler/formfields.cpp
+3
-3
generators/poppler/formfields.h
generators/poppler/formfields.h
+1
-1
No files found.
core/document_p.h
View file @
60ff2f41
...
...
@@ -194,7 +194,7 @@ class DocumentPrivate
/**
* Executes a JavaScript script from the setInterval function.
*
* @since 1.
7
* @since 1.
9
*/
void
executeScript
(
const
QString
&
function
);
...
...
core/form.h
View file @
60ff2f41
...
...
@@ -57,17 +57,6 @@ class OKULARCORE_EXPORT FormField
FormSignature
///< A signature.
};
/**
* The display types of the field.
*/
enum
FieldDisplay
{
FormVisible
,
FormHidden
,
FormNoPrint
,
FormNoView
};
virtual
~
FormField
();
/**
...
...
@@ -124,14 +113,14 @@ class OKULARCORE_EXPORT FormField
/**
Whether this field is printable.
@since 1.
7
@since 1.
9
*/
virtual
bool
isPrintable
()
const
;
/**
Set this field printable
@since 1.
7
@since 1.
9
*/
virtual
void
setPrintable
(
bool
value
);
...
...
@@ -235,7 +224,7 @@ class OKULARCORE_EXPORT FormFieldButton : public FormField
/**
* Sets the icon of the Button to the Icon of the field parameter.
*
* @since 1.
7
* @since 1.
9
*/
virtual
void
setIcon
(
Okular
::
FormField
*
field
);
...
...
core/script/kjs_app.cpp
View file @
60ff2f41
...
...
@@ -17,6 +17,7 @@
#include <qapplication.h>
#include <QLocale>
#include <QTimer>
#include <KLocalizedString>
...
...
@@ -26,6 +27,8 @@
using
namespace
Okular
;
#define OKULAR_TIMERID QStringLiteral( "okular_timerID" )
static
KJSPrototype
*
g_appProto
;
typedef
QHash
<
int
,
QTimer
*
>
TimerCache
;
Q_GLOBAL_STATIC
(
TimerCache
,
g_timerCache
)
...
...
@@ -212,7 +215,7 @@ static KJSObject appSetInterval( KJSContext *ctx, void *object,
QTimer
*
timer
=
new
QTimer
();
QObject
::
connect
(
timer
,
&
QTimer
::
timeout
,
[
=
](){
doc
->
executeScript
(
function
);
}
);
QObject
::
connect
(
timer
,
&
QTimer
::
timeout
,
doc
->
m_parent
,
[
=
](){
doc
->
executeScript
(
function
);
}
);
timer
->
start
(
interval
);
...
...
@@ -224,7 +227,7 @@ static KJSObject appClearInterval( KJSContext *ctx, void *,
const
KJSArguments
&
arguments
)
{
KJSObject
timerObject
=
arguments
.
at
(
0
);
const
int
timerId
=
timerObject
.
property
(
ctx
,
QStringLiteral
(
"okular_timerID"
)
).
toInt32
(
ctx
);
const
int
timerId
=
timerObject
.
property
(
ctx
,
OKULAR_TIMERID
).
toInt32
(
ctx
);
QTimer
*
timer
=
g_timerCache
->
value
(
timerId
);
if
(
timer
!=
nullptr
)
{
...
...
@@ -247,7 +250,7 @@ static KJSObject appSetTimeOut( KJSContext *ctx, void *object,
QTimer
*
timer
=
new
QTimer
();
timer
->
setSingleShot
(
true
);
QObject
::
connect
(
timer
,
&
QTimer
::
timeout
,
[
=
](){
doc
->
executeScript
(
function
);
}
);
QObject
::
connect
(
timer
,
&
QTimer
::
timeout
,
doc
->
m_parent
,
[
=
](){
doc
->
executeScript
(
function
);
}
);
timer
->
start
(
interval
);
...
...
@@ -259,7 +262,7 @@ static KJSObject appClearTimeOut( KJSContext *ctx, void *,
const
KJSArguments
&
arguments
)
{
KJSObject
timerObject
=
arguments
.
at
(
0
);
const
int
timerId
=
timerObject
.
property
(
ctx
,
QStringLiteral
(
"okular_timerID"
)
).
toInt32
(
ctx
);
const
int
timerId
=
timerObject
.
property
(
ctx
,
OKULAR_TIMERID
).
toInt32
(
ctx
);
QTimer
*
timer
=
g_timerCache
->
value
(
timerId
);
if
(
timer
!=
nullptr
)
...
...
@@ -311,7 +314,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
(
"okular_timerID"
)
,
timer
->
timerId
()
);
timerObject
.
setProperty
(
ctx
,
OKULAR_TIMERID
,
timer
->
timerId
()
);
g_timerCache
->
insert
(
timer
->
timerId
(),
timer
);
...
...
core/script/kjs_app_p.h
View file @
60ff2f41
...
...
@@ -13,8 +13,7 @@
class
KJSContext
;
class
KJSObject
;
#include <QTimer>
class
QTimer
;
namespace
Okular
{
...
...
core/script/kjs_display.cpp
View file @
60ff2f41
...
...
@@ -15,8 +15,6 @@
#include <QString>
#include <memory>
using
namespace
Okular
;
static
KJSPrototype
*
g_displayProto
;
...
...
@@ -24,25 +22,25 @@ static KJSPrototype *g_displayProto;
// display.hidden
static
KJSObject
displayGetHidden
(
KJSContext
*
,
void
*
)
{
return
KJSNumber
(
Form
Field
::
FormHidden
);
return
KJSNumber
(
Form
Display
::
FormHidden
);
}
// display.visible
static
KJSObject
displayGetVisible
(
KJSContext
*
,
void
*
)
{
return
KJSNumber
(
Form
Field
::
FormVisible
);
return
KJSNumber
(
Form
Display
::
FormVisible
);
}
// display.noView
static
KJSObject
displayGetNoView
(
KJSContext
*
,
void
*
)
{
return
KJSNumber
(
Form
Field
::
FormNoView
);
return
KJSNumber
(
Form
Display
::
FormNoView
);
}
// display.noPrint
static
KJSObject
displayGetNoPrint
(
KJSContext
*
,
void
*
)
{
return
KJSNumber
(
Form
Field
::
FormNoPrint
);
return
KJSNumber
(
Form
Display
::
FormNoPrint
);
}
void
JSDisplay
::
initType
(
KJSContext
*
ctx
)
...
...
core/script/kjs_display_p.h
View file @
60ff2f41
...
...
@@ -15,6 +15,17 @@ class KJSObject;
namespace
Okular
{
/**
* The display types of the field.
*/
enum
FormDisplay
{
FormVisible
,
FormHidden
,
FormNoPrint
,
FormNoView
};
class
JSDisplay
{
public:
...
...
core/script/kjs_field.cpp
View file @
60ff2f41
...
...
@@ -17,16 +17,18 @@
#include <qhash.h>
#include <QDebug>
#include <memory>
#include "../debug_p.h"
#include "../document_p.h"
#include "../form.h"
#include "../page.h"
#include "../page_p.h"
#include "kjs_display_p.h"
using
namespace
Okular
;
#define OKULAR_NAME QStringLiteral("okular_name")
static
KJSPrototype
*
g_fieldProto
;
typedef
QHash
<
FormField
*
,
Page
*
>
FormCache
;
...
...
@@ -234,9 +236,9 @@ static KJSObject fieldGetDisplay( KJSContext *, void *object )
bool
visible
=
field
->
isVisible
();
if
(
visible
)
{
return
KJSNumber
(
field
->
isPrintable
()
?
Form
Field
::
FormVisible
:
FormField
::
FormNoPrint
);
return
KJSNumber
(
field
->
isPrintable
()
?
Form
Display
::
FormVisible
:
FormDisplay
::
FormNoPrint
);
}
return
KJSNumber
(
field
->
isPrintable
()
?
Form
Field
::
FormNoView
:
FormField
::
FormHidden
);
return
KJSNumber
(
field
->
isPrintable
()
?
Form
Display
::
FormNoView
:
FormDisplay
::
FormHidden
);
}
// Field.display (setter)
...
...
@@ -246,19 +248,19 @@ static void fieldSetDisplay( KJSContext *context, void *object, KJSObject value
const
unsigned
int
b
=
value
.
toInt32
(
context
);
switch
(
b
)
{
case
Form
Field
::
FormVisible
:
case
Form
Display
::
FormVisible
:
field
->
setVisible
(
true
);
field
->
setPrintable
(
true
);
break
;
case
Form
Field
::
FormHidden
:
case
Form
Display
::
FormHidden
:
field
->
setVisible
(
false
);
field
->
setPrintable
(
false
);
break
;
case
Form
Field
::
FormNoPrint
:
case
Form
Display
::
FormNoPrint
:
field
->
setVisible
(
true
);
field
->
setPrintable
(
false
);
break
;
case
Form
Field
::
FormNoView
:
case
Form
Display
::
FormNoView
:
field
->
setVisible
(
false
);
field
->
setPrintable
(
true
);
break
;
...
...
@@ -273,7 +275,7 @@ static KJSObject fieldButtonGetIcon( KJSContext *ctx, void *object,
FormField
*
field
=
reinterpret_cast
<
FormField
*
>
(
object
);
KJSObject
fieldObject
;
fieldObject
.
setProperty
(
ctx
,
QStringLiteral
(
"okular_name"
)
,
field
->
name
()
);
fieldObject
.
setProperty
(
ctx
,
OKULAR_NAME
,
field
->
name
()
);
g_buttonCache
->
insert
(
field
->
name
(),
field
);
return
fieldObject
;
...
...
@@ -287,7 +289,7 @@ static KJSObject fieldButtonSetIcon( KJSContext *ctx, void *object,
{
FormField
*
field
=
reinterpret_cast
<
FormField
*
>
(
object
);
const
QString
fieldName
=
arguments
.
at
(
0
).
property
(
ctx
,
QStringLiteral
(
"okular_name"
)
).
toString
(
ctx
);
const
QString
fieldName
=
arguments
.
at
(
0
).
property
(
ctx
,
OKULAR_NAME
).
toString
(
ctx
);
if
(
field
->
type
()
==
Okular
::
FormField
::
FormButton
)
{
...
...
core/script/kjs_ocg.cpp
View file @
60ff2f41
...
...
@@ -18,8 +18,6 @@
#include <QDebug>
#include <QPair>
#include <memory>
using
namespace
Okular
;
static
KJSPrototype
*
g_OCGProto
;
...
...
@@ -42,7 +40,7 @@ static KJSObject OCGGetState( KJSContext *, void *object )
// OCG.state (setter)
static
void
OCGSetState
(
KJSContext
*
ctx
,
void
*
object
,
KJSObject
value
)
KJSObject
value
)
{
QPair
<
int
,
int
>
*
pair
=
reinterpret_cast
<
QPair
<
int
,
int
>*
>
(
object
);
QAbstractItemModel
*
model
=
g_OCGCache
->
value
(
pair
);
...
...
@@ -85,4 +83,4 @@ void JSOCG::clearCachedFields()
{
g_OCGCache
->
clear
();
}
}
\ No newline at end of file
}
core/script/kjs_ocg_p.h
View file @
60ff2f41
...
...
@@ -27,4 +27,4 @@ class JSOCG
}
#endif
\ No newline at end of file
#endif
generators/poppler/formfields.cpp
View file @
60ff2f41
...
...
@@ -110,7 +110,7 @@ bool PopplerFormFieldButton::isPrintable() const
#ifdef HAVE_POPPLER_0_79
return
m_field
->
isPrintable
();
#else
return
m_field
->
isVisible
()
?
true
:
fals
e
;
return
tru
e
;
#endif
}
...
...
@@ -244,7 +244,7 @@ bool PopplerFormFieldText::isPrintable() const
#ifdef HAVE_POPPLER_0_79
return
m_field
->
isPrintable
();
#else
return
m_field
->
isVisible
()
?
true
:
fals
e
;
return
tru
e
;
#endif
}
...
...
@@ -374,7 +374,7 @@ bool PopplerFormFieldChoice::isPrintable() const
#ifdef HAVE_POPPLER_0_79
return
m_field
->
isPrintable
();
#else
return
m_field
->
isVisible
()
?
true
:
fals
e
;
return
tru
e
;
#endif
}
...
...
generators/poppler/formfields.h
View file @
60ff2f41
...
...
@@ -43,7 +43,7 @@ class PopplerFormFieldButton : public Okular::FormFieldButton
/*
* Supported only in newer versions of Poppler library.
*
* @since 1.
7
* @since 1.
9
*/
Poppler
::
FormFieldIcon
icon
()
const
;
#endif
...
...
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