emailuis/emailui/inc/FreestyleEmailUiUtilities.h
branchRCL_3
changeset 80 726fba06891a
parent 73 c8382f7b54ef
equal deleted inserted replaced
73:c8382f7b54ef 80:726fba06891a
    17 
    17 
    18 
    18 
    19 #ifndef __FREESTYLEMAILUI_UTILITIES_H_
    19 #ifndef __FREESTYLEMAILUI_UTILITIES_H_
    20 #define __FREESTYLEMAILUI_UTILITIES_H_
    20 #define __FREESTYLEMAILUI_UTILITIES_H_
    21 
    21 
    22 #include <e32base.h>	// CTimer
    22 #include <e32base.h>    // CTimer
    23 #include <e32cmn.h>
    23 #include <e32cmn.h>
    24 #include <hlplch.h>
    24 #include <hlplch.h>
    25 #include <msvstd.h>
    25 #include <msvstd.h>
    26 
    26 
    27 #include <AknQueryDialog.h>
    27 #include <AknQueryDialog.h>
    68 
    68 
    69 typedef RArray<TActionMenuCustomItemId> RFsEActionMenuIdList;
    69 typedef RArray<TActionMenuCustomItemId> RFsEActionMenuIdList;
    70 
    70 
    71 
    71 
    72 enum TFollowUpNewState
    72 enum TFollowUpNewState
    73 	{
    73     {
    74 	EFollowUp = 0, // don't change, as these are the in the order they are in popup selection list
    74     EFollowUp = 0, // don't change, as these are the in the order they are in popup selection list
    75 	EFollowUpComplete = 1, // don't change
    75     EFollowUpComplete = 1, // don't change
    76 	EFollowUpClear = 2, // don't change
    76     EFollowUpClear = 2, // don't change
    77 	EFollowUpNoChanges = 3
    77     EFollowUpNoChanges = 3
    78 	};
    78     };
    79 
    79 
    80 enum TMessageSizeClass
    80 enum TMessageSizeClass
    81     {
    81     {
    82     ETiny = KKilo,
    82     ETiny = KKilo,
    83     ESmall = 10*KKilo,
    83     ESmall = 10*KKilo,
    98     static CFSMailBox* GetMceDefaultMailboxL( CFSMailClient& aClient, CMsvSession& aMsvSession );
    98     static CFSMailBox* GetMceDefaultMailboxL( CFSMailClient& aClient, CMsvSession& aMsvSession );
    99 
    99 
   100     static CFSMailBox* GetMailboxForMtmIdL( CFSMailClient& aClient, CMsvSession& aMsvSession, TMsvId aMtmId );
   100     static CFSMailBox* GetMailboxForMtmIdL( CFSMailClient& aClient, CMsvSession& aMsvSession, TMsvId aMtmId );
   101 
   101 
   102     static TBool IsRemoteLookupSupported( CFSMailBox& aMailBox );
   102     static TBool IsRemoteLookupSupported( CFSMailBox& aMailBox );
   103 		
   103         
   104     static void CopyToClipboardL( const TDesC& aBuf );
   104     static void CopyToClipboardL( const TDesC& aBuf );
   105 
   105 
   106     static TInt ShowConfirmationQueryL( TInt aResourceStringId, const TDesC& aResourceParameter = KNullDesC );
   106     static TInt ShowConfirmationQueryL( TInt aResourceStringId, const TDesC& aResourceParameter = KNullDesC );
   107     static TInt ShowConfirmationQueryL( const TDesC& aPromptText );
   107     static TInt ShowConfirmationQueryL( const TDesC& aPromptText );
   108 
   108 
   109     static void ShowErrorNoteL( TInt aResourceStringId, TBool aWaitingDialog = EFalse );
   109     static void ShowErrorNoteL( TInt aResourceStringId, TBool aWaitingDialog = EFalse );
   110     static void ShowInfoNoteL( TInt aResourceStringId, TBool aWaitingDialog = EFalse );
   110     static void ShowInfoNoteL( TInt aResourceStringId, TBool aWaitingDialog = EFalse );
   111 	
   111     
   112     static void ShowGlobalErrorNoteL( TInt aResourceStringId );
   112     static void ShowGlobalErrorNoteL( TInt aResourceStringId );
   113     static void ShowGlobalInfoNoteL( TInt aResourceStringId );
   113     static void ShowGlobalInfoNoteL( TInt aResourceStringId );
   114     static void ShowDiscreetInfoNoteL( TInt aResourceStringId );
   114     static void ShowDiscreetInfoNoteL( TInt aResourceStringId );
   115     static void ShowDiscreetInfoNoteL( const TDesC& aNoteText );    
   115     static void ShowDiscreetInfoNoteL( const TDesC& aNoteText );    
   116      
   116      
   147     * Displays overwrite query if needed
   147     * Displays overwrite query if needed
   148     * 
   148     * 
   149     * @param aFilePath Path to where the file is to be saved
   149     * @param aFilePath Path to where the file is to be saved
   150     * @param aAttachmentPart Message part of the attachment to be saved
   150     * @param aAttachmentPart Message part of the attachment to be saved
   151     * @return ETrue if OK to save the file to a given path, EFalse if not
   151     * @return ETrue if OK to save the file to a given path, EFalse if not
   152     */	
   152     */  
   153 	static TBool OkToSaveFileL( const TDesC& aFilePath, CFSMailMessagePart& aAttachmentPart );
   153     static TBool OkToSaveFileL( const TDesC& aFilePath, CFSMailMessagePart& aAttachmentPart );
   154 
   154 
   155 	static void ShowFilesSavedToFolderNoteL( TInt aCount );
   155     static void ShowFilesSavedToFolderNoteL( TInt aCount );
   156 	
   156     
   157     static void ShowCreateMessageQueryL( const TDesC& aAddressData, TBool aSendingToEmail = EFalse );
   157     static void ShowCreateMessageQueryL( const TDesC& aAddressData, TBool aSendingToEmail = EFalse );
   158     
   158     
   159     static TInt CountRecepients( CFSMailMessage* aMsgPtr );
   159     static TInt CountRecepients( CFSMailMessage* aMsgPtr );
   160 
   160 
   161     static TInt CountRecipientsSmart( CFreestyleEmailUiAppUi& aAppUi, CFSMailMessage* aMsgPtr );
   161     static TInt CountRecipientsSmart( CFreestyleEmailUiAppUi& aAppUi, CFSMailMessage* aMsgPtr );
   203      * SetMessageFollowupFlagL
   203      * SetMessageFollowupFlagL
   204      * 
   204      * 
   205      * @param aShowFlagCompleted Whether to show the completed flag.
   205      * @param aShowFlagCompleted Whether to show the completed flag.
   206      *                           When false we are in the editor view.
   206      *                           When false we are in the editor view.
   207      */
   207      */
   208   	static TFollowUpNewState SetMessageFollowupFlagL( CFSMailMessage& aMsg, TBool aShowFlagCompleted = ETrue ); 
   208     static TFollowUpNewState SetMessageFollowupFlagL( CFSMailMessage& aMsg, TBool aShowFlagCompleted = ETrue ); 
   209     static void SetMessageFollowupStateL( CFSMailMessage& aMsg, TFollowUpNewState aNewFollowUpState ); 
   209     static void SetMessageFollowupStateL( CFSMailMessage& aMsg, TFollowUpNewState aNewFollowUpState ); 
   210     static TBool RunFollowUpListDialogL( TFollowUpNewState& aSelectedOption, TBool aShowFlagCompleted = ETrue );
   210     static TBool RunFollowUpListDialogL( TFollowUpNewState& aSelectedOption, TBool aShowFlagCompleted = ETrue );
   211 	
   211     
   212 	static TFileType GetFileType( const TDesC& aFileName, const TDesC& aMimeType );
   212     static TFileType GetFileType( const TDesC& aFileName, const TDesC& aMimeType );
   213 	
   213     
   214 	static CAlfTexture& GetAttachmentIcon( TFileType aAttachmentType, CFreestyleEmailUiTextureManager& aTextureManager );
   214     static CAlfTexture& GetAttachmentIcon( TFileType aAttachmentType, CFreestyleEmailUiTextureManager& aTextureManager );
   215 	static TFSEmailUiTextures GetAttachmentIconTextureId( TFileType aAttachmentType );
   215     static TFSEmailUiTextures GetAttachmentIconTextureId( TFileType aAttachmentType );
   216 	
   216     
   217     static CAlfTexture& GetMsgIcon( CFSMailMessage* aMsgPtr, CFreestyleEmailUiTextureManager& aTextureManager );
   217     static CAlfTexture& GetMsgIcon( CFSMailMessage* aMsgPtr, CFreestyleEmailUiTextureManager& aTextureManager );
   218     static TFSEmailUiTextures GetMsgIconTextureId( CFSMailMessage* aMsgPtr );
   218     static TFSEmailUiTextures GetMsgIconTextureId( CFSMailMessage* aMsgPtr );
   219 		
   219         
   220     static void MoveMessageToDraftsL( CFSMailBox& aMailBox, CFSMailMessage& aMsg );
   220     static void MoveMessageToDraftsL( CFSMailBox& aMailBox, CFSMailMessage& aMsg );
   221 		
   221         
   222     static TBool IsMessagePartFullyFetched( const CFSMailMessagePart& aPart );
   222     static TBool IsMessagePartFullyFetched( const CFSMailMessagePart& aPart );
   223 
   223 
   224     static TBool IsMessageStructureKnown( const CFSMailMessagePart& aPart );
   224     static TBool IsMessageStructureKnown( const CFSMailMessagePart& aPart );
   225 		
   225         
   226     static void CreatePlainTextPartL( CFSMailMessage& aMsg, CFSMailMessagePart*& aPart );
   226     static void CreatePlainTextPartL( CFSMailMessage& aMsg, CFSMailMessagePart*& aPart );
   227 		
   227         
   228     static TBool IsCompleteOrCancelEvent( TFSProgress aEvent );
   228     static TBool IsCompleteOrCancelEvent( TFSProgress aEvent );
   229 		
   229         
   230     static TBool HasUnfetchedAttachmentsL( CFSMailMessage& aMsg );
   230     static TBool HasUnfetchedAttachmentsL( CFSMailMessage& aMsg );
   231 		
   231         
   232     static TBool IsFollowUpSupported( const CFSMailBox& aMailBox );
   232     static TBool IsFollowUpSupported( const CFSMailBox& aMailBox );
   233 		
   233         
   234     // Set new email message icon on/off
   234     // Set new email message icon on/off
   235     static void ToggleEmailIconL( TBool aIconOn );
   235     static void ToggleEmailIconL( TBool aIconOn );
   236 	static void ToggleEmailIconL( TBool aIconOn, const TFSMailMsgId& aMailBox );
   236     static void ToggleEmailIconL( TBool aIconOn, const TFSMailMsgId& aMailBox );
   237     
   237     
   238     static HBufC* DateTextFromMsgLC( const CFSMailMessage* aMessage,  TBool aAddYearNumer = ETrue );
   238     static HBufC* DateTextFromMsgLC( const CFSMailMessage* aMessage,  TBool aAddYearNumer = ETrue );
   239     static HBufC* TimeTextFromMsgLC( const CFSMailMessage* aMessage );
   239     static HBufC* TimeTextFromMsgLC( const CFSMailMessage* aMessage );
   240     static HBufC* WeekDayTextFromMsgLC( const CFSMailMessage* aMessage, TBool aUseToday, TBool aUseYesterday,
   240     static HBufC* WeekDayTextFromMsgLC( const CFSMailMessage* aMessage, TBool aUseToday, TBool aUseYesterday,
   241                                         TBool& aWasToday, TBool& aWasYesterday );
   241                                         TBool& aWasToday, TBool& aWasYesterday );
   247     static TInt CompareMailSubjectsL( const CFSMailMessage* aMessage1, const CFSMailMessage* aMessage2 );
   247     static TInt CompareMailSubjectsL( const CFSMailMessage* aMessage1, const CFSMailMessage* aMessage2 );
   248     static HBufC* CreateSubjectWithoutLocalisedPrefixLC( const CFSMailMessage* aMessage, TBool aSuppressNotAvailableText = EFalse );
   248     static HBufC* CreateSubjectWithoutLocalisedPrefixLC( const CFSMailMessage* aMessage, TBool aSuppressNotAvailableText = EFalse );
   249     static HBufC* CreateSubjectTextLC( const CFSMailMessage* aMessage );
   249     static HBufC* CreateSubjectTextLC( const CFSMailMessage* aMessage );
   250     static HBufC* CreateBodyTextLC( const CFSMailMessage* aMessage );
   250     static HBufC* CreateBodyTextLC( const CFSMailMessage* aMessage );
   251     static void FilterListItemTextL( TDes& aText );
   251     static void FilterListItemTextL( TDes& aText );
       
   252     static void FilterListItemText2L( TDes& aText );
   252     static TMessageSizeClass MessageSizeClass( const CFSMailMessage& aMessage );
   253     static TMessageSizeClass MessageSizeClass( const CFSMailMessage& aMessage );
   253         
   254         
   254     static HBufC* ConvertHtmlToTxtL( const TDesC& aHtml );
   255     static HBufC* ConvertHtmlToTxtL( const TDesC& aHtml );
   255 		
   256         
   256     static void DisplayMsgsMovedNoteL( TInt aMsgCount, 
   257     static void DisplayMsgsMovedNoteL( TInt aMsgCount, 
   257                                        const TFSMailMsgId aDestinationFolderId,
   258                                        const TFSMailMsgId aDestinationFolderId,
   258                                        TBool aIsWaitingNote );
   259                                        TBool aIsWaitingNote );
   259 
   260 
   260     static TBool IsOfflineModeL();
   261     static TBool IsOfflineModeL();
   261 			
   262             
   262     /**
   263     /**
   263     * Shows mailbox creation query:
   264     * Shows mailbox creation query:
   264     * "No e-mail mailboxes defined. Create a mailbox?"
   265     * "No e-mail mailboxes defined. Create a mailbox?"
   265     *
   266     *
   266     * @return ETrue if user answered "Yes", EFalse if user answered "No"
   267     * @return ETrue if user answered "Yes", EFalse if user answered "No"
   267     */
   268     */
   268     static TBool DisplayCreateMailboxQueryL();
   269     static TBool DisplayCreateMailboxQueryL();
   269     
   270     
   270 //	static CAlfTexture& GetAttachmentIconL( TFileType aAttachmentType, CFreestyleEmailUiTextureManager& aTextureManager );
   271 //  static CAlfTexture& GetAttachmentIconL( TFileType aAttachmentType, CFreestyleEmailUiTextureManager& aTextureManager );
   271 //	static TFSEmailUiTextures GetAttachmentIconTextureIdL( TFileType aAttachmentType );
   272 //  static TFSEmailUiTextures GetAttachmentIconTextureIdL( TFileType aAttachmentType );
   272 
   273 
   273     // Brings Freestyle Email UI application to foreground if it's not already
   274     // Brings Freestyle Email UI application to foreground if it's not already
   274     static void BringFsEmailToForeground();
   275     static void BringFsEmailToForeground();
   275   
   276   
   276     // Formats display name
   277     // Formats display name
   277 	static void StripDisplayName( HBufC& aDisplayName );
   278     static void StripDisplayName( HBufC& aDisplayName );
   278 
   279 
   279     // Creates a displayname of firstname and lastname components
   280     // Creates a displayname of firstname and lastname components
   280     static HBufC* CreateDisplayNameLC( const TDesC& aFirstname, const TDesC& aLastname, TBool aSwitchOrder = EFalse );
   281     static HBufC* CreateDisplayNameLC( const TDesC& aFirstname, const TDesC& aLastname, TBool aSwitchOrder = EFalse );
   281 
   282 
   282     // Creates a displayname of firstname, lastname, emailfield components
   283     // Creates a displayname of firstname, lastname, emailfield components
   284     
   285     
   285     /**
   286     /**
   286      * Determines if the descriptor is a Chinese word
   287      * Determines if the descriptor is a Chinese word
   287      */
   288      */
   288     static TBool IsChineseWord( const TDesC& aWord );
   289     static TBool IsChineseWord( const TDesC& aWord );
   289     
       
   290     /**
       
   291      * Determines if the descriptor is a Korean word
       
   292      */
       
   293     static TBool IsKoreanWord( const TDesC& aWord );
       
   294     
   290     
   295     // Get the icon file name including the drive letter and full path
   291     // Get the icon file name including the drive letter and full path
   296     static void GetFullIconFileNameL( TDes& aFileName );
   292     static void GetFullIconFileNameL( TDes& aFileName );
   297     
   293     
   298     // Check if given file names have the same file extension (omitting the character case)
   294     // Check if given file names have the same file extension (omitting the character case)
   367 *  After that the static functions can be used to operate with action menu.
   363 *  After that the static functions can be used to operate with action menu.
   368 *
   364 *
   369 */
   365 */
   370 class CFSEmailUiActionMenu : public CBase
   366 class CFSEmailUiActionMenu : public CBase
   371     {
   367     {
   372 	friend class CFreestyleEmailUiAppUi;
   368     friend class CFreestyleEmailUiAppUi;
   373 public:
   369 public:
   374     /**
   370     /**
   375     * Get pointer to the action menu, can be used if built-in methods are
   371     * Get pointer to the action menu, can be used if built-in methods are
   376     * not enough. Ownership is not transferred.
   372     * not enough. Ownership is not transferred.
   377     *
   373     *
   378     * @return Action menu pointer
   374     * @return Action menu pointer
   379     */
   375     */
   380     static CFscContactActionMenu* GetActionMenu();
   376     static CFscContactActionMenu* GetActionMenu();
   381 		
   377         
   382     /**
   378     /**
   383     * Remove all items from action menu
   379     * Remove all items from action menu
   384     */
   380     */
   385     static void RemoveAllL();
   381     static void RemoveAllL();
   386 		
   382         
   387     /**
   383     /**
   388     * Add one email specific custom item by id
   384     * Add one email specific custom item by id
   389     *
   385     *
   390     * @param aItemId Item id of the item to be added
   386     * @param aItemId Item id of the item to be added
   391     */
   387     */
   392     static void AddCustomItemL( TActionMenuCustomItemId aItemId );
   388     static void AddCustomItemL( TActionMenuCustomItemId aItemId );
   393 		
   389         
   394     /**
   390     /**
   395     * Add several email specific custom items by list of ids
   391     * Add several email specific custom items by list of ids
   396     *
   392     *
   397     * @param aItemList List of item ids to be added
   393     * @param aItemList List of item ids to be added
   398     */
   394     */
   399     static void AddCustomItemsL( RFsEActionMenuIdList aItemList );
   395     static void AddCustomItemsL( RFsEActionMenuIdList aItemList );
   400 
   396 
   401 	// <cmail>
   397     // <cmail>
   402     /**
   398     /**
   403     * Execute previously constructed action menu
   399     * Execute previously constructed action menu
   404     *
   400     *
   405     * @param aPosition Vertical position where menu is to be openned
   401     * @param aPosition Vertical position where menu is to be openned
   406     * @param aIndex Index of focused/highlighted item when menu is opened
   402     * @param aIndex Index of focused/highlighted item when menu is opened
   419     */
   415     */
   420     // 
   416     // 
   421     static TActionMenuCustomItemId ExecuteL( RFsEActionMenuIdList aItemList,
   417     static TActionMenuCustomItemId ExecuteL( RFsEActionMenuIdList aItemList,
   422                                              TFscContactActionMenuPosition aPosition = EFscCenter,
   418                                              TFscContactActionMenuPosition aPosition = EFscCenter,
   423                                              TInt aIndex = 0, MFsActionMenuPositionGiver* aPositionGiver = 0 );
   419                                              TInt aIndex = 0, MFsActionMenuPositionGiver* aPositionGiver = 0 );
   424 	
   420     
   425     /**
   421     /**
   426     * Dismiss menu
   422     * Dismiss menu
   427     *   Menu gets closed if it was visible when the method was called. 
   423     *   Menu gets closed if it was visible when the method was called. 
   428     *   Otherwise method call does not do anything
   424     *   Otherwise method call does not do anything
   429     *
   425     *
   430     * @param aSlide If ETrue menu slides away from the screen. 
   426     * @param aSlide If ETrue menu slides away from the screen. 
   431     *   Otherwise it disappears instantly
   427     *   Otherwise it disappears instantly
   432     */
   428     */
   433 	static void Dismiss( TBool aSlide );
   429     static void Dismiss( TBool aSlide );
   434     // </cmail> 
   430     // </cmail> 
   435 		
   431         
   436     /**
   432     /**
   437     * Create icon by bitmap and mask
   433     * Create icon by bitmap and mask
   438     *
   434     *
   439     * @param aBitmapId Icon bitmap
   435     * @param aBitmapId Icon bitmap
   440     * @param aMaskId Icon mask
   436     * @param aMaskId Icon mask
   457     CFscContactActionService* iService;   
   453     CFscContactActionService* iService;   
   458     static CFscContactActionMenu* iActionMenu;
   454     static CFscContactActionMenu* iActionMenu;
   459     static TFileName iIconFilePath;
   455     static TFileName iIconFilePath;
   460     static RPointerArray<CGulIcon> iIconArray;
   456     static RPointerArray<CGulIcon> iIconArray;
   461     CFreestyleEmailUiAppUi* iAppUi;
   457     CFreestyleEmailUiAppUi* iAppUi;
   462 	};
   458     };
   463 
   459 
   464 /**
   460 /**
   465 *  Generic timer's callback
   461 *  Generic timer's callback
   466 *
   462 *
   467 *  Classes inherited from this one can be used as a callback for the generic
   463 *  Classes inherited from this one can be used as a callback for the generic
   538     /**
   534     /**
   539     * Constructor.
   535     * Constructor.
   540     */
   536     */
   541     CFSEmailUiGenericTimer( MFSEmailUiGenericTimerCallback* aCallback,
   537     CFSEmailUiGenericTimer( MFSEmailUiGenericTimerCallback* aCallback,
   542                             const TInt aPriority );
   538                             const TInt aPriority );
   543 		
   539         
   544 private:
   540 private:
   545     /**
   541     /**
   546     * 2nd phase constructor.
   542     * 2nd phase constructor.
   547     */
   543     */
   548     void ConstructL();
   544     void ConstructL();