phoneengine/PhoneCntFinder/ContactService/inc/cphcntstoreloaderimpl.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Phone contact data store loader implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_PHCNTSTORELOADERIMPL_H
       
    20 #define C_PHCNTSTORELOADERIMPL_H
       
    21 
       
    22 #include "mphcntstoreloader.h"
       
    23 #include "mphcntstoreloaderobserver.h"
       
    24 #include "cphcntasynctosync.h"
       
    25 
       
    26 class MPhCntContactManager;
       
    27 class MVPbkContactStore;
       
    28 
       
    29 /**
       
    30  *  Implements services to load contact data stores.
       
    31  *
       
    32  *  @lib phonecntfinder
       
    33  *  @since S60 9.1
       
    34  */
       
    35 NONSHARABLE_CLASS( CPhCntStoreLoaderImpl ) 
       
    36         : 
       
    37         public CPhCntAsyncToSync,
       
    38         public MPhCntStoreLoader, 
       
    39         public MPhCntStoreLoaderObserver
       
    40     {
       
    41 
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Two-phased constructor.
       
    46      * @param aManager  Contact manager.
       
    47      */
       
    48     static CPhCntStoreLoaderImpl* NewL( MPhCntContactManager& aManager );
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      * @param aManager  Contact manager.
       
    53      */
       
    54     static CPhCntStoreLoaderImpl* NewLC( MPhCntContactManager& aManager );
       
    55     
       
    56     /**
       
    57     * Destructor.
       
    58     */
       
    59     virtual ~CPhCntStoreLoaderImpl();
       
    60 
       
    61 // from base class MPhCntStoreLoader
       
    62 
       
    63     /**
       
    64      * From MPhCntStoreLoader.
       
    65      *
       
    66      * @since S60 v9.1
       
    67      * @see MPhCntStoreLoader.
       
    68      */
       
    69     TBool IsContactStoreLoaded( const TDesC8& aContactLink ) const;
       
    70     
       
    71     /**
       
    72      * From MPhCntStoreLoader.
       
    73      * 
       
    74      * @since S60 v9.1
       
    75      * @see MPhCntStoreLoader.
       
    76      */
       
    77     void LoadContactStoreL( const TDesC8& aContactLink,
       
    78         MPhCntStoreLoaderObserver& aObserver );
       
    79 
       
    80 // from base class MPhCntStoreLoaderObserver
       
    81 
       
    82     /**
       
    83      * From MPhCntStoreLoaderObserver.
       
    84      *
       
    85      * @since S60 v9.1
       
    86      * @see MPhCntStoreLoaderObserver.
       
    87      */
       
    88     void ContactStoreLoadingCompleted( 
       
    89         MVPbkContactStore* aStore, TInt aErrorCode );
       
    90 public:   
       
    91     /**
       
    92      * Loads contact store with uri
       
    93      * 
       
    94      * @since S60 v5.1
       
    95      * @param aStoreUri Uri of the store to be loaded.
       
    96      */
       
    97     TInt LoadContactStoreWithUri( const TDesC& aStoreUri );
       
    98     
       
    99 protected:
       
   100     /**
       
   101      * From CPhCntAsyncToSync.
       
   102      *
       
   103      * @since S60 v3.2
       
   104      * @see CPhCntAsyncToSync.    
       
   105      */
       
   106     void DoMakeAsyncRequestL();    
       
   107 private:
       
   108 
       
   109     CPhCntStoreLoaderImpl( MPhCntContactManager& aManager );
       
   110 
       
   111     void ConstructL();
       
   112 
       
   113     TBool IsContactStoreLoadedL( const TDesC8& aContactLink ) const;
       
   114 
       
   115     TBool IsContactStoreLoadedL( const TDesC16& aContactStoreUri ) const;
       
   116 private: // data
       
   117 
       
   118     /**
       
   119      * Contact manager.
       
   120      * Not own.
       
   121      */
       
   122     MPhCntContactManager& iContactManager;
       
   123     
       
   124     /**
       
   125      * Observer for contact store loading process.
       
   126      * Not own.
       
   127      */
       
   128     MPhCntStoreLoaderObserver* iObserver;
       
   129 
       
   130     /**
       
   131      * Pointer to uri of the store to be loaded.
       
   132      * Not own.
       
   133      */
       
   134     const TDesC* iStoreUri;
       
   135     };
       
   136 
       
   137 #endif // C_PHCNTSTORELOADERIMPL_H
       
   138