phonebookui/Phonebook2/inc/CPbk2ApplicationServices.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Phonebook 2 application services.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2APPLICATIONSERVICES_H
       
    20 #define CPBK2APPLICATIONSERVICES_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2ApplicationServices.h>
       
    25 #include <MPbk2ApplicationServices2.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CPbk2StoreManager;
       
    29 class CPbk2ContactViewSupplier;
       
    30 class CPbk2ServiceManager;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  * Phonebook 2 application services.
       
    36  * Responsible for owning and delivering commonly used shared objects
       
    37  * and providing some common application level services.
       
    38  */
       
    39 NONSHARABLE_CLASS(CPbk2ApplicationServices) : public CBase,
       
    40                                  public MPbk2ApplicationServices,
       
    41                                  public MPbk2ApplicationServices2
       
    42 
       
    43     {
       
    44     public: // Constructor and destructor
       
    45 
       
    46         /**
       
    47          * Creates a new instance of this class.
       
    48          *
       
    49          * @return  A new instance of this class.
       
    50          */
       
    51         IMPORT_C static CPbk2ApplicationServices* InstanceL();
       
    52         
       
    53         /**
       
    54          * Creates a new instance of this class.
       
    55          *
       
    56          * @return  A new instance of this class.
       
    57          */
       
    58         IMPORT_C static CPbk2ApplicationServices* InstanceLC();
       
    59 
       
    60         /**
       
    61          * Destructor.
       
    62          */
       
    63         ~CPbk2ApplicationServices();
       
    64 
       
    65     public: // From MPbk2ApplicationServices
       
    66         CVPbkContactManager& ContactManager() const;
       
    67         MPbk2CommandHandler* CommandHandlerL();
       
    68         MPbk2ContactNameFormatter& NameFormatter() const;
       
    69         CPbk2SortOrderManager& SortOrderManager() const;
       
    70         CSendUi* SendUiL();
       
    71         CPbk2StorePropertyArray& StoreProperties() const;
       
    72         CPbk2FieldPropertyArray& FieldProperties() const;
       
    73         CPbk2StoreConfiguration& StoreConfiguration() const;
       
    74         MPbk2StoreObservationRegister& StoreObservationRegister() const;
       
    75         MPbk2StoreValidityInformer& StoreValidityInformer() const;
       
    76         MPbk2ContactViewSupplier& ViewSupplier() const;
       
    77         TInt GlobalMenuFilteringFlagsL() const;
       
    78         TBool LocallyVariatedFeatureEnabled(
       
    79             TVPbkLocalVariantFlags aFeatureFlag);
       
    80         TAny* MPbk2ApplicationServicesExtension( TUid aExtensionUid );
       
    81 
       
    82     public: // From MPbk2ApplicationServices2
       
    83         CPbk2StoreManager& StoreManager() const;
       
    84         CPbk2ServiceManager& ServiceManager() const;
       
    85 
       
    86     public:
       
    87         /**
       
    88          * Pushes this object to the cleanup stack for releasing.
       
    89          */
       
    90         inline void PushL();
       
    91 
       
    92     private: // Release interface
       
    93         friend void Release( CPbk2ApplicationServices* aObj );
       
    94         virtual void DoRelease();
       
    95         static void CleanupRelease( TAny* aObj );
       
    96 
       
    97     private: // Implementation
       
    98         CPbk2ApplicationServices();
       
    99         void ConstructL();
       
   100         void CreateManagerL();
       
   101         void CreateSortOrderManagerL();
       
   102         void CreateStorePropertyArrayL();
       
   103         void CreateFieldPropertyArrayL();
       
   104         void CreateNameFormatterL();
       
   105         void CreateViewSupplierL();
       
   106         void CreateStoreConfigurationL();
       
   107         void GetLocalVariationFlags();
       
   108 
       
   109         void IncRef();
       
   110         TInt DecRef();
       
   111 
       
   112     private: // Data
       
   113         /// Own: Reference count
       
   114         TInt iRefCount;
       
   115         /// Own: Virtual Phonebook contact manager
       
   116         CVPbkContactManager* iContactManager;
       
   117         /// Own: Store manager
       
   118         CPbk2StoreManager* iStoreManager;
       
   119         /// Own: Sort order manager
       
   120         CPbk2SortOrderManager* iSortOrderManager;
       
   121         /// Own: Contact name formatter
       
   122         MPbk2ContactNameFormatter* iNameFormatter;
       
   123         /// Own: Store properties
       
   124         CPbk2StorePropertyArray* iStoreProperties;
       
   125         /// Own: Field properties
       
   126         CPbk2FieldPropertyArray* iFieldProperties;
       
   127         /// Own: View supplier
       
   128         CPbk2ContactViewSupplier* iViewSupplier;
       
   129         /// Own: Contact store configuration
       
   130         CPbk2StoreConfiguration* iStoreConfiguration;
       
   131         /// Own: Service manager
       
   132         CPbk2ServiceManager* iServiceManager;
       
   133         /// Own: local variation flags
       
   134         TInt iLocalVariationFlags;
       
   135 
       
   136     };
       
   137 
       
   138 // INLINE IMPLEMENTATION
       
   139 
       
   140 // --------------------------------------------------------------------------
       
   141 // Release
       
   142 // --------------------------------------------------------------------------
       
   143 //
       
   144 inline void Release( CPbk2ApplicationServices* aObj )
       
   145     {
       
   146     if ( aObj )
       
   147         {
       
   148         aObj->DoRelease();
       
   149         }
       
   150     }
       
   151 
       
   152 // --------------------------------------------------------------------------
       
   153 // CPbk2ApplicationServices::PushL
       
   154 // --------------------------------------------------------------------------
       
   155 //
       
   156 inline void CPbk2ApplicationServices::PushL()
       
   157     {
       
   158     CleanupStack::PushL( TCleanupItem( CleanupRelease, this ) );
       
   159     }
       
   160 
       
   161 // --------------------------------------------------------------------------
       
   162 // CPbk2ApplicationServices::CleanupRelease
       
   163 // --------------------------------------------------------------------------
       
   164 //
       
   165 inline void CPbk2ApplicationServices::CleanupRelease( TAny* aObj )
       
   166     {
       
   167     Release( static_cast<CPbk2ApplicationServices*>( aObj ) );
       
   168     }
       
   169 
       
   170 #endif // CPBK2APPLICATIONSERVICES_H
       
   171 
       
   172 // End of File