phonebookui/Phonebook2/Presentation/inc/CPbk2StoreConfigurationImpl.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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: 
       
    15 *     Phonebook 2 contact store configurations.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPBK2STORECONFIGURATIONIMPL_H
       
    21 #define CPBK2STORECONFIGURATIONIMPL_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <e32base.h>
       
    25 #include <badesca.h>
       
    26 #include <MPbk2StoreConfigurationObserver.h>
       
    27 #include <MPbk2DefaultSavingStoreObserver.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CRepository;
       
    31 class CPbk2StoreConfigurationMonitor;
       
    32 class TVPbkContactStoreUriPtr;
       
    33 class CVPbkContactStoreUriArray;
       
    34 class CPbk2DefaultSavingStoreMonitor;
       
    35 
       
    36 /**
       
    37  * Phonebook 2 contact store configurations.
       
    38  * This classes responsability is to retrieve the store configuration
       
    39  * of the device and to monitor changes to the configuration and relay them
       
    40  * to registered observers.
       
    41  */
       
    42 NONSHARABLE_CLASS( CPbk2StoreConfigurationImpl )  :
       
    43             public CBase,
       
    44             private MPbk2StoreConfigurationObserver,
       
    45             private MPbk2DefaultSavingStoreObserver
       
    46     {
       
    47 	public: // Construction and destruction
       
    48 
       
    49         /**
       
    50          * Creates a new instance of this class.
       
    51          *
       
    52          * @return A new instance of this class.
       
    53          */
       
    54 		static CPbk2StoreConfigurationImpl* NewL();
       
    55 
       
    56         /**
       
    57          * Destructor.
       
    58          */
       
    59         ~CPbk2StoreConfigurationImpl();
       
    60 
       
    61     public: // Interface
       
    62         /**
       
    63          * Fetches an array of configured contact store URIs.
       
    64          *
       
    65          * @return Array of URIs that is the current configuration.
       
    66          */
       
    67         CVPbkContactStoreUriArray* CurrentConfigurationL() const;
       
    68 
       
    69         /**
       
    70          * Fetches an array of contact store URIs to be used
       
    71          * in searching, for example phone number matching.
       
    72          *
       
    73          * @return Array of URIs to be used for searching.
       
    74          */
       
    75         CVPbkContactStoreUriArray* SearchStoreConfigurationL();
       
    76 
       
    77         /**
       
    78          * Fetches an array of supported contact stores URIs.
       
    79          * NOTE: All returned stores are not necessarily supported by
       
    80          * the current HW / SW configuration of the phone.
       
    81          *
       
    82          * @return Array of URIs that is the supported store configuration.
       
    83          */
       
    84         CVPbkContactStoreUriArray* SupportedStoreConfigurationL() const;
       
    85 
       
    86         /**
       
    87          * Returns URI of the default store for saving contacts.
       
    88          *
       
    89          * @return URI of the default store.
       
    90          */
       
    91         TVPbkContactStoreUriPtr DefaultSavingStoreL() const;
       
    92 
       
    93         /**
       
    94          * Adds a new contact store URI to current configuration.
       
    95          *
       
    96          * @param aURI  URI to add to current configuration.
       
    97          */
       
    98         void AddContactStoreURIL(
       
    99             TVPbkContactStoreUriPtr aURI);
       
   100 
       
   101         /**
       
   102          * Removes a contact store URI from current configuration.
       
   103          *
       
   104          * @param aURI  URI to remove from current configuration.
       
   105          */
       
   106         void RemoveContactStoreURIL(
       
   107             TVPbkContactStoreUriPtr aURI);
       
   108 
       
   109         /**
       
   110          * Adds a new configuration observer.
       
   111          *
       
   112          * @param aObserver The observer to add.
       
   113          */
       
   114         void AddObserverL(
       
   115             MPbk2StoreConfigurationObserver& aObserver);
       
   116 
       
   117         /**
       
   118          * Removes a configuration observer.
       
   119          *
       
   120          * @param aObserver The observer to remove.
       
   121          */
       
   122         void RemoveObserver(
       
   123             MPbk2StoreConfigurationObserver& aObserver);
       
   124 
       
   125         /**
       
   126          * Adds a default saving store observer.
       
   127          *
       
   128          * @param aObserver The observer to add.
       
   129          */
       
   130         void AddDefaultSavingStoreObserverL(
       
   131             MPbk2DefaultSavingStoreObserver& aObserver);
       
   132 
       
   133         /**
       
   134          * Removes a default saving store observer.
       
   135          *
       
   136          * @param aObserver The observer to remove.
       
   137          */
       
   138         void RemoveDefaultSavingStoreObserver(
       
   139             MPbk2DefaultSavingStoreObserver& aObserver);
       
   140 
       
   141         /**
       
   142          * Adds a new contact store URI to supported configuration.
       
   143          * Use AddContactStoreURIL to add the store to current
       
   144          * configuration if desired.
       
   145          *
       
   146          * @param aURI      The URI to add.
       
   147          */
       
   148         void AddSupportedContactStoreURIL(
       
   149                 TVPbkContactStoreUriPtr aURI );
       
   150 
       
   151         /**
       
   152          * Removes a contact store URI from supported configuration.
       
   153          * Use RemoveContactStoreUriL to remove the store from
       
   154          * current configuration if desired.
       
   155          *
       
   156          * @param aURI      The URI to remove.
       
   157          */
       
   158         void RemoveSupportedContactStoreURIL(
       
   159                 TVPbkContactStoreUriPtr aURI );
       
   160 
       
   161     private: // From MPbk2StoreConfigurationObserver
       
   162         void ConfigurationChanged();
       
   163         void ConfigurationChangedComplete();
       
   164 
       
   165     private: // From MPbk2DefaultSavingStoreObserver
       
   166         void SavingStoreChanged();
       
   167 
       
   168     private: // Implementation
       
   169         CPbk2StoreConfigurationImpl();
       
   170         void ConstructL();
       
   171         TBool AlreadyRegisteredL(
       
   172                 TVPbkContactStoreUriPtr aURI,
       
   173                 RArray<TUint32> aKeys );
       
   174 
       
   175 	private: // Data
       
   176         /// Own: Repository for fetching data
       
   177         CRepository* iRepository;
       
   178         /// Own: Configuration monitor
       
   179         CPbk2StoreConfigurationMonitor* iConfigurationMonitor;
       
   180         /// Own: Default saving store monitor
       
   181         CPbk2DefaultSavingStoreMonitor* iDefaultSavingStoreMonitor;
       
   182         /// Own: Array of observers
       
   183         RPointerArray<MPbk2StoreConfigurationObserver> iObservers;
       
   184         /// Own: Array of default saving store observers
       
   185         RPointerArray<MPbk2DefaultSavingStoreObserver> iDefaultStoreObservers;
       
   186 	};
       
   187 
       
   188 #endif // CPBK2STORECONFIGURATIONIMPL_H
       
   189 
       
   190 // End of File