khtml's find, KFind or KComboBox
David Faure
david at mandrakesoft.com
Wed Nov 20 22:21:31 GMT 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday 20 November 2002 22:54, Carsten Pfeiffer wrote:
> On Wednesday 20 November 2002 22:14, David Faure wrote:
> > 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.
>
> The removing only happens when a duplicate of the to be added item is present [...]
This is the case, "A" is already there.
> In that case, the last item is going to be removed.
> But when the last (and also current) item is removed, then the
> "current" index should be adjusted. QComboBox always has a current item, no?
> (when not empty at least) Then currentText() should return the text of the
> new current item, probably again the new last item.
Well I can assure you it doesn't :)
konqueror: count=2 item=word1 text(0)=word2
konqueror: removeItem 1
konqueror: after insertItem: currentText()=
diff -u -p -r1.160 kcombobox.cpp
- --- kcombobox.cpp 2002/11/12 00:02:45 1.160
+++ kcombobox.cpp 2002/11/20 22:21:20
@@ -429,14 +429,19 @@ void KHistoryCombo::addContextMenuItems(
void KHistoryCombo::addToHistory( const QString& item )
{
- - if ( item.isEmpty() || (count() > 0 && item == text(0) ))
+ kdDebug() << " count=" << count() << " item=" << item << " text(0)=" << text( 0 ) << endl;
+ if ( item.isEmpty() || (count() > 0 && item == text(0) )) {
+ kdDebug() << "doing nothing" << endl;
return;
+ }
// remove all existing items before adding
if ( !duplicatesEnabled() ) {
for ( int i = 0; i < count(); i++ ) {
- - if ( text( i ) == item )
+ if ( text( i ) == item ) {
+ kdDebug() << "removeItem " << i << endl;
removeItem( i );
+ }
}
}
@@ -445,6 +450,8 @@ void KHistoryCombo::addToHistory( const
insertItem( myPixProvider->pixmapFor(item, KIcon::SizeSmall), item, 0);
else
insertItem( item, 0 );
+
+ kdDebug() << "after insertItem: currentText()=" << currentText() << endl;
int last;
QString rmItem;
- --
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)
iD8DBQE93Arr72KcVAmwbhARAqk0AJ96sMQV/fzXoYsTZQbHX1F1V+7X8wCdFOXd
SIbi2pgIQmEQrK3aBTwNH3E=
=4r8N
-----END PGP SIGNATURE-----
More information about the kfm-devel
mailing list