creator/engine/src/creator_message.cpp
changeset 51 b048e15729d6
parent 29 1c71b77fbc93
child 52 36d60d12b4af
equal deleted inserted replaced
44:5db69f4c3d06 51:b048e15729d6
    20 #include "enginewrapper.h"
    20 #include "enginewrapper.h"
    21 
    21 
    22 #include "creator_message.h" 
    22 #include "creator_message.h" 
    23 #include "creator_traces.h"
    23 #include "creator_traces.h"
    24 #include "creator_contactsetcache.h"
    24 #include "creator_contactsetcache.h"
       
    25 #include "creator_phonebook.h"
    25 #include <apgcli.h>
    26 #include <apgcli.h>
    26 #include <MuiuServiceUtilities.h>
    27 #include <MuiuServiceUtilities.h>
    27 #include <utf.h>
    28 #include <utf.h>
    28 
    29 
    29 #include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
    30 #include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
  1199     CleanupStack::PushL(msvStore);
  1200     CleanupStack::PushL(msvStore);
  1200     header->RestoreL(*msvStore);
  1201     header->RestoreL(*msvStore);
  1201     header->SetSubjectL( parameters.iMessageSubject->Des() );
  1202     header->SetSubjectL( parameters.iMessageSubject->Des() );
  1202     if( iSenderArray.Count() == 0 )
  1203     if( iSenderArray.Count() == 0 )
  1203         {
  1204         {
  1204         GetSendersL(iSenderArray, parameters, ETrue, 1 );
  1205         GetSendersL(iSenderArray, parameters, ETrue, KUndef );
  1205         }
  1206         }
  1206     
  1207     
  1207     if( iSenderArray.Count() > 0 )
  1208     if( iSenderArray.Count() > 0 )
  1208         {
  1209         {
  1209         header->SetFromL(iSenderArray[0]->Des());
  1210         TInt rndNum = iEngine->RandomNumber( iSenderArray.Count() );
       
  1211         header->SetFromL(iSenderArray[rndNum]->Des());
  1210         }
  1212         }
  1211     else
  1213     else
  1212         {
  1214         {
  1213         header->SetFromL( parameters.iSenderAddress->Des() );
  1215         header->SetFromL( parameters.iSenderAddress->Des() );
  1214         }
  1216         }
  1527 void CCreatorMessages::SetSenderToEntryDetailsL(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress)
  1529 void CCreatorMessages::SetSenderToEntryDetailsL(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress)
  1528     {        
  1530     {        
  1529     // Only one sender allowed:
  1531     // Only one sender allowed:
  1530     if( iSenderArray.Count() == 0 )
  1532     if( iSenderArray.Count() == 0 )
  1531         {
  1533         {
  1532         GetSendersL(iSenderArray, aParameters, aUseEmailAddress, 1 );
  1534         GetSendersL(iSenderArray, aParameters, aUseEmailAddress, KUndef );
  1533         }
  1535         }
  1534     if( iSenderArray.Count() > 0 )
  1536     if( iSenderArray.Count() > 0 )
  1535         {        
  1537         {        
  1536         aMsgEntry.iDetails.Set( iSenderArray[0]->Des() );        
  1538         TInt rnd = iEngine->RandomNumber( iSenderArray.Count() );
       
  1539         aMsgEntry.iDetails.Set( iSenderArray[rnd]->Des() );        
  1537         }
  1540         }
  1538     else
  1541     else
  1539         {
  1542         {
  1540         aMsgEntry.iDetails.Set(KEmpty);
  1543         aMsgEntry.iDetails.Set(KEmpty);
  1541         }        
  1544         }        
  1665  */
  1668  */
  1666 void CCreatorMessages::GetLinkedAddressesL(
  1669 void CCreatorMessages::GetLinkedAddressesL(
  1667         RPointerArray<HBufC>& aAddressArray, 
  1670         RPointerArray<HBufC>& aAddressArray, 
  1668         const RArray<TLinkIdParam>& aLinkIds, 
  1671         const RArray<TLinkIdParam>& aLinkIds, 
  1669         TBool aUseEmailAddress,
  1672         TBool aUseEmailAddress,
  1670         TInt aNumOfExistingAddresses )
  1673         TInt /*aNumOfExistingAddresses*/ )
  1671     {
  1674     {
  1672 }
  1675     CCreatorPhonebook* phonebook = dynamic_cast<CCreatorPhonebook*>(iEngine->GetPhonebook());
       
  1676     User::LeaveIfNull( phonebook );
       
  1677     CCreatorPhonebookWrapper* phonebookWrapper = phonebook->GetPhonebookWrapper();
       
  1678     
       
  1679     for( TInt i = 0; i < aLinkIds.Count(); ++i )
       
  1680         {
       
  1681         const CCreatorContactSet& set = ContactLinkCache::Instance()->ContactSet(aLinkIds[i].iLinkId);
       
  1682         const RArray<TUint32> links = set.ContactLinks();//ContactLinkCache::Instance()->ContactSets();//set.ContactLinks();
       
  1683         TInt numberOfExplicitLinks = links.Count(); // Number of defined contacts in contact-set
       
  1684         for( TInt j = 0; j < numberOfExplicitLinks; ++j )
       
  1685             {
       
  1686             TBuf<128> name;
       
  1687             TBuf<128> email;
       
  1688             TBuf<128> phoneNumber;
       
  1689             phonebookWrapper->GetContactDetailsL( links[j], name, phoneNumber, email );
       
  1690             HBufC* address = ( aUseEmailAddress ? email.AllocLC() : phoneNumber.AllocLC() );
       
  1691             aAddressArray.AppendL( address );
       
  1692             CleanupStack::Pop( address );
       
  1693             }
       
  1694         }
       
  1695     }
  1673 
  1696 
  1674 //----------------------------------------------------------------------------
  1697 //----------------------------------------------------------------------------
  1675 void CCreatorMessages::DeleteAllL()
  1698 void CCreatorMessages::DeleteAllL()
  1676     {
  1699     {
  1677     LOGSTRING("Creator: CCreatorMessages::DeleteAllL");
  1700     LOGSTRING("Creator: CCreatorMessages::DeleteAllL");