epoc32/include/app/miutconv.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
       
    14 // MIUTCONV.H
    14 //
    15 //
       
    16 
       
    17 /**
       
    18  * @file 
       
    19  * @publishedAll
       
    20  * @released
       
    21  */
    15 
    22 
    16 #ifndef __MIUTCONV_H__
    23 #ifndef __MIUTCONV_H__
    17 #define __MIUTCONV_H__
    24 #define __MIUTCONV_H__
    18 
    25 
    19 #include <e32base.h>
    26 #include <e32base.h>
    29 
    36 
    30 #if !defined (__UTF_H_)
    37 #if !defined (__UTF_H_)
    31 #include <utf.h>
    38 #include <utf.h>
    32 #endif
    39 #endif
    33 
    40 
    34 // IMail-specific stream type within an IMail file store for TImEmailTransformingInfo
    41 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    35 //
    42 #include "cimconvertcharconv.h"
    36 const TUint KUidMsvCharsetNone				= {0x10003C7F};		// 268450943
    43 #endif
    37 const TUid KUidMsgFileTransformingInfo		= {0x100094A5};		// 268473509
       
    38 const TUid KUidMsgEmailGeneralCenRep		= {0x10285A25};		// 271079973
       
    39 
       
    40 // No longer used as the charset information retrieved from resource file.
       
    41 // Might possibly needed in the future ? maybe
       
    42 // const TUid KUidMiutSystemDefaultCharset		= {0x10009418};		// 268473368
       
    43 // const TUid KUidMiutOverrideCharset			= {0x10009419};		// 268473369
       
    44 
       
    45 _LIT8(KMiutUndisplayableChar, "?");
       
    46 
    44 
    47 /** SMTP send methods. 
    45 /** SMTP send methods. 
    48 @publishedAll
    46 @publishedAll
    49 @released
    47 @released
    50 */
    48 */
   131 	TUint	iTextAttachmentCharset;	
   129 	TUint	iTextAttachmentCharset;	
   132 
   130 
   133 	TImSendMethod iSendMethod;
   131 	TImSendMethod iSendMethod;
   134 	};
   132 	};
   135 
   133 
   136 
   134 #endif //__MIUTCONV_H__
   137 // Default Sending Charset/Encoding Values
       
   138 const TImEncodingType KDefaultMIMEHeaderEncoding	=	EEncodingTypeBASE64;		// MIME
       
   139 const TImEncodingType KDefaultMIMEBodyTextEncoding	=	EEncodingTypeQP;
       
   140 const TImEncodingType KDefaultMIMEHTMLEncoding		=	EEncodingTypeBASE64;
       
   141 const TImEncodingType KDefaultMIMEAttachmentEncoding=	EEncodingTypeBASE64;
       
   142 
       
   143 #define KDefaultPlainCharset		KCharacterSetIdentifierIso88591
       
   144 
       
   145 const TImEncodingType	KDefaultPlainHeaderEncoding		=	EEncodingTypeNone;	// Non-MIME or Plain
       
   146 const TImEncodingType	KDefaultPlainBodyTextEncoding	=	EEncodingTypeNone;
       
   147 const TImEncodingType KDefaultPlainAttachmentEncoding	=	EEncodingTypeUU;
       
   148 
       
   149 
       
   150 
       
   151 
       
   152 // Wrapper class for CHARCONV.
       
   153 // 'Our' charset dependant on build, UNICODE or CodePage 1252.
       
   154 //
       
   155 class CImConvertCharconv : public CBase
       
   156 /**
       
   157 @internalTechnology
       
   158 @released
       
   159 */
       
   160 	{
       
   161 public:	
       
   162 	IMPORT_C static CImConvertCharconv* NewL(CCnvCharacterSetConverter& aConverter, RFs& anFs);
       
   163 	~CImConvertCharconv();
       
   164 
       
   165 	// MUST call prepare function first.
       
   166 	IMPORT_C TInt ConvertToOurCharsetL( const TDesC8& aBufIn, TDes& rBufOut, 
       
   167 										TInt& rNumUnconvertedChars, 
       
   168 										TInt& rIndexOfFirstUnconvertedChar);
       
   169 	IMPORT_C TInt ConvertFromOurCharsetL(const TDesC& aBufIn, TDes8& rBufOut, 
       
   170 										 TInt& rNumUnconvertedChars,
       
   171 										 TInt& rIndexOfFirstUnconvertedChar);
       
   172 
       
   173 	// MUST be called prior to calling above two functions.
       
   174 	IMPORT_C TInt PrepareToConvertToFromOurCharsetL(const TUint aUid);
       
   175 
       
   176 	IMPORT_C TUint GetMimeCharsetUidL(const TDesC8& aBufIn) const;
       
   177 	IMPORT_C HBufC8* GetMimeCharsetTextStringL(const TUint& aUid) const;
       
   178 	IMPORT_C TUint DefaultCharset() const;
       
   179 	IMPORT_C TUint SystemDefaultCharset() const;
       
   180 
       
   181 	static TInt StraightCopy( const TDesC8& aBufIn, TDes& rBufOut);
       
   182 	static TInt StraightCopy( const TDesC& aBufIn, TDes8& rBufOut);
       
   183 private:
       
   184 	void ConstructL();
       
   185 	CImConvertCharconv(CCnvCharacterSetConverter& aConverter, RFs& anFs);
       
   186 	TBool CharsetAvailable(const TUint aUid);
       
   187 	void SetSystemDefaultCharsetL();
       
   188 
       
   189 	TInt GetSystemCharsetFromCenRepL(TDes8& aMimeCharSet);
       
   190 
       
   191 	enum TEmailGeneralSettingsCenRepId
       
   192 		{
       
   193 		EEmailGeneralCharSetId				= 0x00000000
       
   194 		};
       
   195 
       
   196 private:
       
   197 	CCnvCharacterSetConverter& iConverter;
       
   198 	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iCharsetsAvailable; 
       
   199 
       
   200 	RFs& iFs;
       
   201 	TUint iCharsetUid;
       
   202 	TUint iSystemDefaultCharset;		// Value obtained from .ini file
       
   203 	TInt  iCharconvState;
       
   204 	};
       
   205 
       
   206 #endif