-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 @@ -330,4 +330,5 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; + bool match = false; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { #if QT_VERSION >= 0x030000 @@ -337,9 +338,26 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) #endif { - new AddresseeCardViewItem(fields(), mShowEmptyFields, - addressBook(), *it, mCardView); + new AddresseeCardViewItem(fields(), mShowEmptyFields, + addressBook(), *it, mCardView); + match = true; break; } } + 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 @@ -151,5 +151,5 @@ class AddresseeIconViewItem : public QIconViewItem QPixmap icon; - QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) ); + KABC::Picture pic = mAddressee.photo(); if ( pic.data().isNull() ) @@ -164,11 +164,24 @@ class AddresseeIconViewItem : public QIconViewItem icon = img.scaleHeight( 32 ); #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 ); } @@ -284,4 +297,5 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; + bool match = false; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { #if QT_VERSION >= 0x030000 @@ -292,6 +306,21 @@ 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 @@ -171,4 +171,5 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; + bool match = false; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { #if QT_VERSION >= 0x030000 @@ -180,7 +181,22 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) //qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() ); ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); + match = true; break; } } + 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; + } + } } } |