uiservicetab/vimpstcmdprocess/src/cvimpstcmdaddfrompbk.cpp
branchRCL_3
changeset 14 9fdee5e1da30
parent 10 78867dafe7eb
equal deleted inserted replaced
13:796276a1bdcc 14:9fdee5e1da30
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include "cvimpstcmdaddfrompbk.h"
    20 #include "cvimpstcmdaddfrompbk.h"
    21 #include "vimpstcmd.hrh"
    21 #include "vimpstcmd.hrh"
    22 #include "mvimpstcmdobserver.h"
    22 #include "mvimpstcmdobserver.h"
    23 #include "vimpstdebugprint.h" 
    23 
       
    24 #include "uiservicetabtracer.h"
    24 
    25 
    25 #include <e32def.h>
    26 #include <e32def.h>
    26 #include <mvpbkstorecontact.h>
    27 #include <mvpbkstorecontact.h>
    27 #include "mvimpstengine.h"
    28 #include "mvimpstengine.h"
    28 #include "mvimpststorageserviceview.h"
    29 #include "mvimpststorageserviceview.h"
    64 //
    65 //
    65 CVIMPSTCmdAddFromPbk* CVIMPSTCmdAddFromPbk::NewL( const TInt aCommandId,
    66 CVIMPSTCmdAddFromPbk* CVIMPSTCmdAddFromPbk::NewL( const TInt aCommandId,
    66                                                   const MVPbkStoreContact& aStoreContact,
    67                                                   const MVPbkStoreContact& aStoreContact,
    67                                                   MVIMPSTEngine& aEngine )
    68                                                   MVIMPSTEngine& aEngine )
    68     {
    69     {
       
    70     TRACER_AUTO;
    69     CVIMPSTCmdAddFromPbk* self = new (ELeave ) CVIMPSTCmdAddFromPbk( aCommandId ,aStoreContact, aEngine);
    71     CVIMPSTCmdAddFromPbk* self = new (ELeave ) CVIMPSTCmdAddFromPbk( aCommandId ,aStoreContact, aEngine);
    70     self->ConstructL(); //use contsurctL if necessary
    72     self->ConstructL(); //use contsurctL if necessary
    71     return self;
    73     return self;
    72     }
    74     }
    73 // --------------------------------------------------------------------------
    75 // --------------------------------------------------------------------------
    83 // CVIMPSTCmdAddFromPbk::ExecuteLD
    85 // CVIMPSTCmdAddFromPbk::ExecuteLD
    84 // --------------------------------------------------------------------------
    86 // --------------------------------------------------------------------------
    85 //
    87 //
    86 void CVIMPSTCmdAddFromPbk::ExecuteLD()
    88 void CVIMPSTCmdAddFromPbk::ExecuteLD()
    87     {
    89     {
    88     CHAT_DP_FUNC_ENTER("CVIMPSTCmdAddFromPbk::ExecuteLD");
    90     
       
    91     TRACER_AUTO;
    89     //push to the cleanupstack
    92     //push to the cleanupstack
    90     CleanupStack::PushL( this );
    93     CleanupStack::PushL( this );
    91     MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL( iEngine.ServiceId() ) ;
    94     MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL( iEngine.ServiceId() ) ;
    92     if(storage)
    95     if(storage)
    93         {
    96         {
   123         }
   126         }
   124     if(iObserver)
   127     if(iObserver)
   125         {
   128         {
   126         iObserver->CommandFinishedL(*this);
   129         iObserver->CommandFinishedL(*this);
   127         }
   130         }
   128     CHAT_DP_FUNC_ENTER("CVIMPSTCmdAddFromPbk:: CommandFinished");    
   131        
   129     CleanupStack::PopAndDestroy();  
   132     CleanupStack::PopAndDestroy();  
   130     CHAT_DP_FUNC_DONE("CVIMPSTCmdAddFromPbk::ExecuteLD");    
   133    
   131     }
   134     }
   132 
   135 
   133 
   136 
   134 // --------------------------------------------------------------------------
   137 // --------------------------------------------------------------------------
   135 // CVIMPSTCmdAddFromPbk::AddObserver
   138 // CVIMPSTCmdAddFromPbk::AddObserver
   164 // CVIMPSTCmdAddFromPbk::GetServiceFieldsL
   167 // CVIMPSTCmdAddFromPbk::GetServiceFieldsL
   165 // ---------------------------------------------------------------------------
   168 // ---------------------------------------------------------------------------
   166 //  
   169 //  
   167 void CVIMPSTCmdAddFromPbk::GetServiceFieldsL( CDesCArray& aArrayForServiceFields )
   170 void CVIMPSTCmdAddFromPbk::GetServiceFieldsL( CDesCArray& aArrayForServiceFields )
   168     {
   171     {
   169     CHAT_DP_FUNC_ENTER("[CVIMPSTStorageContact::GetServiceFieldsL]  ->  GetServiceFieldsL");
   172    
       
   173     TRACER_AUTO;
   170     HBufC* values[40];
   174     HBufC* values[40];
   171     for( TInt index = 0 ; 
   175     for( TInt index = 0 ; 
   172         index < iStoreContact.Fields().FieldCount() ; 
   176         index < iStoreContact.Fields().FieldCount() ; 
   173         index++ )
   177         index++ )
   174         {
   178         {
   186             ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_SIP )||
   190             ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_SIP )||
   187             ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_EMAILWORK ) ||
   191             ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_EMAILWORK ) ||
   188             ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_EMAILHOME ) ||
   192             ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_EMAILHOME ) ||
   189             ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_EMAILGEN ))
   193             ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_EMAILGEN ))
   190                 {
   194                 {
   191                 CHAT_DP_FUNC_ENTER("[CVIMPSTStorageContact::GetServiceFieldsL]  ->  GetServiceFieldsL - Found");
   195                 TRACE("GetServiceFieldsL - Found");
   192                 values[0] = MVPbkContactFieldTextData::Cast( 
   196                 values[0] = MVPbkContactFieldTextData::Cast( 
   193                 iStoreContact.Fields().FieldAt( index ).
   197                 iStoreContact.Fields().FieldAt( index ).
   194                 FieldData() ).Text().AllocLC();
   198                 FieldData() ).Text().AllocLC();
   195                 if ( values[0] )
   199                 if ( values[0] )
   196                     {
   200                     {
   197                     // Check for prefix and remove if found
   201                     // Check for prefix and remove if found
   198                     TInt prefixLocation = values[0]->Locate( ':' );
   202                     TInt prefixLocation = values[0]->Locate( ':' );
   199                     if ( KErrNotFound != prefixLocation )
   203                     if ( KErrNotFound != prefixLocation )
   200                         {
   204                         {
   201                         CHAT_DP_FUNC_ENTER("[CVIMPSTStorageContact::GetServiceFieldsL]  ->  Prefix found -> remove");
   205                         TRACE("Prefix found -> remove");                    
   202                         aArrayForServiceFields.AppendL( values[0]->Des().Mid(
   206                         aArrayForServiceFields.AppendL( values[0]->Des().Mid(
   203                         prefixLocation+1 ) );
   207                         prefixLocation+1 ) );
   204                         }
   208                         }
   205                     else
   209                     else
   206                         {
   210                         {
   207                         CHAT_DP_FUNC_ENTER("[CVIMPSTStorageContact::GetServiceFieldsL]  ->  No Prefix found");
   211                     TRACE("No prefix");                    
   208                         aArrayForServiceFields.AppendL( values[0]->Des() );    
   212                         aArrayForServiceFields.AppendL( values[0]->Des() );    
   209                         }
   213                         }
   210                     CleanupStack::PopAndDestroy( values[0] );
   214                     CleanupStack::PopAndDestroy( values[0] );
   211                     }
   215                     }
   212                 }
   216                 }