|
1 /* |
|
2 * Copyright (c) 2002-2006 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: This class offers single ECOM interface to all SendUi MTM plugins. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_GENERICMTMPLUGIN_H |
|
22 #define C_GENERICMTMPLUGIN_H |
|
23 |
|
24 |
|
25 #include <ConeResLoader.h> |
|
26 #include <msvapi.h> |
|
27 #include <txtmrtsr.h> |
|
28 #include <cmsvrecipientlist.h> |
|
29 #include <TSendingCapabilities.h> |
|
30 |
|
31 #include <CMessageAddress.h> |
|
32 #include <CSendingService.h> |
|
33 |
|
34 class CSendingServiceInfo; |
|
35 class CMessageData; |
|
36 class CClientMtmRegistry; |
|
37 class TSendingCapabilities; |
|
38 class CAknContextPane; |
|
39 class CAknWaitDialog; |
|
40 class CBaseMtmUi; |
|
41 class CBioMsgBlacklist; |
|
42 class CBaseMtmUiData; |
|
43 class CMtmUiDataRegistry; |
|
44 class CMtmUiRegistry; |
|
45 class CSendUiAttachment; |
|
46 class CSendUiSingleton; |
|
47 |
|
48 /** |
|
49 * Offers single ECOM interface to all SendUi MTM plugins. |
|
50 * |
|
51 * @lib genericmtmplugin |
|
52 * @since S60 S60 v3.2 |
|
53 */ |
|
54 NONSHARABLE_CLASS( CGenericMtmPlugin ) : public CSendingService, |
|
55 public MRichTextStoreResolver |
|
56 { |
|
57 |
|
58 public: |
|
59 |
|
60 static CGenericMtmPlugin* NewL( TSendingServiceParams* aParams ); |
|
61 |
|
62 virtual ~CGenericMtmPlugin(); |
|
63 |
|
64 /** |
|
65 * Initializes sending. |
|
66 * |
|
67 * @since S60 v.3.2 |
|
68 * @return None. |
|
69 */ |
|
70 TBool InitializeSendingL(); |
|
71 |
|
72 // from base class CSendingService |
|
73 |
|
74 /** |
|
75 * From CSendingService |
|
76 * Populates given list with the provided services. |
|
77 * |
|
78 * @since Series 60 v3.2 |
|
79 * @param aList Service list to be populated. |
|
80 * @return None |
|
81 */ |
|
82 void PopulateServicesListL( RPointerArray<CSendingServiceInfo>& aList ); |
|
83 |
|
84 /** |
|
85 * From CSendingService |
|
86 * Creates and sends message via selected MTM |
|
87 * |
|
88 * @since Series 60 v3.2 |
|
89 * @param aServiceUid Uid of the sending service. |
|
90 * @param aMessageData Data for the message. |
|
91 * @param aLaunchEditorEmbedded True, if editor is to be launched embedded |
|
92 */ |
|
93 void CreateAndSendMessageL( |
|
94 TUid aMtmUid, |
|
95 const CMessageData* aMessageData, |
|
96 TBool aLaunchEditorEmbedded ); |
|
97 |
|
98 /** |
|
99 * From CSendingService |
|
100 * Returns the id of the service provider. |
|
101 * |
|
102 * @since Series 60 3.0 |
|
103 * @return Id of the service provider. |
|
104 */ |
|
105 TUid ServiceProviderId() const; |
|
106 |
|
107 |
|
108 private: |
|
109 |
|
110 CGenericMtmPlugin( CCoeEnv& aCoeEnv, CSendUiSingleton& aSingleton ); |
|
111 |
|
112 void ConstructL( ); |
|
113 |
|
114 // from base class MRichTextResolver |
|
115 |
|
116 /** |
|
117 * Returns pointer to stream store |
|
118 * |
|
119 * @since Series 60 v3.2 |
|
120 * @param Not used. |
|
121 */ |
|
122 const CStreamStore& StreamStoreL(TInt) const; |
|
123 |
|
124 |
|
125 // New functions |
|
126 private: |
|
127 |
|
128 /** |
|
129 * Start syncronous MTM scanning process |
|
130 * |
|
131 * @since Series 60 3.0 |
|
132 */ |
|
133 void ScanMtmsL( RPointerArray<CSendingServiceInfo>& aList ); |
|
134 |
|
135 |
|
136 /** |
|
137 * Validates attachments |
|
138 * |
|
139 * Checks relevant validity information depended on the file type and |
|
140 * sending service. Possible checks are file integrity, MMS and DRM |
|
141 * validity checks |
|
142 * |
|
143 * @since Series 60 2.8 |
|
144 * @param aMtmUid Chosen sending service |
|
145 * @param aMessageData Message data |
|
146 * @param aValidAttachmentPaths Array of file paths |
|
147 * @param aValidAttachments Array of open file handles |
|
148 * @return ETrue, if all attachments are valid or user has accepted sending |
|
149 * possibly corrupted files or files that receiver cannot open. |
|
150 */ |
|
151 TBool ValidateAttachmentsL( |
|
152 TUid aMtmUid, |
|
153 CBaseMtmUiData& aMtmUiData, |
|
154 CArrayPtrFlat<CSendUiAttachment>* aAttachments ); |
|
155 |
|
156 /** |
|
157 * Determines if a wait note is needed |
|
158 * |
|
159 * If there are attachments or body text, then wait note is required. |
|
160 * |
|
161 * @since Series 60 2.8 |
|
162 * @param aMtmUid Chosen sending service |
|
163 * @param aMessageData Message data |
|
164 * @param aAttachmentCount Number of attachments including file paths and file handles |
|
165 * @return ETrue, if note required. Otherwise EFalse. |
|
166 */ |
|
167 TBool IsWaitNoteNeededL( |
|
168 TUid aMtmUid , |
|
169 const CMessageData& aMessageData, |
|
170 TInt aAttachmentCount ); |
|
171 |
|
172 /** |
|
173 * Shows wait note |
|
174 * |
|
175 * @since Series 60 2.8 |
|
176 */ |
|
177 void ShowWaitNoteLC(); |
|
178 |
|
179 /** |
|
180 * Resets sending state of SendUi by cleaning the cleanupitem |
|
181 * |
|
182 * @since Series 60 2.8 |
|
183 * @param aAny Sending state |
|
184 * @return EFalse Sending state |
|
185 */ |
|
186 static void ResetIsSending(TAny* aAny); |
|
187 |
|
188 /** |
|
189 * Destroys wait dialog. |
|
190 * |
|
191 * Called from CleanupStack. |
|
192 * |
|
193 * @since Series 60 2.8 |
|
194 * @param aAny CAknWaitDialog pointer |
|
195 */ |
|
196 static void CleanupWaitDialog(TAny* aAny); |
|
197 void CreateMessageL( TUid& aMtmUid, |
|
198 TMsvId aService ); |
|
199 |
|
200 /** |
|
201 * Creates message |
|
202 * |
|
203 * Validates the given MTM and creates a message to the MTM |
|
204 * |
|
205 * @since Series 60 2.8 |
|
206 * @param aMtmUid Chosen sending service |
|
207 * @param aLaunchEmbedded ETrue, if editor is to be launched embedded |
|
208 */ |
|
209 TBool CreateMessageL( |
|
210 TUid& aMtmUid, |
|
211 TBool& aLaunchEmbedded ); |
|
212 |
|
213 /** |
|
214 * Sets recipients |
|
215 * |
|
216 * @since Series 60 2.8 |
|
217 * @param aMtmUid Selected MTM |
|
218 * @param aMessageData Message data |
|
219 */ |
|
220 void SetRecipientsL( |
|
221 TUid aMtmUid, |
|
222 const CMessageData& aMessageData ); |
|
223 |
|
224 /** |
|
225 * Adds addressees |
|
226 * |
|
227 * @since Series 60 2.8 |
|
228 * @param aRecipientType Type of message: To,Cc,Bcc |
|
229 * @param aAddressees Address data |
|
230 */ |
|
231 void AddAddresseesL( |
|
232 TMsvRecipientType aRecipientType, |
|
233 const CMessageAddressArray& aAddressees ); |
|
234 |
|
235 /** |
|
236 * Inserts multiple attachments to sending MTM |
|
237 * |
|
238 * @since Series 60 2.8 |
|
239 * @param aMtmUid Chosen sending service |
|
240 * @param aAttaFilePaths Attachment path array |
|
241 * @param aAttaFileHandles Attachment file handle array |
|
242 * @return EFalse, if attachment addition was not successful. Normally ETrue. |
|
243 */ |
|
244 TBool AddAttachmentsL( |
|
245 CBaseMtmUiData& aMtmUiData, |
|
246 CArrayPtrFlat<CSendUiAttachment>* aAttachments ); |
|
247 |
|
248 /** |
|
249 * Inserts one attachment to sending MTM |
|
250 * |
|
251 * @since Series 60 2.8 |
|
252 * @param aAttachment Attachment file path |
|
253 * @return EFalse, if attachment addition was not successful. Normally ETrue. |
|
254 */ |
|
255 TBool AddAttachmentL( CSendUiAttachment* aAttachment, TInt aSupportsLinks ); |
|
256 |
|
257 /** |
|
258 * Sets body text of the message to MTM |
|
259 * |
|
260 * @since Series 60 2.8 |
|
261 * @param aMessageData Message data containing body text |
|
262 */ |
|
263 void SetBodyL( |
|
264 const CBaseMtmUiData& aMtmUiData, |
|
265 const CMessageData& aMessageData, |
|
266 CArrayPtrFlat<CSendUiAttachment>* aAttachments ); |
|
267 |
|
268 /** |
|
269 * Launches editor |
|
270 * |
|
271 * @since Series 60 v3.2 |
|
272 * @param aTempFileName Name of a temporary file |
|
273 */ |
|
274 void LaunchEditorL( |
|
275 TInt aAttachmentCount, |
|
276 TBool aLaunchEditorEmbedded ); |
|
277 |
|
278 /** |
|
279 * Returns default Email service |
|
280 * |
|
281 * Leaves without error note, if email service cannot be found even after running email |
|
282 * setup wizard. |
|
283 * |
|
284 * @param aServiceId Default Email service |
|
285 * @since Series 60 v3.2 |
|
286 */ |
|
287 TMsvId EmailDefaultServiceL(); |
|
288 |
|
289 /** |
|
290 * Removes illegal characters. |
|
291 * |
|
292 * Removes < and > characters. |
|
293 * |
|
294 * @since Series 60 v2.8 |
|
295 */ |
|
296 void RemoveIllegalChars( TPtr& aCheckedString); |
|
297 |
|
298 /** |
|
299 * Check for feature support |
|
300 * |
|
301 * Relevant feature support flags are temporary saved from FeatureManager |
|
302 * during object construction |
|
303 * |
|
304 * @since Series 60 v2.8 |
|
305 */ |
|
306 TBool IsSupported( const TUint& aFeature ); |
|
307 |
|
308 /** |
|
309 * Check for ongoing call |
|
310 * |
|
311 * @since Series 60 v2.8 |
|
312 * @param aPhoneNumberString Returns the number of the caller |
|
313 * @param aName Returns the name of the caller |
|
314 * @return ETrue, if call is going |
|
315 */ |
|
316 TBool IsCallOngoing( |
|
317 TDes& aPhoneNumberString, |
|
318 TDes& aName ); |
|
319 |
|
320 /** |
|
321 * Sends files over Bluetooth |
|
322 * |
|
323 * @since Series 60 v2.8 |
|
324 * @param aAttaFilePaths Filepaths to be send |
|
325 * @param aAttaFileHandles Filehandles to be send |
|
326 */ |
|
327 void SendBtMessageL( CArrayPtrFlat<CSendUiAttachment>* aAttachments ); |
|
328 |
|
329 /** |
|
330 * Calls MTM UI to validate service function |
|
331 * |
|
332 * @since Series 60 v3.1 |
|
333 * @return ETrue, if service is valid |
|
334 */ |
|
335 TBool IsValidServiceL( ); |
|
336 |
|
337 /** |
|
338 * Validates MTM |
|
339 * |
|
340 * Checks if service supports validation and validates the service if it does. |
|
341 * |
|
342 * @since Series 60 v3.2 |
|
343 * @param aMtmUid Service identification |
|
344 * @return ETrue, if service is valid or does not support validation. |
|
345 */ |
|
346 TBool ValidateMtmL( ); |
|
347 |
|
348 /** |
|
349 * Retrieve and validate a service |
|
350 * |
|
351 * @since Series 60 v3.2 |
|
352 * @param aMtmUid Service identification |
|
353 * @return TMsvId Id of a found service |
|
354 KMsvUnknownServiceIndexEntryId if no valid service found. |
|
355 */ |
|
356 TMsvId GetAndValidateServiceL( |
|
357 TUid& aMtmUid, |
|
358 TBool aLaunchEmbedded, |
|
359 TBool& aContinue ); |
|
360 |
|
361 /** |
|
362 * Validates an account |
|
363 * |
|
364 * @since Series 60 v3.2 |
|
365 * @param aMtmUiData Reference to Mtm ui data |
|
366 * @param aMtmUid Service identification |
|
367 */ |
|
368 TBool ValidateAccountL( CBaseMtmUiData& aMtmUiData, TUid aMtmUid ); |
|
369 |
|
370 void LoadMtmL( |
|
371 TUid aMtmType, |
|
372 RPointerArray<CSendingServiceInfo>& aList ); |
|
373 |
|
374 void GetMtmSendingCapabilitiesL( CBaseMtmUiData& mtmUiData, TSendingCapabilities& cap ); |
|
375 |
|
376 static TBool IsPostcardContactLink( const CArrayPtrFlat<CSendUiAttachment>* aAttachments); |
|
377 |
|
378 private: // data |
|
379 |
|
380 /** |
|
381 * Stores locally required feature flags from FeatureManager. |
|
382 */ |
|
383 TUint iSendUiFeatureFlags; |
|
384 |
|
385 /** |
|
386 * Contains pointers to the data of the services provided by this plugin. |
|
387 * Pointed service data objects are owned. |
|
388 */ |
|
389 RPointerArray<CSendingServiceInfo> iServiceArray; |
|
390 |
|
391 /** |
|
392 * Temporary stream store |
|
393 * Own. |
|
394 */ |
|
395 CStreamStore* iStore; |
|
396 |
|
397 /** |
|
398 * Selected MTM sending service |
|
399 * Own. |
|
400 */ |
|
401 CBaseMtm* iClientMtm; |
|
402 |
|
403 /** |
|
404 * Selected MTM sending service UI |
|
405 * Own. |
|
406 */ |
|
407 CBaseMtmUi* iMtmUi; |
|
408 |
|
409 /** |
|
410 * Waitdialog |
|
411 * |
|
412 * Note. This is destroyed using CleanupStack. |
|
413 * Own. |
|
414 */ |
|
415 CAknWaitDialog* iWaitDialog; |
|
416 |
|
417 /** |
|
418 * The required capabilities for the sending service |
|
419 */ |
|
420 TSendingCapabilities iRequiredCapabilities; |
|
421 |
|
422 /** |
|
423 * Index entry at the Message Server |
|
424 */ |
|
425 TMsvEntry iIndexEntry; |
|
426 |
|
427 /** |
|
428 * Sending state |
|
429 */ |
|
430 TBool iIsSending; |
|
431 |
|
432 }; |
|
433 |
|
434 #endif // C_GENERICMTMPLUGIN_H |