khtml's find, KFind or KComboBox
David Faure
david at mandrakesoft.com
Wed Nov 20 21:14:09 GMT 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday 20 November 2002 19:26, Carsten Pfeiffer wrote:
> On Wednesday 20 November 2002 17:48, David Faure wrote:
>
> > > Indeed the problem is that KHistoryCombo::addToHistory() removes the
> > > item from where it is, and inserts it at position 0... Hmm, I guess
> > > that's on purpose, to make it the "most current" again, so my first
> > > attempt, fixing it there (which worked), is probably a bad idea.
> >
> > Actually, KHistoryCombo::addToHistory() could simply call setCurrentText()
> > afterwards, _if_ the string that has just been added was the current text
> > already. What do you think, Carsten?
>
> I don't understand. addToHistory() inserts the new item at position 0 (and
> doesn't if the the same text is already there). Is that what you mean?
>
> void KHistoryCombo::addToHistory( const QString& item )
> {
> if ( item.isEmpty() || (count() > 0 && item == text(0) ))
> return;
> [... ]
>
> The text you add shall always be the first item in the combo.
But not necessarily the currentText().
The problem here is that in KFindDialog, the addToHistory() call
_changes_ the current text, so when the caller calls currentText(),
it gets an empty string.
Precise description in the initial report. I just debugged a bit more, and
what happens, if you type A, then B, is that
the combo has item0=B and item1=A.
So pressing up (or down) to select A again causes addToHistory("A"), where text(0)=="B",
so the above if() doesn't apply. Then removeItem(1) is called, which clears the current text.
Then insertItem(0) will put "A" at position 0 again - but the bug is that
currentText() is now empty.
- --
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE92/sh72KcVAmwbhARAtjBAJwLZgR6BgfGY0BVhdieHJ8H/RugEACfbLRm
5IT382eXBDiuCNS5qBl3taU=
=vDqp
-----END PGP SIGNATURE-----
More information about the kfm-devel
mailing list