-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 22 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 39 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 16 |
3 files changed, 70 insertions, 7 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index ca21016..b503652 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp @@ -331,2 +331,3 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) continue; + bool match = false; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { @@ -338,4 +339,5 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) { - new AddresseeCardViewItem(fields(), mShowEmptyFields, - addressBook(), *it, mCardView); + new AddresseeCardViewItem(fields(), mShowEmptyFields, + addressBook(), *it, mCardView); + match = true; break; @@ -343,2 +345,18 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) } + if ( ! match ) { + if ( (*it).matchPhoneNumber( &re ) ) { + new AddresseeCardViewItem(fields(), mShowEmptyFields, + addressBook(), *it, mCardView); + match = true; + break; + } + } + if ( ! match ) { + if ( (*it).matchAddress( &re ) ) { + new AddresseeCardViewItem(fields(), mShowEmptyFields, + addressBook(), *it, mCardView); + match = true; + break; + } + } } 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 @@ -152,3 +152,3 @@ class AddresseeIconViewItem : public QIconViewItem QPixmap icon; - QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) ); + KABC::Picture pic = mAddressee.photo(); @@ -165,9 +165,22 @@ class AddresseeIconViewItem : public QIconViewItem #else //KAB_EMBEDDED + + int wid = pic.data().width(); + int hei = pic.data().height(); + int max = 48; + if ( wid > max || hei > max ) { + if ( wid > hei ) { + hei = (hei*max)/wid; + wid = max; + } else { + wid = (wid*max)/hei; + hei = max; + } + } qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); - icon.convertFromImage(img.smoothScale(32, 32)); + icon.convertFromImage(img.smoothScale(wid, hei)); #endif //KAB_EMBEDDED - } else - icon = defaultIcon; - + } else { + icon = KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ); + } setPixmap( icon ); @@ -285,2 +298,3 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) continue; + bool match = false; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { @@ -293,4 +307,19 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); + match = true; break; } + } + if ( ! match ) { + if ( (*it).matchPhoneNumber( &re ) ) { + mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); + match = true; + break; + } + } + if ( ! match ) { + if ( (*it).matchAddress( &re ) ) { + mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); + match = true; + break; + } } diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 348f491..02fc40a 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -172,2 +172,3 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) continue; + bool match = false; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { @@ -181,2 +182,3 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); + match = true; break; @@ -184,2 +186,16 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) } + if ( ! match ) { + if ( (*it).matchPhoneNumber( &re ) ) { + ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); + match = true; + break; + } + } + if ( ! match ) { + if ( (*it).matchAddress( &re ) ) { + ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); + match = true; + break; + } + } } |