emailservices/psmruadapter/inc/CPsMruAdapter.h
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Predictive Search MRU ADapter 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_PS_MRU_ADAPTER_H
       
    20 #define C_PS_MRU_ADAPTER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <CPsDataPlugin.h>
       
    24 //<cmail>
       
    25 #include "MFSMailEventObserver.h"
       
    26 //</cmail>
       
    27 
       
    28 // FORWARD DECLARATION
       
    29 class CPsData;
       
    30 class CFSMailClient;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * MRU Data Store
       
    36 * This class acts as a MRU Data store, which allows access to 
       
    37 * FS Email Framework MRU data 
       
    38 * 
       
    39 * @since S60 v3.2
       
    40 */
       
    41 class CPsMruAdapter : public CPsDataPlugin, public MFSMailEventObserver
       
    42 	{
       
    43 	public: 
       
    44 	
       
    45 	    /**
       
    46 	     * Two phase construction
       
    47 	     */
       
    48 	    static CPsMruAdapter* NewL(TAny* aPsDataPluginParameters);
       
    49 
       
    50 	    /**
       
    51 	     * Destructor
       
    52 	     */
       
    53 	    virtual ~CPsMruAdapter();
       
    54 
       
    55 	    /**
       
    56 	     * Returns the additional data for given item id
       
    57 	     * Returns NULL (in current implementation)
       
    58 	     */
       
    59 	    TAny* RequestForDataExtensionL( TInt ItemId );
       
    60 
       
    61 // from base class CPsDataPlugin
       
    62 
       
    63         /**
       
    64          * Requests for data from this store
       
    65          * The adapters need to pass an instance of the observer. The data 
       
    66          * to the algorithm is provided via the observer callback 
       
    67          */
       
    68         void  RequestForDataL( TDesC& aDataStoreURI );      
       
    69 
       
    70         /**
       
    71          * Gets the supported data stores URIs
       
    72          * 
       
    73          * @param aDataStores supported data stores URIs
       
    74          */  
       
    75         void GetSupportedDataStoresL( RPointerArray<TDesC>& aDataStoresURIs );
       
    76 
       
    77         /**
       
    78          * Checks if the given data store is supported.
       
    79          * 
       
    80          * @param aDataStoreURI data store
       
    81          * @return True if this store is supported        
       
    82          */  
       
    83         TBool IsDataStoresSupportedL( TDesC& aDataStoreURI ) ;
       
    84 
       
    85         /**
       
    86          * Gets the supported data fields for specific stores URIs
       
    87          * 
       
    88          * @param aDataFields supported data fields for aStoreURI         
       
    89          */ 
       
    90         void GetSupportedDataFieldsL( RArray<TInt>& aDataFields );
       
    91 
       
    92 // from base class MFSMailEventObserver
       
    93 
       
    94         /**
       
    95          * Handles mailbox events from plugins.
       
    96          */
       
    97         void EventL( TFSMailEvent aEvent, TFSMailMsgId aMailbox, 
       
    98             TAny* aParam1, TAny* aParam2, TAny* aParam3 );
       
    99 
       
   100 	private:
       
   101 
       
   102 	    /**
       
   103 	     * Constructor
       
   104 	     */
       
   105 		CPsMruAdapter();
       
   106 
       
   107 		/**
       
   108 		 * 2nd phase construtor
       
   109 		 */
       
   110 		void ConstructL(MDataStoreObserver* aObserverForDataStore,
       
   111 		    MStoreListObserver* aStoreListObserver);
       
   112 
       
   113 		/**
       
   114 		 * Updates given data store
       
   115 		 */  	    
       
   116 		TBool FillDataStoreL( TDesC& aDataStoreURI );
       
   117 
       
   118 		/**
       
   119 		 * Updates given data store
       
   120 		 */  	    	    
       
   121 		TBool FillDataStoreL( TFSMailMsgId& aId );
       
   122 
       
   123 		/**
       
   124 		 * Updates a list of supported data stores
       
   125 		 */  	    
       
   126 		void UpdateSupportedDataStoresList();	    
       
   127 
       
   128 		/**
       
   129 		 * Starts observing mailbox
       
   130 		 */
       
   131 		TBool AddMailboxObserverL( TFSMailMsgId& aId );
       
   132 		
       
   133 		/**
       
   134 		 * Stops observing mailbox
       
   135 		 */
       
   136 	    TBool RemoveMailboxObserver( TFSMailMsgId& aId );
       
   137 	    
       
   138 		/**
       
   139 		 * Stops all mailbox observers
       
   140 		 */
       
   141 	    void RemoveAllMailboxObservers();
       
   142 		
       
   143 		/**
       
   144 		 * Converts Uri to TFsMailMsgId
       
   145 		 */
       
   146 		TBool GetMailboxIdentifierFromUri( TDesC& aUri, TFSMailMsgId& aId );
       
   147 
       
   148 		/**
       
   149 		 * Converts TFsMailMsgId to Uri
       
   150 		 */
       
   151 	    TBool GetUriFromMailboxIdentifier( TFSMailMsgId& aId, HBufC& aUri );
       
   152 	    
       
   153 		/**
       
   154 	    * Updates given data store
       
   155 	    */  	    	    
       
   156 	    TBool FillDataStoreL( TFSMailMsgId& aId, TDesC& aDataStoreURI );	    
       
   157 
       
   158     private: // data
       
   159 
       
   160 		/**
       
   161 		 * Holds the observer object to communicate add/modify/delete of contacts
       
   162 		 * Not owned.
       
   163 		 */
       
   164 		MDataStoreObserver* iDataStoreObserver;
       
   165 		
       
   166 		/**
       
   167 	    * An observer instance used to send the datastore to the adapter
       
   168 	    */
       
   169 		MStoreListObserver* iStoreListObserver;		
       
   170 			
       
   171 		/**
       
   172         * Supported Uris(data stores)
       
   173         */
       
   174     	RPointerArray<HBufC> iSupportedUris;	
       
   175     	
       
   176     	/**
       
   177     	 * List of mailboxes currently being observed
       
   178     	 */
       
   179     	RArray<TFSMailMsgId> iObservedMailboxes;
       
   180     	
       
   181 		/**
       
   182         * Fs Email framework client
       
   183         */
       
   184 	    CFSMailClient* iMailClient;
       
   185 	};
       
   186 	
       
   187 
       
   188 #endif // C_PS_MRU_ADAPTER_H