|
1 // Copyright (c) 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 // cimconvertcharconv.h |
|
15 // |
|
16 |
|
17 /** |
|
18 * @file |
|
19 * @internal |
|
20 * @released |
|
21 */ |
|
22 |
|
23 #ifndef __CIMCONVERTCHARCONV_H__ |
|
24 #define __CIMCONVERTCHARCONV_H__ |
|
25 |
|
26 /** |
|
27 * IMail-specific stream type within an IMail file store for TImEmailTransformingInfo |
|
28 * @internalTechnology |
|
29 * @released |
|
30 */ |
|
31 const TUint KUidMsvCharsetNone = {0x10003C7F}; // 268450943 |
|
32 |
|
33 /** |
|
34 * IMail-specific stream type within an IMail file store for TImEmailTransformingInfo |
|
35 * @internalComponent |
|
36 * @released |
|
37 */ |
|
38 const TUid KUidMsgFileTransformingInfo = {0x100094A5}; // 268473509 |
|
39 const TUid KUidMsgEmailGeneralCenRep = {0x10285A25}; // 271079973 |
|
40 |
|
41 /** |
|
42 * Default Sending Charset/Encoding Values |
|
43 * @internalComponent |
|
44 * @released |
|
45 */ |
|
46 _LIT8(KMiutUndisplayableChar, "?"); |
|
47 #define KDefaultPlainCharset KCharacterSetIdentifierIso88591 |
|
48 const TImEncodingType KDefaultMIMEHeaderEncoding = EEncodingTypeBASE64; // MIME |
|
49 const TImEncodingType KDefaultMIMEBodyTextEncoding = EEncodingTypeQP; |
|
50 const TImEncodingType KDefaultMIMEHTMLEncoding = EEncodingTypeBASE64; |
|
51 const TImEncodingType KDefaultMIMEAttachmentEncoding = EEncodingTypeBASE64; |
|
52 const TImEncodingType KDefaultPlainHeaderEncoding = EEncodingTypeNone; // Non-MIME or Plain |
|
53 const TImEncodingType KDefaultPlainBodyTextEncoding = EEncodingTypeNone; |
|
54 const TImEncodingType KDefaultPlainAttachmentEncoding = EEncodingTypeUU; |
|
55 |
|
56 // Wrapper class for CHARCONV. |
|
57 // 'Our' charset dependant on build, UNICODE or CodePage 1252. |
|
58 // |
|
59 class CImConvertCharconv : public CBase |
|
60 /** |
|
61 @internalTechnology |
|
62 @released |
|
63 */ |
|
64 { |
|
65 public: |
|
66 IMPORT_C static CImConvertCharconv* NewL(CCnvCharacterSetConverter& aConverter, RFs& anFs); |
|
67 ~CImConvertCharconv(); |
|
68 |
|
69 // MUST call prepare function first. |
|
70 IMPORT_C TInt ConvertToOurCharsetL( const TDesC8& aBufIn, TDes& rBufOut, |
|
71 TInt& rNumUnconvertedChars, |
|
72 TInt& rIndexOfFirstUnconvertedChar); |
|
73 IMPORT_C TInt ConvertFromOurCharsetL(const TDesC& aBufIn, TDes8& rBufOut, |
|
74 TInt& rNumUnconvertedChars, |
|
75 TInt& rIndexOfFirstUnconvertedChar); |
|
76 |
|
77 // MUST be called prior to calling above two functions. |
|
78 IMPORT_C TInt PrepareToConvertToFromOurCharsetL(const TUint aUid); |
|
79 |
|
80 IMPORT_C TUint GetMimeCharsetUidL(const TDesC8& aBufIn) const; |
|
81 IMPORT_C HBufC8* GetMimeCharsetTextStringL(const TUint& aUid) const; |
|
82 IMPORT_C TUint DefaultCharset() const; |
|
83 IMPORT_C TUint SystemDefaultCharset() const; |
|
84 |
|
85 static TInt StraightCopy( const TDesC8& aBufIn, TDes& rBufOut); |
|
86 static TInt StraightCopy( const TDesC& aBufIn, TDes8& rBufOut); |
|
87 private: |
|
88 void ConstructL(); |
|
89 CImConvertCharconv(CCnvCharacterSetConverter& aConverter, RFs& anFs); |
|
90 TBool CharsetAvailable(const TUint aUid); |
|
91 void SetSystemDefaultCharsetL(); |
|
92 |
|
93 TInt GetSystemCharsetFromCenRepL(TDes8& aMimeCharSet); |
|
94 |
|
95 enum TEmailGeneralSettingsCenRepId |
|
96 { |
|
97 EEmailGeneralCharSetId = 0x00000000 |
|
98 }; |
|
99 |
|
100 private: |
|
101 CCnvCharacterSetConverter& iConverter; |
|
102 CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iCharsetsAvailable; |
|
103 |
|
104 RFs& iFs; |
|
105 TUint iCharsetUid; |
|
106 TUint iSystemDefaultCharset; // Value obtained from .ini file |
|
107 TInt iCharconvState; |
|
108 }; |
|
109 |
|
110 #endif //__CIMCONVERTCHARCONV_H__ |