1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: General utilities for unified editor and plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __UNIEDITOR_GEN_UTILS_H__ |
|
19 #define __UNIEDITOR_GEN_UTILS_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <e32const.h> |
|
24 #include "muiuutilsdefines.h" |
|
25 #include "convergedmessage.h" |
|
26 #include "MsgMedia.hrh" |
|
27 |
|
28 const TInt KDefaultMaxSmsSize = 10; |
|
29 // Length of one 7bit normal sms |
|
30 const TInt KFirstNormalSmsLength = 160; |
|
31 // Length of one unicode sms |
|
32 const TInt KFirstUnicodeSmsLength = 70; |
|
33 // Submsg length for normal 7bit sms |
|
34 const TInt KNormalConcatenationInterval = 153; |
|
35 // Submsg length for unicode sms |
|
36 const TInt KUnicodeConcatenationInterval = 67; |
|
37 |
|
38 const TInt KMaxSmsSizeByStandard = 30; |
|
39 const TInt KDefaultSmsRecipients = 20; |
|
40 const TInt KDefaultMmsRecipients = 100; |
|
41 const TInt KDefaultMaxSize = 300 * 1024; |
|
42 const TInt KEstimatedMmsSmilHeaderSize = 2.4 * 1024; // 1Kb buffer for mime headers + 1.4Kb for smil |
|
43 const TInt KEstimatedMimeHeaderSize = 1400; |
|
44 |
|
45 class CMsgMediaResolver; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 class MUIU_UTILS_EXPORT UniEditorGenUtils |
|
49 { |
|
50 |
|
51 public: |
|
52 |
|
53 explicit UniEditorGenUtils(); |
|
54 |
|
55 ~UniEditorGenUtils(); |
|
56 |
|
57 public: |
|
58 /** |
|
59 * Returns the current Email-over-Sms settings |
|
60 * @param aSmsc |
|
61 * @param aDestinationAddress |
|
62 * @param aModifiable |
|
63 * @return Symbian OS standard error code |
|
64 */ |
|
65 TInt ReadEmailOverSmsSettingsL( |
|
66 TDes& aSmsc, |
|
67 TDes& aDestinationAddress, |
|
68 TBool& aModifiable ); |
|
69 |
|
70 /** |
|
71 * Writes the current Email-over-Sms settings to file |
|
72 * @param aSmsc service centre, used for Email over Sms |
|
73 * @param aDestinationAddress service number, used for Email over Sms |
|
74 * @param aModifiable to check if user is allowed to modify setting |
|
75 * @return Symbian OS standard error code |
|
76 */ |
|
77 TInt WriteEmailOverSmsSettingsL( |
|
78 const TDes& aSmsc, |
|
79 const TDes& aDestinationAddress, |
|
80 const TBool& aModifiable ); |
|
81 |
|
82 /** |
|
83 * Checks if phone is in offline mode or not |
|
84 * Make sure that offline feature has been checked |
|
85 * using feature manager |
|
86 * @return ETrue if phone is in offline mode, otherwise EFalse. |
|
87 */ |
|
88 TBool IsPhoneOfflineL(); |
|
89 |
|
90 /** |
|
91 * Checks if email addresses are supported over sms message type |
|
92 * using feature manager |
|
93 * @return ETrue if emailoversms is suppoted |
|
94 */ |
|
95 TBool AcceptEmailAddressesL(); |
|
96 |
|
97 /** |
|
98 * Checks if the given addresslist contains a valid email address |
|
99 * @param addr converged message address list |
|
100 * @return ETrue if list contains a valid email address |
|
101 */ |
|
102 TBool VerifyEmailAddressesL( ConvergedMessageAddressList addr); |
|
103 |
|
104 /** |
|
105 * Gets byte-size of UTF8 formatted text |
|
106 * @param aText |
|
107 * @return Size of text in bytes |
|
108 */ |
|
109 TInt UTF8Size( QString aText ); |
|
110 |
|
111 /** |
|
112 * Get maximum recipient count for sms from feature manager |
|
113 * @return max recipient count |
|
114 */ |
|
115 TInt MaxSmsRecipientsL(); |
|
116 |
|
117 /** |
|
118 * Get maximum recipient count for mms from feature manager |
|
119 * @return max recipient count |
|
120 */ |
|
121 TInt MaxMmsRecipientsL(); |
|
122 |
|
123 /** |
|
124 * Checks if a given address string is a valid email address |
|
125 * @param addr address string |
|
126 * @return ETrue if addr is valid email address |
|
127 */ |
|
128 TBool IsValidEmailAddress( QString addr ); |
|
129 |
|
130 /** |
|
131 * Calculates the size of the given message |
|
132 * @param msg ConvergedMessage |
|
133 * @return size of the converged message |
|
134 */ |
|
135 TInt CalculateMsgSize(ConvergedMessage& msg); |
|
136 |
|
137 /** |
|
138 * Get the maximum size allowed for mms |
|
139 * using feature manager |
|
140 * @return max mms size |
|
141 */ |
|
142 TInt MaxMmsMsgSizeL(); |
|
143 |
|
144 /** |
|
145 * get file's size and mimetype info |
|
146 * @param filePath IN path of file |
|
147 * @param size OUT size of the given file |
|
148 * Size includes filesize + max mime headers size |
|
149 * @param mimetype OUT mimetype of the given file |
|
150 * @param mediaType OUT media-type grouping of mimetype |
|
151 */ |
|
152 void getFileInfoL(QString filePath, |
|
153 int& size, |
|
154 QString& mimetype, |
|
155 TMsgMediaType& mediaType); |
|
156 |
|
157 /** |
|
158 * get max sms size limit from feature manager |
|
159 * @return max sms size limit |
|
160 */ |
|
161 int MaxSmsMsgSizeL(); |
|
162 |
|
163 /** |
|
164 * Convert digits from any digit format to another format eg. from |
|
165 * european digits to arabic-indic digits. |
|
166 * @param aDes Parameter to change. It can contain digits |
|
167 * from several digit types. |
|
168 * @param aDigitType Destination digit type. |
|
169 */ |
|
170 void ConvertDigitsTo( TDes& aDes, TDigitType aDigitType ); |
|
171 |
|
172 /** |
|
173 * Identifies the digit format |
|
174 * @param ch digit, whose format is to be recognized |
|
175 * @return digit format |
|
176 */ |
|
177 TChar NumberToBase(TChar ch); |
|
178 |
|
179 /** |
|
180 * Replace all control chars with a single character, |
|
181 * usually a whitespace. |
|
182 * @param aDes Parameter to change |
|
183 * @param aCharacters A set of characters to remove |
|
184 * @param aReplacement A character used as replacement |
|
185 */ |
|
186 void ReplaceCharacters(TDes &aDes, const TDesC &aChars, TChar aReplacement); |
|
187 |
|
188 private: |
|
189 /** |
|
190 * get sms character limits from feature manager |
|
191 * @param singlePartLength length of one part |
|
192 * @param concatenatedPartLength total length over all parts |
|
193 */ |
|
194 void getSmsCharacterLimits(int& singlePartLength, int& concatenatedPartLength); |
|
195 |
|
196 /** |
|
197 * checks if the character mode is unicode |
|
198 * @return ETrue if character mode is unicode |
|
199 */ |
|
200 bool unicodeCharacterMode(); |
|
201 |
|
202 /** |
|
203 * get the maximum number of parts for sms |
|
204 * using feature manager |
|
205 * @return max number of parts for the sms |
|
206 */ |
|
207 int absoluteMaxSmsPartsL(); |
|
208 |
|
209 /** |
|
210 * get the character limit for sms |
|
211 * using feature manager |
|
212 * @return sms character limit |
|
213 */ |
|
214 int absoluteMaxSmsCharactersL(); |
|
215 }; |
|
216 |
|
217 |
|
218 #endif //__UNIEDITOR_GEN_UTILS_H__ |
|
219 |
|
220 // End of file |
|