diff -r d189ee25cf9d -r 3533d4323edc emailuis/emailui/inc/FSComposerFetchLogic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emailuis/emailui/inc/FSComposerFetchLogic.h Wed Sep 01 12:28:57 2010 +0100 @@ -0,0 +1,192 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file defines class MComposerFetchLogicCallback. +* +*/ + + +#ifndef __FSCOMPOSERFETCHLOGIC_H__ +#define __FSCOMPOSERFETCHLOGIC_H__ + + +#include +//#include //cmail + +#include"FreestyleEmailDownloadInformationMediator.h" + +class CFSMailClient; +class CFSMailBox; +class CFSMailFolder; +class CFSMailMessage; +class CFreestyleEmailUiAppUi; + +enum TComposerFetchState + { + EStateNotStarted, // not started + EStateSmartReply, // smart reply test + EStateSmartForward, // smart forward test + EStateStructure, // fetch message structure + EStateBody, // fetch message body + EStateAttachments // fetch attachments + }; + + +/** +* MComposerFetchLogicCallback +*/ +class MComposerFetchLogicCallback + { +public: + // Returns ETrue if the corresponding CFsComposerFetchLogic object has + // been deleted. + virtual TBool FetchLogicComplete( TComposerFetchState aState, TInt aError ) = 0; + }; + + +/** +* CFsComposerFetchLogic +*/ +class CFsComposerFetchLogic: + public CBase, + //public MProgressDialogCallback, // + public MFSEmailDownloadInformationObserver, + public MFSMailRequestObserver + { +public: // new public methods + + static CFsComposerFetchLogic* NewL( CFSMailClient& aClient, + TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId, + MComposerFetchLogicCallback& aObserver, + CFreestyleEmailUiAppUi& aAppUi ); + + ~CFsComposerFetchLogic(); + + void RunReplyLogicL(); + + void RunForwardLogicL(); + + void CancelFetchings(); // + +public: // from MFSMailRequestObserver + + void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); + +public: // from MFSEmailDownloadInformationObserver + + void RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart ); + +public: // from MProgressDialogCallback //MAknBackgroundProcess + + /** + * Completes one cycle of the process. + */ + //virtual void StepL(); + + /** + * Return true when the process is done. + */ + //virtual TBool IsProcessDone() const; + + /** + * Callback when the process is finished. + */ + //virtual void ProcessFinished(); + + /** + * Callback when the dialog is dismissed + */ + //void DialogDismissedL( TInt aButtonId ); + + /** + * Handles error occurred in StepL + * @param aError error code that occurred + * @return translated error code. If this is != KErrNone process will be stopped. + */ + //virtual TInt CycleError( TInt aError ); + +private: + + CFsComposerFetchLogic( CFSMailClient& aClient, + MComposerFetchLogicCallback& aObserver, + CFreestyleEmailUiAppUi& aAppUi ); + + void ConstructL( TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, + TFSMailMsgId aMessageId ); + + void RunStateL(); + + void ShowWaitNoteL(); + + /** + * AskIfUserWantsToFetchAttachmentsL + * @return ETrue if user select yes + */ +// TBool AskIfUserWantsToFetchAttachmentsL(); + + //void CancelFetchings(); + + void Complete(); + +private: + + enum TRunMode + { + EModeInvalid, + EModeReply, + EModeForward + }; + + TRunMode iRunMode; + + TComposerFetchState iState; + + CFreestyleEmailUiAppUi& iAppUi; + + CFSMailClient& iClient; + + MComposerFetchLogicCallback& iObserver; + + // using different wait note than freestyle + //CAknWaitNoteWrapper* iAsyncWaitNote; + CAknWaitDialog* iAsyncWaitNote; + TBool iFetchingCancelGoingOn; + // + + TBool iFetchComplete; + + CFSMailBox* iMailBox; + + CFSMailFolder* iFolder; + + CFSMailMessage* iMessage; + + TInt iError; + + TInt iStructureRequestId; + TBool iFetchingStructure; + + TInt iBodyRequestId; + TBool iFetchingBody; + + TBool iRequestCompleted; // + + /** + * part data for those parts that are being downloaded + */ + RArray iParts; + + }; + + +#endif