Commit a9c4a50a authored by Joao Oliveira's avatar Joao Oliveira

Deleted unused QDebug, added check to see if text is valid on start and...

Deleted unused QDebug, added check to see if text is valid on start and changed m_formatted to be consistent
parent 4c2f0354
Pipeline #6975 passed with stage
in 20 minutes and 23 seconds
......@@ -496,8 +496,7 @@ FormLineEdit::FormLineEdit( Okular::FormFieldText * text, QWidget * parent )
m_prevCursorPos = cursorPosition();
m_prevAnchorPos = cursorPosition();
m_editing = false;
m_formatted = true;
m_editing = m_formatted = false;
connect( this, &QLineEdit::textEdited, this, &FormLineEdit::slotChanged );
connect( this, &QLineEdit::cursorPositionChanged, this, &FormLineEdit::slotChanged );
......@@ -510,6 +509,25 @@ void FormLineEdit::setFormWidgetsController(FormWidgetsController* controller)
FormWidgetIface::setFormWidgetsController(controller);
connect( m_controller, &FormWidgetsController::formTextChangedByUndoRedo,
this, &FormLineEdit::slotHandleTextChangedByUndoRedo );
Okular::FormFieldText *fft = static_cast< Okular::FormFieldText * > ( m_ff );
m_lastText = fft->text();
if( const Okular::Action *action = m_ff->additionalAction( Okular::FormField::FieldModified ) )
{
bool ok = false;
emit m_controller->keystrokeAction( action, fft, ok );
if( !ok ){
fft->setText( text().replace( '.', ',' ) );
emit m_controller->keystrokeAction( action, fft, ok );
fft->setText( text() );
if( ok )
m_lastText = text().replace( '.', ',' );
}
}
setText( m_lastText );
processFormTextCommitActions();
}
bool FormLineEdit::event( QEvent* e )
......@@ -517,7 +535,6 @@ bool FormLineEdit::event( QEvent* e )
if ( e->type() == QEvent::KeyPress )
{
QKeyEvent *keyEvent = static_cast< QKeyEvent* >( e );
qDebug() << (keyEvent->text());
if ( keyEvent == QKeySequence::Undo )
{
emit m_controller->requestUndo();
......@@ -578,6 +595,7 @@ void FormLineEdit::processFormTextCommitActions()
{
m_formatted = true;
emit m_controller->formatAction( action, fft );
m_formatted = false;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment