email/imap4mtm/imapmailstore/inc/cmsvplainbodytextqueueentry.h
changeset 80 8b14b30db193
parent 0 72b543305e3a
equal deleted inserted replaced
79:2981cb3aa489 80:8b14b30db193
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __CMSVPLAINBODYTEXTQUEUEENTRY_H__
       
    17 #define __CMSVPLAINBODYTEXTQUEUEENTRY_H__
       
    18 
       
    19 #include "cqueueentrybase.h"
       
    20 #include "cstoreutilities.h"
       
    21 
       
    22 class CMsvPlainBodyText;
       
    23 
       
    24 /**
       
    25 Used to hold chunk info when sorting chunks into the correct order.
       
    26 @internalComponent
       
    27 @prototype
       
    28 */
       
    29 class CPlainBodyChunkInfo : public CBase
       
    30 	{
       
    31 public:
       
    32 	static CPlainBodyChunkInfo* NewL(TInt aChunkNumber,HBufC8* aData);
       
    33 	~CPlainBodyChunkInfo();
       
    34 private:
       
    35 	CPlainBodyChunkInfo(TInt aChunkNumber,HBufC8* aData);
       
    36 	void ConstructL();
       
    37 public:
       
    38 	TInt iChunkNumber;
       
    39 	HBufC8* iData;	
       
    40 	};
       
    41 
       
    42 /**
       
    43 Used for requests to store body text.
       
    44 @internalComponent
       
    45 @prototype
       
    46 */
       
    47 class CMsvPlainBodyTextQueueEntry : public CQueueEntryBase
       
    48 	{
       
    49 public:                            
       
    50 	static CMsvPlainBodyTextQueueEntry* NewL(TInt aTotalChunks,CImapMailStore& aParent,CMsvServerEntry& aServerEntry,CImapSettings& aImapSettings,CFetchBodyInfo& aFetchBodyInfo,TInt aLogId,MMailStoreObserver& aObserver,MChunkOutOfOrderObserver& aChunkObserver, TBool aBinaryCap);
       
    51 	~CMsvPlainBodyTextQueueEntry();
       
    52 	TBool AddChunkL(HBufC8* aData,TInt aChunkNumber, TInt aExtraFetchRequestCount);
       
    53 protected:
       
    54 	virtual void RunL();
       
    55 	virtual TInt RunError(TInt aError);
       
    56 private:
       
    57 	void ConstructL();
       
    58 	CMsvPlainBodyTextQueueEntry(TInt aTotalChunks,CImapMailStore& aParent,CMsvServerEntry& aServerEntry,CImapSettings& aImapSettings,CFetchBodyInfo& aFetchBodyInfo,TInt aLogId,MMailStoreObserver& aObserver,MChunkOutOfOrderObserver& aChunkObserver, TBool aBinaryCap);
       
    59 	static TInt CompareChunks(const CPlainBodyChunkInfo& aChunkBodyInfo1, const CPlainBodyChunkInfo& aChunkBodyInfo2);
       
    60 private:
       
    61 	/** Total no. of chunks to be fetched.*/
       
    62 	TInt 								iTotalChunks;
       
    63 	TInt 								iNextExpectedChunk;
       
    64 	TImEncodingType 					iEncoding;
       
    65 	/** The charsetid for the message being fetched.*/
       
    66 	TUint 								iCharsetId;
       
    67 	/** For a partial fetch this is the amount of data not being fetched */
       
    68 	TInt32  							iBodyPartRemainingSize;
       
    69 	/** Array to store the incoming chunk before it is written to message store.*/
       
    70 	RPointerArray<CPlainBodyChunkInfo> 	iDataArray;
       
    71 	/** Utility class for decoding the incoming data.*/
       
    72 	CStoreUtilities* 					iStoreUtilities;
       
    73 	CImapSettings& 						iImapSettings;
       
    74 	TInt 								iLogId;
       
    75 	/** The message store class to store received chunks.*/
       
    76 	CMsvPlainBodyText* 					iPlainBodyText;
       
    77 	CMsvStore* 							iStore;
       
    78 	/** Observer to handle the receival of out of order chunks.*/
       
    79 	MChunkOutOfOrderObserver& 			iChunkObserver;
       
    80 	/** Indicates if the chunk is written to store so that it can be removed from the buffer array.*/
       
    81 	TBool 								iReadyToRemoveChunk;
       
    82 	/** Buffer which contains the chunk */
       
    83 	HBufC8* 				iDecodedData;
       
    84 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT)		
       
    85 	/** Flag to check if BINARY capability is set */
       
    86 	TBool iBinaryCap;
       
    87 	/** For message body download using Binary Fetch, this value indicates the extra Fetch Request given
       
    88 	which is not required.
       
    89 	*/
       
    90 	TInt iExtraFetchRequestCount;
       
    91 #endif
       
    92 	};
       
    93 	
       
    94 #endif//_CMSVPLAINBODYTEXTQUEUEENTRY_H__