email/imap4mtm/imapmailstore/src/cfetchbodyinfo.cpp
changeset 80 8b14b30db193
equal deleted inserted replaced
79:2981cb3aa489 80:8b14b30db193
       
     1 // Copyright (c) 2006-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 
       
    17 #include "cfetchbodyinfo.h"
       
    18 #include "imappaniccodes.h"
       
    19 
       
    20 EXPORT_C CFetchBodyInfo*  CFetchBodyInfo::NewLC(TMsvId aPartId) 
       
    21 	{
       
    22 	CFetchBodyInfo* self = new (ELeave) CFetchBodyInfo(aPartId);
       
    23 	CleanupStack::PushL(self);
       
    24 	return self;
       
    25 	}
       
    26 	
       
    27 EXPORT_C CFetchBodyInfo*  CFetchBodyInfo::NewL(TMsvId aPartId) 
       
    28 	{
       
    29 	CFetchBodyInfo* self = CFetchBodyInfo::NewLC(aPartId);
       
    30 	CleanupStack::Pop(self);
       
    31 	return self;;
       
    32 	}
       
    33 	
       
    34 CFetchBodyInfo::CFetchBodyInfo(TMsvId aPartId)
       
    35  : iPartId(aPartId)
       
    36 	{
       
    37 		iEmbed = EFalse;
       
    38 	}	
       
    39 
       
    40 CFetchBodyInfo::~CFetchBodyInfo()
       
    41 	{
       
    42 	delete iRelativePath;
       
    43 	}
       
    44 
       
    45 EXPORT_C void CFetchBodyInfo::SetSizeToFetch(TInt32 aSize)
       
    46 	{
       
    47 	iSizeToFetch=aSize;
       
    48 	}
       
    49 
       
    50 EXPORT_C void CFetchBodyInfo::SetIsText(TBool aIsText)
       
    51 	{
       
    52 	iIsText=aIsText;
       
    53 	}
       
    54 
       
    55 EXPORT_C void CFetchBodyInfo::SetPartId(const TMsvId aPartId)
       
    56 	{
       
    57 	iPartId=aPartId;
       
    58 	}
       
    59 
       
    60 EXPORT_C void CFetchBodyInfo::SetRelativePathL(const TDesC8& aRelativePath)
       
    61 	{
       
    62 	HBufC8* newRelativePath = aRelativePath.AllocL();
       
    63 	delete iRelativePath;
       
    64 	iRelativePath = newRelativePath;
       
    65 	}
       
    66 
       
    67 EXPORT_C void CFetchBodyInfo::SetBodyPartRemainingSize(const TInt32 aSize)
       
    68 	{
       
    69 	iBodyPartRemainingSize=aSize;
       
    70 	}
       
    71 	
       
    72 EXPORT_C TInt32 CFetchBodyInfo::BodyPartRemainingSize()
       
    73 	{
       
    74 	return iBodyPartRemainingSize;
       
    75 	}
       
    76 
       
    77 EXPORT_C TInt32 CFetchBodyInfo::SizeToFetch()
       
    78 	{
       
    79 	return iSizeToFetch;
       
    80 	}
       
    81 
       
    82 EXPORT_C TBool CFetchBodyInfo::IsText()
       
    83 	{
       
    84 	return iIsText;
       
    85 	}
       
    86 
       
    87 EXPORT_C TMsvId  CFetchBodyInfo::PartId()
       
    88 	{
       
    89 	return iPartId;
       
    90 	}
       
    91 
       
    92 EXPORT_C HBufC8* CFetchBodyInfo::RelativePath() const
       
    93 	{
       
    94 	return iRelativePath;
       
    95 	}
       
    96 
       
    97 EXPORT_C void CFetchBodyInfo::SetContentTransferEncoding(TImEncodingType aContentTransferEncoding)
       
    98 	{
       
    99 	iContentTransferEncoding=aContentTransferEncoding;
       
   100 	}
       
   101 	
       
   102 EXPORT_C void CFetchBodyInfo::SetCharsetId(const TUint aCharsetId)
       
   103 	{
       
   104 	iCharsetId=aCharsetId;
       
   105 	}
       
   106 
       
   107 EXPORT_C TImEncodingType CFetchBodyInfo::ContentTransferEncoding() const
       
   108 	{
       
   109 	return iContentTransferEncoding;
       
   110 	}
       
   111 	
       
   112 EXPORT_C TUint CFetchBodyInfo::CharsetId() const
       
   113 	{
       
   114 	return iCharsetId;
       
   115 	}
       
   116 	
       
   117 EXPORT_C void CFetchBodyInfo::SetCaf(CImCaf* aCaf)
       
   118 	{
       
   119 	__ASSERT_DEBUG(aCaf!=NULL, TImapServerPanic::ImapPanic(TImapServerPanic::EMailStoreFetchBodyBadCAFHandle));
       
   120 	iCaf=aCaf;
       
   121 	}
       
   122 
       
   123 EXPORT_C void CFetchBodyInfo::ResetCaf()
       
   124 	{
       
   125 	iCaf=NULL;
       
   126 	}
       
   127 	
       
   128 EXPORT_C CImCaf* CFetchBodyInfo::Caf() const
       
   129 	{
       
   130 	return iCaf;
       
   131 	}
       
   132 
       
   133 EXPORT_C TInt32 CFetchBodyInfo::BytesFetched()
       
   134 	{
       
   135 	return iBytesFetched;	
       
   136 	}
       
   137 	
       
   138 EXPORT_C void CFetchBodyInfo::IncrementBytesFetched(TInt32 aByteCount)
       
   139 	{
       
   140 	iBytesFetched+=aByteCount;	
       
   141 	}