serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tcontacts_async_blocks.cpp
branchRCL_3
changeset 44 0b68a1b0c15e
parent 41 50d20108beab
child 45 a9c0808a1095
equal deleted inserted replaced
43:1790c2f1027c 44:0b68a1b0c15e
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include <e32svr.h>
    22 #include <e32svr.h>
    23 #include <StifParser.h>
    23 #include <StifParser.h>
    24 #include <StifTestInterface.h>
    24 #include <StifTestInterface.h>
    25 #include <VPbkEng.rsg>
    25 #include <VPbkEng.rsg>
    26 #include <mmfcontrollerpluginresolver.h>
    26 
    27 #include <MVPbkContactFieldTextData.h>
    27 #include <MVPbkContactFieldTextData.h>
    28 #include <MVPbkContactStoreList.h>
    28 #include <MVPbkContactStoreList.h>
    29 #include <MVPbkContactOperationBase.h>
    29 #include <MVPbkContactOperationBase.h>
    30 #include <MVPbkContactLink.h>
    30 #include <MVPbkContactLink.h>
    31 #include <CVPbkContactLinkArray.h>
    31 #include <CVPbkContactLinkArray.h>
   110     return RunInternalL( KFunctions, count, aItem );
   110     return RunInternalL( KFunctions, count, aItem );
   111 
   111 
   112     }
   112     }
   113 void CContactsUT::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId )
   113 void CContactsUT::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId )
   114     {
   114     {
   115     delete acntId;
       
   116     CActiveScheduler::Stop();
   115     CActiveScheduler::Stop();
   117     if(aError == KErrNone)
       
   118         iErr = KErrNone;
       
   119 
       
   120     }
   116     }
   121 
   117 
   122 void CContactsUT::HandleReturnArray(const TInt& aError, RPointerArray<HBufC8>& aArray, TInt aTransId )
   118 void CContactsUT::HandleReturnArray(const TInt& aError, RPointerArray<HBufC8>& aArray, TInt aTransId )
   123     {
   119     {
   124     CActiveScheduler::Stop();
   120     CActiveScheduler::Stop();
   205                         {
   201                         {
   206                         field->SetFieldParamsL(KField,KNullDesC,KPhone);
   202                         field->SetFieldParamsL(KField,KNullDesC,KPhone);
   207                         iLog->Log(_L("Phone Contact Field modified \n"));
   203                         iLog->Log(_L("Phone Contact Field modified \n"));
   208                         __UHEAP_MARK;
   204                         __UHEAP_MARK;
   209                         iServiceHandle->AddL(this,0,singleContact);
   205                         iServiceHandle->AddL(this,0,singleContact);
   210                         __UHEAP_MARKEND;
       
   211 
       
   212                         iLog->Log(_L("AddL called\n"));
   206                         iLog->Log(_L("AddL called\n"));
   213                         iLog->Log(_L("Start Active Scheduler\n"));
   207                         iLog->Log(_L("Start Active Scheduler\n"));
   214                         CActiveScheduler::Start(); 
   208                         CActiveScheduler::Start(); 
       
   209                         __UHEAP_MARKEND;
   215                         break;                        
   210                         break;                        
   216                         }
   211                         }
   217                     }
   212                     }
   218                 }            
   213                 }            
   219               
   214               
   663     // Print to log file
   658     // Print to log file
   664     iLog->Log( KExample );
   659     iLog->Log( KExample );
   665 
   660 
   666     iErr = KErrNone;
   661     iErr = KErrNone;
   667        
   662        
   668   //  __UHEAP_MARK;    
   663     __UHEAP_MARK;    
   669     iOp = iContactManager->MatchPhoneNumberL(
   664     iOp = iContactManager->MatchPhoneNumberL(
   670         KPhoneNumber, KPhoneNumber().Length(), *this );    
   665         KPhoneNumber, KPhoneNumber().Length(), *this );    
   671     CActiveScheduler::Start();
   666     CActiveScheduler::Start();
   672     delete iOp;
   667     delete iOp;
   673     iOp = NULL;
   668     iOp = NULL;
   689     iOp = NULL;
   684     iOp = NULL;
   690     CleanupStack::PopAndDestroy(iContactToDelete);
   685     CleanupStack::PopAndDestroy(iContactToDelete);
   691     iContactToDelete = NULL;
   686     iContactToDelete = NULL;
   692          
   687          
   693     
   688     
   694  //   __UHEAP_MARKEND;          
   689     __UHEAP_MARKEND;          
   695     }
   690     }
   696     
   691     
   697 //Add 1 contact
   692 //Add 1 contact
   698 void CContactsUT::AddOneContactL(TDesC& aName)
   693 void CContactsUT::AddOneContactL(TDesC& aName)
   699     {
   694     {
   743     __UHEAP_MARKEND;    
   738     __UHEAP_MARKEND;    
   744     }
   739     }
   745     
   740     
   746 //Check for contact
   741 //Check for contact
   747 void CContactsUT::CheckContactsL(TInt& aCount,RPointerArray<TDesC8>& aIdArray)
   742 void CContactsUT::CheckContactsL(TInt& aCount,RPointerArray<TDesC8>& aIdArray)
   748     { 
   743     {    
   749     CleanupResetAndDestroyPushL(aIdArray);   
       
   750     // Print to UI
   744     // Print to UI
   751     _LIT( KContactsTest, "ContactsUT" );
   745     _LIT( KContactsTest, "ContactsUT" );
   752     _LIT( KExample, "In CheckContactsL" );
   746     _LIT( KExample, "In CheckContactsL" );
   753     TestModuleIf().Printf( 0, KContactsTest, KExample );
   747     TestModuleIf().Printf( 0, KContactsTest, KExample );
   754     // Print to log file
   748     // Print to log file
   770         aIdArray.AppendL((const_cast<MVPbkContactLink&>(iFindResults->At(--count))).PackLC());
   764         aIdArray.AppendL((const_cast<MVPbkContactLink&>(iFindResults->At(--count))).PackLC());
   771         CleanupStack::Pop();
   765         CleanupStack::Pop();
   772         }
   766         }
   773     delete iFindResults;
   767     delete iFindResults;
   774     iFindResults = NULL;
   768     iFindResults = NULL;
   775    // __UHEAP_MARKENDC(aCount);
   769    // __UHEAP_MARKENDC(aCount);          
   776    CleanupStack::Pop(&aIdArray);          
       
   777     }
   770     }
   778     
   771     
   779 // -----------------------------------------------------------------------------
   772 // -----------------------------------------------------------------------------
   780 // CContactsUT::?member_function
   773 // CContactsUT::?member_function
   781 // ?implementation_description
   774 // ?implementation_description
  3159      
  3152      
  3160     if(count)
  3153     if(count)
  3161         {        
  3154         {        
  3162         while(count)
  3155         while(count)
  3163             { 
  3156             { 
  3164             __UHEAP_MARK;           
  3157             //__UHEAP_MARK;           
  3165             iBuffer = (const_cast<MVPbkContactLink&>(iFindResults->At(--count))).PackLC();
  3158             iBuffer = (const_cast<MVPbkContactLink&>(iFindResults->At(--count))).PackLC();
  3166             CleanupStack::Pop();//iBuffer            
  3159             CleanupStack::Pop();//iBuffer            
  3167             iServiceHandle = CContactService::NewL();
  3160             iServiceHandle = CContactService::NewL();
  3168             iLog->Log( KServiceOpen );
  3161             iLog->Log( KServiceOpen );
  3169             
  3162             
  3174             CActiveScheduler::Start();
  3167             CActiveScheduler::Start();
  3175             
  3168             
  3176             delete iServiceHandle;//serviceHandle   
  3169             delete iServiceHandle;//serviceHandle   
  3177             iServiceHandle = NULL;
  3170             iServiceHandle = NULL;
  3178             iLog->Log( KServiceClose );
  3171             iLog->Log( KServiceClose );
  3179             __UHEAP_MARKEND;
  3172             //__UHEAP_MARKEND;
  3180             }       
  3173             }       
  3181         
  3174         
  3182         }
  3175         }
  3183      
  3176      
  3184     /** ends */
  3177     /** ends */