emailuis/emailui/inc/FSComposerFetchLogic.h
changeset 0 8466d47a6819
child 1 12c456ceeff2
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: 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     virtual void FetchLogicComplete( TComposerFetchState aState, TInt aError ) = 0;
       
    52 	};
       
    53 	
       
    54 	
       
    55 /**
       
    56 * CFsComposerFetchLogic
       
    57 */
       
    58 class CFsComposerFetchLogic: 
       
    59     public CBase, 
       
    60     //public MProgressDialogCallback, //<cmail>
       
    61 	public MFSEmailDownloadInformationObserver, 
       
    62 	public MFSMailRequestObserver
       
    63 	{
       
    64 public: // new public methods
       
    65 	
       
    66     static CFsComposerFetchLogic* NewL( CFSMailClient& aClient, 
       
    67                                         TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId, 
       
    68                                         MComposerFetchLogicCallback& aObserver,
       
    69                                         CFreestyleEmailUiAppUi& aAppUi );
       
    70 
       
    71     ~CFsComposerFetchLogic();
       
    72 		
       
    73     void RunReplyLogicL();
       
    74 		
       
    75     void RunForwardLogicL();
       
    76 
       
    77     void CancelFetchings(); //<cmail>
       
    78 
       
    79 public: // from MFSMailRequestObserver
       
    80 		
       
    81     void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
       
    82 		
       
    83 public: // from MFSEmailDownloadInformationObserver
       
    84 
       
    85     void RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart );
       
    86 
       
    87 public: // from MProgressDialogCallback <cmail> //MAknBackgroundProcess
       
    88         
       
    89     /**
       
    90     * Completes one cycle of the process.
       
    91     */
       
    92     //virtual void StepL(); <cmail>
       
    93     
       
    94     /**
       
    95     * Return true when the process is done.
       
    96     */
       
    97     //virtual TBool IsProcessDone() const; <cmail>
       
    98     
       
    99     /**
       
   100     * Callback when the process is finished.
       
   101     */
       
   102     //virtual void ProcessFinished();<cmail>
       
   103 
       
   104     /**
       
   105     * Callback when the dialog is dismissed
       
   106     */
       
   107     //void DialogDismissedL( TInt aButtonId ); <cmail>
       
   108 
       
   109     /**
       
   110     * Handles error occurred in StepL
       
   111     * @param aError error code that occurred
       
   112     * @return translated error code. If this is != KErrNone process will be stopped.
       
   113     */
       
   114     //virtual TInt CycleError( TInt aError ); <cmail>
       
   115         
       
   116 private:
       
   117 	
       
   118     CFsComposerFetchLogic( CFSMailClient& aClient, 
       
   119                            MComposerFetchLogicCallback& aObserver,
       
   120                            CFreestyleEmailUiAppUi& aAppUi );
       
   121 				
       
   122     void ConstructL( TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, 
       
   123                      TFSMailMsgId aMessageId );
       
   124 		
       
   125     void RunStateL();
       
   126 		
       
   127     void ShowWaitNoteL();
       
   128 
       
   129         /**
       
   130         * AskIfUserWantsToFetchAttachmentsL
       
   131         * @return ETrue if user select yes
       
   132         */
       
   133 //        TBool AskIfUserWantsToFetchAttachmentsL();
       
   134         
       
   135     //void CancelFetchings(); <cmail>
       
   136         
       
   137     void Complete();
       
   138         
       
   139 private:
       
   140 	
       
   141     enum TRunMode
       
   142         {
       
   143         EModeInvalid,
       
   144         EModeReply,
       
   145         EModeForward
       
   146         };
       
   147 			
       
   148     TRunMode iRunMode;
       
   149 	
       
   150     TComposerFetchState iState;
       
   151 		
       
   152 	CFreestyleEmailUiAppUi& iAppUi;	
       
   153 		
       
   154     CFSMailClient& iClient;
       
   155 
       
   156     MComposerFetchLogicCallback& iObserver;
       
   157 		
       
   158     //<cmail> using different wait note than freestyle
       
   159     //CAknWaitNoteWrapper* iAsyncWaitNote;
       
   160     CAknWaitDialog* iAsyncWaitNote;
       
   161     TBool iFetchingCancelGoingOn;
       
   162     //</cmail>
       
   163     	
       
   164     TBool iFetchComplete;
       
   165     	
       
   166     CFSMailBox* iMailBox;
       
   167     	
       
   168     CFSMailFolder* iFolder;
       
   169     	
       
   170     CFSMailMessage* iMessage;
       
   171 
       
   172     TInt iError;
       
   173     	
       
   174     TInt iStructureRequestId;
       
   175     TBool iFetchingStructure;
       
   176     
       
   177     TInt iBodyRequestId;
       
   178     TBool iFetchingBody;
       
   179     	
       
   180     TBool iRequestCompleted; //<cmail>
       
   181     	
       
   182     /**
       
   183     * part data for those parts that are being downloaded
       
   184     */
       
   185     RArray<TPartData> iParts;
       
   186         
       
   187 	};
       
   188 
       
   189 
       
   190 #endif