kdelibs/kdelibs-4.6.5-khtml-kde#277457.patch
Kevin Kofler 951e5a7edf * Mon Jul 25 2011 Kevin Kofler <Kevin@tigcc.ticalc.org> 4.6.5-2
- fix KHTML form completion regression (kde#277457, patch by Andrea Iacovitti)
2011-07-26 00:22:59 +02:00

57 lines
2.0 KiB
Diff

--- kdelibs/khtml/rendering/render_form.cpp
+++ kdelibs/khtml/rendering/render_form.cpp
@@ -1012,11 +1012,11 @@
// -----------------------------------------------------------------------------
RenderLineEdit::RenderLineEdit(HTMLInputElementImpl *element)
- : RenderFormElement(element)
+ : RenderFormElement(element), m_blockElementUpdates(false)
{
LineEditWidget *edit = new LineEditWidget(element, view(), view()->widget());
connect(edit,SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
- connect(edit,SIGNAL(textEdited(QString)),this,SLOT(slotTextEdited(QString)));
+ connect(edit,SIGNAL(textChanged(QString)),this,SLOT(slotTextChanged(QString)));
if(element->inputType() == HTMLInputElementImpl::PASSWORD)
edit->setEchoMode( QLineEdit::Password );
@@ -1142,17 +1142,21 @@
}
if (element()->value().string() != widget()->text()) {
+ m_blockElementUpdates = true;
int pos = widget()->cursorPosition();
widget()->setText(element()->value().string());
widget()->setCursorPosition(pos);
+ m_blockElementUpdates = false;
}
widget()->setReadOnly(element()->readOnly());
RenderFormElement::updateFromElement();
}
-void RenderLineEdit::slotTextEdited(const QString &string)
+void RenderLineEdit::slotTextChanged(const QString &string)
{
+ if (m_blockElementUpdates) return;
+
// don't use setValue here!
element()->m_value = string;
element()->m_unsubmittedFormChange = true;
--- kdelibs/khtml/rendering/render_form.h
+++ kdelibs/khtml/rendering/render_form.h
@@ -282,12 +282,13 @@
void setSelectionRange(long start, long end);
public Q_SLOTS:
void slotReturnPressed();
- void slotTextEdited(const QString &string);
+ void slotTextChanged(const QString &string);
protected:
private:
virtual bool isEditable() const { return true; }
virtual bool canHaveBorder() const { return true; }
+ bool m_blockElementUpdates;
};
// -------------------------------------------------------------------------