emailuis/emailui/src/FreestyleEmailUiContactHandler.cpp
branchRCL_3
changeset 70 968773a0b6ef
parent 64 3533d4323edc
child 73 c8382f7b54ef
equal deleted inserted replaced
64:3533d4323edc 70:968773a0b6ef
   759         iContactObjects.Append( item );
   759         iContactObjects.Append( item );
   760 
   760 
   761         CleanupStack::PopAndDestroy( selectedEmailAddress );
   761         CleanupStack::PopAndDestroy( selectedEmailAddress );
   762         selectedEmailAddress = NULL;
   762         selectedEmailAddress = NULL;
   763 
   763 
   764         
       
   765         CleanupStack::PopAndDestroy( displayname );
   764         CleanupStack::PopAndDestroy( displayname );
   766         CleanupStack::PopAndDestroy( &emailAddresses );
   765         CleanupStack::PopAndDestroy( &emailAddresses );
   767         CleanupStack::PopAndDestroy( &lastname );
   766         CleanupStack::PopAndDestroy( &lastname );
   768         CleanupStack::PopAndDestroy( &firstname );
   767         CleanupStack::PopAndDestroy( &firstname );
   769         CleanupStack::PopAndDestroy( aContact );
   768         CleanupStack::PopAndDestroy( aContact );
   770         
   769         
   771         // Get index of Next ContactLink if there's no LinkSet
   770         // Get index of Next ContactLink if there's no LinkSet
   772         // or iCurrenLink index is set to 0
   771         // or iCurrenLink index is set to 0
   773         TInt index = (iLinksSet && iCurrentLink ? iLinksSet->Find
   772         TInt index = ( iLinksSet && iCurrentLink ? 
   774                 (*iCurrentLink) + 1 : 0);
   773             iLinksSet->Find( *iCurrentLink ) + 1 : 0 );
   775         
   774 
   776         if (iLinksSet && index < iLinksSet->Count())
   775         if ( iLinksSet && index < iLinksSet->Count() )
   777             {
   776             {
   778             iCurrentLink = &iLinksSet->At(index);
   777             delete iCurrentLink;
       
   778             iCurrentLink = NULL;
       
   779 
       
   780             iCurrentLink = iLinksSet->At(index).CloneLC();
       
   781             CleanupStack::Pop();
       
   782 
   779             delete iLinkOperationFetch;
   783             delete iLinkOperationFetch;
   780             iLinkOperationFetch = NULL;
   784             iLinkOperationFetch = NULL;
   781 
   785 
   782             //Async operation, callback VPbkSingleContactOperationCompleteL
   786             //Async operation, callback VPbkSingleContactOperationCompleteL
   783             //Error situations: VPbkSingleContactOperationFailed
   787             //Error situations: VPbkSingleContactOperationFailed
   787         else 
   791         else 
   788             {
   792             {
   789             delete iLinkOperationFetch; 
   793             delete iLinkOperationFetch; 
   790             iLinkOperationFetch = NULL;
   794             iLinkOperationFetch = NULL;
   791 
   795 
       
   796             delete iCurrentLink;
   792             iCurrentLink = NULL;
   797             iCurrentLink = NULL;
       
   798 
   793             iState = EContactHandlerIdle;
   799             iState = EContactHandlerIdle;
   794             delete iLinksSet;
   800             delete iLinksSet;
   795             iLinksSet = NULL;
   801             iLinksSet = NULL;
   796 
   802 
   797             if ( iHandlerObserver )
   803             if ( iHandlerObserver )
   858             // State is now idle.
   864             // State is now idle.
   859             iState = EContactHandlerIdle;
   865             iState = EContactHandlerIdle;
   860             // Store contact
   866             // Store contact
   861             iContactForMsgCreation = aContact;
   867             iContactForMsgCreation = aContact;
   862             // Create clonelink for address selection
   868             // Create clonelink for address selection
   863             MVPbkContactLink* cloneLink = iCurrentLink->CloneLC();  
   869             MVPbkContactLink* cloneLink = iCurrentLink->CloneLC();
   864             CleanupStack::Pop();
   870             CleanupStack::Pop();
   865             switch ( iMsgCreationHelperState )
   871             switch ( iMsgCreationHelperState )
   866                 {
   872                 {
   867                 case EContactHandlerGetSmsAddressFromPhonebook:
   873                 case EContactHandlerGetSmsAddressFromPhonebook:
   868                     // Select SMS address, sending is done when callback completes
   874                     // Select SMS address, sending is done when callback completes
   977 
   983 
   978             iLinksSet = iContactManager->CreateLinksLC(contactLinks);
   984             iLinksSet = iContactManager->CreateLinksLC(contactLinks);
   979             CleanupStack::Pop();
   985             CleanupStack::Pop();
   980             if ( iLinksSet->Count() )
   986             if ( iLinksSet->Count() )
   981                 {
   987                 {
   982                 iCurrentLink = &iLinksSet->At(0);
   988                 delete iCurrentLink;
       
   989                 iCurrentLink = NULL;
       
   990 
       
   991                 iCurrentLink = iLinksSet->At(0).CloneLC();
       
   992                 CleanupStack::Pop();
   983                 //Async operation, callback VPbkSingleContactOperationCompleteL
   993                 //Async operation, callback VPbkSingleContactOperationCompleteL
   984                 //Error situations: VPbkSingleContactOperationFailed
   994                 //Error situations: VPbkSingleContactOperationFailed
   985                 iLinkOperationFetch = iContactManager->RetrieveContactL( iLinksSet->At(0), *this );
   995                 iLinkOperationFetch = iContactManager->RetrieveContactL( 
       
   996                     iLinksSet->At(0), *this );
   986                 }
   997                 }
   987 
   998 
   988             iContactManager->ContactStoresL().OpenAllL( *this );
   999             iContactManager->ContactStoresL().OpenAllL( *this );
   989             }
  1000             }
   990 
  1001 
  1119         if ( iLinkOperationFetch )
  1130         if ( iLinkOperationFetch )
  1120             {
  1131             {
  1121             delete iLinkOperationFetch;
  1132             delete iLinkOperationFetch;
  1122             iLinkOperationFetch = NULL;
  1133             iLinkOperationFetch = NULL;
  1123             }
  1134             }
  1124         
  1135 
  1125         //Async operation, callback VPbkSingleContactOperationCompleteL
  1136         //Async operation, callback VPbkSingleContactOperationCompleteL
  1126         //Error situations: VPbkSingleContactOperationFailed
  1137         //Error situations: VPbkSingleContactOperationFailed
  1127         iLinkOperationFetch = iContactManager->RetrieveContactL
  1138         iLinkOperationFetch = iContactManager->RetrieveContactL(
  1128         (*iCurrentLink, *this); 
  1139             *iCurrentLink, *this);
  1129         
       
  1130         }
  1140         }
  1131     }
  1141     }
  1132 
  1142 
  1133 void CFSEmailUiContactHandler::CreateMessageL( const RPointerArray<CFSEmailUiClsItem>& aMatchingItems )
  1143 void CFSEmailUiContactHandler::CreateMessageL( const RPointerArray<CFSEmailUiClsItem>& aMatchingItems )
  1134     {
  1144     {
  1236                 iLinkOperationFetch = NULL;
  1246                 iLinkOperationFetch = NULL;
  1237                 }
  1247                 }
  1238             
  1248             
  1239             //Async operation, callback VPbkSingleContactOperationCompleteL
  1249             //Async operation, callback VPbkSingleContactOperationCompleteL
  1240             //Error situations: VPbkSingleContactOperationFailed
  1250             //Error situations: VPbkSingleContactOperationFailed
  1241             iLinkOperationFetch = iContactManager->RetrieveContactL
  1251             iLinkOperationFetch = iContactManager->RetrieveContactL(
  1242             (*iCurrentLink, *this);                                         
  1252                 *iCurrentLink, *this);
  1243             }
  1253             }
  1244         }
  1254         }
  1245     }
  1255     }
  1246 
  1256 
  1247 // -----------------------------------------------------------------------------
  1257 // -----------------------------------------------------------------------------