|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __UNIEDITORSMSPLUGINPRIVATE_H |
|
19 #define __UNIEDITORSMSPLUGINPRIVATE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <msvapi.h> |
|
23 #include <gsmuelem.h> |
|
24 #include <mtclbase.h> |
|
25 #include "unieditorplugininterface.h" |
|
26 #include "UniSendingSettings.h" |
|
27 |
|
28 // DATA TYPES |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CClientMtmRegistry; |
|
32 class CSmsClientMtm; |
|
33 class CSmsHeader; |
|
34 class CParaFormatLayer; |
|
35 class CCharFormatLayer; |
|
36 class CRichText; |
|
37 class CMsgSmsEmailOverSmsFunc; |
|
38 class CSmsNumber; |
|
39 class CSmsMessage; |
|
40 class ConvergedMessage; |
|
41 class UniEditorGenUtils; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * UniEditorSmsPluginPrivate |
|
47 */ |
|
48 class UniEditorSmsPluginPrivate :public MMsvSessionObserver |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 */ |
|
55 static UniEditorSmsPluginPrivate* NewL(); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~UniEditorSmsPluginPrivate(); |
|
61 |
|
62 public: // From CUniEditorPlugin |
|
63 |
|
64 /** |
|
65 * load sms headers either from store, if provided, |
|
66 * or from global settings |
|
67 * @param aStore message store |
|
68 */ |
|
69 void LoadHeadersL( CMsvStore* aStore ); |
|
70 |
|
71 /** |
|
72 * Converts message from message store into ConvergedMessage |
|
73 * based on the operation |
|
74 * @param TMsvId id |
|
75 * @param aOperation operation type |
|
76 * @return ConvergedMessage object is returned in successfull cases and |
|
77 * NULL is returned in failure cases. The ownership of the object |
|
78 * is transferred to the caller. |
|
79 */ |
|
80 ConvergedMessage* ConvertFromL( TMsvId aId, |
|
81 UniEditorPluginInterface::EditorOperation aOperation ); |
|
82 |
|
83 /** |
|
84 * convert convergedmessage type to a message entry in store |
|
85 * @param message convergedmessage |
|
86 * @return message entry id |
|
87 */ |
|
88 TMsvId ConvertToL( ConvergedMessage* message ); |
|
89 |
|
90 /** |
|
91 * send a message |
|
92 * @aId message entry id |
|
93 */ |
|
94 void SendL( TMsvId aId ); |
|
95 |
|
96 /** |
|
97 * validate settings |
|
98 * @param aEmailOverSms if email over sms is supported or not |
|
99 */ |
|
100 TBool ValidateServiceL( TBool aEmailOverSms = EFalse ); |
|
101 |
|
102 /** |
|
103 * validate the service |
|
104 */ |
|
105 TBool IsServiceValidL(); |
|
106 |
|
107 /** |
|
108 * set unicode mode to true/false |
|
109 */ |
|
110 inline void SetUnicodeMode( TBool aUnicodeMode ); |
|
111 |
|
112 //Turkish SMS(PREQ2265) specific... |
|
113 void SetEncodingSettingsL(TBool aUnicodeMode, TSmsEncoding aAlternativeEncodingType, TInt charSupportType); |
|
114 |
|
115 /** |
|
116 * for deciding on reduced or full charset support |
|
117 */ |
|
118 void GetNumPDUsL ( |
|
119 TDesC& aBuf, |
|
120 TInt& aNumOfRemainingChars, |
|
121 TInt& aNumOfPDUs, |
|
122 TBool& aUnicodeMode, |
|
123 TSmsEncoding& aAlternativeEncodingType); |
|
124 |
|
125 /** |
|
126 * delete entry aId from drafts folder |
|
127 * @param aId entry to be deleted |
|
128 */ |
|
129 void DeleteDraftsEntryL( TMsvId aId ); |
|
130 |
|
131 private: // Constructors |
|
132 |
|
133 /** |
|
134 * C++ default constructor. |
|
135 */ |
|
136 UniEditorSmsPluginPrivate(); |
|
137 |
|
138 /** |
|
139 * By default Symbian 2nd phase constructor is private. |
|
140 */ |
|
141 void ConstructL(); |
|
142 |
|
143 /** |
|
144 * Returns pointer to iSmsMtm member variable |
|
145 */ |
|
146 CSmsClientMtm* SmsMtmL(); |
|
147 |
|
148 /** |
|
149 * Moves message into outbox for sending and creates copies of SMS messages |
|
150 * into outbox in case of multiple recipients |
|
151 */ |
|
152 void MoveMessagesToOutboxL(); |
|
153 |
|
154 /** |
|
155 * Called in MoveMessagesToOutboxL, calls the actual moving |
|
156 * function |
|
157 */ |
|
158 TMsvId MoveMessageEntryL( TMsvId aTarget ); |
|
159 |
|
160 |
|
161 /** |
|
162 * Creates messages into the Outbox if there are several recipients |
|
163 * @param TMsvEntry& a reference to entry to be copied |
|
164 * @param CSmsNumber& a reference to CSmsNumber to be copied |
|
165 * @param CRichText& a reference to msg body contents |
|
166 * @return TMsvId of the created msg entry |
|
167 */ |
|
168 TMsvId CreateMessageInOutboxL( |
|
169 const TMsvEntry& aEntry, |
|
170 const CSmsNumber& aRecipient, |
|
171 const CRichText& aBody ); |
|
172 |
|
173 /** |
|
174 * Creates messages into the Outbox if there are several recipients |
|
175 * and the message is E-Mail over SMS message |
|
176 * @param aEntry a reference to entry to be copied |
|
177 * @param aAddress a reference to address to be copied |
|
178 * @return TMsvId of the created msg entry |
|
179 */ |
|
180 virtual TMsvId CreateMessageInOutboxL( |
|
181 const TMsvEntry& aEntry, |
|
182 const TDesC& aAddress ); |
|
183 |
|
184 |
|
185 /** |
|
186 * Calls the actual sending method of SMS Client MTM |
|
187 */ |
|
188 void SetScheduledSendingStateL( CMsvEntrySelection* aSelection ); |
|
189 |
|
190 /** |
|
191 * Extracts name and address |
|
192 */ |
|
193 void NameAndAddress( const TDesC& aMsvAddress, TPtrC& aName, TPtrC& aAddress ); |
|
194 |
|
195 /** |
|
196 * Creates text for TMsvEntry::iDescription. It could be subject or |
|
197 * if subject does not exist a beginning of the message body |
|
198 */ |
|
199 void ExtractDescriptionFromMessageL( |
|
200 const CSmsMessage& aMessage, |
|
201 TDes& aDescription, |
|
202 TInt aMaxLength); |
|
203 |
|
204 /** |
|
205 * Copies text from attachment into the body of the SMS |
|
206 */ |
|
207 void CreatePlainTextSMSL( RFile& aFile ); |
|
208 |
|
209 /** |
|
210 * Insert subject into the body of the SMS |
|
211 */ |
|
212 void InsertSubjectL( CSmsHeader& aHeader, CRichText& aText ); |
|
213 |
|
214 /** |
|
215 * Copies data from VCard attachment into body of the SMS |
|
216 */ |
|
217 void CreateVCardSMSL( RFile& aFile ); |
|
218 |
|
219 /** |
|
220 * Copies data from VCCalendar attachment into body of the SMS |
|
221 */ |
|
222 void CreateVCalSMSL( RFile& aFile ); |
|
223 |
|
224 /** |
|
225 * Checks service center address |
|
226 */ |
|
227 TBool ValidateSCNumberL(); |
|
228 |
|
229 /** |
|
230 * Checks service center address for E-Mail over SMS messages |
|
231 */ |
|
232 TBool ValidateSCNumberForEmailOverSmsL(); |
|
233 |
|
234 /** |
|
235 * Saves E-Mail specific information in header |
|
236 */ |
|
237 void FillEmailInformationDataL( CSmsHeader& aHeader, const TPtrC& aAddress ); |
|
238 |
|
239 /** |
|
240 * Checks if the address is E-Mail address |
|
241 */ |
|
242 TBool IsEmailAddress( const TPtrC& aAddress ) const; |
|
243 |
|
244 /** |
|
245 * Converts sms message to uni message format. |
|
246 * @param aId message id |
|
247 * @param [OUT]aMessage convergedmessage |
|
248 * @param aOperation operation type |
|
249 */ |
|
250 void DoConvertFromL( TMsvId aId, |
|
251 ConvergedMessage* aMessage, |
|
252 UniEditorPluginInterface::EditorOperation aOperation ); |
|
253 |
|
254 /** |
|
255 * create Sms entry into draft folder |
|
256 */ |
|
257 TMsvId CreateNativeSmsL(); |
|
258 |
|
259 /** |
|
260 * set/update sms settings |
|
261 */ |
|
262 void SetSmsSettingsL(); |
|
263 |
|
264 /** |
|
265 * set data to the sms |
|
266 */ |
|
267 void SetSmsDataL(ConvergedMessage* message); |
|
268 |
|
269 /** |
|
270 * set recipient / subject to the message entry |
|
271 */ |
|
272 void SetSmsHeaderL(ConvergedMessage* message); |
|
273 |
|
274 /** |
|
275 * set body text from converged message into |
|
276 * message entry in store |
|
277 */ |
|
278 void SetSmsBodyL(ConvergedMessage* message); |
|
279 |
|
280 /** |
|
281 * set attachment info from converged message into |
|
282 * message entry in store |
|
283 */ |
|
284 void SetSmsAttachmentsL(ConvergedMessage* message); |
|
285 |
|
286 /** |
|
287 * create attachment in message store for the |
|
288 * message under composition |
|
289 * @param aFilePath file for which attachment is created |
|
290 * @param aStore message store |
|
291 */ |
|
292 void CreateAttachmentL(CMsvStore* aStore, const TDesC& aFilePath); |
|
293 |
|
294 /** |
|
295 * Populates address feilds into converged message |
|
296 */ |
|
297 void populateRecipientsL(ConvergedMessage* aMessage); |
|
298 |
|
299 /** |
|
300 * Populates body into converged message |
|
301 */ |
|
302 void populateMessageBodyL(ConvergedMessage* aMessage, |
|
303 TMsvEntry &aEntry); |
|
304 |
|
305 /** |
|
306 * @see MMsvSessionObserver |
|
307 */ |
|
308 void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, |
|
309 TAny* aArg3); |
|
310 |
|
311 private: // Data |
|
312 |
|
313 /** |
|
314 * message service session |
|
315 * Owned |
|
316 */ |
|
317 CMsvSession* iSession; |
|
318 |
|
319 /** |
|
320 * Mtm registry |
|
321 * Owned |
|
322 */ |
|
323 CClientMtmRegistry* iMtmRegistry; |
|
324 |
|
325 /** |
|
326 * sms mtm |
|
327 * Owned |
|
328 */ |
|
329 CSmsClientMtm* iSmsMtm; |
|
330 |
|
331 /** |
|
332 * sms service id |
|
333 */ |
|
334 TMsvId iSmsServiceId; |
|
335 |
|
336 /** |
|
337 * sms header |
|
338 * Owned |
|
339 */ |
|
340 CSmsHeader* iSmsHeader; |
|
341 |
|
342 /** |
|
343 * Owned |
|
344 */ |
|
345 CParaFormatLayer* iParaFormatLayer; |
|
346 |
|
347 /** |
|
348 * Owned |
|
349 */ |
|
350 CCharFormatLayer* iCharFormatLayer; |
|
351 |
|
352 /** |
|
353 * Owned |
|
354 */ |
|
355 CRichText* iRichText; |
|
356 |
|
357 /** |
|
358 * recipient array |
|
359 * Owned |
|
360 */ |
|
361 CDesCArray* iRecipients; |
|
362 |
|
363 /** |
|
364 * flag for biomsg distinction |
|
365 */ |
|
366 TBool iBioMsg; |
|
367 |
|
368 enum TUniPluginPanic |
|
369 { |
|
370 EIllegalArguments |
|
371 }; |
|
372 |
|
373 /** |
|
374 * email gateway address/alias |
|
375 * Owned |
|
376 */ |
|
377 CSmsNumber* iEmailOverSmsC; |
|
378 |
|
379 /** |
|
380 * flag for setting unicodemode true/false |
|
381 */ |
|
382 TBool iUnicodeMode; |
|
383 |
|
384 /** |
|
385 * feature flag to check if offline is supported or not |
|
386 */ |
|
387 TBool iOfflineSupported; |
|
388 |
|
389 //Turkish SMS(PREQ2265) specific... |
|
390 TInt iCharSupportType; |
|
391 TSmsEncoding iAlternativeEncodingType; |
|
392 TBool iNLTFeatureSupport; |
|
393 |
|
394 /** |
|
395 * general utility class |
|
396 * Owned |
|
397 */ |
|
398 UniEditorGenUtils* iGenUtils; |
|
399 }; |
|
400 |
|
401 inline void UniEditorSmsPluginPrivate::SetUnicodeMode( TBool aUnicodeMode ) |
|
402 { |
|
403 iUnicodeMode = aUnicodeMode; |
|
404 } |
|
405 |
|
406 #endif // __UNIEDITORSMSPLUGINPRIVATE_H |
|
407 |
|
408 // End of File |