From 6975c67a62ff1849e9b6e8a08759ef2a51481903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Netto?= Date: Sat, 10 Aug 2019 18:21:38 -0300 Subject: [PATCH] Changed nomenclature and add format action now sets the AP stream text --- core/document.cpp | 15 ++++++++------- ui/formwidgets.cpp | 12 ++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/core/document.cpp b/core/document.cpp index f70fa3522..2c3242d1c 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -4326,7 +4326,7 @@ void Document::processFormatAction( const Action * action, Okular::FormFieldText return; } - const QString oldVal = fft->text(); + const QString unformattedText = fft->text(); 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 d->m_scripter->setEvent( nullptr ); - const QString newVal = event->value().toString(); - if ( newVal != oldVal ) + const QString formattedText = event->value().toString(); + if ( formattedText != unformattedText ) { - // We set the newVal, because when we call refreshFormWidget - // It will set the QLineEdit to this newVal - fft->setText( newVal ); + // We set the formattedText, because when we call refreshFormWidget + // It will set the QLineEdit to this formattedText + fft->setText( formattedText ); + fft->setAppearanceText( formattedText ); 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 ); + fft->setText( unformattedText ); } else if ( fft->additionalAction( FormField::CalculateField ) ) { diff --git a/ui/formwidgets.cpp b/ui/formwidgets.cpp index 36abf6ab8..290bb5658 100644 --- a/ui/formwidgets.cpp +++ b/ui/formwidgets.cpp @@ -556,13 +556,13 @@ void FormLineEdit::slotChanged() if( form->additionalAction( Okular::FormField::FieldModified ) && m_editing && !form->isReadOnly() ) { bool ok = false; - QString oldText = form->text(); + QString oldInputText = form->text(); form->setText( text() ); emit m_controller->keystrokeAction( form->additionalAction( Okular::FormField::FieldModified ), form, ok ); - form->setText( oldText ); + form->setText( oldInputText ); if(!ok) { - setText( oldText ); + setText( oldInputText ); return; } } @@ -743,13 +743,13 @@ void TextAreaEdit::slotChanged() if( form->additionalAction( Okular::FormField::FieldModified ) && m_editing && !form->isReadOnly() ) { bool ok = false; - QString oldText = form->text(); + QString oldInputText = form->text(); form->setText( toPlainText() ); emit m_controller->keystrokeAction( form->additionalAction( Okular::FormField::FieldModified ), form, ok ); - form->setText( oldText ); + form->setText( oldInputText ); if(!ok) { - setText( oldText ); + setText( oldInputText ); return; } }