ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp
branchRCL_3
changeset 5 81f8547efd4f
parent 0 e686773b3f54
child 6 e8e3147d53eb
equal deleted inserted replaced
3:04ab22b956c2 5:81f8547efd4f
    35 #include "cmsphonebookproxy.h"
    35 #include "cmsphonebookproxy.h"
    36 #include "cmsservercontact.h"
    36 #include "cmsservercontact.h"
    37 #include "cmsdefines.h"
    37 #include "cmsdefines.h"
    38 #include "cmsserver.h"
    38 #include "cmsserver.h"
    39 #include "cmsdebug.h"
    39 #include "cmsdebug.h"
       
    40 #include "cmssetvoicecalldefault.h"
    40 
    41 
    41 #include "cmsfindlinkedcontact.h"
    42 #include "cmsfindlinkedcontact.h"
    42 #include <MVPbkContactLink.h>
    43 #include <MVPbkContactLink.h>
    43 
    44 
    44 // CONSTANTS
    45 // CONSTANTS
    86     {
    87     {
    87     PRINT ( _L("Start CCmsPhonebookProxy::ConstructL()") );
    88     PRINT ( _L("Start CCmsPhonebookProxy::ConstructL()") );
    88     iStoreConfiguration = CPbk2StoreConfiguration::NewL();
    89     iStoreConfiguration = CPbk2StoreConfiguration::NewL();
    89     iStoreConfiguration->AddObserverL( *this );
    90     iStoreConfiguration->AddObserverL( *this );
    90     CreateConfigurationL();
    91     CreateConfigurationL();
       
    92     iSetDefault = CmsSetVoiceCallDefault::NewL();
    91     PRINT ( _L("End CCmsPhonebookProxy::ConstructL()") );
    93     PRINT ( _L("End CCmsPhonebookProxy::ConstructL()") );
    92     }
    94     }
    93 
    95 
    94 // ----------------------------------------------------------
    96 // ----------------------------------------------------------
    95 // CCmsPhonebookProxy::~CCmsPhonebookProxy
    97 // CCmsPhonebookProxy::~CCmsPhonebookProxy
   108         delete iStoreConfiguration;
   110         delete iStoreConfiguration;
   109         iStoreConfiguration = NULL;
   111         iStoreConfiguration = NULL;
   110         }
   112         }
   111     iObserverArray.Close();
   113     iObserverArray.Close();
   112     ixSPStoresArray.Reset();
   114     ixSPStoresArray.Reset();
       
   115     delete iSetDefault;
   113     }
   116     }
   114 
   117 
   115 // ----------------------------------------------------------
   118 // ----------------------------------------------------------
   116 // CCmsPhonebookProxy::StoreOpenStatus
   119 // CCmsPhonebookProxy::StoreOpenStatus
   117 //
   120 //
   226             }
   229             }
   227         else
   230         else
   228             {
   231             {
   229             contactLinkToFetch = contactLink.CloneLC();
   232             contactLinkToFetch = contactLink.CloneLC();
   230             }
   233             }
   231         
   234         // Send the latest contact link to cmsservercontact
   232         //Retreive the contact Info
   235         // to fetch contact.
   233         if( iOperation )
   236         iContactInterface->FetchContactL( contactLinkToFetch );
   234             {
       
   235             delete iOperation;
       
   236             iOperation = NULL;
       
   237             }
       
   238         iOperation = iContactManager->RetrieveContactL( *contactLinkToFetch, *this );
       
   239         CleanupStack::PopAndDestroy();  //contactLinkToFetch
   237         CleanupStack::PopAndDestroy();  //contactLinkToFetch
   240         
   238         
   241         if ( findLinkedContact )
   239         if ( findLinkedContact )
   242             {
   240             {
   243             CleanupStack::PopAndDestroy();  //findLinkedContact
   241             CleanupStack::PopAndDestroy();  //findLinkedContact
   404     param->iWordArray->AppendL( data );
   402     param->iWordArray->AppendL( data );
   405     return 0;
   403     return 0;
   406     }
   404     }
   407 
   405 
   408 // ----------------------------------------------------------
   406 // ----------------------------------------------------------
       
   407 // CCmsPhonebookProxy::SetVoiceCallDefaultL
       
   408 //
       
   409 // ----------------------------------------------------------
       
   410 //
       
   411 void CCmsPhonebookProxy::SetVoiceCallDefaultL()
       
   412 	{
       
   413 	iSetDefault->SetVoiceCallDefaultL( iContact, iContactManager );
       
   414 	}
       
   415 
       
   416 // ----------------------------------------------------------
   409 // CCmsPhonebookProxy::ExternalStoresIntalled
   417 // CCmsPhonebookProxy::ExternalStoresIntalled
   410 //
   418 //
   411 // ----------------------------------------------------------
   419 // ----------------------------------------------------------
   412 //
   420 //
   413 TBool CCmsPhonebookProxy::ExternalStoresIntalled() const
   421 TBool CCmsPhonebookProxy::ExternalStoresIntalled() const
   540 void CCmsPhonebookProxy::HandleStoreEventL( MVPbkContactStore& /*aContactStore*/,
   548 void CCmsPhonebookProxy::HandleStoreEventL( MVPbkContactStore& /*aContactStore*/,
   541                                             TVPbkContactStoreEvent aStoreEvent )
   549                                             TVPbkContactStoreEvent aStoreEvent )
   542     {
   550     {
   543     PRINT( _L("Start CCmsPhonebookProxy::HandleStoreEventL()" ) );
   551     PRINT( _L("Start CCmsPhonebookProxy::HandleStoreEventL()" ) );
   544     
   552     
   545     TBool found = EFalse;
       
   546     const TInt count = iObserverArray.Count();
   553     const TInt count = iObserverArray.Count();
   547     for( TInt i = 0;!found && i < count;i++ )
   554     // send store event to all observers
       
   555     for( TInt i = 0; i < count ; i++ )
   548         {
   556         {
   549         MCmsContactInterface* observer( iObserverArray[i] );
   557         MCmsContactInterface* observer( iObserverArray[i] );
   550         if( observer )
   558         if( observer )
   551             {
   559             {
   552             TCmsPhonebookEvent event = SelectEventType( aStoreEvent.iEventType );
   560             TCmsPhonebookEvent event = SelectEventType( aStoreEvent.iEventType );
   553             found = observer->OfferContactEventL( event, aStoreEvent.iContactLink );
   561             observer->OfferContactEventL( event, aStoreEvent.iContactLink );
   554             }
   562             }
   555         }
   563         }
   556     PRINT( _L("End CCmsPhonebookProxy::HandleStoreEventL()" ) );
   564     PRINT( _L("End CCmsPhonebookProxy::HandleStoreEventL()" ) );
   557     }
   565     }
   558 
   566 
   717         MVPbkStoreContact* aContact )
   725         MVPbkStoreContact* aContact )
   718     {
   726     {
   719     PRINT( _L( "Start CCmsPhonebookProxy::VPbkSingleContactOperationComplete()" ) );
   727     PRINT( _L( "Start CCmsPhonebookProxy::VPbkSingleContactOperationComplete()" ) );
   720 
   728 
   721     ResetData();
   729     ResetData();
       
   730     iContact = aContact;
   722     CompleteContactRequestL( KErrNone, aContact );
   731     CompleteContactRequestL( KErrNone, aContact );
   723     iCmsPhonebookOperationsObserver.CmsSingleContactOperationComplete( KErrNone );
   732     iCmsPhonebookOperationsObserver.CmsSingleContactOperationComplete( KErrNone );
   724 
   733 
   725     PRINT( _L( "End CCmsPhonebookProxy::VPbkSingleContactOperationComplete()" ) );
   734     PRINT( _L( "End CCmsPhonebookProxy::VPbkSingleContactOperationComplete()" ) );
   726     }
   735     }