[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdepim/enterprise/kdepim/libkdepim
From: Allen Winter <winter () kde ! org>
Date: 2010-05-14 18:13:54
Message-ID: 20100514181354.7C279AC8B6 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1126729 by winterz:
more attempts to get the filtering working
this is harder than it seems to get right.
kolab/issue4256
MERGE: none (addressesdiaog has been obseleted by SelectDialog)
M +22 -10 addressesdialog.cpp
--- branches/kdepim/enterprise/kdepim/libkdepim/addressesdialog.cpp #1126728:1126729
@@ -986,10 +986,10 @@
int personalVisible = 0;
int recentVisible = 0;
- int distlistVisible = 0;
while ( it.current() ) {
AddresseeViewItem* item = static_cast<AddresseeViewItem*>( it.current() );
++it;
+
if ( showAll ) {
item->setOpen( true );
item->setVisible( true );
@@ -998,35 +998,36 @@
// item->setOpen( false );//close to not have too many entries
continue;
}
+
if ( item->category() == AddresseeViewItem::Entry ) {
bool matches = item->matches( txt );
item->setVisible( matches );
QListViewItem *parent = static_cast<QListViewItem*>( item )->parent();
if ( matches && parent ) {
- parent->setOpen( true );//open the parents with found entries
if ( parent == d->personal ) {
personalVisible++;
} else if ( parent == d->recent ) {
recentVisible++;
- } else { // distlist
- distlistVisible++;
}
}
}
+ if ( item->category() == AddresseeViewItem::Group ) {
+ item->setOpen( true );
+ item->setVisible( true );
}
+ }
if ( !showAll && personalVisible == 0 ) {
+ d->personal->setOpen( false );
d->personal->setVisible( false );
}
if ( !showAll && recentVisible == 0 ) {
+ d->recent->setOpen( false );
d->recent->setVisible( false );
}
+
+ int distlistgroupVisible = 0;
if ( !showAll ) {
- if ( distlistVisible == 0 ) {
- if ( d->topdist ) {
- d->topdist->setVisible( false );
- }
- } else {
QPtrListIterator<AddresseeViewItem> it( d->dists );
for ( ; it.current(); ++it ) {
QListViewItem *p = *it;
@@ -1042,13 +1043,24 @@
}
p2 = static_cast<AddresseeViewItem*>( p2->nextSibling() );
}
- if ( !pcount ) {
+ if ( !pcount && !p->text( 0 ).contains( txt, false ) ) {
p->setVisible( false );
}
+ distlistgroupVisible += pcount;
+ if ( p->text( 0 ).contains( txt, false ) ) {
+ distlistgroupVisible++;
}
}
}
+ if ( d->topdist ) {
+ if ( showAll || distlistgroupVisible > 0 ) {
+ d->topdist->setOpen( true );
+ } else {
+ d->topdist->setOpen( false );
+ d->topdist->setVisible( false );
}
+ }
+}
KABC::Addressee::List
AddressesDialog::allAddressee( KListView* view, bool onlySelected ) const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic