PECengine/JanitorPlugin2/Src/CPEngListObserver.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Contact Database observer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CPENGLISTOBSERVER_H__
       
    21 #define __CPENGLISTOBSERVER_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <MPEngContactListObserver2.h>
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 
       
    30 class MPEngContactMapper;
       
    31 class CPEngNWSessionSlotID2;
       
    32 class CContactIdArray;
       
    33 class CPEngContactListStore2;
       
    34 class CPEngContactListNotifier2;
       
    35 class MPEngContactList2;
       
    36 class MPEngContactItem;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /**
       
    40  *  Contact List observer
       
    41  *  Observes contact list changes changes in given session slot
       
    42  *
       
    43  *  @lib PEngJanitor2
       
    44  *  @since 3.0
       
    45  */
       
    46 NONSHARABLE_CLASS( CPEngListObserver )
       
    47         : public CBase,
       
    48         public MPEngContactListObserver2
       
    49     {
       
    50 public:  // Constructors and destructor
       
    51 
       
    52     /**
       
    53     * Two-phased constructor.
       
    54     */
       
    55     static CPEngListObserver* NewLC(
       
    56         MPEngContactMapper& aMapper,
       
    57         const CPEngNWSessionSlotID2& aSessionId );
       
    58 
       
    59     /**
       
    60     * Destructor.
       
    61     */
       
    62     virtual ~CPEngListObserver();
       
    63 
       
    64 public: // Function from MPEngContactListObserver2
       
    65     /**
       
    66      * Contact list change handler.
       
    67      *
       
    68      * @see <MPEngContactListObserver2.h>
       
    69      * @since 3.0
       
    70      */
       
    71     void HandleContactListChangeL(
       
    72         CPEngContactListNotifier2& aNotifier,
       
    73         const TDesC& aContactListName );
       
    74 
       
    75 
       
    76     /**
       
    77      * Notification failure handler.
       
    78      *
       
    79      * @see <MPEngContactListObserver2.h>
       
    80      * @since 3.0
       
    81      */
       
    82     void HandleContactListError(
       
    83         TInt aError,
       
    84         CPEngContactListNotifier2& aNotifier );
       
    85 
       
    86 public: // new public function
       
    87 
       
    88     /*
       
    89      * Update mapping for given WV Id
       
    90      *
       
    91      * @since 3.0
       
    92      * @param aWVId
       
    93      * @param aContactIds
       
    94      */
       
    95     void UpdateMappingL( const TDesC& aWVId,
       
    96                          const CContactIdArray* aContactIds );
       
    97 
       
    98 
       
    99     /**
       
   100      *  Do full re-mapping of all contact list
       
   101      *  Called when contact db done unspecified change
       
   102      *
       
   103      *  @since 3.0
       
   104      */
       
   105     void ReMappAllContactsL();
       
   106 
       
   107 
       
   108     /**
       
   109      *  Session slot Id
       
   110      *
       
   111      *  @since 3.0
       
   112      *  @return session slot id
       
   113      */
       
   114     const CPEngNWSessionSlotID2& SessionId() const;
       
   115 
       
   116 private:
       
   117     /**
       
   118      *  Build list of supported contact lists
       
   119      *
       
   120      *  @since 3.0
       
   121      */
       
   122     void RefreshSupportedListsL();
       
   123 
       
   124     /**
       
   125      *  Find Contact list
       
   126      *
       
   127      *  @since 3.0
       
   128      *  @param aContactList contact list name
       
   129      *  @return contact list model
       
   130      */
       
   131     MPEngContactList2& ContactListL( const TDesC& aContactList );
       
   132 
       
   133     /**
       
   134      *  Remap whole contact list
       
   135      *
       
   136      *  @since 3.0
       
   137      *  @param aContactList contact list name
       
   138      *  @param aForceUpdate force update flag
       
   139      */
       
   140     void RemapContactListL( MPEngContactList2& aContactList,
       
   141                             TBool aForceUpdate = EFalse );
       
   142 
       
   143 
       
   144     /**
       
   145      *  Remap one Contact Item with given contact db ids
       
   146      *
       
   147      *  @since 3.0
       
   148      *  @param aContactItem contact item to store mapping
       
   149      *  @param aContactIds contact db ids array
       
   150      */
       
   151     void RemapContactItemL( MPEngContactItem& aContactItem,
       
   152                             const CContactIdArray* aContactIds );
       
   153 
       
   154 
       
   155 private:
       
   156 
       
   157     /**
       
   158     * C++ default constructor.
       
   159     */
       
   160     CPEngListObserver( MPEngContactMapper& aMapper );
       
   161 
       
   162     /**
       
   163     * By default Symbian 2nd phase constructor is private.
       
   164     */
       
   165     void ConstructL( const CPEngNWSessionSlotID2& aSessionId );
       
   166 
       
   167 
       
   168 private:    // Data
       
   169 
       
   170     /// REF: Janitor observer, not owned
       
   171     MPEngContactMapper& 				iContactMapper;
       
   172 
       
   173     /// OWN: Session slot id
       
   174     CPEngNWSessionSlotID2*				iSessionId;
       
   175 
       
   176     /// OWN: Contact list store
       
   177     CPEngContactListStore2*				iListStore;
       
   178 
       
   179     /// OWN: contact list notifier
       
   180     CPEngContactListNotifier2*			iListNotifier;
       
   181 
       
   182     /// REF: list of supported contact lists
       
   183     RPointerArray<MPEngContactList2>	iContactLists;
       
   184 
       
   185 
       
   186     };
       
   187 
       
   188 #endif      // __CPENGLISTOBSERVER_H__
       
   189 
       
   190 // End of File