wvuing/wvuipresence/src/CCAPEngListObserver.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Observer class for active presence list handling
       
    15 *               (Contact-list updater/ Attribute-list publisher ).
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CCAPENGLISTOBSERVER_H
       
    21 #define CCAPENGLISTOBSERVER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <MPEngContactListObserver2.h>
       
    26 
       
    27 #include <badesca.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CPEngContactListNotifier;
       
    31 class MCAStoredContacts;
       
    32 class CPEngContactListStore2;
       
    33 class CPEngNWSessionSlotID2;
       
    34 class CPEngPresenceNotifier2;
       
    35 class MCAPresenceUpdater;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  *  Observer class for contact list events.
       
    41  *
       
    42  *  @lib CAPresence.dll
       
    43  *  @since 2.1
       
    44  */
       
    45 class CCAPEngListObserver :	public CBase,
       
    46             public MPEngContactListObserver2
       
    47     {
       
    48 
       
    49     public:  // Constructors and destructor
       
    50 
       
    51         /**
       
    52          * Two-phased constructor.
       
    53          */
       
    54         static CCAPEngListObserver* NewL( CPEngNWSessionSlotID2* aSessionSlotID,
       
    55                                           CPEngPresenceNotifier2& aAttributeNotifier,
       
    56                                           RArray<TUint32>& aHandledAttributes,
       
    57                                           MCAPresenceUpdater& aUpdater );
       
    58 
       
    59         /**
       
    60          * Destructor.
       
    61          */
       
    62         virtual ~CCAPEngListObserver();
       
    63 
       
    64     public: // New functions
       
    65 
       
    66         /**
       
    67          * Set the active contact list name
       
    68          * for the list observer. All other lists are ignored
       
    69          * except the list set as active.
       
    70          * @param aListId The contact list id
       
    71          * @since 2.1
       
    72          */
       
    73         void SetActiveListIdL( const TDesC& aListId );
       
    74 
       
    75         /**
       
    76          * Set the contact list names for the list observer.
       
    77          * @param aListIds The contact list ids
       
    78          * @since 3.0
       
    79          */
       
    80         void SetListIds( const MDesCArray& aListIds );
       
    81 
       
    82         /**
       
    83          * Skips storage removal next time HandleContactListChange gets called
       
    84          */
       
    85         void SkipStorageRemoval();
       
    86 
       
    87         /**
       
    88          * Clears old values from list notifier.
       
    89          */
       
    90         void ClearListNotifier();
       
    91 
       
    92         /**
       
    93          * Start notifying list.
       
    94          * @param aListId, List id for list to be notified.
       
    95          */
       
    96         void StartNotifier( const TDesC& aListId );
       
    97 
       
    98         /**
       
    99          * Add list to notifier. Will start notifier if not already started.
       
   100          * @param aListId, List id for list to be notified.
       
   101          */
       
   102         void AddL( const TDesC& aListId );
       
   103 
       
   104         /**
       
   105          * Remove list from notifier. If last list is removed, the
       
   106          * notifier is stopped.
       
   107          * @param aListId, List id for list to be notified.
       
   108          */
       
   109         void Remove( const TDesC& aListId );
       
   110 
       
   111 
       
   112     protected: // From MPEngContactListTransactionObserver2
       
   113 
       
   114         /**
       
   115          * @see MPEngContactListTransactionObserver2
       
   116          * @since 2.1
       
   117          */
       
   118         void HandleContactListChangeL( CPEngContactListNotifier2& aNotifier,
       
   119                                        const TDesC& aContactListName );
       
   120 
       
   121         /**
       
   122          * @see MPEngContactListTransactionObserver2
       
   123          * @since 2.1
       
   124          */
       
   125         void HandleContactListError( TInt aError,
       
   126                                      CPEngContactListNotifier2& aNotifier );
       
   127 
       
   128 
       
   129     private: // internal functions
       
   130 
       
   131         /**
       
   132          * C++ default constructor.
       
   133          */
       
   134         CCAPEngListObserver( CPEngPresenceNotifier2& aAttributeNotifier,
       
   135                              RArray<TUint32>& aHandledAttributes,
       
   136                              MCAPresenceUpdater& aUpdater );
       
   137 
       
   138         /**
       
   139          * By default Symbian 2nd phase constructor is private.
       
   140          */
       
   141         void ConstructL( CPEngNWSessionSlotID2* aSessionSlotID );
       
   142 
       
   143     private:    // Data
       
   144 
       
   145         // notifier for contact list events
       
   146         CPEngContactListNotifier2* iPEngContactListNotifier; // owns
       
   147 
       
   148         // memory cache of contacts
       
   149         MCAStoredContacts* iStoredContacts;
       
   150 
       
   151         // active contact list name
       
   152         HBufC* iActiveListId; /// owns
       
   153 
       
   154         // skip removal from storage in HandleContactListChange
       
   155         TBool iSkipRemoval;
       
   156 
       
   157         // owns. PEC contact list store
       
   158         CPEngContactListStore2* iContactListStore;
       
   159 
       
   160         // handle to attributenotifier
       
   161         CPEngPresenceNotifier2& iAttributeNotifier;
       
   162 
       
   163         // Array of attributes handled
       
   164         RArray<TUint32>& iAttributes;
       
   165 
       
   166         // Presence updater
       
   167         MCAPresenceUpdater& iPresenceUpdater;
       
   168     };
       
   169 
       
   170 #endif      // CCAPENGLISTOBSERVER_H 
       
   171 
       
   172 // End of File