summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Iacovitti <aiacovitti@libero.it>2011-08-05 19:45:34 (GMT)
committerAndrea Iacovitti <aiacovitti@libero.it>2011-08-05 19:45:34 (GMT)
commit2a90109ab5ff7f53b4ed0555eef3e45428619f9b (patch)
treeff604abdc60956271af25b1973f0930602c03dd9
parentec4afe7b2a865919aa0a780d95647f0c2210aded (diff)
Unbreak completion on tab-out.
KLineEdit no longer emits textEdited signal when scrolling completion list (see commit 8db60a2f) then use textChanged as in the past. BUG: 277457 FIXED-IN: 4.7.1
-rw-r--r--khtml/rendering/render_form.cpp10
-rw-r--r--khtml/rendering/render_form.h3
2 files changed, 9 insertions, 4 deletions
diff --git a/khtml/rendering/render_form.cpp b/khtml/rendering/render_form.cpp
index 15e6efb..a65a4863 100644
--- a/khtml/rendering/render_form.cpp
+++ b/khtml/rendering/render_form.cpp
@@ -1012,11 +1012,11 @@ void LineEditWidget::mouseMoveEvent(QMouseEvent *e)
// -----------------------------------------------------------------------------
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,9 +1142,11 @@ void RenderLineEdit::updateFromElement()
}
if (element()->value().string() != widget()->text()) {
+ m_blockElementUpdates = true; // Do not block signals here (#188374)
int pos = widget()->cursorPosition();
widget()->setText(element()->value().string());
widget()->setCursorPosition(pos);
+ m_blockElementUpdates = false;
}
widget()->setReadOnly(element()->readOnly());
@@ -1153,8 +1155,10 @@ void RenderLineEdit::updateFromElement()
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;
diff --git a/khtml/rendering/render_form.h b/khtml/rendering/render_form.h
index 1966910..2be4df5 100644
--- a/khtml/rendering/render_form.h
+++ b/khtml/rendering/render_form.h
@@ -282,12 +282,13 @@ public:
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;
};
// -------------------------------------------------------------------------