|
1 /* |
|
2 * Copyright (c) 2002-2007 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 * Sms Mtm Ui. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #if !defined(__SMSU_H__) |
|
22 #define __SMSU_H__ |
|
23 |
|
24 #if !defined(__MTMUIBAS_H__) |
|
25 #include <mtmuibas.h> // CBaseMtmUi |
|
26 #endif |
|
27 #if !defined(__SMSCLNT_H__) |
|
28 #include <barsc.h> // RResourceFile |
|
29 #include <smsclnt.h> // CSmsClientMtm |
|
30 #endif |
|
31 |
|
32 #include <centralrepository.h> |
|
33 #include <etelmm.h> |
|
34 #include <smutset.h> |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CMtmStore; |
|
38 class TCharFormatMask; |
|
39 class TCharFormat; |
|
40 class CPlainText; |
|
41 class CSmsNumber; |
|
42 class CTextResolver; |
|
43 class CSimDlgPluginInterface; |
|
44 // CONSTANTS |
|
45 const TInt KTBuf80Length = 80; |
|
46 // CLASS DECLARATION |
|
47 /** |
|
48 * CSmsMtmUi |
|
49 * Inherited from CBaseMtmUi |
|
50 */ |
|
51 NONSHARABLE_CLASS( CSmsMtmUi ) : public CBaseMtmUi |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 */ |
|
58 static CSmsMtmUi* NewL(CBaseMtm& aBaseMtm,CRegisteredMtmDll& aRegisteredMtmDll); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~CSmsMtmUi(); |
|
64 |
|
65 public: // Functions from base classes |
|
66 |
|
67 /** |
|
68 * From CBaseMtmUi |
|
69 * Function NOT dependent on the current context |
|
70 * Context set to new entry |
|
71 */ |
|
72 virtual CMsvOperation* CreateL(const TMsvEntry& aEntry, CMsvEntry& aParent, TRequestStatus& aStatus); |
|
73 |
|
74 /** |
|
75 * From CBaseMtmUi |
|
76 * Context-specific |
|
77 */ |
|
78 virtual CMsvOperation* OpenL(TRequestStatus& aStatus); |
|
79 |
|
80 /** |
|
81 * From CBaseMtmUi |
|
82 * Context-specific |
|
83 */ |
|
84 virtual CMsvOperation* CloseL(TRequestStatus& aStatus); |
|
85 |
|
86 /** |
|
87 * From CBaseMtmUi |
|
88 * Context-specific |
|
89 */ |
|
90 virtual CMsvOperation* EditL(TRequestStatus& aStatus); |
|
91 |
|
92 /** |
|
93 * From CBaseMtmUi |
|
94 * Context-specific |
|
95 */ |
|
96 virtual CMsvOperation* ViewL(TRequestStatus& aStatus); |
|
97 |
|
98 /** |
|
99 * From CBaseMtmUi |
|
100 * Context-specific |
|
101 */ |
|
102 virtual CMsvOperation* CancelL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection); |
|
103 |
|
104 /** |
|
105 * From CBaseMtmUi |
|
106 * Selections must be in same folder and all of the correct MTM type |
|
107 * Context may change after calling these functions |
|
108 */ |
|
109 virtual CMsvOperation* OpenL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection); |
|
110 |
|
111 /** |
|
112 * From CBaseMtmUi |
|
113 * Selections must be in same folder and all of the correct MTM type |
|
114 * Context may change after calling these functions |
|
115 */ |
|
116 virtual CMsvOperation* CloseL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection); |
|
117 |
|
118 /** |
|
119 * From CBaseMtmUi |
|
120 * Selections must be in same folder and all of the correct MTM type |
|
121 * Context may change after calling these functions |
|
122 */ |
|
123 virtual CMsvOperation* EditL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection); |
|
124 |
|
125 /** |
|
126 * From CBaseMtmUi |
|
127 * Selections must be in same folder and all of the correct MTM type |
|
128 * Context may change after calling these functions |
|
129 */ |
|
130 virtual CMsvOperation* ViewL(TRequestStatus& aStatus, const CMsvEntrySelection& aSelection); |
|
131 |
|
132 /** |
|
133 * From CBaseMtmUi |
|
134 * Deletes entries from the current context, which must be a folder or service of the relevant MTM |
|
135 */ |
|
136 virtual CMsvOperation* DeleteFromL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
137 |
|
138 /** |
|
139 * From CBaseMtmUi |
|
140 * Deletes service, which need not be the current context |
|
141 */ |
|
142 virtual CMsvOperation* DeleteServiceL(const TMsvEntry& aService, TRequestStatus& aStatus); |
|
143 |
|
144 /** |
|
145 * From CBaseMtmUi |
|
146 * Context-specific |
|
147 * Takes ownership of the passed entry (which the context is switched to ) |
|
148 */ |
|
149 virtual CMsvOperation* ReplyL(TMsvId aDestination, TMsvPartList aPartlist, TRequestStatus& aCompletionStatus); |
|
150 |
|
151 /** |
|
152 * From CBaseMtmUi |
|
153 * Context-specific |
|
154 * Takes ownership of the passed entry (which the context is switched to ) |
|
155 */ |
|
156 virtual CMsvOperation* ForwardL(TMsvId aDestination, TMsvPartList aPartList, TRequestStatus& aCompletionStatus); |
|
157 |
|
158 /** |
|
159 * From CBaseMtmUi |
|
160 * Context should be MTM folder/service to copy to |
|
161 */ |
|
162 virtual CMsvOperation* CopyToL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
163 |
|
164 /** |
|
165 * From CBaseMtmUi |
|
166 * Context should be MTM folder/service to move to |
|
167 */ |
|
168 virtual CMsvOperation* MoveToL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
169 |
|
170 /** |
|
171 * From CBaseMtmUi |
|
172 * Context should be MTM folder/service to copy from |
|
173 */ |
|
174 virtual CMsvOperation* CopyFromL(const CMsvEntrySelection& aSelection, TMsvId aTargetId, TRequestStatus& aStatus); |
|
175 |
|
176 /** |
|
177 * From CBaseMtmUi |
|
178 * Context should be MTM folder/service to move from |
|
179 */ |
|
180 virtual CMsvOperation* MoveFromL(const CMsvEntrySelection& aSelection, TMsvId aTargetId, TRequestStatus& aStatus); |
|
181 |
|
182 /** |
|
183 * From CBaseMtmUi |
|
184 * Interpret transfer progress |
|
185 */ |
|
186 virtual TInt DisplayProgressSummary(const TDesC8& aProgress) const; |
|
187 |
|
188 /** |
|
189 * From CBaseMtmUi |
|
190 */ |
|
191 virtual TInt QueryCapability(TUid aCapability, TInt& aResponse); |
|
192 |
|
193 /** |
|
194 * From CBaseMtmUi |
|
195 */ |
|
196 virtual void InvokeSyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter); |
|
197 |
|
198 /** |
|
199 * From CBaseMtmUi |
|
200 */ |
|
201 virtual CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TRequestStatus& aCompletionStatus, TDes8& aParameter); |
|
202 |
|
203 public: // new functions |
|
204 |
|
205 /** |
|
206 * Asyncronous function for displaying message info |
|
207 * @param aCompletionStatus |
|
208 * @param aParameter |
|
209 * @return pointer to started operation |
|
210 */ |
|
211 virtual CMsvOperation* ShowMessageInfoL(TRequestStatus& aCompletionStatus, TDes8& aParameter) const; |
|
212 |
|
213 /** |
|
214 * Syncronous function for displaying message info |
|
215 * @return |
|
216 */ |
|
217 virtual void ShowMessageInfoL() const; |
|
218 |
|
219 /** |
|
220 * Enumerations for different editor types |
|
221 * (used below) |
|
222 */ |
|
223 enum TEditorType |
|
224 { |
|
225 EReadOnly, |
|
226 EEditExisting, |
|
227 ECreateNewMessage |
|
228 }; |
|
229 |
|
230 /** |
|
231 * Returns a pointer to current textbody |
|
232 * @param aStatus |
|
233 * @param aSession |
|
234 * @param aEditorType |
|
235 * @param aParentId |
|
236 * @return pointer to started operation |
|
237 */ |
|
238 virtual CMsvOperation* LaunchEditorApplicationL( |
|
239 TRequestStatus& aStatus, |
|
240 CMsvSession& aSession, |
|
241 TEditorType aEditorType = EEditExisting, |
|
242 TMsvId aParentId = KMsvDraftEntryIdValue ); |
|
243 |
|
244 protected: // Functions from base classes |
|
245 |
|
246 /** |
|
247 * from CBaseMtmUi |
|
248 */ |
|
249 virtual void GetResourceFileName( TFileName& aFileName ) const; |
|
250 |
|
251 /** |
|
252 * Performs CopyToL or MoveToL operation |
|
253 * @param aSelection the entries to be sent |
|
254 * @param aStatus follows the operation progress |
|
255 * @param aCopyOnly defines is it copy or move |
|
256 * @return pointer to started operation |
|
257 */ |
|
258 virtual CMsvOperation* CopyMoveToL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus, TBool aCopyOnly); |
|
259 |
|
260 protected: // New functions |
|
261 |
|
262 /** |
|
263 * Ensures that the TMsvEntry is a suitable candidate for treatment by |
|
264 * this MtmUi layer. |
|
265 * @param aEntry as to be checked entry |
|
266 * @return boolean-answer |
|
267 */ |
|
268 virtual TBool CheckEntry( const TMsvEntry& aEntry ) const; |
|
269 |
|
270 /** |
|
271 * Launch the service settings dialog on the current entry |
|
272 * @param aStatus follows the operation progress |
|
273 * @return pointer to started operation |
|
274 */ |
|
275 virtual CMsvOperation* LaunchSettingsDialogL( TRequestStatus& aStatus ); |
|
276 |
|
277 /** |
|
278 * Creates Sms Service |
|
279 * @param aNoServiceNoCheckNeeded is check needed or not |
|
280 * @return id of service |
|
281 */ |
|
282 virtual TMsvId CreateSmsServiceL( TBool aNoServiceNoCheckNeeded ); |
|
283 |
|
284 /** |
|
285 * Returns service's id |
|
286 * @return id of service |
|
287 */ |
|
288 virtual TMsvId ServiceIdL(); |
|
289 |
|
290 /** |
|
291 * Actual Sms service default creator |
|
292 * @param aServiceId of service |
|
293 */ |
|
294 virtual void CreateDefaultSettingsL( TMsvId aServiceId, TBool aMailInit = EFalse ); |
|
295 |
|
296 /** |
|
297 * Reads default / variated settings from shared data |
|
298 * @param aServiceSettings pointer to service |
|
299 */ |
|
300 virtual void ReadDefaultSettingsFromSharedDataL( CSmsSettings* aServiceSettings ); |
|
301 |
|
302 /** |
|
303 * Copies service centres from old to new settings |
|
304 * @param aServiceSettings pointer to service |
|
305 */ |
|
306 virtual void CopySCentresFromOldToNewSettingsL( CSmsSettings* aServiceSettings ); |
|
307 |
|
308 /** |
|
309 * Take the name and number fields from the recipients array and concaternate them |
|
310 * together, putting <> around the numbers and separating recipients with a comma |
|
311 * @return pointer to descriptor |
|
312 */ |
|
313 virtual HBufC* TurnRecipientsArrayIntoStringLC( |
|
314 const CArrayPtrFlat<CSmsNumber>& aRecip, |
|
315 const TBool aEmailMessage = EFalse ) const; |
|
316 |
|
317 /** |
|
318 * Extracts title from GMS body NOTE : IS THIS STILL NEEDED? |
|
319 * Extracts up to aMaxLength of the text from a picture message. |
|
320 * the format of the body will be blocks of the following: |
|
321 * <type> <length> <contents> |
|
322 * where type is a code indicating text or picture. |
|
323 * this code is based on functions in CGmsModel from gmsbc which |
|
324 * unfortunately aren't exported, so I've had to copy bits. |
|
325 * @param aBody textbody descriptor |
|
326 * @param aMaxLength tells how long description is wanted |
|
327 * @return pointer to descriptor |
|
328 */ |
|
329 virtual HBufC* ExtractTitleFromGMSBodyL( const CRichText& aBody, TInt aMaxLength ) const; |
|
330 |
|
331 /** |
|
332 * Returns a pointer to Sms Client Mtm |
|
333 * @return reference to Sms Client Mtm |
|
334 */ |
|
335 inline CSmsClientMtm& SmsClientMtm() const { return STATIC_CAST( CSmsClientMtm&, BaseMtm());}; |
|
336 |
|
337 /** |
|
338 * Function to set shared data variables up to date for other apps to observe for example |
|
339 * creation of sms service |
|
340 * @param afile shared data file which is modified |
|
341 * @param aKey key in file which is modified |
|
342 * @param aValue new value for the key |
|
343 */ |
|
344 virtual void SetSharedDataL( const TUint32 aId, const TInt aVal ); |
|
345 /** |
|
346 * Enums for return values of CheckAndEnsureSmsServiceOkL |
|
347 */ |
|
348 enum TSmumSmsReCreation |
|
349 { |
|
350 ESmsReCreatedNone = 0, |
|
351 ESmsReCreatedService, |
|
352 ESmsReCreatedServicesStore, |
|
353 ESmsReCreatedBoth |
|
354 }; |
|
355 |
|
356 /** |
|
357 * Checks do we have sms service and store for it, if not creates (if wanted) |
|
358 * one with default settings |
|
359 * @param aCreateService if missing create one |
|
360 * @param aCreateStore if missing create one |
|
361 * @param aFetchSMSCs if something recreated fetch SMSCs from SIM |
|
362 * @return TInt enum TSmumSmsReCreation tells what was done |
|
363 */ |
|
364 virtual TInt CheckAndEnsureSmsServiceOkL( |
|
365 TBool aCreateService, |
|
366 TBool aCreateStore, |
|
367 TBool aFetchSMSCs ); |
|
368 |
|
369 /** |
|
370 * Reads SMSCs from SIM. A bit slow operation. |
|
371 * @return TInt errorcode |
|
372 */ |
|
373 virtual TInt ReadSMSCsFromSIML(); |
|
374 |
|
375 /** |
|
376 * Checks the SIM status |
|
377 * @return TInt, value of sim state |
|
378 */ |
|
379 virtual TInt CheckSimStateL(); |
|
380 |
|
381 /** |
|
382 * Extracts all the required data from the mtm, populates a message info array |
|
383 * and passes this array to the message info dialog class which displays the |
|
384 * dialog. |
|
385 * This is used for sms's and also created bio messages (which use sms as the |
|
386 * bearer). |
|
387 * @return |
|
388 */ |
|
389 virtual void ConstructAndShowInfoDialogL() const; |
|
390 |
|
391 /** |
|
392 * Extracts subject text from message body text |
|
393 * @since Series 60 2.8 |
|
394 * @param aTEntry, entry which to determine the right message type |
|
395 * @param aSmsClientMtm, mtm from which the subject is extract |
|
396 * @param aSubject buffer to hold the extracted subject text |
|
397 * @param aIsEmailMessage True if message TP-PID is set to interworking |
|
398 * with email |
|
399 */ |
|
400 virtual void GetSubjectTextL( |
|
401 const TMsvEntry& aTEntry, |
|
402 const CSmsClientMtm& aSmsClientMtm, |
|
403 HBufC*& aSubject, |
|
404 TBool aIsEmailMessage = EFalse ) const; |
|
405 |
|
406 /** |
|
407 * Returns the resource id according to TMsvEntry type |
|
408 * @since Series 60 2.8 |
|
409 * @param aTEntry, entry which is used to find the correct resource id |
|
410 * @return, resource id for TMsvEntry type |
|
411 */ |
|
412 virtual TInt GetBioResourceId( const TMsvEntry& aTEntry ) const; |
|
413 |
|
414 /** |
|
415 * Checks if the message bio type is supported |
|
416 * @since Series 60 2.8 |
|
417 * @param aTEntry, entry which is used to check if type is supported or not |
|
418 * @return, ETrue if supported otherwise EFalse |
|
419 */ |
|
420 virtual TBool IsBioTypeSupported( const TMsvEntry& aTEntry ) const; |
|
421 |
|
422 protected: |
|
423 |
|
424 /** |
|
425 * By default Symbian OS constructor is private. |
|
426 */ |
|
427 virtual void ConstructL(); |
|
428 |
|
429 /** |
|
430 * Constructor (accessible only through factory function) |
|
431 */ |
|
432 CSmsMtmUi(CBaseMtm& aBaseMtm,CRegisteredMtmDll& aRegisteredMtmDll); |
|
433 |
|
434 protected: // Data |
|
435 TBool iNewSmsSettings; |
|
436 CTextResolver* iErrorResolver; |
|
437 // Central Repository session |
|
438 CRepository* iCenRepSession; |
|
439 CSimDlgPluginInterface* iSimDlgPluginIntf; |
|
440 RTelServer iServer; |
|
441 RMobilePhone iPhone; |
|
442 }; |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 // CLASS DECLARATION |
|
449 /** |
|
450 * TSmsSmumProgress |
|
451 */ |
|
452 |
|
453 NONSHARABLE_CLASS( TSmsSmumProgress )// : public TSmsProgress |
|
454 { |
|
455 public : |
|
456 |
|
457 /** |
|
458 * Enumerations for different progress types |
|
459 * (used below) |
|
460 */ |
|
461 enum TSmsSmumProgressType |
|
462 { |
|
463 ESmsSmumFirstProgType = TSmsProgress::ESmsProgressTypeDefault+200, |
|
464 ESmsSmumSmsOpening, |
|
465 ESmsSmumLastProgType |
|
466 }; |
|
467 |
|
468 public : //data |
|
469 TInt iError; |
|
470 TSmsSmumProgressType iType; |
|
471 }; |
|
472 |
|
473 typedef TPckgBuf<TSmsSmumProgress> TSmsSmumProgressBuf; |
|
474 |
|
475 #endif // __SMSU_H__ |
|
476 |
|
477 |
|
478 |
|
479 // End of File |