diff -r 35b64624a9e7 -r 36f374c67aa8 messagingapp/msgappfw/server/src/ccscontactsresolver.cpp --- a/messagingapp/msgappfw/server/src/ccscontactsresolver.cpp Wed Jun 23 18:09:17 2010 +0300 +++ b/messagingapp/msgappfw/server/src/ccscontactsresolver.cpp Tue Jul 06 14:12:40 2010 +0300 @@ -16,7 +16,7 @@ */ // SYSTEM INCLUDES -#include "qtcontacts.h" +#include "qtcontacts.h" #include "qcontactdetailfilter.h" #include @@ -50,21 +50,37 @@ const QString &address, CCsContactDetail &contactDetail) { + // apply filter on phone number field QContactDetailFilter phoneFilter; phoneFilter.setDetailDefinitionName( - QContactPhoneNumber::DefinitionName, + QContactPhoneNumber::DefinitionName, QContactPhoneNumber::FieldNumber); - + phoneFilter.setValue(address); phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith); - QList matchingContacts = mPhonebookManager->contacts(phoneFilter); + if ( matchingContacts.count() > 0 ) { + QContact match = matchingContacts.at(0); + // Fill the contact details + contactDetail.contactId = match.localId(); + contactDetail.displayName = match.displayLabel(); + return true; + } - if ( matchingContacts.count() > 0 ) { + // apply filter on email address field + QContactDetailFilter emailFilter; + emailFilter.setDetailDefinitionName( + QContactEmailAddress::DefinitionName, + QContactEmailAddress::FieldEmailAddress); + + emailFilter.setValue(address); + emailFilter.setMatchFlags(QContactFilter::MatchExactly); + matchingContacts = mPhonebookManager->contacts(emailFilter); + if ( matchingContacts.count() > 0 ) { QContact match = matchingContacts.at(0); - // Fill the contact details + // Fill the contact details contactDetail.contactId = match.localId(); - contactDetail.displayName = match.displayLabel(); + contactDetail.displayName = match.displayLabel(); return true; } return false; @@ -76,14 +92,14 @@ // ---------------------------------------------------------------------------- void CCsContactsResolver::resolveContactId( const quint32 &contactId, - CCsContactDetail &contactDetail) + CCsContactDetail &contactDetail) { // Fetch back the persisted contact QContact contact = mPhonebookManager->contact(contactId); - contactDetail.contactId = contact.localId(); - + contactDetail.contactId = contact.localId(); + contactDetail.displayName = contact.displayLabel(); - + QList numbers = contact.details(); int numberCount = numbers.count(); @@ -91,7 +107,16 @@ { QString phoneNumber= numbers.at(a).number(); contactDetail.addressList.append(phoneNumber); - } + } + + QList emailAddresses = contact.details(); + int emailCount = emailAddresses.count(); + + for ( int a=0; a