--------------Boundary-00=_IB6YULI8BMS2ZJS37W17 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Hello, as suggested by Tackat on IRC I tried myself on form completion as in IE 5 for KHTML. The attached patch does this, seems to work okay, but I'm not sure if I put it into the Right Places (pat. pending). Does it look okay to commit or should it be done in a different place? -Malte --------------Boundary-00=_IB6YULI8BMS2ZJS37W17 Content-Type: text/x-c; charset="iso-8859-1"; name="formcomplete.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="formcomplete.diff" Index: khtmlview.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/khtml/khtmlview.cpp,v retrieving revision 1.366 diff -u -r1.366 khtmlview.cpp --- khtmlview.cpp=092001/03/04 18:01:17=091.366 +++ khtmlview.cpp=092001/03/09 20:28:13 @@ -35,6 +35,8 @@ #include "khtml_settings.h" =20 #include +#include +#include =20 #include #include @@ -66,9 +68,11 @@ reset(); tp=3D0; paintBuffer=3D0; + formCompletions=3D0; } ~KHTMLViewPrivate() { + delete formCompletions; delete tp; tp =3D 0; delete paintBuffer; paintBuffer =3D0; } @@ -101,7 +105,7 @@ bool useSlowRepaints; =20 int borderX, borderY; - + KSimpleConfig *formCompletions; }; =20 =20 @@ -862,3 +866,21 @@ if (e) =09e->setActive(pressed); } + +QStringList KHTMLView::formCompletionItems(const QString &name) const +{ + if (!d->formCompletions) + d->formCompletions =3D new KSimpleConfig(locateLocal("data", "kh= tml/formcompletions")); + return d->formCompletions->readListEntry(name); +} + +void KHTMLView::addFormCompletionItem(const QString &name, const QString= &value) +{ + QStringList items =3D formCompletionItems(name); + if (!items.contains(value)) + items.prepend(value); + while (items.count() > 10) + items.remove(items.fromLast()); + d->formCompletions->writeEntry(name, items); +} + Index: khtmlview.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/khtml/khtmlview.h,v retrieving revision 1.127 diff -u -r1.127 khtmlview.h --- khtmlview.h=092001/03/04 18:01:17=091.127 +++ khtmlview.h=092001/03/09 20:28:14 @@ -39,6 +39,7 @@ class HTMLElementImpl; class HTMLTitleElementImpl; class HTMLGenericFormElementImpl; + class HTMLFormElementImpl; class Range; class NodeImpl; class CSSProperty; @@ -48,6 +49,7 @@ class RenderObject; class RenderRoot; class RenderStyle; + class RenderLineEdit; void applyRule(RenderStyle *style, DOM::CSSProperty *prop, DOM::Elem= entImpl *e); }; =20 @@ -69,6 +71,8 @@ friend class KHTMLPart; friend class khtml::RenderRoot; friend class DOM::HTMLGenericFormElementImpl; + friend class DOM::HTMLFormElementImpl; + friend class khtml::RenderLineEdit; friend void khtml::applyRule(khtml::RenderStyle *style, DOM::CSSProp= erty *prop, DOM::ElementImpl *e); =20 public: @@ -224,6 +228,9 @@ DOM::NodeImpl *nodeUnderMouse() const; =20 void restoreScrollBar(); + + QStringList formCompletionItems(const QString &name) const; + void addFormCompletionItem(const QString &name, const QString &value= ); =20 // ------------------------------------- member variables ----------= -------------------------- private: Index: html/html_formimpl.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/khtml/html/html_formimpl.cpp,v retrieving revision 1.143 diff -u -r1.143 html_formimpl.cpp --- html/html_formimpl.cpp=092001/03/09 01:10:57=091.143 +++ html/html_formimpl.cpp=092001/03/09 20:28:14 @@ -326,6 +326,16 @@ #endif if(!view) return; =20 + for(HTMLGenericFormElementImpl *current =3D formElements.first(); cu= rrent; current =3D formElements.next()) + { + if (current->id() =3D=3D ID_INPUT && + static_cast(current)->inputType() =3D= =3D HTMLInputElementImpl::TEXT) + { + HTMLInputElementImpl *input =3D static_cast(current); + view->addFormCompletionItem(input->name().string(), input->v= alue().string()); + } + } + =20 QByteArray form_data =3D formData(); if(m_post) { Index: rendering/render_form.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/khtml/rendering/render_form.cpp,v retrieving revision 1.83 diff -u -r1.83 render_form.cpp --- rendering/render_form.cpp=092001/03/09 01:10:34=091.83 +++ rendering/render_form.cpp=092001/03/09 20:28:15 @@ -464,6 +464,7 @@ =20 if(element->inputType() =3D=3D HTMLInputElementImpl::PASSWORD) edit->setEchoMode( QLineEdit::Password ); + edit->completionObject()->setItems(static_cast(view)->f= ormCompletionItems(element->name().string())); =20 setQWidget(edit, false); } --------------Boundary-00=_IB6YULI8BMS2ZJS37W17--