diff -r 84d9eb65b26f -r 518b245aa84c messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp --- a/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Mon May 03 12:29:07 2010 +0300 +++ b/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Fri Jun 25 15:47:40 2010 +0530 @@ -18,17 +18,15 @@ #include "univiewerfeeder_p.h" // SYSTEM INCLUDES #include -#include #include -#include -#include "qtcontacts.h" -#include "qcontactdetailfilter.h" // USER INCLUDES #include "nativemessageconsts.h" #include "univiewerfeeder.h" #include "unidatamodelloader.h" +#include "msgcontacthandler.h" #include "debugtraces.h" +#include "msgbiouids.h" // --------------------------------------------------------------------------- // UniViewerFeederPrivate::UniViewerFeederPrivate @@ -158,8 +156,8 @@ void UniViewerFeederPrivate::fetchDetailsL() { QDEBUG_WRITE("UniViewerFeederPrivate fetchDetailsL : SMS start"); - if (msgType() == KSenduiMtmSmsUidValue) - { + if (msgType() == KSenduiMtmSmsUidValue || (msgType() == KSenduiMtmBioUidValue + && mEntry.iBioType == KMsgBioNokiaServiceMessage.iUid)) { QString body; mPluginInterface->body(body); q_ptr->emitMsgBody(body); @@ -250,14 +248,21 @@ mPluginInterface->setMessageId(msgId); } - if (msgType() == KSenduiMtmMmsUidValue) - { + else if (msgType() == KSenduiMtmMmsUidValue) { mPluginInterface = mPluginLoader->getDataModelPlugin(ConvergedMessage::Mms); mPluginInterface->setMessageId(msgId); mSlideCount = mPluginInterface->slideCount(); + } + else if (msgType() == KSenduiMtmBioUidValue && mEntry.iBioType + == KMsgBioNokiaServiceMessage.iUid) { + mPluginInterface = mPluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); + mPluginInterface->setMessageId(msgId); + } + mPluginInterface->toRecipientList(mToAddressList); mPluginInterface->ccRecipientList(mCcAddressList); + mPluginInterface->bccRecipientList(mBccAddressList); } // --------------------------------------------------------------------------- @@ -267,9 +272,10 @@ ConvergedMessageAddressList UniViewerFeederPrivate::toAddressList() { QString alias = QString(); - for (int i = 0; i < mToAddressList.count(); ++i) - { - GetNameFromContacts(mToAddressList.at(i)->address(), alias); + int count; + for (int i = 0; i < mToAddressList.count(); ++i) { + MsgContactHandler::resolveContactDisplayName( + mToAddressList.at(i)->address(), alias, count); mToAddressList.at(i)->setAlias(alias); alias.clear(); } @@ -283,9 +289,10 @@ ConvergedMessageAddressList UniViewerFeederPrivate::ccAddressList() { QString alias = QString(); - for (int i = 0; i < mCcAddressList.count(); ++i) - { - GetNameFromContacts(mCcAddressList.at(i)->address(), alias); + int count; + for (int i = 0; i < mCcAddressList.count(); ++i) { + MsgContactHandler::resolveContactDisplayName( + mToAddressList.at(i)->address(), alias, count); mCcAddressList.at(i)->setAlias(alias); alias.clear(); @@ -294,6 +301,35 @@ } // --------------------------------------------------------------------------- +// UniViewerFeederPrivate::bccAddressList +// @see header file +// --------------------------------------------------------------------------- +ConvergedMessageAddressList UniViewerFeederPrivate::bccAddressList() +{ + QString alias = QString(); + int count; + for (int i = 0; i < mBccAddressList.count(); ++i) + { + MsgContactHandler::resolveContactDisplayName( + mBccAddressList.at(i)->address(), + alias, + count); + mBccAddressList.at(i)->setAlias(alias); + alias.clear(); + } + return mBccAddressList; +} + +// --------------------------------------------------------------------------- +// UniViewerFeederPrivate::recipientCount +// @see header file +// --------------------------------------------------------------------------- +int UniViewerFeederPrivate::recipientCount() +{ + return mToAddressList.count() + mCcAddressList.count() + mBccAddressList.count(); +} + +// --------------------------------------------------------------------------- // UniViewerFeederPrivate::messageSize // @see header file // --------------------------------------------------------------------------- @@ -309,7 +345,8 @@ void UniViewerFeederPrivate::fromAddressAndAlias(QString& from, QString& alias) { mPluginInterface->fromAddress(from); - GetNameFromContacts(from, alias); + int count; + MsgContactHandler::resolveContactDisplayName(from, alias, count); } // --------------------------------------------------------------------------- @@ -328,51 +365,13 @@ { delete mCcAddressList.at(i); } - mCcAddressList.clear(); -} - -// --------------------------------------------------------------------------- -// UniViewerFeederPrivate::GetNameFromContacts -// @see header file -//---------------------------------------------------------------------------- -int UniViewerFeederPrivate::GetNameFromContacts(const QString& address, - QString& alias) -{ - QContactManager contactManager("symbian"); - //set filter - QContactDetailFilter phoneFilter; - phoneFilter.setDetailDefinitionName(QContactPhoneNumber::DefinitionName, - QContactPhoneNumber::FieldNumber); - phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith); - - phoneFilter.setValue(address); // this is the phone number to be resolved - QList sortOrder; - QList matchingContacts = - contactManager.contacts(phoneFilter, - sortOrder, - QStringList()); - - int count = 0; - if (matchingContacts.count() > 0) + for (int i = 0; i < mBccAddressList.count(); ++i) { - QContact match = matchingContacts.at(0); - - QString displayLabel = match.displayLabel(); - - if (displayLabel != "Unnamed") - { - alias.append(displayLabel); - } - - QList numbers = - match.details (); - count = numbers.count(); - + delete mBccAddressList.at(i); } - - return count; + mBccAddressList.clear(); } // EOF