|
1 /* |
|
2 * Copyright (c) 2008 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: Definition of the class CFscSendPluginImpl. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFSCSENDPLUGINIMPL_H |
|
20 #define CFSCSENDPLUGINIMPL_H |
|
21 |
|
22 //<cmail> |
|
23 #include "cfsccontactactionplugin.h" |
|
24 #include "mfscreasoncallback.h" |
|
25 #include "mfsccontactsetobserver.h" |
|
26 //</cmail> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CSendUi; |
|
30 class CFscAttachmentFile; |
|
31 class CMessageData; |
|
32 class MFscContactActionPluginObserver; |
|
33 |
|
34 /** |
|
35 * Send plugin implementation. |
|
36 * Contains implementation of send actions. |
|
37 * |
|
38 * @lib fscsendplugin.lib |
|
39 * @since S60 3.1 |
|
40 */ |
|
41 class CFscSendPluginImpl : public CFscContactActionPlugin, |
|
42 public MFscReasonCallback, |
|
43 public MFscContactSetObserver |
|
44 { |
|
45 |
|
46 /** |
|
47 * States of operations |
|
48 */ |
|
49 enum TActionPluginLastEvent |
|
50 { |
|
51 EActionEventIdle, |
|
52 EActionEventCanExecuteLaunched, |
|
53 EActionEventCanExecuteProcessContact, |
|
54 EActionEventCanExecuteProcessGroup, |
|
55 EActionEventCanExecuteProcessGroupMember, |
|
56 EActionEventCanExecuteFinished, |
|
57 EActionEventCanExecuteContactRetrieve, |
|
58 EActionEventCanExecuteGroupRetrieve, |
|
59 EActionEventContactAvailableLaunched, |
|
60 EActionEventContactAvailableProcess, |
|
61 EActionEventContactAvailableFinished, |
|
62 EActionEventContactAvailableContactRetrieve, |
|
63 EActionEventExecuteContactRetrieve, |
|
64 EActionEventExecuteGroupRetrieve, |
|
65 EActionEventExecuteProcessContact, |
|
66 EActionEventExecuteProcessGroup, |
|
67 EActionEventExecuteProcessGroupMember, |
|
68 EActionEventExecuteFinished, |
|
69 EActionEventCanceled |
|
70 }; |
|
71 |
|
72 |
|
73 public: |
|
74 |
|
75 /** |
|
76 * Two-phased constructor. |
|
77 * |
|
78 * @param aParams contact action plugin parameters |
|
79 * @return New instance of CFscSendPluginImpl |
|
80 */ |
|
81 static CFscSendPluginImpl* NewL( TAny* aParams ); |
|
82 |
|
83 /** |
|
84 * Destructor. |
|
85 */ |
|
86 virtual ~CFscSendPluginImpl(); |
|
87 |
|
88 public: // From CFscContactActionPlugin |
|
89 |
|
90 /** |
|
91 * @see CFscContactActionPlugin::Uid |
|
92 */ |
|
93 virtual TUid Uid() const; |
|
94 |
|
95 /** |
|
96 * @see CFscContactActionPlugin::ActionList |
|
97 */ |
|
98 virtual const CArrayFix<TUid>* ActionList() const; |
|
99 |
|
100 /** |
|
101 * @see CFscContactActionPlugin::GetActionL |
|
102 */ |
|
103 virtual const MFscContactAction& GetActionL( |
|
104 TUid aActionUid ) const ; |
|
105 |
|
106 /** |
|
107 * @see CFscContactActionPlugin::PriorityForContactSetL |
|
108 */ |
|
109 virtual void PriorityForContactSetL( |
|
110 TUid aActionUid, |
|
111 MFscContactSet& aContactSet, |
|
112 TFscContactActionVisibility& aActionMenuVisibility, |
|
113 TFscContactActionVisibility& aOptionsMenuVisibility, |
|
114 MFscContactActionPluginObserver* aObserver ); |
|
115 |
|
116 /** |
|
117 * @see CFscContactActionPlugin::ExecuteL |
|
118 */ |
|
119 virtual void ExecuteL( |
|
120 TUid aActionUid, |
|
121 MFscContactSet& aContactSet, |
|
122 MFscContactActionPluginObserver* aObserver ); |
|
123 |
|
124 public: // From MFscReasonCallback |
|
125 |
|
126 /** |
|
127 * @see MFscReasonCallback::GetReasonL |
|
128 */ |
|
129 virtual void GetReasonL( |
|
130 TUid aActionUid, |
|
131 TInt aReasonId, |
|
132 HBufC*& aReason ) const; |
|
133 |
|
134 public: //From base class MFscContactSetObserver |
|
135 |
|
136 /** |
|
137 * @see MFscContactSetObserver::NextContactComplete |
|
138 */ |
|
139 virtual void NextContactComplete( MVPbkStoreContact* aContact ); |
|
140 |
|
141 /** |
|
142 * @see MFscContactSetObserver::NextContactFailed |
|
143 */ |
|
144 virtual void NextContactFailed( TInt aError ); |
|
145 |
|
146 /** |
|
147 * @see MFscContactSetObserver::NextGroupComplete |
|
148 */ |
|
149 virtual void NextGroupComplete( MVPbkStoreContact* aContact ); |
|
150 |
|
151 /** |
|
152 * @see MFscContactSetObserver::NextGroupFailed |
|
153 */ |
|
154 virtual void NextGroupFailed( TInt aError ); |
|
155 |
|
156 /** |
|
157 * @see MFscContactSetObserver::GetGroupContactComplete |
|
158 */ |
|
159 virtual void GetGroupContactComplete( MVPbkStoreContact* aContact ); |
|
160 |
|
161 /** |
|
162 * @see MFscContactSetObserver::GetGroupContactFailed |
|
163 */ |
|
164 virtual void GetGroupContactFailed( TInt aError ); |
|
165 |
|
166 /** |
|
167 * @see CFscContactActionPlugin::CancelPriorityForContactSet |
|
168 */ |
|
169 virtual void CancelPriorityForContactSet(); |
|
170 |
|
171 /** |
|
172 * @see CFscContactActionPlugin::CancelExecute |
|
173 */ |
|
174 virtual void CancelExecute(); |
|
175 |
|
176 private: // methods |
|
177 |
|
178 /** |
|
179 * Sends unified/audio message using SEND UI API |
|
180 * |
|
181 * @param aActionUid Uid of action to be performed |
|
182 * @param aMessageData list of addresses |
|
183 */ |
|
184 void SendToSelectedMembersL( |
|
185 TUid aActionUid, |
|
186 const CMessageData* aAddressList ); |
|
187 |
|
188 /** |
|
189 * Returns true if aContactSet contains atleast one contact |
|
190 * |
|
191 * @param aContactSet contact set to process |
|
192 */ |
|
193 void ContactAvailableL( MFscContactSet& aContactSet ); |
|
194 |
|
195 /** |
|
196 * Helper method to check if action can be executed with |
|
197 * given contacts in current context |
|
198 * |
|
199 * @param aActionId Action Id |
|
200 * @param aContactSet contains contact list and group lists |
|
201 * @return KErrNone if action can be executed, |
|
202 * otherwise system wide error code |
|
203 */ |
|
204 void CanExecuteL( |
|
205 TUid aActionUid, |
|
206 MFscContactSet& aContactSet ); |
|
207 |
|
208 /** |
|
209 * Updates action icons |
|
210 * |
|
211 * @param aActionId Action Id |
|
212 */ |
|
213 void UpdateActionIconL( TUid aActionUid ); |
|
214 |
|
215 /** |
|
216 * Add contact |
|
217 * |
|
218 * @param aActionId Action Id |
|
219 * @param aAddressList list of addresses |
|
220 * @param aContact Contact data |
|
221 */ |
|
222 TInt AddContactL( |
|
223 TUid aActionUid, |
|
224 CMessageData& aAddressList, |
|
225 MVPbkStoreContact& aContact ); |
|
226 |
|
227 /** |
|
228 * Add postcard contact |
|
229 * |
|
230 * @param aAddressList list of contacts |
|
231 * @param aContact Contact data |
|
232 */ |
|
233 void AddPostcardContactL( |
|
234 CMessageData& aAddressList, |
|
235 const MVPbkStoreContact& aContact ); |
|
236 |
|
237 /** |
|
238 * Write data to postcard attachment file |
|
239 * |
|
240 * @param aContact Contact data |
|
241 * @param aAttachmentFile attachment file |
|
242 */ |
|
243 void WritePostcardAttachmentContentL( |
|
244 const MVPbkStoreContact& aContact, |
|
245 CFscAttachmentFile& aAttachmentFile ); |
|
246 |
|
247 private: // constructors |
|
248 |
|
249 /** |
|
250 * Constructor. |
|
251 * |
|
252 * @param aParams contact action plugin parameters |
|
253 */ |
|
254 CFscSendPluginImpl( |
|
255 const TFscContactActionPluginParams& aParams ); |
|
256 |
|
257 /** |
|
258 * Second phase constructor. |
|
259 */ |
|
260 void ConstructL(); |
|
261 |
|
262 /** |
|
263 * Restores members related to state machine |
|
264 */ |
|
265 void ResetData(); |
|
266 |
|
267 /** |
|
268 * Checks action priority and informs observer |
|
269 * |
|
270 * @param aActionUid action UID |
|
271 */ |
|
272 void CheckPriority( TUid aActionUid ); |
|
273 |
|
274 /** |
|
275 * Move Group iterator to specified index |
|
276 * |
|
277 * @param aContactSet - set of contacts |
|
278 * @param aIndex - specified index |
|
279 * @param aError - result |
|
280 */ |
|
281 void MoveGroupToIndexL( MFscContactSet& aContactSet, |
|
282 TInt aIndex, TInt& aError ); |
|
283 |
|
284 /** |
|
285 * Checks if contact is member of selected groups |
|
286 */ |
|
287 TBool IsAnyGroupMemberL( MVPbkStoreContact& aContact ); |
|
288 |
|
289 /** |
|
290 * Check maximum recipients value |
|
291 */ |
|
292 TInt MaxMsgRecipientsL(); |
|
293 |
|
294 |
|
295 private: // data |
|
296 |
|
297 /** |
|
298 * Action plugin parameters |
|
299 */ |
|
300 TFscContactActionPluginParams iParams; |
|
301 |
|
302 /** |
|
303 * Resource handle |
|
304 */ |
|
305 TInt iResourceHandle; |
|
306 |
|
307 /** |
|
308 * Own: SMS and MMS action |
|
309 */ |
|
310 CFscContactAction* iContactMsgAction; |
|
311 |
|
312 /** |
|
313 * Own: Audio message action |
|
314 */ |
|
315 CFscContactAction* iContactAudioMsgAction; |
|
316 |
|
317 /** |
|
318 * Own: Send Postcard action |
|
319 */ |
|
320 CFscContactAction* iContactPostcardAction; |
|
321 |
|
322 /** |
|
323 * Own: Send Email action |
|
324 */ |
|
325 CFscContactAction* iContactEmailAction; |
|
326 |
|
327 /** |
|
328 * Own: Contact action array |
|
329 */ |
|
330 CArrayFixFlat<TUid>* iActionList; |
|
331 |
|
332 /** |
|
333 * CFscAttachmentFile |
|
334 */ |
|
335 CFscAttachmentFile* iAttachmentFile; |
|
336 |
|
337 /** |
|
338 * Action Uid |
|
339 */ |
|
340 TUid iActionUid; |
|
341 |
|
342 /** |
|
343 * Can display action |
|
344 */ |
|
345 TInt iCanDisplay; |
|
346 |
|
347 /** |
|
348 * Is contact available |
|
349 */ |
|
350 TBool iIsContactAvailable; |
|
351 |
|
352 //TBool is |
|
353 |
|
354 /** |
|
355 * Retrieved store contact |
|
356 */ |
|
357 MVPbkStoreContact* iRetrievedStoreContact; |
|
358 |
|
359 /** |
|
360 * Retrieved store contact |
|
361 */ |
|
362 MVPbkStoreContact* iRetrievedStoreGroup; |
|
363 |
|
364 /** |
|
365 * Retrieved group member - own |
|
366 */ |
|
367 MVPbkStoreContact* iRetrievedGroupMember; |
|
368 |
|
369 /* |
|
370 * Count of current group |
|
371 */ |
|
372 TInt iGroupMembersCount; |
|
373 |
|
374 /* |
|
375 * Current group member index |
|
376 */ |
|
377 TInt iGroupMemberIndex; |
|
378 |
|
379 /** |
|
380 * Action menu visbility |
|
381 */ |
|
382 TFscContactActionVisibility* iActionMenuVisibility; |
|
383 |
|
384 /** |
|
385 * Options menu visbility |
|
386 */ |
|
387 TFscContactActionVisibility* iOptionsMenuVisibility; |
|
388 |
|
389 /** |
|
390 * Contact set |
|
391 */ |
|
392 MFscContactSet* iContactSet; |
|
393 |
|
394 /** |
|
395 * Plug-in observer |
|
396 */ |
|
397 MFscContactActionPluginObserver* iPluginObserver; |
|
398 |
|
399 /** |
|
400 * Current state of state machine |
|
401 */ |
|
402 TActionPluginLastEvent iLastEvent; |
|
403 |
|
404 /** |
|
405 * Action priority |
|
406 */ |
|
407 TInt iActionPriority; |
|
408 |
|
409 /** |
|
410 * Is ExecuteL or PriorityForContactSetL launched |
|
411 */ |
|
412 TBool iIsExecute; |
|
413 |
|
414 /** |
|
415 * Number type |
|
416 */ |
|
417 TContactNumberType iNumberType; |
|
418 |
|
419 /** |
|
420 * List of recipients addresses |
|
421 */ |
|
422 CMessageData* iAddressList; |
|
423 |
|
424 /** |
|
425 * Missing contacts counter |
|
426 */ |
|
427 TInt iMissingCount; |
|
428 |
|
429 /** |
|
430 * Last proccessed group in interator |
|
431 */ |
|
432 MVPbkContactLink* iLastGroupLink; |
|
433 |
|
434 /** |
|
435 * Group iterator index |
|
436 */ |
|
437 TInt iGroupIteratorPosition; |
|
438 |
|
439 /** |
|
440 * Maximum message recipients |
|
441 */ |
|
442 TInt iMaxRecipients; |
|
443 |
|
444 /** |
|
445 * Recipients counter |
|
446 */ |
|
447 TInt iRecipientsCounter; |
|
448 }; |
|
449 |
|
450 #endif // CFSCSENDPLUGINIMPL_H |