1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/miutconv.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,206 @@
1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __MIUTCONV_H__
1.20 +#define __MIUTCONV_H__
1.21 +
1.22 +#include <e32base.h>
1.23 +
1.24 +
1.25 +#if !defined (__CHARCONV_H_)
1.26 +#include <charconv.h>
1.27 +#endif
1.28 +
1.29 +#if !defined (__MIUTHDR_H__)
1.30 +#include <miuthdr.h>
1.31 +#endif
1.32 +
1.33 +#if !defined (__UTF_H_)
1.34 +#include <utf.h>
1.35 +#endif
1.36 +
1.37 +// IMail-specific stream type within an IMail file store for TImEmailTransformingInfo
1.38 +//
1.39 +const TUint KUidMsvCharsetNone = {0x10003C7F}; // 268450943
1.40 +const TUid KUidMsgFileTransformingInfo = {0x100094A5}; // 268473509
1.41 +const TUid KUidMsgEmailGeneralCenRep = {0x10285A25}; // 271079973
1.42 +
1.43 +// No longer used as the charset information retrieved from resource file.
1.44 +// Might possibly needed in the future ? maybe
1.45 +// const TUid KUidMiutSystemDefaultCharset = {0x10009418}; // 268473368
1.46 +// const TUid KUidMiutOverrideCharset = {0x10009419}; // 268473369
1.47 +
1.48 +_LIT8(KMiutUndisplayableChar, "?");
1.49 +
1.50 +/** SMTP send methods.
1.51 +@publishedAll
1.52 +@released
1.53 +*/
1.54 +enum TImSendMethod
1.55 + {
1.56 + /** Simple email. */
1.57 + ESendAsSimpleEmail,
1.58 + /** MIME email. */
1.59 + ESendAsMimeEmail
1.60 + };
1.61 +
1.62 +
1.63 +// Information to be used when sending an email message.
1.64 +// Relating to how parts are encoded and converted.
1.65 +//
1.66 +class TImEmailTransformingInfo
1.67 +/** Encapsulates character conversion and encoding settings for sending SMTP email.
1.68 +
1.69 +The default outcomes for header, body, HTML, and attachment parts respectively
1.70 +for each of the listed categories are given below:
1.71 +
1.72 +Plain Charset: ISO-8859-1,ISO-8859-1,N/A,N/A
1.73 +
1.74 +Plain Encoding:None,None,N/A,UU
1.75 +
1.76 +MIME Charset:UTF8,UTF8,UTF8*,N/A
1.77 +
1.78 +MIME Encoding:B,QP,Base64,Base64
1.79 +
1.80 +*: the UTF8 value set in the header field, but no conversion is done. The
1.81 +HTML converter converts to UTF8.
1.82 +@publishedAll
1.83 +@released
1.84 +*/
1.85 + {
1.86 +public:
1.87 + IMPORT_C TImEmailTransformingInfo& operator=(const TImEmailTransformingInfo& aInfo);
1.88 + IMPORT_C TBool operator==(const TImEmailTransformingInfo& aInfo);
1.89 +
1.90 + // streaming operations
1.91 + IMPORT_C void ExternalizeL( RWriteStream& aWriteStream ) const;
1.92 + IMPORT_C void InternalizeL( RReadStream& aReadStream );
1.93 + IMPORT_C void StoreL( CMsvStore& aStore ) const;
1.94 + IMPORT_C void RestoreL( CMsvStore& aStore );
1.95 +
1.96 + // Setting functions
1.97 + IMPORT_C void SetToDefault(const TImSendMethod aMethod);
1.98 + IMPORT_C void SetSendMethod(const TImSendMethod aMethod);
1.99 + IMPORT_C TImSendMethod SendMethod() const;
1.100 +
1.101 + IMPORT_C void SetHeaderEncodingQ();
1.102 + IMPORT_C void SetHeaderEncodingB();
1.103 + IMPORT_C void SetBodyTextEncoding(TImEncodingType aType);
1.104 + IMPORT_C void SetHTMLEncoding(TImEncodingType aType);
1.105 + IMPORT_C void SetAttachmentEncoding(TImEncodingType aType);
1.106 +
1.107 + IMPORT_C void SetHeaderAndBodyCharset(TUint aCharset);
1.108 + IMPORT_C void SetHeaderCharset(TUint aCharset);
1.109 + IMPORT_C void SetBodyTextCharset(TUint aCharset);
1.110 + IMPORT_C void SetHTMLCharset(TUint aCharset);
1.111 +
1.112 + // Accessor functions
1.113 + IMPORT_C TImEncodingType HeaderEncoding() const;
1.114 + IMPORT_C TImEncodingType BodyTextEncoding() const;
1.115 + IMPORT_C TImEncodingType HTMLEncoding() const;
1.116 + IMPORT_C TImEncodingType AttachmentEncoding() const;
1.117 +
1.118 + IMPORT_C TUint HeaderCharset() const;
1.119 + IMPORT_C TUint BodyTextCharset() const;
1.120 + IMPORT_C TUint HTMLCharset() const;
1.121 +
1.122 +private:
1.123 + void SetHeaderEncoding(TImEncodingType aType);
1.124 +
1.125 +private:
1.126 + TImEncodingType iHeaderEncoding;
1.127 + TImEncodingType iBodyEncoding;
1.128 + TImEncodingType iHTMLEncoding;
1.129 + TImEncodingType iAttachmentEncoding;
1.130 +
1.131 + TUint iHeaderCharset;
1.132 + TUint iBodyCharset;
1.133 + TUint iHTMLCharset;
1.134 + TUint iTextAttachmentCharset;
1.135 +
1.136 + TImSendMethod iSendMethod;
1.137 + };
1.138 +
1.139 +
1.140 +// Default Sending Charset/Encoding Values
1.141 +const TImEncodingType KDefaultMIMEHeaderEncoding = EEncodingTypeBASE64; // MIME
1.142 +const TImEncodingType KDefaultMIMEBodyTextEncoding = EEncodingTypeQP;
1.143 +const TImEncodingType KDefaultMIMEHTMLEncoding = EEncodingTypeBASE64;
1.144 +const TImEncodingType KDefaultMIMEAttachmentEncoding= EEncodingTypeBASE64;
1.145 +
1.146 +#define KDefaultPlainCharset KCharacterSetIdentifierIso88591
1.147 +
1.148 +const TImEncodingType KDefaultPlainHeaderEncoding = EEncodingTypeNone; // Non-MIME or Plain
1.149 +const TImEncodingType KDefaultPlainBodyTextEncoding = EEncodingTypeNone;
1.150 +const TImEncodingType KDefaultPlainAttachmentEncoding = EEncodingTypeUU;
1.151 +
1.152 +
1.153 +
1.154 +
1.155 +// Wrapper class for CHARCONV.
1.156 +// 'Our' charset dependant on build, UNICODE or CodePage 1252.
1.157 +//
1.158 +class CImConvertCharconv : public CBase
1.159 +/**
1.160 +@internalTechnology
1.161 +@released
1.162 +*/
1.163 + {
1.164 +public:
1.165 + IMPORT_C static CImConvertCharconv* NewL(CCnvCharacterSetConverter& aConverter, RFs& anFs);
1.166 + ~CImConvertCharconv();
1.167 +
1.168 + // MUST call prepare function first.
1.169 + IMPORT_C TInt ConvertToOurCharsetL( const TDesC8& aBufIn, TDes& rBufOut,
1.170 + TInt& rNumUnconvertedChars,
1.171 + TInt& rIndexOfFirstUnconvertedChar);
1.172 + IMPORT_C TInt ConvertFromOurCharsetL(const TDesC& aBufIn, TDes8& rBufOut,
1.173 + TInt& rNumUnconvertedChars,
1.174 + TInt& rIndexOfFirstUnconvertedChar);
1.175 +
1.176 + // MUST be called prior to calling above two functions.
1.177 + IMPORT_C TInt PrepareToConvertToFromOurCharsetL(const TUint aUid);
1.178 +
1.179 + IMPORT_C TUint GetMimeCharsetUidL(const TDesC8& aBufIn) const;
1.180 + IMPORT_C HBufC8* GetMimeCharsetTextStringL(const TUint& aUid) const;
1.181 + IMPORT_C TUint DefaultCharset() const;
1.182 + IMPORT_C TUint SystemDefaultCharset() const;
1.183 +
1.184 + static TInt StraightCopy( const TDesC8& aBufIn, TDes& rBufOut);
1.185 + static TInt StraightCopy( const TDesC& aBufIn, TDes8& rBufOut);
1.186 +private:
1.187 + void ConstructL();
1.188 + CImConvertCharconv(CCnvCharacterSetConverter& aConverter, RFs& anFs);
1.189 + TBool CharsetAvailable(const TUint aUid);
1.190 + void SetSystemDefaultCharsetL();
1.191 +
1.192 + TInt GetSystemCharsetFromCenRepL(TDes8& aMimeCharSet);
1.193 +
1.194 + enum TEmailGeneralSettingsCenRepId
1.195 + {
1.196 + EEmailGeneralCharSetId = 0x00000000
1.197 + };
1.198 +
1.199 +private:
1.200 + CCnvCharacterSetConverter& iConverter;
1.201 + CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iCharsetsAvailable;
1.202 +
1.203 + RFs& iFs;
1.204 + TUint iCharsetUid;
1.205 + TUint iSystemDefaultCharset; // Value obtained from .ini file
1.206 + TInt iCharconvState;
1.207 + };
1.208 +
1.209 +#endif