phoneengine/PhoneCntFinder/ContactService/src/cphcntstoreloaderimpl.cpp
branchRCL_3
changeset 10 ba54057fe027
parent 0 5f000ab63145
equal deleted inserted replaced
9:91c2fb4b78df 10:ba54057fe027
    13 *
    13 *
    14 * Description:  Implementation of CPhCntStoreLoaderImpl class.
    14 * Description:  Implementation of CPhCntStoreLoaderImpl class.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 #include <MVPbkContactLink.h>
    19 #include <CVPbkContactLinkArray.h>
    19 #include <CVPbkContactLinkArray.h>
       
    20 #include <MVPbkContactStoreList.h>
       
    21 #include <CVPbkContactStoreUriArray.h>
    20 #include <TVPbkContactStoreUriPtr.h>
    22 #include <TVPbkContactStoreUriPtr.h>
    21 #include <MVPbkContactStoreList.h>
    23 #include <MVPbkContactStore.h>
       
    24 #include <MVPbkContactStoreProperties.h>
       
    25 #include <talogger.h>
    22 #include "cphcntstoreloaderimpl.h"
    26 #include "cphcntstoreloaderimpl.h"
    23 #include "MPhCntContactManager.h"
    27 #include "MPhCntContactManager.h"
       
    28 #include "cphcntcontactstoreuris.h"
    24 
    29 
    25 // ======== MEMBER FUNCTIONS ========
    30 // ======== MEMBER FUNCTIONS ========
    26 
    31 
    27 // ---------------------------------------------------------------------------
    32 // ---------------------------------------------------------------------------
    28 // CPhCntStoreLoaderImpl::CPhCntStoreLoaderImpl
    33 // CPhCntStoreLoaderImpl::CPhCntStoreLoaderImpl
   174 // Checks is the contact store (specified by the given contact link) loaded.
   179 // Checks is the contact store (specified by the given contact link) loaded.
   175 // ---------------------------------------------------------------------------
   180 // ---------------------------------------------------------------------------
   176 //
   181 //
   177 TBool CPhCntStoreLoaderImpl::IsContactStoreLoadedL( 
   182 TBool CPhCntStoreLoaderImpl::IsContactStoreLoadedL( 
   178         const TDesC8& aContactLink ) const
   183         const TDesC8& aContactLink ) const
   179     {
   184     {    
   180     CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC( 
   185     TBool storeLoaded = EFalse;
   181         aContactLink, iContactManager.ContactStoresL() );
   186     CPhCntContactStoreUris& storeUris = iContactManager.ContactStoreUrisL();
       
   187     CVPbkContactStoreUriArray* uriArray = storeUris.ActiveContactStoresL(); 
       
   188     CleanupStack::PushL( uriArray );
   182     
   189     
   183     TBool storeLoaded( linkArray->Count() != 0 );
   190     if ( uriArray->Count() > 0 ) 
   184     CleanupStack::PopAndDestroy( linkArray );
   191         {  
   185     
   192         MVPbkContactLink* link = iContactManager.ConvertDescriptorToLinkL( aContactLink );
       
   193         if( link )
       
   194             {
       
   195             for ( int i=0; i<uriArray->Count();i++ )
       
   196                 {           
       
   197                 if ((*uriArray)[i].Compare( 
       
   198                     link->ContactStore().StoreProperties().Uri(), 
       
   199                     TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ) 
       
   200                         == KErrNone )
       
   201                     {
       
   202                     storeLoaded = ETrue;
       
   203                     break;
       
   204                     }
       
   205                 }
       
   206             delete link;
       
   207             }
       
   208     }
       
   209     CleanupStack::PopAndDestroy( uriArray );
   186     return storeLoaded;
   210     return storeLoaded;
   187     }
   211     }
   188 
   212 
   189 // ---------------------------------------------------------------------------
   213 // ---------------------------------------------------------------------------
   190 // CPhCntStoreLoaderImpl::IsContactStoreLoadedL.
   214 // CPhCntStoreLoaderImpl::IsContactStoreLoadedL.