emailservices/emailstore/message_store/client/inc/MsgStoreObserverHandler.h
changeset 0 8466d47a6819
child 8 e1b6206813b4
child 48 10eaf342f539
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 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:  Message store observer handler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MSGSTOREOBSERVERHANDLER_H_
       
    20 #define MSGSTOREOBSERVERHANDLER_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 //<cmail>
       
    24 #include "MsgStoreTypes.h"
       
    25 #include "MsgStoreObserver.h"
       
    26 #include "MsgStoreMailBoxObserver.h"
       
    27 //</cmail>
       
    28 #include "RMessageStoreSession.h"
       
    29 #include "MessageStoreClientServer.h"
       
    30 
       
    31 const TUint KEventBufferLength  = 30;
       
    32 
       
    33 // ===============================
       
    34 // CLASS: CMsgStoreObserverHandler
       
    35 // ===============================
       
    36 class CMsgStoreObserverHandler : private CActive
       
    37 	{
       
    38 	public:
       
    39 	
       
    40 	    // ==============
       
    41 	    // PUBLIC METHODS
       
    42 	    // ==============
       
    43 	    
       
    44 		static CMsgStoreObserverHandler* NewL( RMessageStoreSession& aSession );
       
    45 	
       
    46 		virtual ~CMsgStoreObserverHandler();
       
    47 	
       
    48 		void AddObserverL( MMsgStoreObserver* aObserver );
       
    49 		
       
    50 		void RemoveObserverL( MMsgStoreObserver* aObserver );
       
    51 		
       
    52 		void AddObserverL( MMsgStoreMailBoxObserver* aOBserver, TMsgStoreId aMailBoxId );
       
    53 		
       
    54 		void RemoveObserverL( MMsgStoreMailBoxObserver* aObserver, TMsgStoreId aMailBoxId );
       
    55 	
       
    56 	private:
       
    57 	
       
    58 		struct TMailBoxObserverInfo
       
    59 			{
       
    60 			TMsgStoreId               iMailBoxId;
       
    61 			MMsgStoreMailBoxObserver* iObserver;
       
    62 			};
       
    63 	
       
    64 	    // ===============
       
    65 	    // PRIVATE METHODS
       
    66 	    // ===============	    
       
    67 	
       
    68 		CMsgStoreObserverHandler( RMessageStoreSession& aSession );
       
    69 
       
    70 		void ModificationNotify( const TMsgStoreEvent& aEvent );
       
    71 		void SystemEventNotify( const TMsgStoreEvent& aEvent );
       
    72 		void AccountEventNotify( const TMsgStoreEvent& aEvent );
       
    73 		
       
    74 		// inherited from CActive
       
    75 		void RunL();
       
    76 		void DoCancel();
       
    77 		TInt RunError( TInt aError );
       
    78 	
       
    79 	    // ==================
       
    80 	    // PRIVATE ATTRIBUTES
       
    81 	    // ==================
       
    82 	
       
    83 		RMessageStoreSession&                            iSession;
       
    84 		RArray<MMsgStoreObserver*>                       iObservers;
       
    85 		RArray<TMailBoxObserverInfo>                     iMailBoxObservers;
       
    86 		TBuf8<sizeof(TMsgStoreEvent)*KEventBufferLength> iEventBuffer;
       
    87 		
       
    88 		__LOG_DECLARATION
       
    89 	
       
    90 	}; // end class CMsgStoreObserverHandler
       
    91 
       
    92 #endif /*MSGSTOREOBSERVERHANDLER_H_*/