--nextPart1520007.5bZA8sSzDd Content-Type: multipart/mixed; boundary="Boundary-01=_PD/kB+/zcWiWdvm" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_PD/kB+/zcWiWdvm Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, I had a look at http://bugs.kde.org/88512 (KMail shows similar behaviour) a= nd=20 it seems to me this is actually an issue with KListViewSearchLine. The=20 attached patch makes KListViewSearchLine show children of matched items by= =20 default. What do you think? cheers, Jakob --Boundary-01=_PD/kB+/zcWiWdvm Content-Type: text/x-diff; charset="us-ascii"; name="klistviewsearchline-showchildren.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="klistviewsearchline-showchildren.diff" Index: klistviewsearchline.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/kdeui/klistviewsearchline.h,v retrieving revision 1.9 diff -u -3 -p -r1.9 klistviewsearchline.h =2D-- klistviewsearchline.h 22 Oct 2004 12:39:34 -0000 1.9 +++ klistviewsearchline.h 11 Nov 2004 22:30:01 -0000 @@ -84,6 +84,15 @@ public: bool keepParentsVisible() const; =20 /** + * If this is true (the default) then the children of matched items wi= ll also + * be shown. + * + * @see setKeepChildrenVisible() + * @since 3.4 + */ + bool keepChildrenVisible() const; + + /** * Returns the listview that is currently filtered by the search. * * @see setListView() @@ -117,6 +126,14 @@ public slots: void setKeepParentsVisible(bool v); =20 /** + * If this is set to true (the default) then the children of matching = items + * will be shown. + * + * @see keepChildrenVisible + */ + void setKeepChildrenVisible(bool v); + + /** * Sets the list of columns to be searched. The default is to search = all, * visible columns which can be restored by passing \a columns as an e= mpty * list. @@ -190,6 +207,18 @@ private: */ bool checkItemParentsVisible(QListViewItem *item); =20 + /** + * This is used in case child items of matching items should be visibl= e. + * It makes a recursive call to all children. + */ + void ensureChildrenVisible(QListViewItem *item); + + /** + * This is used in case child items of matching items shouldn't be vis= ible. + */ + void ensureChildrenNotVisible(QListViewItem *item); + + private slots: void itemAdded(QListViewItem *item) const; void listViewDeleted(); Index: klistviewsearchline.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/kdeui/klistviewsearchline.cpp,v retrieving revision 1.10 diff -u -3 -p -r1.10 klistviewsearchline.cpp =2D-- klistviewsearchline.cpp 22 Oct 2004 13:18:40 -0000 1.10 +++ klistviewsearchline.cpp 11 Nov 2004 22:30:01 -0000 @@ -35,12 +35,14 @@ public: caseSensitive(false), activeSearch(false), keepParentsVisible(true), + keepChildrenVisible(true), queuedSearches(0) {} =20 KListView *listView; bool caseSensitive; bool activeSearch; bool keepParentsVisible; + bool keepChildrenVisible; QString search; int queuedSearches; QValueList searchColumns; @@ -104,6 +106,11 @@ bool KListViewSearchLine::keepParentsVis return d->keepParentsVisible; } =20 +bool KListViewSearchLine::keepChildrenVisible() const +{ + return d->keepChildrenVisible; +} + KListView *KListViewSearchLine::listView() const { return d->listView; @@ -164,6 +171,11 @@ void KListViewSearchLine::setKeepParents d->keepParentsVisible =3D v; } =20 +void KListViewSearchLine::setKeepChildrenVisible(bool v) +{ + d->keepChildrenVisible =3D v; +} + void KListViewSearchLine::setSearchColumns(const QValueList &columns) { d->searchColumns =3D columns; @@ -325,9 +337,17 @@ void KListViewSearchLine::checkItemParen { QListViewItem *item =3D it.current(); if(itemMatches(item, d->search)) + { item->setVisible(true); + if(d->keepChildrenVisible) + ensureChildrenVisible( item->firstChild() ); + } else + { item->setVisible(false); + if(!d->keepChildrenVisible) + ensureChildrenNotVisible( item->firstChild() ); + } } } =20 @@ -339,12 +359,31 @@ bool KListViewSearchLine::checkItemParen itemMatches(item, d->search)) { item->setVisible( true ); + if(d->keepChildrenVisible) + ensureChildrenVisible( item->firstChild() ); visible =3D true; } else + { item->setVisible(false); + if(!d->keepChildrenVisible) + ensureChildrenNotVisible( item->firstChild() ); + } } return visible; } =20 +void KListViewSearchLine::ensureChildrenNotVisible(QListViewItem *item) +{ + for(; item; item =3D item->nextSibling()) + item->setVisible( false ); + +} + +void KListViewSearchLine::ensureChildrenVisible(QListViewItem *item) +{ + for(; item; item =3D item->nextSibling()) + item->setVisible( true ); +} + #include "klistviewsearchline.moc" --Boundary-01=_PD/kB+/zcWiWdvm-- --nextPart1520007.5bZA8sSzDd Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBBk/DSRIytGOFpChERAhSbAJwNmccLN0rXkqOLgCWoT8DCSmSf6ACfcWkj 8qdwqlXkGkYvBI/2cnbqyt0= =5LxF -----END PGP SIGNATURE----- --nextPart1520007.5bZA8sSzDd--