|         |      1 /* | 
|         |      2 * Copyright (c) 2002-2006 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:  Central repository handler for mail | 
|         |     15 * | 
|         |     16 */ | 
|         |     17  | 
|         |     18  | 
|         |     19  | 
|         |     20 #ifndef CMAILCRHANDLER_H | 
|         |     21 #define CMAILCRHANDLER_H | 
|         |     22  | 
|         |     23 //  INCLUDES | 
|         |     24 #include <e32base.h> | 
|         |     25 #include <cenrepnotifyhandler.h> | 
|         |     26 #include <s32std.h> | 
|         |     27 #include "MailVariant.hrh" | 
|         |     28  | 
|         |     29 // FORWARD DECLARATIONS | 
|         |     30 class CRepository; | 
|         |     31 class CMsgMailDocument; | 
|         |     32  | 
|         |     33 // CLASS DECLARATION | 
|         |     34  | 
|         |     35 /** | 
|         |     36 *  Central repository handler for mail | 
|         |     37 *  Sets and observes central repository keys for mail | 
|         |     38 * | 
|         |     39 *  @lib msgeditorutils.lib | 
|         |     40 *  @since Series 60 3.0 | 
|         |     41 */ | 
|         |     42 class CMailCRHandler :	public CBase, | 
|         |     43 						public MCenRepNotifyHandlerCallback | 
|         |     44     { | 
|         |     45     public:  // Constructors and destructor | 
|         |     46  | 
|         |     47     	enum ERepository | 
|         |     48 			{ | 
|         |     49 			EMailRepository = 0, | 
|         |     50 			ECommonUiRepository, | 
|         |     51 			EMuiuVariationKeys, | 
|         |     52 			ERepositoryOutOfBounds | 
|         |     53 			}; | 
|         |     54  | 
|         |     55  | 
|         |     56         /** | 
|         |     57         * Two-phased constructor. | 
|         |     58         * @param aModel key observer. | 
|         |     59         */ | 
|         |     60         IMPORT_C static CMailCRHandler* NewL(CMsgMailDocument *aModel); | 
|         |     61  | 
|         |     62         /** | 
|         |     63         * Destructor. | 
|         |     64         */ | 
|         |     65         IMPORT_C virtual ~CMailCRHandler(); | 
|         |     66  | 
|         |     67     public: // New functions | 
|         |     68  | 
|         |     69 		/** | 
|         |     70 		* Fetches the integer from CR with given keys | 
|         |     71 		* @param aUid Uid to be used | 
|         |     72 		* @param aKey Which value is to be fetched | 
|         |     73 		* @param aValue Variable to store fetched value | 
|         |     74 		* @return KErrNone, when no errors happened | 
|         |     75 		*/ | 
|         |     76 		IMPORT_C TInt GetCRInt( | 
|         |     77 			const TUid&     aUid, | 
|         |     78 			const TUint32   aKey, | 
|         |     79 			TInt&           aValue ) const; | 
|         |     80  | 
|         |     81         /** | 
|         |     82         * Sets the integer to CR with given keys | 
|         |     83         * @param aUid Uid to be used | 
|         |     84         * @param aKey Which value is to be fetched | 
|         |     85         * @param aValue Variable that contains value to be stored | 
|         |     86         * @return KErrNone, when no errors happened | 
|         |     87         */ | 
|         |     88         IMPORT_C TInt SetCRInt( | 
|         |     89             const TUid&     aUid, | 
|         |     90             const TUint32   aKey, | 
|         |     91             const TInt      aValue ) const; | 
|         |     92  | 
|         |     93 		/** | 
|         |     94 		* Fetches the real from CR with given keys | 
|         |     95 		* @param aUid Uid to be used | 
|         |     96 		* @param aKey Which value is to be fetched | 
|         |     97 		* @param aValue Variable to store fetched value | 
|         |     98 		* @return KErrNone, when no errors happened | 
|         |     99 		*/ | 
|         |    100     	IMPORT_C TInt GetCRReal( | 
|         |    101 	  		const TUid&     aUid, | 
|         |    102 	  		const TUint32   aKey, | 
|         |    103 	  		TReal&          aValue ) const; | 
|         |    104  | 
|         |    105 		/** | 
|         |    106         * Sets the real to CR with given keys | 
|         |    107         * @param aUid Uid to be used | 
|         |    108         * @param aKey Which value is to be fetched | 
|         |    109         * @param aValue Variable that contains value to be stored | 
|         |    110         * @return KErrNone, when no errors happened | 
|         |    111         */ | 
|         |    112 		IMPORT_C TInt SetCRReal( | 
|         |    113 	       	const TUid&     aUid, | 
|         |    114 	       	const TUint32   aKey, | 
|         |    115     	   	const TReal&    aValue ) const; | 
|         |    116  | 
|         |    117 		/** | 
|         |    118 		* Fetches the binary from CR with given keys | 
|         |    119 		* @param aUid Uid to be used | 
|         |    120 		* @param aKey Which value is to be fetched | 
|         |    121 		* @param aValue Variable to store fetched value | 
|         |    122 		* @return KErrNone, when no errors happened | 
|         |    123 		*/ | 
|         |    124        	IMPORT_C TInt GetCRBinary( | 
|         |    125 	    	const TUid&     aUid, | 
|         |    126 	    	const TUint32   aKey, | 
|         |    127     		TDes8&          aValue ) const; | 
|         |    128  | 
|         |    129 		/** | 
|         |    130         * Sets the integer to CR with given keys | 
|         |    131         * @param aUid Uid to be used | 
|         |    132         * @param aKey Which value is to be fetched | 
|         |    133         * @param aValue Variable that contains value to be stored | 
|         |    134         * @return KErrNone, when no errors happened | 
|         |    135         */ | 
|         |    136 		IMPORT_C TInt SetCRBinary( | 
|         |    137     		const TUid&     aUid, | 
|         |    138     		const TUint32   aKey, | 
|         |    139     		const TDesC8&   aValue ) const; | 
|         |    140  | 
|         |    141 		/** | 
|         |    142 		* Fetches the string from CR with given keys | 
|         |    143 		* @param aUid Uid to be used | 
|         |    144 		* @param aKey Which value is to be fetched | 
|         |    145 		* @param aValue Variable to store fetched value | 
|         |    146 		* @return KErrNone, when no errors happened | 
|         |    147 		*/ | 
|         |    148     	IMPORT_C TInt GetCRString( | 
|         |    149 		    const TUid&     aUid, | 
|         |    150 		    const TUint32   aKey, | 
|         |    151     		TDes16&         aValue ) const; | 
|         |    152  | 
|         |    153 		/** | 
|         |    154         * Sets the integer to CR with given keys | 
|         |    155         * @param aUid Uid to be used | 
|         |    156         * @param aKey Which value is to be fetched | 
|         |    157         * @param aValue Variable that contains value to be stored | 
|         |    158         * @return KErrNone, when no errors happened | 
|         |    159         */ | 
|         |    160     	IMPORT_C TInt SetCRString( | 
|         |    161 			const TUid&     aUid, | 
|         |    162 		    const TUint32   aKey, | 
|         |    163     		const TDesC16&  aValue ) const; | 
|         |    164  | 
|         |    165 		/** | 
|         |    166         * Sets the notifyhandler on specific key | 
|         |    167         * @param aObserver observer | 
|         |    168         * @param aRepository repository to be watched. See ERepository | 
|         |    169         * @param aKeyType keytype to be watched  | 
|         |    170         * @param aKeyValue which uid is watched | 
|         |    171         */ | 
|         |    172 		IMPORT_C void SetNotifyHandlerL( | 
|         |    173 			MCenRepNotifyHandlerCallback* aObserver, | 
|         |    174 			CMailCRHandler::ERepository aRepository,  | 
|         |    175 			CCenRepNotifyHandler::TCenRepKeyType aKeyType,  | 
|         |    176 			TUint32 aKeyValue ); | 
|         |    177  | 
|         |    178 		/** | 
|         |    179 		* Fetches all parameters from central repository and initializes model | 
|         |    180         */ | 
|         |    181 		IMPORT_C void UpdateModelFromCentralRepositoryL(); | 
|         |    182 				 | 
|         |    183 		/** | 
|         |    184 		* inline | 
|         |    185 		* MailAdditionalHeaders | 
|         |    186 		* @return ETrue if Additional Bcc header field is supported. | 
|         |    187 		*/ | 
|         |    188         inline TBool MailAdditionalHeaders() const;	 | 
|         |    189 		 | 
|         |    190 		/** | 
|         |    191 		* inline | 
|         |    192 		* MailAttachmentField | 
|         |    193 		* @return ETrue if Attachment field is supported. | 
|         |    194 		*/ | 
|         |    195         inline TBool MailAttachmentField() const; | 
|         |    196             		 | 
|         |    197 		/** | 
|         |    198 		* inline | 
|         |    199 		* MailEncodingSetting | 
|         |    200 		* @return ETrue if EncodingSetting is supported. | 
|         |    201 		*/ | 
|         |    202         inline TBool MailEncodingSetting() const; | 
|         |    203          | 
|         |    204 		/** | 
|         |    205 		* inline | 
|         |    206 		* MailCopyMoveSupport | 
|         |    207 		* @return ETrue if MailCopyMove is supported. | 
|         |    208 		*/ | 
|         |    209         inline TBool MailCopyMoveSupport() const;  | 
|         |    210          | 
|         |    211 		/** | 
|         |    212 		* inline | 
|         |    213 		* MailInsertToolBar | 
|         |    214 		* @return ETrue if Insert toolbar is supported. | 
|         |    215 		*/ | 
|         |    216         inline TBool MailInsertToolBar() const; | 
|         |    217                      | 
|         |    218     public: // Functions from base classes | 
|         |    219  | 
|         |    220         /** | 
|         |    221         * From MCentRepNotifyHandlerCallback. | 
|         |    222 	    */ | 
|         |    223         void HandleNotifyInt( | 
|         |    224 			TUint32 aId, TInt aNewValue ); | 
|         |    225  | 
|         |    226         /** | 
|         |    227 		* From MCentRepNotifyHandlerCallback. | 
|         |    228 	    */ | 
|         |    229         void HandleNotifyReal( | 
|         |    230 			TUint32 aId, TReal aNewValue); | 
|         |    231  | 
|         |    232         /** | 
|         |    233 		* From MCentRepNotifyHandlerCallback. | 
|         |    234 	    */ | 
|         |    235         void HandleNotifyString( | 
|         |    236 			TUint32 aId, const TDesC16& aNewValue); | 
|         |    237  | 
|         |    238         /** | 
|         |    239 		* From MCentRepNotifyHandlerCallback. | 
|         |    240 	    */ | 
|         |    241         void HandleNotifyBinary( | 
|         |    242 			TUint32 aId, const TDesC8& aNewValue); | 
|         |    243  | 
|         |    244         /** | 
|         |    245 		*   From MCentRepNotifyHandlerCallback. | 
|         |    246 		*/ | 
|         |    247 		void HandleNotifyError( | 
|         |    248 			TUint32 aId, TInt aError, CCenRepNotifyHandler* aHandler ); | 
|         |    249  | 
|         |    250 		/** | 
|         |    251         *   From MCentRepNotifyHandlerCallback. | 
|         |    252         */ | 
|         |    253         void HandleNotifyGeneric( TUint32 aId ); | 
|         |    254  | 
|         |    255 		/** | 
|         |    256         * Through this method the Property subscribers notify of  | 
|         |    257         * Property changes. | 
|         |    258         * @param aCategory The category of the property to be observed | 
|         |    259 		* @param aKey The subkey of the property to be observed | 
|         |    260 		*/ | 
|         |    261         void HandlePropertyChangedL( const TUid& aCategory, TInt aKey ); | 
|         |    262  | 
|         |    263  | 
|         |    264  | 
|         |    265     private: // private functions | 
|         |    266  | 
|         |    267     	/** | 
|         |    268 		* Gets the CR client according to Uid to be used | 
|         |    269 		* @param aUid Uid to be used | 
|         |    270 		* @param aClient Variable to client shall be stored | 
|         |    271 		* @return KErrNone, when succesful | 
|         |    272 		*/ | 
|         |    273 		TInt GetClientForUid( | 
|         |    274 			const TUid&		aUid, | 
|         |    275 			CRepository*&  	aClient ) const; | 
|         |    276  | 
|         |    277     private: //private constructors | 
|         |    278  | 
|         |    279         /** | 
|         |    280         * C++ default constructor. | 
|         |    281         */ | 
|         |    282         CMailCRHandler(CMsgMailDocument* aModel); | 
|         |    283  | 
|         |    284         /** | 
|         |    285         * By default Symbian 2nd phase constructor is private. | 
|         |    286         */ | 
|         |    287         void ConstructL(); | 
|         |    288  | 
|         |    289     private:    // Data | 
|         |    290  | 
|         |    291     // a pointer to the model (document) | 
|         |    292 	CMsgMailDocument* iModel; | 
|         |    293  | 
|         |    294 	// A CR session & notifier for mail | 
|         |    295     RPointerArray<CRepository> iSessions; | 
|         |    296     RPointerArray<CCenRepNotifyHandler> iSettingsNotifyHandlers; | 
|         |    297     // Mail UI local variation flags | 
|         |    298     TInt iMailUiLocalVariationFlags; | 
|         |    299     // Muiu variation flags | 
|         |    300     TInt iMuiuVariationFlags; | 
|         |    301     // MMS variation flags | 
|         |    302     TInt iMmsVariationFags;     | 
|         |    303     }; | 
|         |    304  | 
|         |    305 // Inline functions | 
|         |    306 #include "CMailCRHandler.inl" | 
|         |    307  | 
|         |    308 #endif      // CMAILCRHANDLER_H | 
|         |    309  | 
|         |    310 // End of File |