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

List:       kde-commits
Subject:    kdepim/kaddressbook/views
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2003-01-23 20:01:26
[Download RAW message or body]

CVS commit by tokoe: 


moved the setPixmap code to the refresh method of the IconViewItem


  M +19 -18    kaddressbookiconview.cpp   1.10


--- kdepim/kaddressbook/views/kaddressbookiconview.cpp  #1.9:1.10
@@ -118,4 +118,21 @@ class AddresseeIconViewItem : public KIc
         if (!mAddressee.isEmpty())
           setText( mAddressee.givenName() + " " + mAddressee.familyName() );
+
+        QPixmap icon;
+        QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
+        KABC::Picture pic = mAddressee.photo();
+        if ( pic.data().isNull() )
+          pic = mAddressee.logo();
+
+        if ( pic.isIntern() && !pic.data().isNull() ) {
+          QImage img = pic.data();
+        if ( img.width() > img.height() )
+          icon = img.scaleWidth( 32 );
+        else
+          icon = img.scaleHeight( 32 );
+      } else
+        icon = defaultIcon;
+
+      setPixmap( icon );
     }
     
@@ -200,23 +217,7 @@ void KAddressBookIconView::refresh(QStri
     KABC::Addressee::List addresseeList = addressees();
     KABC::Addressee::List::Iterator iter;
-    QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
-    for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) {
-      QPixmap icon;
-      KABC::Picture pic = (*iter).photo();
-      if ( pic.data().isNull() )
-        pic = (*iter).logo();
-
-      if ( pic.isIntern() && !pic.data().isNull() ) {
-        QImage img = pic.data();
-        if ( img.width() > img.height() )
-          icon = img.scaleWidth( 32 );
-        else
-          icon = img.scaleHeight( 32 );
-      } else
-        icon = defaultIcon;
-
+    for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter )
       aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView );
-      aItem->setPixmap( icon );
-    }
+
     mIconView->arrangeItemsInGrid( true );
 


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

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