email/imap4mtm/imapmailstore/src/cfetchbodyinfo.cpp
changeset 0 72b543305e3a
child 77 da6ac9d688df
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 	}	
       
    38 
       
    39 CFetchBodyInfo::~CFetchBodyInfo()
       
    40 	{
       
    41 	delete iRelativePath;
       
    42 	}
       
    43 
       
    44 EXPORT_C void CFetchBodyInfo::SetSizeToFetch(TInt32 aSize)
       
    45 	{
       
    46 	iSizeToFetch=aSize;
       
    47 	}
       
    48 
       
    49 EXPORT_C void CFetchBodyInfo::SetIsText(TBool aIsText)
       
    50 	{
       
    51 	iIsText=aIsText;
       
    52 	}
       
    53 
       
    54 EXPORT_C void CFetchBodyInfo::SetPartId(const TMsvId aPartId)
       
    55 	{
       
    56 	iPartId=aPartId;
       
    57 	}
       
    58 
       
    59 EXPORT_C void CFetchBodyInfo::SetRelativePathL(const TDesC8& aRelativePath)
       
    60 	{
       
    61 	HBufC8* newRelativePath = aRelativePath.AllocL();
       
    62 	delete iRelativePath;
       
    63 	iRelativePath = newRelativePath;
       
    64 	}
       
    65 
       
    66 EXPORT_C void CFetchBodyInfo::SetBodyPartRemainingSize(const TInt32 aSize)
       
    67 	{
       
    68 	iBodyPartRemainingSize=aSize;
       
    69 	}
       
    70 	
       
    71 EXPORT_C TInt32 CFetchBodyInfo::BodyPartRemainingSize()
       
    72 	{
       
    73 	return iBodyPartRemainingSize;
       
    74 	}
       
    75 
       
    76 EXPORT_C TInt32 CFetchBodyInfo::SizeToFetch()
       
    77 	{
       
    78 	return iSizeToFetch;
       
    79 	}
       
    80 
       
    81 EXPORT_C TBool CFetchBodyInfo::IsText()
       
    82 	{
       
    83 	return iIsText;
       
    84 	}
       
    85 
       
    86 EXPORT_C TMsvId  CFetchBodyInfo::PartId()
       
    87 	{
       
    88 	return iPartId;
       
    89 	}
       
    90 
       
    91 EXPORT_C HBufC8* CFetchBodyInfo::RelativePath() const
       
    92 	{
       
    93 	return iRelativePath;
       
    94 	}
       
    95 
       
    96 EXPORT_C void CFetchBodyInfo::SetContentTransferEncoding(TImEncodingType aContentTransferEncoding)
       
    97 	{
       
    98 	iContentTransferEncoding=aContentTransferEncoding;
       
    99 	}
       
   100 	
       
   101 EXPORT_C void CFetchBodyInfo::SetCharsetId(const TUint aCharsetId)
       
   102 	{
       
   103 	iCharsetId=aCharsetId;
       
   104 	}
       
   105 
       
   106 EXPORT_C TImEncodingType CFetchBodyInfo::ContentTransferEncoding() const
       
   107 	{
       
   108 	return iContentTransferEncoding;
       
   109 	}
       
   110 	
       
   111 EXPORT_C TUint CFetchBodyInfo::CharsetId() const
       
   112 	{
       
   113 	return iCharsetId;
       
   114 	}
       
   115 	
       
   116 EXPORT_C void CFetchBodyInfo::SetCaf(CImCaf* aCaf)
       
   117 	{
       
   118 	__ASSERT_DEBUG(aCaf!=NULL, TImapServerPanic::ImapPanic(TImapServerPanic::EMailStoreFetchBodyBadCAFHandle));
       
   119 	iCaf=aCaf;
       
   120 	}
       
   121 
       
   122 EXPORT_C void CFetchBodyInfo::ResetCaf()
       
   123 	{
       
   124 	iCaf=NULL;
       
   125 	}
       
   126 	
       
   127 EXPORT_C CImCaf* CFetchBodyInfo::Caf() const
       
   128 	{
       
   129 	return iCaf;
       
   130 	}
       
   131 
       
   132 EXPORT_C TInt32 CFetchBodyInfo::BytesFetched()
       
   133 	{
       
   134 	return iBytesFetched;	
       
   135 	}
       
   136 	
       
   137 EXPORT_C void CFetchBodyInfo::IncrementBytesFetched(TInt32 aByteCount)
       
   138 	{
       
   139 	iBytesFetched+=aByteCount;	
       
   140 	}