Changed nomenclature and add format action now sets the AP stream text

remotes/origin/more-conventional-sidebar
João Netto 7 years ago committed by Albert Astals Cid
parent 53a8acf813
commit 6975c67a62
  1. 15
      core/document.cpp
  2. 12
      ui/formwidgets.cpp

@ -4326,7 +4326,7 @@ void Document::processFormatAction( const Action * action, Okular::FormFieldText
return; return;
} }
const QString oldVal = fft->text(); const QString unformattedText = fft->text();
std::shared_ptr< Event > event = Event::createFormatEvent( fft, d->m_pagesVector[foundPage] ); std::shared_ptr< Event > event = Event::createFormatEvent( fft, d->m_pagesVector[foundPage] );
@ -4341,17 +4341,18 @@ void Document::processFormatAction( const Action * action, Okular::FormFieldText
// Clear out the event after execution // Clear out the event after execution
d->m_scripter->setEvent( nullptr ); d->m_scripter->setEvent( nullptr );
const QString newVal = event->value().toString(); const QString formattedText = event->value().toString();
if ( newVal != oldVal ) if ( formattedText != unformattedText )
{ {
// We set the newVal, because when we call refreshFormWidget // We set the formattedText, because when we call refreshFormWidget
// It will set the QLineEdit to this newVal // It will set the QLineEdit to this formattedText
fft->setText( newVal ); fft->setText( formattedText );
fft->setAppearanceText( formattedText );
emit refreshFormWidget( fft ); emit refreshFormWidget( fft );
d->refreshPixmaps( foundPage ); d->refreshPixmaps( foundPage );
// Then we make the form have the unformatted text, to use // Then we make the form have the unformatted text, to use
// in calculations and other things. // in calculations and other things.
fft->setText( oldVal ); fft->setText( unformattedText );
} }
else if ( fft->additionalAction( FormField::CalculateField ) ) else if ( fft->additionalAction( FormField::CalculateField ) )
{ {

@ -556,13 +556,13 @@ void FormLineEdit::slotChanged()
if( form->additionalAction( Okular::FormField::FieldModified ) && m_editing && !form->isReadOnly() ) if( form->additionalAction( Okular::FormField::FieldModified ) && m_editing && !form->isReadOnly() )
{ {
bool ok = false; bool ok = false;
QString oldText = form->text(); QString oldInputText = form->text();
form->setText( text() ); form->setText( text() );
emit m_controller->keystrokeAction( form->additionalAction( Okular::FormField::FieldModified ), form, ok ); emit m_controller->keystrokeAction( form->additionalAction( Okular::FormField::FieldModified ), form, ok );
form->setText( oldText ); form->setText( oldInputText );
if(!ok) if(!ok)
{ {
setText( oldText ); setText( oldInputText );
return; return;
} }
} }
@ -743,13 +743,13 @@ void TextAreaEdit::slotChanged()
if( form->additionalAction( Okular::FormField::FieldModified ) && m_editing && !form->isReadOnly() ) if( form->additionalAction( Okular::FormField::FieldModified ) && m_editing && !form->isReadOnly() )
{ {
bool ok = false; bool ok = false;
QString oldText = form->text(); QString oldInputText = form->text();
form->setText( toPlainText() ); form->setText( toPlainText() );
emit m_controller->keystrokeAction( form->additionalAction( Okular::FormField::FieldModified ), form, ok ); emit m_controller->keystrokeAction( form->additionalAction( Okular::FormField::FieldModified ), form, ok );
form->setText( oldText ); form->setText( oldInputText );
if(!ok) if(!ok)
{ {
setText( oldText ); setText( oldInputText );
return; return;
} }
} }

Loading…
Cancel
Save