[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-04-04 21:09:32
Message-ID: 20100404210932.907EDAC891 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1111110 by winterz:

if the filtered results are empty, then don't show the category header item
also, increase the min size of the dialog
kolab/issue4256
MERGE: trunk,4.4


 M  +20 -2     addressesdialog.cpp  


--- branches/kdepim/enterprise/kdepim/libkdepim/addressesdialog.cpp #1111109:1111110
@@ -223,6 +223,9 @@
   initConnections();
 
   d->ui->mAvailableView->setFocus();
+
+  setMainWidget( page );
+  page->setMinimumSize( 750, 400 );
 }
 
 AddressesDialog::~AddressesDialog()
@@ -979,6 +982,8 @@
   if ( txt.isEmpty() )
     showAll = true;
 
+  int personalVisible = 0;
+  int recentVisible = 0;
   while ( it.current() ) {
     AddresseeViewItem* item = static_cast<AddresseeViewItem*>( it.current() );
     ++it;
@@ -991,11 +996,24 @@
     if ( item->category() == AddresseeViewItem::Entry ) {
       bool matches = item->matches( txt ) ;
       item->setVisible( matches );
-      if ( matches && static_cast<QListViewItem*>(item)->parent() ) {
-          static_cast<QListViewItem*>(item)->parent()->setOpen( true );//open the \
parents with found entries +      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 {
+          recentVisible++;
+        }
       }
     }
   }
+
+  if ( !showAll && personalVisible == 0 ) {
+    d->personal->setVisible( false );
+  }
+  if ( !showAll && recentVisible == 0 ) {
+    d->recent->setVisible( false );
+  }
 }
 
 KABC::Addressee::List


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic