|
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: SendUI API implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef C_CSENDUIIMPL_H |
|
23 #define C_CSENDUIIMPL_H |
|
24 |
|
25 #include <f32file.h> |
|
26 #include <e32base.h> |
|
27 #include <e32property.h> |
|
28 #include <badesca.h> |
|
29 #include <ConeResLoader.h> |
|
30 #include <apaserverapp.h> |
|
31 #include <msvapi.h> |
|
32 |
|
33 #include <TSendingCapabilities.h> |
|
34 #include <sendui.h> |
|
35 #include <SendUiConsts.h> |
|
36 |
|
37 class CEikMenuPane; |
|
38 class CSendNormalUi; |
|
39 class CMessageData; |
|
40 class CSendingServiceManager; |
|
41 class CSendingServiceInfo; |
|
42 class RSendUiServiceClient; |
|
43 class CPropertyObserver; |
|
44 class TDataType; |
|
45 class CSendUiSingleton; |
|
46 class CSendUiAttachment; |
|
47 class CSendUiFileRightsEngine; |
|
48 |
|
49 /** |
|
50 * Implementation of SendUI API |
|
51 * |
|
52 * Can be used to show "Send" list query and to create and send |
|
53 * messages via available services. Sending services can be based |
|
54 * on the MTM or ECom architecture. Created messages are sent |
|
55 * directly or message editor is opened for editing, depending on |
|
56 * the type of selected service. |
|
57 * @lib sendui.lib |
|
58 * @since S60 v3.0 |
|
59 */ |
|
60 class CSendUiImpl : public CBase |
|
61 { |
|
62 friend class UT_CSendUiImpl; |
|
63 public: |
|
64 |
|
65 static CSendUiImpl* NewL(); |
|
66 |
|
67 virtual ~CSendUiImpl(); |
|
68 |
|
69 public: |
|
70 |
|
71 /** |
|
72 * Adds menu item of given type to menupane. |
|
73 * No menu item is added, if services are not found. |
|
74 * This can happen if asyncronous sending service update is not |
|
75 * yet finished. This API will not provide any result of |
|
76 * requested operation. New API AddTypedMenuItemToMenuPaneL |
|
77 * with aResult param is added. Caller application can use this |
|
78 * new API to know the API operation result. |
|
79 * |
|
80 * @since Series 60 3.0 |
|
81 * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu" |
|
82 * @param aMenuPane Menupane where the menu item should be added. |
|
83 * @param aIndex The place of the menu item in menupane. |
|
84 * @param aCommandId Command id for the menu item. |
|
85 * @param aRequiredCapabilities Capabilities required by services to be |
|
86 * shown in "Send" list query. If no capabilities are required |
|
87 * (KCapabilitiesForAllServices), all available services are |
|
88 * shown in "Send" list query. |
|
89 * @return None. |
|
90 */ |
|
91 void AddTypedMenuItemL( |
|
92 CSendUi::TSendUiMenuType aMenuType, |
|
93 CEikMenuPane& aMenuPane, |
|
94 TInt aIndex, |
|
95 TInt aCommandId, |
|
96 TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices ); |
|
97 |
|
98 /** |
|
99 * First displays list query and then creates the message. |
|
100 * Editor is launched for editing the message or the message is sent |
|
101 * directly without opening the editor. Functionality depends on the |
|
102 * type of selected service. |
|
103 * |
|
104 * List query can be manipulated in three ways. All three methods can be |
|
105 * used or just some of those. |
|
106 * |
|
107 * The first option is to set the required capabilities for services. |
|
108 * Eg. attachments supported. Sending services not matching to required |
|
109 * capabilities are filtered away. Capabilities are defined in |
|
110 * TSendingCapabilities.h. |
|
111 * |
|
112 * The second option is content based filtering. Filtering is based on |
|
113 * the files intended to send. Those files can be set as part of message |
|
114 * data. Filtering is done according the predefined rules. |
|
115 * |
|
116 * The third option is to set the array of service uids not wanted to |
|
117 * be shown in list query. Uid can be the technology type, service provider or |
|
118 * service id. These sending services are filtered away |
|
119 * even if those match to required capabilities. |
|
120 * |
|
121 * @since Series 60 3.0 |
|
122 * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu" |
|
123 * @param aMessageData Data for the message. |
|
124 * @param aRequiredCapabilities Capabilities required by sending services |
|
125 * to be shown in "Send" pop-up list query. If no capabilities are |
|
126 * required (KCapabilitiesForAllServices), all available services |
|
127 * are shown in "Send" pop-up list query. |
|
128 * @param aServicesToDim Array of service uids (service uid, service |
|
129 * provider's uid or service's TechnologyType) _NOT_ wanted to "Send" |
|
130 * list query. |
|
131 * See predefined sending service uids in SendUiConsts.h . |
|
132 * @param aLaunchEditorEmbedded ETrue if the editor should be launched |
|
133 * embedded. Otherwise the editor is launched stand-alone. |
|
134 * Note: some services sends the messages without launching the |
|
135 * editor at all. |
|
136 * @param aTitleText Title of the list query. If no title is defined, |
|
137 * then the localised default title is used, e.g. "Send" or |
|
138 * "Write". |
|
139 * @return None. |
|
140 */ |
|
141 void ShowTypedQueryAndSendL( |
|
142 CSendUi::TSendUiMenuType aMenuType, |
|
143 const CMessageData* aMessageData, |
|
144 TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices, |
|
145 CArrayFix<TUid>* aServicesToDim = NULL, |
|
146 TBool aLaunchEditorEmbedded = ETrue, |
|
147 const TDesC& aTitleText = KNullDesC ); |
|
148 |
|
149 /** |
|
150 * Displays list query and returns the user selection. |
|
151 * |
|
152 * List query can be manipulated in three ways. All three methods can be |
|
153 * used or just some of those. |
|
154 * |
|
155 * The first option is to set the required capabilities for services. |
|
156 * Eg. attachments supported. Sending services not matching to required |
|
157 * capabilities are filtered away. Capabilities are defined in |
|
158 * TSendingCapabilities.h. |
|
159 * |
|
160 * The second option is content based filtering. Filtering is based on |
|
161 * the files intended to send. Those files can be set as part of message |
|
162 * data. Filtering is done according the predefined rules. |
|
163 * |
|
164 * The third option is to set the array of service uids not wanted to |
|
165 * be shown in list query. These sending services are filtered away |
|
166 * even if those match to required capabilities. |
|
167 * |
|
168 * @since Series 60 3.0 |
|
169 * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu" |
|
170 * @param aMessageData Data for the message. Attachments are used for |
|
171 * content based filtering. |
|
172 * @param aRequiredCapabilities Capabilities required by sending services |
|
173 * to be shown in list query. If no capabilities are required |
|
174 * (KCapabilitiesForAllServices), all available services are |
|
175 * shown in list query. |
|
176 * @param aServicesToDim Array of service uids (service uid, service |
|
177 * provider's uid or service's TechnologyType) _NOT_ wanted to "Send" |
|
178 * list query. |
|
179 * See predefined sending service uids in SendUiConsts.h . |
|
180 * @param aTitleText Title of the list query. If no title is defined, |
|
181 * then the localised default title is used, e.g. "Send" or |
|
182 * "Write" |
|
183 * @return Uid of the selected service (MTM or ECom). |
|
184 * KNullId is returned if user selects cancel. |
|
185 */ |
|
186 TUid ShowTypedQueryL( |
|
187 CSendUi::TSendUiMenuType aMenuType, |
|
188 const CMessageData* aMessageData = NULL, |
|
189 TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices, |
|
190 CArrayFix<TUid>* aServicesToDim = NULL, |
|
191 const TDesC& aTitleText = KNullDesC ); |
|
192 |
|
193 /** |
|
194 * Creates the message and launches the editor for editing the message |
|
195 * or sends the message directly without opening the editor. |
|
196 * Functionality depends on the type of selected service. |
|
197 * |
|
198 * @since Series 60 3.2 |
|
199 * @param aServiceUid Uid of the sending service. |
|
200 * @param aMessageData Data for the message. |
|
201 * @return None. |
|
202 */ |
|
203 TInt SendMessageL( |
|
204 TUid aServiceUid, |
|
205 const CMessageData* aMessageData, |
|
206 TBool aLaunchEditorEmbedded ); |
|
207 |
|
208 /** |
|
209 * Launches server application, which will eventually call SendMessageL |
|
210 * with the same parameters. |
|
211 * |
|
212 * @since Series 60 3.2 |
|
213 * @param aServiceUid Uid of the sending service. |
|
214 * @param aMessageData Data for the message. |
|
215 * @return None. |
|
216 */ |
|
217 void SendMessageViaServerL( |
|
218 TUid aServiceUid, |
|
219 const CMessageData* aMessageData, |
|
220 TBool aLaunchEditorEmbedded ); |
|
221 /** |
|
222 * Creates the message and launches the editor for editing the message |
|
223 * or sends the message directly without opening the editor. |
|
224 * Functionality depends on the type of selected service. |
|
225 * |
|
226 * @since Series 60 3.0 |
|
227 * @param aServiceUid Uid of the sending service. |
|
228 * @param aMessageData Data for the message. |
|
229 * @return None. |
|
230 */ |
|
231 void CreateAndSendMessageL( |
|
232 TUid aServiceUid, |
|
233 const CMessageData* aMessageData, |
|
234 TBool aLaunchEditorEmbedded = ETrue ); |
|
235 |
|
236 /** |
|
237 * Returns sending capabilities of the sending service. |
|
238 * @since Series 60 3.0 |
|
239 * @param aServiceUid Uid of the sending service. |
|
240 * @param aServiceCapabilities TSendingCapabilities of the sending |
|
241 * service as a return value. |
|
242 * @return Return KErrNone if successful, or one of the system wide |
|
243 * errors if unsuccessful. |
|
244 */ |
|
245 TInt ServiceCapabilities( |
|
246 TUid aServiceUid, |
|
247 TSendingCapabilities& aServiceCapabilities ); |
|
248 |
|
249 /** |
|
250 * Populates given list with the information about services |
|
251 * provided by specified ECom service provider. |
|
252 * Each service provider can provide 1..n services. |
|
253 * Ownership of the pointed objects are transfered to caller. |
|
254 * |
|
255 * Can be used for ex. when creating own "Send" menu, which needs to |
|
256 * include ECom based services. |
|
257 * |
|
258 * NOTE: Can be used only for ECom based services, also for MTMs |
|
259 * |
|
260 * @since Series 60 2.8 |
|
261 * @param aServiceList Service list to be populated. |
|
262 * @param aServiceProvider Id of the specified service provider. |
|
263 * KNullId means all service providers. |
|
264 * Service providers are defined in SendUiConsts.h |
|
265 * @return none |
|
266 */ |
|
267 void AvailableServicesL( |
|
268 RPointerArray<CSendingServiceInfo>& aServiceList, |
|
269 TUid aServiceProvider = KNullUid); |
|
270 |
|
271 /** |
|
272 * Returns the technology type of a service |
|
273 * |
|
274 * @since Series 60 3.0 |
|
275 * @param aServiceId Service of interest |
|
276 * @return Technology type of the provided service. NULL if Mtm |
|
277 * service doesn't exist or service is ECOM based. |
|
278 */ |
|
279 TUid TechnologyType( TUid aServiceUid ); |
|
280 |
|
281 /** |
|
282 * Returns the index of the service in service array |
|
283 * |
|
284 * @since Series 60 3.2 |
|
285 * @param aServiceId Service of interest |
|
286 * @return Index of a found service. Otherwise KErrNotFound. |
|
287 */ |
|
288 TInt ResolveServiceIndex( TUid aUid ); |
|
289 |
|
290 /** |
|
291 * Compares service capabilities with the required capabilities |
|
292 * |
|
293 * @since S60 v3.2 |
|
294 * @param aServiceIndex Index of the service |
|
295 * @param aRequiredCapabilities Required capabilities |
|
296 * @return ETrue, if service has required or more capabilities. |
|
297 * EFalse, if service does not have the required capabilities |
|
298 * or service does not exist. |
|
299 */ |
|
300 TBool QueryCapabilities( |
|
301 TInt aServiceIndex, |
|
302 TSendingCapabilities aCap ); |
|
303 |
|
304 /** |
|
305 * Copies sending service information from Central Repository to local data |
|
306 * |
|
307 * @since S60 v3.2 |
|
308 */ |
|
309 void GetServicesL( ); |
|
310 |
|
311 //Functions introduced for CMail changes |
|
312 |
|
313 /** |
|
314 * Checks if Device has any mailbox or not |
|
315 * |
|
316 * @since S60 v5.0 |
|
317 * @param void |
|
318 * @return ETrue, if atleast one mailbox is available. |
|
319 * EFalse, if no mailbox are there |
|
320 */ |
|
321 |
|
322 TBool IsMailboxAvailableL(void); |
|
323 |
|
324 /** |
|
325 * Checks if Device has any ThirdParty Mail Services or not |
|
326 * |
|
327 * @since S60 v5.0 |
|
328 * @param void |
|
329 * @return ETrue, if atleast one Third Party Service is available. |
|
330 * EFalse, if Third Party Service are there |
|
331 */ |
|
332 |
|
333 TBool IsThirdPartyMailService(TUid aUid ); |
|
334 |
|
335 /** |
|
336 * Checks if Email entry is valid to be appended |
|
337 * |
|
338 * @since S60 v5.0 |
|
339 * @param void |
|
340 * @return ETrue, if it can be appended. |
|
341 * EFalse, if cannot be appended |
|
342 */ |
|
343 |
|
344 TBool IsEmailAppendableL(TMsvEntry tentry); |
|
345 |
|
346 /** |
|
347 * Adds menu item of given type to menupane and know the opeation |
|
348 * result. |
|
349 * No menu item is added, if services are not found. |
|
350 * This can happen if asyncronous sending service update is not |
|
351 * yet finished. Caller application can use this API to know the |
|
352 * API operation result. |
|
353 * |
|
354 * @since Series 60 9.2 |
|
355 * @param aResult API opeartion result. ETrue, if item is added successfully |
|
356 * EFalse , if failed to add item. * |
|
357 * @param aMenuType Type of the menu, e.g. "ESendMenu" or "EWriteMenu" |
|
358 * @param aMenuPane Menupane where the menu item should be added. |
|
359 * @param aIndex The place of the menu item in menupane. |
|
360 * @param aCommandId Command id for the menu item. |
|
361 * @param aRequiredCapabilities Capabilities required by services to be |
|
362 * shown in "Send" list query. If no capabilities are required |
|
363 * (KCapabilitiesForAllServices), all available services are |
|
364 * shown in "Send" list query. |
|
365 * @return None. |
|
366 */ |
|
367 void AddTypedMenuItemToMenuPaneL( |
|
368 TBool& aResult, |
|
369 CSendUi::TSendUiMenuType aMenuType, |
|
370 CEikMenuPane& aMenuPane, |
|
371 TInt aIndex, |
|
372 TInt aCommandId, |
|
373 TSendingCapabilities aRequiredCapabilities = KCapabilitiesForAllServices ); |
|
374 |
|
375 private: |
|
376 |
|
377 |
|
378 /** |
|
379 * |
|
380 * @since Series 60 3.0 |
|
381 * @param aListItems |
|
382 * @param aTitleText Title of the pop-up list query. If no title |
|
383 * is defined, then the localised default title is used. |
|
384 * @return: User selection. |
|
385 */ |
|
386 TUid ShowListQueryL( |
|
387 MDesCArray* aListItems, |
|
388 const CArrayFix<TUid>& aListItemUids, |
|
389 const TDesC& aTitleText, |
|
390 CSendUi::TSendUiMenuType aMenuType ); |
|
391 |
|
392 /** |
|
393 * Filtering services by their content |
|
394 * |
|
395 * @since Series 60 3.0 |
|
396 * @param aServiceUid |
|
397 * @param aServiceProviderUid |
|
398 * @param aMessageData Message data, which is base of the content filtering. |
|
399 * @param aMimeType The mimetype of the first attachment. |
|
400 * @return: True, if given service can send specified content |
|
401 */ |
|
402 TBool CanSendContentL( |
|
403 TUid aServiceUid, |
|
404 TUid aServiceProviderUid, |
|
405 const CMessageData* aMessageData, |
|
406 TDataType* aMimeType ); |
|
407 |
|
408 /** |
|
409 * |
|
410 * @since Series 60 3.0 |
|
411 * @param aListItemUids |
|
412 * @param aListItemUids |
|
413 * @param aRequiredCapabilities |
|
414 * @param aContentArray |
|
415 * @param aServicesToDim |
|
416 * @return: None. |
|
417 */ |
|
418 void FilterServicesL( |
|
419 CDesCArrayFlat& aListItems, |
|
420 CArrayFix<TUid>& aListItemUids, |
|
421 TSendingCapabilities aRequiredCapabilities, |
|
422 const CMessageData* aMessageData, |
|
423 CSendUi::TSendUiMenuType aMenuType ); |
|
424 |
|
425 /** |
|
426 * Sorts service lists |
|
427 * |
|
428 * @since S60 v3.0 |
|
429 * @param aListItems Names of items in array |
|
430 * @param aListItemUids Uids of items in array |
|
431 * @return: Sorted array |
|
432 */ |
|
433 void SortListL( |
|
434 CDesCArrayFlat& aListItems, |
|
435 CArrayFix<TUid>& aListItemUids ); |
|
436 |
|
437 /** |
|
438 * Resets sending state flag. |
|
439 * @since Series 60 3.0 |
|
440 * @return None. |
|
441 */ |
|
442 static void ResetIsSending( TAny* aAny ); |
|
443 |
|
444 /** |
|
445 * Compares ECom service sending capabilities to required capabilities. |
|
446 * @since Series 60 3.0 |
|
447 * @param aServiceUid Uid of the sending service. |
|
448 * @param aRequiredCapabilities Capabilities required for the sending |
|
449 * service. |
|
450 * @return: ETrue if service sending capabilities matches to |
|
451 * required capabilities, otherwise EFalse. |
|
452 */ |
|
453 TBool CheckServiceCapabilities( |
|
454 TUid aServiceUid, |
|
455 TSendingCapabilities aRequiredCapabilities ); |
|
456 |
|
457 /** |
|
458 * Checks if the feature is supported by feature manager. |
|
459 * @since Series 60 3.2.3 |
|
460 * @param aFeature Feature manager id of the sending service. |
|
461 * @param aNewFeatures To keep track of which feature is modified |
|
462 * @param aFeatureFlag Uid of the sending service used for central repository storage. |
|
463 * @return None |
|
464 */ |
|
465 void FeatureStatus( |
|
466 TInt aFeature, |
|
467 TInt &aNewFeatures, |
|
468 TInt aFeatureFlag ); |
|
469 private: |
|
470 |
|
471 CSendUiImpl(); |
|
472 |
|
473 void ConstructL(); |
|
474 |
|
475 private: // data |
|
476 |
|
477 /** |
|
478 * Pointer to Control environment |
|
479 * Not own. |
|
480 */ |
|
481 CCoeEnv* iCoeEnv; |
|
482 |
|
483 /** |
|
484 * Pointer to File Server Session. Initialized from CCoeEnv->FsSession. |
|
485 * Not own. |
|
486 */ |
|
487 RFs& iFs; |
|
488 |
|
489 /** |
|
490 * Pointer to CSendUiSingleton |
|
491 * Own. |
|
492 */ |
|
493 CSendUiSingleton* iSingleton; |
|
494 |
|
495 /** |
|
496 * Indicates whether or not the sending process is in progress. |
|
497 */ |
|
498 TBool iIsSending; |
|
499 |
|
500 /** |
|
501 * For UI resource loading |
|
502 * Own. |
|
503 */ |
|
504 RConeResourceLoader iResourceLoader; |
|
505 |
|
506 /** |
|
507 * Services to be dimmed |
|
508 * Own. |
|
509 */ |
|
510 CArrayFixFlat<TUid>* iServicesToDim; |
|
511 |
|
512 /** |
|
513 * Resource file name and path. |
|
514 * Own. |
|
515 */ |
|
516 TFileName iResourceFileName; |
|
517 |
|
518 |
|
519 TBool iEmailClientIntegration; |
|
520 |
|
521 /** |
|
522 * Variable to know if Cmail |
|
523 * Feature is on |
|
524 */ |
|
525 TBool iEmailFramework; |
|
526 |
|
527 /** |
|
528 * Array of available sending service |
|
529 * Own. |
|
530 */ |
|
531 RPointerArray<CSendingServiceInfo> iSendingServices; |
|
532 |
|
533 /** |
|
534 * IPC client with SendUiLauncherApp |
|
535 * Own. |
|
536 */ |
|
537 RSendUiServiceClient* iSendUiClient; |
|
538 |
|
539 /** |
|
540 * The requested order of sending services in the menu. |
|
541 * Read from resources. |
|
542 * Own. |
|
543 */ |
|
544 CArrayFixFlat<TInt32>* iSendUiServicesOrderArray; |
|
545 |
|
546 TBool iServerAppLaunch; |
|
547 |
|
548 CPropertyObserver* iPropertyObserver; |
|
549 |
|
550 }; |
|
551 |
|
552 #endif // C_CSENDUIIMPL_H |