phonebookui/Phonebook2/inc/CPbk2ContactViewSupplier.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 view supplier.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2CONTACTVIEWSUPPLIER_H
       
    20 #define CPBK2CONTACTVIEWSUPPLIER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2ContactViewSupplier.h>
       
    25 #include <MPbk2ContactViewSupplier2.h>
       
    26 #include <MVPbkContactViewObserver.h>
       
    27 #include <MPbk2StoreConfigurationObserver.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MVPbkContactViewBase;
       
    31 class CVPbkContactManager;
       
    32 class CPbk2SortOrderManager;
       
    33 class CPbk2StoreConfiguration;
       
    34 class CPbk2StorePropertyArray;
       
    35 class MVPbkFieldTypeList;
       
    36 class CVPbkSortOrderAcquirer;
       
    37 class CPbk2NonTopContactSelector;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42  * Phonebook 2 view supplier.
       
    43  * Responsible for owning and delivering shared contact views.
       
    44  */
       
    45 class CPbk2ContactViewSupplier : public CBase,
       
    46                                  public MPbk2ContactViewSupplier,
       
    47                                  public MPbk2ContactViewSupplier2,
       
    48                                  private MVPbkContactViewObserver,
       
    49                                  private MPbk2StoreConfigurationObserver
       
    50     {
       
    51     public: // Constructor and destructor
       
    52 
       
    53         /**
       
    54          * Creates a new instance of this class.
       
    55          *
       
    56          * @param aContactManager               Virtual Phonebook
       
    57          *                                      contact manager.
       
    58          * @param aSortOrderManager             Sort order manager.
       
    59          * @param aStoreConfiguration           Store configuration.
       
    60          * @param aStoreProperties              Store properties.
       
    61          * @param aActOnConfigurationEvents     Indicates whether to
       
    62          *                                      reconstruct the views when
       
    63          *                                      configuration changes.
       
    64          * @return  A new instance of this class.
       
    65          */
       
    66         IMPORT_C static CPbk2ContactViewSupplier* NewL(
       
    67                 CVPbkContactManager& aContactManager,
       
    68                 CPbk2SortOrderManager& aSortOrderManager,
       
    69                 CPbk2StoreConfiguration& aStoreConfiguration,
       
    70                 CPbk2StorePropertyArray& aStoreProperties,
       
    71                 TBool aActOnConfigurationEvents );
       
    72 
       
    73         /**
       
    74          * Destructor.
       
    75          */
       
    76         ~CPbk2ContactViewSupplier();
       
    77 
       
    78     public: // From MPbk2ContactViewSupplier
       
    79         MVPbkContactViewBase* AllContactsViewL();
       
    80         MVPbkContactViewBase* AllGroupsViewL();
       
    81         TAny* MPbk2ContactViewSupplierExtension( TUid aExtensionUid );
       
    82         
       
    83     public: // From MPbk2ContactViewSupplier2
       
    84         MVPbkContactViewBase* TopContactsViewL();
       
    85 
       
    86     private: // From MVPbkContactViewObserver
       
    87         void ContactViewReady(
       
    88                 MVPbkContactViewBase& aView );
       
    89         void ContactViewUnavailable(
       
    90                 MVPbkContactViewBase& aView );
       
    91         void ContactAddedToView(
       
    92                 MVPbkContactViewBase& aView,
       
    93                 TInt aIndex,
       
    94                 const MVPbkContactLink& aContactLink );
       
    95         void ContactRemovedFromView(
       
    96                 MVPbkContactViewBase& aView,
       
    97                 TInt aIndex,
       
    98                 const MVPbkContactLink& aContactLink );
       
    99         void ContactViewError(
       
   100                 MVPbkContactViewBase& aView,
       
   101                 TInt aError,
       
   102                 TBool aErrorNotified );
       
   103 
       
   104     private: // From MPbk2StoreConfigurationObserver
       
   105         void ConfigurationChanged();
       
   106         void ConfigurationChangedComplete();
       
   107 
       
   108     private: // Implementation
       
   109         CPbk2ContactViewSupplier(
       
   110                 CVPbkContactManager& aContactManager,
       
   111                 CPbk2SortOrderManager& aSortOrderManager,
       
   112                 CPbk2StoreConfiguration& aStoreConfiguration,
       
   113                 CPbk2StorePropertyArray& aStoreProperties );
       
   114         void ConstructL(
       
   115                 TBool aActOnConfigurationEvents );
       
   116         void HandleConfigurationChangedL();
       
   117         MVPbkContactViewBase* CreateAllContactsViewL();
       
   118         MVPbkContactViewBase* CreateAllGroupsViewL();
       
   119 
       
   120     private: // Data
       
   121         /// Ref: Virtual Phonebook contact manager
       
   122         CVPbkContactManager& iContactManager;
       
   123         /// Ref: Sort order manager
       
   124         CPbk2SortOrderManager& iSortOrderManager;
       
   125         /// Ref: Store configuration
       
   126         CPbk2StoreConfiguration& iStoreConfiguration;
       
   127         /// Ref: Store properties
       
   128         CPbk2StorePropertyArray& iStoreProperties;
       
   129         /// Own: The shared all contacts view object
       
   130         MVPbkContactViewBase* iAllContactsView;
       
   131         /// Own: The shared all groups view object
       
   132         MVPbkContactViewBase* iAllGroupsView;
       
   133         /// Own: Old contacts view
       
   134         MVPbkContactViewBase* iOldContactsView;
       
   135         /// Own: Old groups view
       
   136         MVPbkContactViewBase* iOldGroupsView;
       
   137         /// Own: Group sort order acquirer which owns the group sort order
       
   138         CVPbkSortOrderAcquirer* iSortOrderAcquirer;
       
   139 
       
   140         CPbk2NonTopContactSelector* iNonTopContactSelector;
       
   141     };
       
   142 
       
   143 #endif // CPBK2CONTACTVIEWSUPPLIER_H
       
   144 
       
   145 // End of File