summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/kaddressbookiconview.cpp
Unidiff
Diffstat (limited to 'kaddressbook/views/kaddressbookiconview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp
index 4bbdf1d..d6ddec3 100644
--- a/kaddressbook/views/kaddressbookiconview.cpp
+++ b/kaddressbook/views/kaddressbookiconview.cpp
@@ -150,7 +150,7 @@ class AddresseeIconViewItem : public QIconViewItem
150 setText( mAddressee.givenName() + " " + mAddressee.familyName() ); 150 setText( mAddressee.givenName() + " " + mAddressee.familyName() );
151 151
152 QPixmap icon; 152 QPixmap icon;
153 QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) ); 153
154 KABC::Picture pic = mAddressee.photo(); 154 KABC::Picture pic = mAddressee.photo();
155 if ( pic.data().isNull() ) 155 if ( pic.data().isNull() )
156 pic = mAddressee.logo(); 156 pic = mAddressee.logo();
@@ -163,13 +163,26 @@ class AddresseeIconViewItem : public QIconViewItem
163 else 163 else
164 icon = img.scaleHeight( 32 ); 164 icon = img.scaleHeight( 32 );
165#else //KAB_EMBEDDED 165#else //KAB_EMBEDDED
166
167 int wid = pic.data().width();
168 int hei = pic.data().height();
169 int max = 48;
170 if ( wid > max || hei > max ) {
171 if ( wid > hei ) {
172 hei = (hei*max)/wid;
173 wid = max;
174 } else {
175 wid = (wid*max)/hei;
176 hei = max;
177 }
178 }
166 qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); 179 qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor");
167 icon.convertFromImage(img.smoothScale(32, 32)); 180 icon.convertFromImage(img.smoothScale(wid, hei));
168#endif //KAB_EMBEDDED 181#endif //KAB_EMBEDDED
169 182
170 } else 183 } else {
171 icon = defaultIcon; 184 icon = KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 );
172 185 }
173 setPixmap( icon ); 186 setPixmap( icon );
174 } 187 }
175 188
@@ -283,6 +296,7 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
283 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 296 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
284 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 297 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
285 continue; 298 continue;
299 bool match = false;
286 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 300 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
287#if QT_VERSION >= 0x030000 301#if QT_VERSION >= 0x030000
288 if (re.search((*fieldIt)->value( *it ).lower()) == 0) 302 if (re.search((*fieldIt)->value( *it ).lower()) == 0)
@@ -291,8 +305,23 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
291#endif 305#endif
292 { 306 {
293 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); 307 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
308 match = true;
294 break; 309 break;
295 } 310 }
311 }
312 if ( ! match ) {
313 if ( (*it).matchPhoneNumber( &re ) ) {
314 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
315 match = true;
316 break;
317 }
318 }
319 if ( ! match ) {
320 if ( (*it).matchAddress( &re ) ) {
321 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
322 match = true;
323 break;
324 }
296 } 325 }
297 } 326 }
298 } 327 }