ipsservices/ipssosplugin/inc/ipsplgimap4fetchattachmentop.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Feb 2010 22:37:30 +0200
branchRCL_3
changeset 8 e1b6206813b4
parent 0 8466d47a6819
child 12 4ce476e64c59
permissions -rw-r--r--
Revision: 201003 Kit: 201007

/*
* Copyright (c) 2007-2008 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:  IMAP4 attachment fetch operation
*
*/

#ifndef __IPSPLGIMAP4FETCHATTACHMENTOP_H__
#define __IPSPLGIMAP4FETCHATTACHMENTOP_H__


class CIpsPlgImap4FetchAttachmentOp;

/**
* class CIpsPlgImap4FetchAttachmentOp
*
*/
class CIpsFetchProgReport : public CActive
    {
    public:
        /**
        *
        */
        static CIpsFetchProgReport* NewL( 
            CIpsPlgImap4FetchAttachmentOp& aAttaOp );

        /**
        *
        */    
        ~CIpsFetchProgReport();

        /**
        *
        */    
        virtual void DoCancel();

        /**
        *
        */	
	    virtual void RunL();
	
	private:

        /**
        *
        */	
	    CIpsFetchProgReport( 
	        CIpsPlgImap4FetchAttachmentOp& aAttaOp );
        
        /**
        *
        */	    
	    void ConstructL();

        /**
        *
        */	
	    void AdjustTimer();
	
	private:
	
	    RTimer iTimer;
	    
	    CIpsPlgImap4FetchAttachmentOp& iAttaOp;
	
    };

/**
* class CIpsPlgImap4FetchAttachmentOp
*
*/
class CIpsPlgImap4FetchAttachmentOp :
    public CIpsPlgOnlineOperation
    {
    public:

        /**
        * NewL()
        * Basic factory function - creates dialog with standard title resource
        * @param CMsvSession& 
        *
        *
        *
        *
        *
        *
        * @return CIpsPlgImap4FetchAttachmentOp* self pointer
        */

        static CIpsPlgImap4FetchAttachmentOp* NewL(
            CMsvSession& aMsvSession,
            TRequestStatus& aObserverRequestStatus,
            TInt aFunctionId,
            TMsvId aService,
            CIpsPlgTimerOperation& aActivityTimer,
            const TImImap4GetMailInfo& aGetMailInfo,
            const CMsvEntrySelection& aSel,
            TFSMailMsgId aFSMailBoxId,
            MFSMailRequestObserver& aFSOperationObserver,
            TInt aFSRequestId );

        /**
        * ~CIpsPlgImap4FetchAttachmentOp()
        * destructor
        */

        virtual ~CIpsPlgImap4FetchAttachmentOp();

        /**
        *
        */
        const TDesC8& ProgressL();

        
        /**
        *
        */
        const TDesC8& GetErrorProgressL( TInt aError );
        
        /**
        * 
        */
        TFSProgress GetFSProgressL() const;
        
        
    private:


        /**
        * CIpsPlgImap4PopulateOp()
        * @param 
        *
        *
        *
        *
        *
        *
        
        */

        CIpsPlgImap4FetchAttachmentOp(
            CMsvSession& aMsvSession,
            TRequestStatus& aObserverRequestStatus,
            TInt aFunctionId,
            TMsvId aService,
            CIpsPlgTimerOperation& aActivityTimer,
            const TImImap4GetMailInfo& aGetMailInfo,
            TFSMailMsgId aFSMailBoxId,
            MFSMailRequestObserver& aFSOperationObserver,
            TInt aFSRequestId );

        /**
        * ConstructL()
        */

        void ConstructL( const CMsvEntrySelection& aSel );


        /**
        * RunL()
        */

        void RunL();

        /**
        * DoRunL()
        */

        void DoRunL();

        /**
        * DoCancel()
        */

        //virtual void DoCancel();

        /**
        * Complete()
        */

        void Complete();
        
        /**
        *
        */
        void DoConnectL();
        
        /**
        * 
        */
        void ReportProgressL();  

    protected:
        
        /**
        * From CIpsPlgOnlineoperation
        */
        TInt GetEngineProgress( const TDesC8& aProgress );
        
        /**
        *
        */
        void DoFetchAttachmentL( );
        
        enum TFetchState {
            EStateIdle,
            EStateConnecting,
            EStateFetching,
            EStateDisconnecting };
        TFetchState iState;
        
    private: //Data
    
        // because use of ReportProgressL()
        friend class CIpsFetchProgReport;
            
        CMsvEntrySelection*                     iSelection;
        TDesC8*                                 iFetchErrorProgress;
        TImImap4GetMailInfo                     iGetMailInfo;
        TInt                                    iFunctionId;
        TPckgBuf<TImap4CompoundProgress>        iProgress;
        TMsvId                                  iService;
        TBool                                   iPopulated;
        CIpsFetchProgReport*                    iProgReport;
        TInt                                    iRetryCount;
    };

#endif //__IPSPLGIMAP4FETCHATTACHMENTOP_H__