emailuis/emailui/inc/FSComposerFetchLogic.h
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     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: This file defines class MComposerFetchLogicCallback.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __FSCOMPOSERFETCHLOGIC_H__
       
    20 #define __FSCOMPOSERFETCHLOGIC_H__
       
    21 
       
    22 
       
    23 #include<e32base.h>
       
    24 //#include <aknwaitnotewrapper.h> //cmail
       
    25 
       
    26 #include"FreestyleEmailDownloadInformationMediator.h"
       
    27 
       
    28 class CFSMailClient;
       
    29 class CFSMailBox;
       
    30 class CFSMailFolder;
       
    31 class CFSMailMessage;
       
    32 class CFreestyleEmailUiAppUi;
       
    33 
       
    34 enum TComposerFetchState
       
    35 	{
       
    36 	EStateNotStarted,	// not started
       
    37 	EStateSmartReply,	// smart reply test
       
    38 	EStateSmartForward, // smart forward test
       
    39 	EStateStructure,	// fetch message structure
       
    40 	EStateBody,			// fetch message body
       
    41 	EStateAttachments   // fetch attachments
       
    42 	};
       
    43 
       
    44 
       
    45 /**
       
    46 * MComposerFetchLogicCallback
       
    47 */
       
    48 class MComposerFetchLogicCallback
       
    49 	{
       
    50 public:
       
    51     // Returns ETrue if the corresponding CFsComposerFetchLogic object has
       
    52     // been deleted.
       
    53     virtual TBool FetchLogicComplete( TComposerFetchState aState, TInt aError ) = 0;
       
    54 	};
       
    55 	
       
    56 	
       
    57 /**
       
    58 * CFsComposerFetchLogic
       
    59 */
       
    60 class CFsComposerFetchLogic: 
       
    61     public CBase, 
       
    62     //public MProgressDialogCallback, //<cmail>
       
    63 	public MFSEmailDownloadInformationObserver, 
       
    64 	public MFSMailRequestObserver
       
    65 	{
       
    66 public: // new public methods
       
    67 	
       
    68     static CFsComposerFetchLogic* NewL( CFSMailClient& aClient, 
       
    69                                         TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId, 
       
    70                                         MComposerFetchLogicCallback& aObserver,
       
    71                                         CFreestyleEmailUiAppUi& aAppUi );
       
    72 
       
    73     ~CFsComposerFetchLogic();
       
    74 		
       
    75     void RunReplyLogicL();
       
    76 		
       
    77     void RunForwardLogicL();
       
    78 
       
    79     void CancelFetchings(); //<cmail>
       
    80 
       
    81 public: // from MFSMailRequestObserver
       
    82 		
       
    83     void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
       
    84 		
       
    85 public: // from MFSEmailDownloadInformationObserver
       
    86 
       
    87     void RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart );
       
    88 
       
    89 public: // from MProgressDialogCallback <cmail> //MAknBackgroundProcess
       
    90         
       
    91     /**
       
    92     * Completes one cycle of the process.
       
    93     */
       
    94     //virtual void StepL(); <cmail>
       
    95     
       
    96     /**
       
    97     * Return true when the process is done.
       
    98     */
       
    99     //virtual TBool IsProcessDone() const; <cmail>
       
   100     
       
   101     /**
       
   102     * Callback when the process is finished.
       
   103     */
       
   104     //virtual void ProcessFinished();<cmail>
       
   105 
       
   106     /**
       
   107     * Callback when the dialog is dismissed
       
   108     */
       
   109     //void DialogDismissedL( TInt aButtonId ); <cmail>
       
   110 
       
   111     /**
       
   112     * Handles error occurred in StepL
       
   113     * @param aError error code that occurred
       
   114     * @return translated error code. If this is != KErrNone process will be stopped.
       
   115     */
       
   116     //virtual TInt CycleError( TInt aError ); <cmail>
       
   117         
       
   118 private:
       
   119 	
       
   120     CFsComposerFetchLogic( CFSMailClient& aClient, 
       
   121                            MComposerFetchLogicCallback& aObserver,
       
   122                            CFreestyleEmailUiAppUi& aAppUi );
       
   123 				
       
   124     void ConstructL( TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, 
       
   125                      TFSMailMsgId aMessageId );
       
   126 		
       
   127     void RunStateL();
       
   128 		
       
   129     void ShowWaitNoteL();
       
   130 
       
   131         /**
       
   132         * AskIfUserWantsToFetchAttachmentsL
       
   133         * @return ETrue if user select yes
       
   134         */
       
   135 //        TBool AskIfUserWantsToFetchAttachmentsL();
       
   136         
       
   137     //void CancelFetchings(); <cmail>
       
   138         
       
   139     void Complete();
       
   140         
       
   141 private:
       
   142 	
       
   143     enum TRunMode
       
   144         {
       
   145         EModeInvalid,
       
   146         EModeReply,
       
   147         EModeForward
       
   148         };
       
   149 			
       
   150     TRunMode iRunMode;
       
   151 	
       
   152     TComposerFetchState iState;
       
   153 		
       
   154 	CFreestyleEmailUiAppUi& iAppUi;	
       
   155 		
       
   156     CFSMailClient& iClient;
       
   157 
       
   158     MComposerFetchLogicCallback& iObserver;
       
   159 		
       
   160     //<cmail> using different wait note than freestyle
       
   161     //CAknWaitNoteWrapper* iAsyncWaitNote;
       
   162     CAknWaitDialog* iAsyncWaitNote;
       
   163     TBool iFetchingCancelGoingOn;
       
   164     //</cmail>
       
   165     	
       
   166     TBool iFetchComplete;
       
   167     	
       
   168     CFSMailBox* iMailBox;
       
   169     	
       
   170     CFSMailFolder* iFolder;
       
   171     	
       
   172     CFSMailMessage* iMessage;
       
   173 
       
   174     TInt iError;
       
   175     	
       
   176     TInt iStructureRequestId;
       
   177     TBool iFetchingStructure;
       
   178     
       
   179     TInt iBodyRequestId;
       
   180     TBool iFetchingBody;
       
   181     	
       
   182     TBool iRequestCompleted; //<cmail>
       
   183     	
       
   184     /**
       
   185     * part data for those parts that are being downloaded
       
   186     */
       
   187     RArray<TPartData> iParts;
       
   188         
       
   189 	};
       
   190 
       
   191 
       
   192 #endif