author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 09:45:25 +0300 | |
changeset 52 | 12db4185673b |
parent 31 | ebfee66fde93 |
child 70 | a15d9966050f |
permissions | -rw-r--r-- |
31 | 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 |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
48 |
class MUIU_UTILS_EXPORT UniEditorGenUtils :public CBase |
31 | 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 |
* Calculates the size of the given message |
|
125 |
* @param msg ConvergedMessage |
|
126 |
* @return size of the converged message |
|
127 |
*/ |
|
128 |
TInt CalculateMsgSize(ConvergedMessage& msg); |
|
129 |
||
130 |
/** |
|
131 |
* Get the maximum size allowed for mms |
|
132 |
* using feature manager |
|
133 |
* @return max mms size |
|
134 |
*/ |
|
135 |
TInt MaxMmsMsgSizeL(); |
|
136 |
||
137 |
/** |
|
138 |
* get file's size and mimetype info |
|
139 |
* @param filePath IN path of file |
|
140 |
* @param size OUT size of the given file |
|
141 |
* Size includes filesize + max mime headers size |
|
142 |
* @param mimetype OUT mimetype of the given file |
|
143 |
* @param mediaType OUT media-type grouping of mimetype |
|
144 |
*/ |
|
145 |
void getFileInfoL(QString filePath, |
|
146 |
int& size, |
|
147 |
QString& mimetype, |
|
148 |
TMsgMediaType& mediaType); |
|
149 |
||
150 |
/** |
|
151 |
* get max sms size limit from feature manager |
|
152 |
* @param unicode if set to true limits |
|
153 |
* will be based on Unicode charset |
|
154 |
* @return max sms size limit |
|
155 |
*/ |
|
156 |
int MaxSmsMsgSizeL(bool unicode=false); |
|
157 |
||
158 |
/** |
|
159 |
* Convert digits from any digit format to another format eg. from |
|
160 |
* european digits to arabic-indic digits. |
|
161 |
* @param aDes Parameter to change. It can contain digits |
|
162 |
* from several digit types. |
|
163 |
* @param aDigitType Destination digit type. |
|
164 |
*/ |
|
165 |
void ConvertDigitsTo( TDes& aDes, TDigitType aDigitType ); |
|
166 |
||
167 |
/** |
|
168 |
* Identifies the digit format |
|
169 |
* @param ch digit, whose format is to be recognized |
|
170 |
* @return digit format |
|
171 |
*/ |
|
172 |
TChar NumberToBase(TChar ch); |
|
173 |
||
174 |
/** |
|
175 |
* Replace all control chars with a single character, |
|
176 |
* usually a whitespace. |
|
177 |
* @param aDes Parameter to change |
|
178 |
* @param aCharacters A set of characters to remove |
|
179 |
* @param aReplacement A character used as replacement |
|
180 |
*/ |
|
181 |
void ReplaceCharacters(TDes &aDes, const TDesC &aChars, TChar aReplacement); |
|
182 |
||
183 |
/** |
|
184 |
* Checks if a given address string is a valid email address |
|
185 |
* @param addr address string |
|
186 |
* @return ETrue if addr is valid email address |
|
187 |
*/ |
|
188 |
TBool IsValidEmailAddress( const TDesC& aAddress ); |
|
189 |
||
190 |
private: |
|
191 |
/** |
|
192 |
* get sms character limits from feature manager |
|
193 |
* @param singlePartLength length of one part |
|
194 |
* @param concatenatedPartLength total length over all parts |
|
195 |
* @param unicode if set to true limits |
|
196 |
* will be based on Unicode charset |
|
197 |
*/ |
|
198 |
void getSmsCharacterLimits(int& singlePartLength, |
|
199 |
int& concatenatedPartLength, |
|
200 |
bool unicode); |
|
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 |
* validate the domain portion of an email address |
|
218 |
*/ |
|
219 |
TBool IsValidDomain ( const TDesC& aDomain ); |
|
220 |
||
221 |
private: //data |
|
222 |
/** |
|
223 |
* Read only once for optimization purpose |
|
224 |
* Max number of parts allowed for sms msgs |
|
225 |
*/ |
|
226 |
int mAbsMaxConcatenatedSms; |
|
227 |
||
228 |
/** |
|
229 |
* Read only once for optimization purpose |
|
230 |
* Character limit for sms msgs |
|
231 |
*/ |
|
232 |
int mAbsMaxSmsCharacters; |
|
233 |
||
234 |
/** |
|
235 |
* Read only once for optimization purpose |
|
236 |
* MMS size limit |
|
237 |
*/ |
|
238 |
int mMaxMmsSize; |
|
239 |
}; |
|
240 |
||
241 |
||
242 |
#endif //__UNIEDITOR_GEN_UTILS_H__ |
|
243 |
||
244 |
// End of file |