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
53a8acf8
Commit
53a8acf8
authored
Aug 09, 2019
by
Joao Oliveira
Committed by
Albert Astals Cid
Aug 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the use of internalText(), replacing by text()
parent
b66df684
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
72 deletions
+11
-72
core/document.cpp
core/document.cpp
+5
-7
core/documentcommands.cpp
core/documentcommands.cpp
+0
-2
core/form.cpp
core/form.cpp
+0
-31
core/form.h
core/form.h
+0
-25
core/script/event.cpp
core/script/event.cpp
+2
-2
core/script/kjs_field.cpp
core/script/kjs_field.cpp
+2
-3
ui/formwidgets.cpp
ui/formwidgets.cpp
+2
-2
No files found.
core/document.cpp
View file @
53a8acf8
...
...
@@ -4328,9 +4328,6 @@ void Document::processFormatAction( const Action * action, Okular::FormFieldText
const
QString
oldVal
=
fft
->
text
();
// We are before formatting. So the unformatted text is currently in fft->text()
// Internally we want to use the current value for calculations and formatting.
fft
->
setInternalText
(
oldVal
);
std
::
shared_ptr
<
Event
>
event
=
Event
::
createFormatEvent
(
fft
,
d
->
m_pagesVector
[
foundPage
]
);
const
ScriptAction
*
linkscript
=
static_cast
<
const
ScriptAction
*
>
(
action
);
...
...
@@ -4347,9 +4344,14 @@ void Document::processFormatAction( const Action * action, Okular::FormFieldText
const
QString
newVal
=
event
->
value
().
toString
();
if
(
newVal
!=
oldVal
)
{
// We set the newVal, because when we call refreshFormWidget
// It will set the QLineEdit to this newVal
fft
->
setText
(
newVal
);
emit
refreshFormWidget
(
fft
);
d
->
refreshPixmaps
(
foundPage
);
// Then we make the form have the unformatted text, to use
// in calculations and other things.
fft
->
setText
(
oldVal
);
}
else
if
(
fft
->
additionalAction
(
FormField
::
CalculateField
)
)
{
...
...
@@ -4400,10 +4402,6 @@ void Document::processKeystrokeAction( const Action * action, Okular::FormFieldT
// Clear out the event after execution
d
->
m_scripter
->
setEvent
(
nullptr
);
returnCode
=
event
->
returnCode
();
if
(
returnCode
)
{
fft
->
setInternalText
(
fft
->
text
()
);
}
}
void
Document
::
processSourceReference
(
const
SourceReference
*
ref
)
...
...
core/documentcommands.cpp
View file @
53a8acf8
...
...
@@ -506,7 +506,6 @@ void EditFormTextCommand::undo()
{
moveViewportIfBoundingRectNotFullyVisible
(
m_form
->
rect
(),
m_docPriv
,
m_pageNumber
);
m_form
->
setText
(
m_prevContents
);
m_form
->
setInternalText
(
m_prevContents
);
emit
m_docPriv
->
m_parent
->
formTextChangedByUndoRedo
(
m_pageNumber
,
m_form
,
m_prevContents
,
m_prevCursorPos
,
m_prevAnchorPos
);
m_docPriv
->
notifyFormChanges
(
m_pageNumber
);
}
...
...
@@ -515,7 +514,6 @@ void EditFormTextCommand::redo()
{
moveViewportIfBoundingRectNotFullyVisible
(
m_form
->
rect
(),
m_docPriv
,
m_pageNumber
);
m_form
->
setText
(
m_newContents
);
m_form
->
setInternalText
(
m_newContents
);
emit
m_docPriv
->
m_parent
->
formTextChangedByUndoRedo
(
m_pageNumber
,
m_form
,
m_newContents
,
m_newCursorPos
,
m_newCursorPos
);
m_docPriv
->
notifyFormChanges
(
m_pageNumber
);
}
...
...
core/form.cpp
View file @
53a8acf8
...
...
@@ -182,19 +182,6 @@ class Okular::FormFieldTextPrivate : public Okular::FormFieldPrivate
Q_Q
(
const
FormFieldText
);
return
q
->
text
();
}
void
setInternalText
(
const
QString
&
v
)
{
m_internalText
=
v
;
}
QString
internalText
()
const
{
return
m_internalText
;
}
private:
QString
m_internalText
;
};
...
...
@@ -236,24 +223,6 @@ bool FormFieldText::canBeSpellChecked() const
return
false
;
}
QString
FormFieldText
::
internalText
()
const
{
Q_D
(
const
FormFieldText
);
const
QString
val
=
d
->
internalText
();
if
(
val
.
isNull
()
)
{
return
text
();
}
return
val
;
}
void
FormFieldText
::
setInternalText
(
const
QString
&
text
)
{
Q_D
(
FormFieldText
);
d
->
setInternalText
(
text
);
}
class
Okular
::
FormFieldChoicePrivate
:
public
Okular
::
FormFieldPrivate
{
public:
...
...
core/form.h
View file @
53a8acf8
...
...
@@ -317,31 +317,6 @@ class OKULARCORE_EXPORT FormFieldText : public FormField
*/
virtual
bool
canBeSpellChecked
()
const
;
/**
* Optionally different internal text.
*
* Internal text is the value of the field before formatting
* and should be used for editing and calculations.
*
* The default implementation returns the value of
* @ref text if no internal text was set.
*
* @since 1.5
*/
virtual
QString
internalText
()
const
;
/**
* Set internalText to a value before formatting.
*
* If the text value was changed for display purposes use
* setRawText to store the internal value @p text before
* formatting. The internal text is used for calculations
* and editing.
*
* @since 1.5
*/
virtual
void
setInternalText
(
const
QString
&
text
);
/**
* Set the text which should be rendered by the PDF.
*
...
...
core/script/event.cpp
View file @
53a8acf8
...
...
@@ -171,7 +171,7 @@ std::shared_ptr<Event> Event::createFormCalculateEvent( FormField *target,
FormFieldText
*
fft
=
dynamic_cast
<
FormFieldText
*
>
(
target
);
if
(
fft
)
{
ret
->
setValue
(
QVariant
(
fft
->
internalT
ext
()
)
);
ret
->
setValue
(
QVariant
(
fft
->
t
ext
()
)
);
}
return
ret
;
}
...
...
@@ -189,7 +189,7 @@ std::shared_ptr<Event> Event::createFormatEvent( FormField *target,
FormFieldText
*
fft
=
dynamic_cast
<
FormFieldText
*
>
(
target
);
if
(
fft
)
{
ret
->
setValue
(
QVariant
(
fft
->
internalT
ext
()
)
);
ret
->
setValue
(
QVariant
(
fft
->
t
ext
()
)
);
}
return
ret
;
}
...
...
core/script/kjs_field.cpp
View file @
53a8acf8
...
...
@@ -148,7 +148,7 @@ static KJSObject fieldGetValue( KJSContext */*context*/, void *object )
case
FormField
::
FormText
:
{
const
FormFieldText
*
text
=
static_cast
<
const
FormFieldText
*
>
(
field
);
return
KJSString
(
text
->
internalT
ext
()
);
return
KJSString
(
text
->
t
ext
()
);
}
case
FormField
::
FormChoice
:
{
...
...
@@ -192,10 +192,9 @@ static void fieldSetValue( KJSContext *context, void *object, KJSObject value )
{
FormFieldText
*
textField
=
static_cast
<
FormFieldText
*
>
(
field
);
const
QString
text
=
value
.
toString
(
context
);
if
(
text
!=
textField
->
internalT
ext
()
)
if
(
text
!=
textField
->
t
ext
()
)
{
textField
->
setText
(
text
);
textField
->
setInternalText
(
text
);
updateField
(
field
);
}
break
;
...
...
ui/formwidgets.cpp
View file @
53a8acf8
...
...
@@ -505,7 +505,7 @@ bool FormLineEdit::event( QEvent* e )
else
if
(
e
->
type
()
==
QEvent
::
FocusIn
)
{
const
auto
fft
=
static_cast
<
Okular
::
FormFieldText
*
>
(
m_ff
);
setText
(
fft
->
internalT
ext
()
);
setText
(
fft
->
t
ext
()
);
m_editing
=
true
;
}
else
if
(
e
->
type
()
==
QEvent
::
FocusOut
)
...
...
@@ -667,7 +667,7 @@ bool TextAreaEdit::event( QEvent* e )
else
if
(
e
->
type
()
==
QEvent
::
FocusIn
)
{
const
auto
fft
=
static_cast
<
Okular
::
FormFieldText
*
>
(
m_ff
);
setText
(
fft
->
internalT
ext
()
);
setText
(
fft
->
t
ext
()
);
m_editing
=
true
;
}
else
if
(
e
->
type
()
==
QEvent
::
FocusOut
)
...
...
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