|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 Group UI Extension send message command. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CPguSendMessageGroupCmd.h" |
|
21 #include "CPguUIExtensionPlugin.h" |
|
22 |
|
23 // Phonebook 2 |
|
24 #include "MPbk2ProcessDecorator.h" |
|
25 #include <MPbk2ContactNameFormatter.h> |
|
26 #include <MPbk2ContactUiControl.h> |
|
27 #include <MPbk2CommandObserver.h> |
|
28 #include <Pbk2UIControls.rsg> |
|
29 #include <TPbk2AddressSelectParams.h> |
|
30 #include <CPbk2AddressSelect.h> |
|
31 #include <MPbk2AppUi.h> |
|
32 #include <MPbk2ApplicationServices.h> |
|
33 |
|
34 // Virtual Phonebook |
|
35 #include <VPbkFieldType.hrh> |
|
36 #include <CVPbkContactManager.h> |
|
37 #include <MVPbkContactLink.h> |
|
38 #include <MVPbkContactOperationBase.h> |
|
39 #include <MVPbkStoreContact.h> |
|
40 #include <MVPbkContactFieldTextData.h> |
|
41 #include <MVPbkStoreContactFieldCollection.h> |
|
42 #include <RVPbkContactFieldDefaultPriorities.h> |
|
43 #include <MVPbkContactGroup.h> |
|
44 #include <MVPbkContactLinkArray.h> |
|
45 |
|
46 // System includes |
|
47 #include <featmgr.h> |
|
48 #include <coemain.h> |
|
49 #include <barsread.h> |
|
50 #include <sendui.h> |
|
51 #include <SenduiMtmUids.h> |
|
52 #include <CMessageData.h> |
|
53 #include <eikenv.h> |
|
54 #include <akntitle.h> |
|
55 #include <eikspane.h> |
|
56 #include <avkon.hrh> |
|
57 #include <avkon.rsg> |
|
58 #include <layoutmetadata.cdl.h> |
|
59 // Debugging headers |
|
60 #include <Pbk2Debug.h> |
|
61 |
|
62 /// Unnamed namespace for local definitions |
|
63 namespace { |
|
64 |
|
65 const TInt KDefaultTitleFormat = MPbk2ContactNameFormatter::EUseSeparator; |
|
66 const TInt KGranularity( 4 ); |
|
67 |
|
68 #ifdef _DEBUG |
|
69 |
|
70 enum TPanicCode |
|
71 { |
|
72 EPanicUnknownMedia = 1, |
|
73 ERunL_InvalidState, |
|
74 EPanicLogic |
|
75 }; |
|
76 |
|
77 void Panic(TPanicCode aReason) |
|
78 { |
|
79 _LIT(KPanicText, "CPguSendMessageGroupCmd"); |
|
80 User::Panic(KPanicText,aReason); |
|
81 } |
|
82 |
|
83 #endif // _DEBUG |
|
84 |
|
85 } /// namespace |
|
86 |
|
87 // -------------------------------------------------------------------------- |
|
88 // CPguSendMessageGroupCmd::CPguSendMessageGroupCmd |
|
89 // -------------------------------------------------------------------------- |
|
90 // |
|
91 CPguSendMessageGroupCmd::CPguSendMessageGroupCmd( |
|
92 MPbk2ContactUiControl& aUiControl, |
|
93 CPguUIExtensionPlugin* aPguUIExtensionPlugin ) : |
|
94 CActive( EPriorityIdle ), |
|
95 iUiControl( &aUiControl ), |
|
96 iPguUIExtensionPlugin( aPguUIExtensionPlugin ) |
|
97 { |
|
98 CActiveScheduler::Add( this ); |
|
99 } |
|
100 |
|
101 // -------------------------------------------------------------------------- |
|
102 // CPguSendMessageGroupCmd::~CPguSendMessageGroupCmd |
|
103 // -------------------------------------------------------------------------- |
|
104 // |
|
105 CPguSendMessageGroupCmd::~CPguSendMessageGroupCmd() |
|
106 { |
|
107 Cancel(); |
|
108 |
|
109 if( iUiControl ) |
|
110 { |
|
111 iUiControl->RegisterCommand( NULL ); |
|
112 } |
|
113 |
|
114 delete iMessageData; |
|
115 delete iSelectedContacts; |
|
116 delete iMtmFilter; |
|
117 delete iRetrieveOperation; |
|
118 delete iStoreContact; |
|
119 } |
|
120 |
|
121 // -------------------------------------------------------------------------- |
|
122 // CPguSendMessageGroupCmd::NewL |
|
123 // -------------------------------------------------------------------------- |
|
124 // |
|
125 CPguSendMessageGroupCmd* CPguSendMessageGroupCmd::NewL |
|
126 ( MPbk2ContactUiControl& aUiControl, |
|
127 CPguUIExtensionPlugin* aPguUIExtensionPlugin ) |
|
128 { |
|
129 CPguSendMessageGroupCmd* self = |
|
130 new ( ELeave ) CPguSendMessageGroupCmd( aUiControl, |
|
131 aPguUIExtensionPlugin ); |
|
132 CleanupStack::PushL( self ); |
|
133 self->ConstructL(); |
|
134 CleanupStack::Pop( self ); |
|
135 return self; |
|
136 } |
|
137 |
|
138 // -------------------------------------------------------------------------- |
|
139 // CPguSendMessageGroupCmd::ConstructL |
|
140 // -------------------------------------------------------------------------- |
|
141 // |
|
142 void CPguSendMessageGroupCmd::ConstructL() |
|
143 { |
|
144 |
|
145 iUiControl->RegisterCommand( this ); |
|
146 |
|
147 iFieldPropertyArray = &Phonebook2::Pbk2AppUi()-> |
|
148 ApplicationServices().FieldProperties(); |
|
149 |
|
150 iMtmFilter = new(ELeave) CArrayFixFlat<TUid>( KGranularity ); |
|
151 iMtmFilter->AppendL(KSenduiMtmPostcardUid); // hide postcard |
|
152 |
|
153 iSendingCapabilities.iFlags = TSendingCapabilities::ESupportsEditor; |
|
154 iSelectedContacts = iUiControl->SelectedContactsOrFocusedContactL(); |
|
155 iMessageData = CMessageData::NewL(); |
|
156 } |
|
157 |
|
158 // -------------------------------------------------------------------------- |
|
159 // CPguSendMessageGroupCmd::ExecuteLD |
|
160 // -------------------------------------------------------------------------- |
|
161 // |
|
162 void CPguSendMessageGroupCmd::ExecuteLD() |
|
163 { |
|
164 iCurrentContactLinkIndex = 0; |
|
165 iState = EShowWriteQuery; |
|
166 IssueRequest(); |
|
167 } |
|
168 |
|
169 // -------------------------------------------------------------------------- |
|
170 // CPguSendMessageGroupCmd::AddObserver |
|
171 // -------------------------------------------------------------------------- |
|
172 // |
|
173 void CPguSendMessageGroupCmd::AddObserver( MPbk2CommandObserver& aObserver ) |
|
174 { |
|
175 iCommandObserver = &aObserver; |
|
176 } |
|
177 |
|
178 // -------------------------------------------------------------------------- |
|
179 // CPguSendMessageGroupCmd::ResetUiControl |
|
180 // -------------------------------------------------------------------------- |
|
181 // |
|
182 void CPguSendMessageGroupCmd::ResetUiControl( |
|
183 MPbk2ContactUiControl& aUiControl) |
|
184 { |
|
185 if (iUiControl == &aUiControl) |
|
186 { |
|
187 iUiControl = NULL; |
|
188 } |
|
189 } |
|
190 |
|
191 // -------------------------------------------------------------------------- |
|
192 // CPguSendMessageGroupCmd::DoCancel |
|
193 // -------------------------------------------------------------------------- |
|
194 // |
|
195 void CPguSendMessageGroupCmd::DoCancel() |
|
196 { |
|
197 //Do nothing |
|
198 } |
|
199 |
|
200 // -------------------------------------------------------------------------- |
|
201 // CPguSendMessageGroupCmd::RunL |
|
202 // -------------------------------------------------------------------------- |
|
203 // |
|
204 void CPguSendMessageGroupCmd::RunL() |
|
205 { |
|
206 switch ( iState ) |
|
207 { |
|
208 case ERetrieving: |
|
209 { |
|
210 if ( iSelectedContacts ) |
|
211 { |
|
212 if ( iSelectedContacts->Count() == iCurrentContactLinkIndex ) |
|
213 { |
|
214 iState = EStarting; |
|
215 IssueRequest(); |
|
216 } |
|
217 else |
|
218 { |
|
219 RetrieveContactL( iSelectedContacts->At( |
|
220 iCurrentContactLinkIndex ) ); |
|
221 iCurrentContactLinkIndex++; |
|
222 } |
|
223 } |
|
224 else |
|
225 { |
|
226 iState = EStopping; |
|
227 IssueRequest(); |
|
228 } |
|
229 break; |
|
230 } |
|
231 case EShowWriteQuery: |
|
232 { |
|
233 iMtmUid = ShowWriteQueryL(); |
|
234 if ( iMtmUid == KNullUid ) |
|
235 { |
|
236 iState = EStopping; |
|
237 // Disconnect the relationship between control and command |
|
238 iUiControl->RegisterCommand( NULL ); |
|
239 iUiControl = NULL; |
|
240 } |
|
241 else |
|
242 { |
|
243 iState = ERetrieving; |
|
244 } |
|
245 IssueRequest(); |
|
246 break; |
|
247 } |
|
248 case EResolveGroup: |
|
249 { |
|
250 ResolveGroupL(); |
|
251 break; |
|
252 } |
|
253 case EResolveURL: |
|
254 { |
|
255 ResolveUrlL(); |
|
256 break; |
|
257 } |
|
258 case EStarting: |
|
259 { |
|
260 DoSendMessageL(); |
|
261 break; |
|
262 } |
|
263 case EStopping: |
|
264 { |
|
265 iSendMessage = EFalse; |
|
266 ProcessDismissed( KErrNone ); |
|
267 break; |
|
268 } |
|
269 default: |
|
270 { |
|
271 __ASSERT_DEBUG(EFalse, Panic(ERunL_InvalidState)); |
|
272 break; |
|
273 } |
|
274 } |
|
275 } |
|
276 |
|
277 // -------------------------------------------------------------------------- |
|
278 // CPguSendMessageGroupCmd::RunError |
|
279 // -------------------------------------------------------------------------- |
|
280 // |
|
281 TInt CPguSendMessageGroupCmd::RunError( TInt aError ) |
|
282 { |
|
283 return FilterErrors( aError ); |
|
284 } |
|
285 |
|
286 // -------------------------------------------------------------------------- |
|
287 // CPguSendMessageGroupCmd::VPbkSingleContactOperationComplete |
|
288 // -------------------------------------------------------------------------- |
|
289 // |
|
290 void CPguSendMessageGroupCmd::VPbkSingleContactOperationComplete( |
|
291 MVPbkContactOperationBase& aOperation, |
|
292 MVPbkStoreContact* aContact ) |
|
293 { |
|
294 if ( &aOperation == iRetrieveOperation ) |
|
295 { |
|
296 delete iRetrieveOperation; |
|
297 iRetrieveOperation = NULL; |
|
298 |
|
299 // We now have a store contact |
|
300 delete iStoreContact; |
|
301 iStoreContact = aContact; |
|
302 |
|
303 if ( iStoreContact->Group() ) |
|
304 { |
|
305 iState = EResolveGroup; |
|
306 IssueRequest(); |
|
307 } |
|
308 else |
|
309 { |
|
310 iState = EResolveURL; |
|
311 IssueRequest(); |
|
312 } |
|
313 } |
|
314 else |
|
315 { |
|
316 IssueStopRequest(); |
|
317 } |
|
318 } |
|
319 |
|
320 // -------------------------------------------------------------------------- |
|
321 // CPguSendMessageGroupCmd::VPbkSingleContactOperationFailed |
|
322 // -------------------------------------------------------------------------- |
|
323 // |
|
324 void CPguSendMessageGroupCmd::VPbkSingleContactOperationFailed( |
|
325 MVPbkContactOperationBase& aOperation, |
|
326 TInt aError ) |
|
327 { |
|
328 if ( &aOperation == iRetrieveOperation ) |
|
329 { |
|
330 delete iRetrieveOperation; |
|
331 iRetrieveOperation = NULL; |
|
332 |
|
333 // We cannot get the contact, so we have to |
|
334 // fail. We cannot continue, since this operation |
|
335 // was executed only in case of one contact. |
|
336 ProcessDismissed( aError ); |
|
337 } |
|
338 } |
|
339 |
|
340 // -------------------------------------------------------------------------- |
|
341 // CPguSendMessageGroupCmd::ShowWriteQueryL |
|
342 // -------------------------------------------------------------------------- |
|
343 // |
|
344 TUid CPguSendMessageGroupCmd::ShowWriteQueryL() |
|
345 { |
|
346 TUid uid = Phonebook2::Pbk2AppUi()->ApplicationServices().SendUiL()-> |
|
347 ShowTypedQueryL( CSendUi::EWriteMenu, NULL, iSendingCapabilities, |
|
348 iMtmFilter ); |
|
349 return uid; |
|
350 } |
|
351 |
|
352 // -------------------------------------------------------------------------- |
|
353 // CPguSendMessageGroupCmd::RetrieveContactL |
|
354 // -------------------------------------------------------------------------- |
|
355 // |
|
356 void CPguSendMessageGroupCmd::RetrieveContactL( |
|
357 const MVPbkContactLink& aContactLink ) |
|
358 { |
|
359 // Retrieve the actual store contact from the given link |
|
360 iRetrieveOperation = Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
361 ContactManager().RetrieveContactL( aContactLink, *this ); |
|
362 } |
|
363 |
|
364 // -------------------------------------------------------------------------- |
|
365 // CPguSendMessageGroupCmd::DoSendMessageL |
|
366 // -------------------------------------------------------------------------- |
|
367 // |
|
368 void CPguSendMessageGroupCmd::DoSendMessageL() |
|
369 { |
|
370 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
371 ("CPguSendMessageGroupCmd::DoSendMessageL() start") ); |
|
372 |
|
373 if ( iSendMessage ) |
|
374 { |
|
375 // Gets current tile pane and saves it to title |
|
376 HBufC* title = NULL; |
|
377 CAknTitlePane* titlePane = NULL; |
|
378 CEikStatusPane *sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
379 titlePane = STATIC_CAST( CAknTitlePane*, |
|
380 sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
381 title = titlePane->Text()->AllocLC(); |
|
382 |
|
383 Phonebook2::Pbk2AppUi()->ApplicationServices().SendUiL()-> |
|
384 CreateAndSendMessageL( iMtmUid, iMessageData ); |
|
385 |
|
386 if( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
387 { |
|
388 sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
389 sp->MakeVisible( ETrue ); |
|
390 |
|
391 // Sets title pane for tile which was save |
|
392 titlePane->SetText( title ); |
|
393 sp->DrawNow(); |
|
394 } |
|
395 else |
|
396 { |
|
397 // Sets title pane for tile which was save |
|
398 titlePane->SetText( title ); |
|
399 } |
|
400 CleanupStack::Pop(); |
|
401 } |
|
402 |
|
403 iState = EStopping; |
|
404 IssueRequest(); |
|
405 } |
|
406 |
|
407 // -------------------------------------------------------------------------- |
|
408 // CPguSendMessageGroupCmd::ResolveGroupL |
|
409 // -------------------------------------------------------------------------- |
|
410 // |
|
411 void CPguSendMessageGroupCmd::ResolveGroupL() |
|
412 { |
|
413 MVPbkContactLinkArray* linkArray = |
|
414 iStoreContact->Group()->ItemsContainedLC(); |
|
415 CleanupStack::Pop(); //linkArray |
|
416 |
|
417 delete iSelectedContacts; |
|
418 iSelectedContacts = linkArray; |
|
419 iCurrentContactLinkIndex = 0; |
|
420 |
|
421 iState = ERetrieving; |
|
422 IssueRequest(); |
|
423 } |
|
424 |
|
425 // -------------------------------------------------------------------------- |
|
426 // CPguSendMessageGroupCmd::ResolveUrlL |
|
427 // -------------------------------------------------------------------------- |
|
428 // |
|
429 void CPguSendMessageGroupCmd::ResolveUrlL() |
|
430 { |
|
431 TResourceReader resReader; |
|
432 TUid techTypeUid = Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
433 SendUiL()->TechnologyType( iMtmUid ); |
|
434 |
|
435 RVPbkContactFieldDefaultPriorities defaults; |
|
436 CleanupClosePushL( defaults ); |
|
437 |
|
438 TInt resourceId = PrepareAddressSelectL( defaults, techTypeUid ); |
|
439 CCoeEnv::Static()->CreateResourceReaderLC( resReader, resourceId ); |
|
440 |
|
441 TPbk2AddressSelectParams params( |
|
442 *iStoreContact, |
|
443 Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager(), |
|
444 Phonebook2::Pbk2AppUi()->ApplicationServices().NameFormatter(), |
|
445 *iFieldPropertyArray, |
|
446 resReader ); |
|
447 params.SetFocusedField( iFocusedField ); |
|
448 params.SetUseDefaultDirectly( ETrue ); |
|
449 params.SetDefaultPriorities( defaults ); |
|
450 params.SetSuppressWarnings( ETrue ); |
|
451 |
|
452 CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL( params ); |
|
453 MVPbkStoreContactField* selectedField = addressSelect->ExecuteLD(); |
|
454 |
|
455 CleanupStack::PopAndDestroy( 2 ); // defaults, resReader |
|
456 |
|
457 if ( selectedField ) |
|
458 { |
|
459 CleanupDeletePushL( selectedField ); |
|
460 SetAddressFromFieldL( *selectedField ); |
|
461 CleanupStack::PopAndDestroy(); // selectedField |
|
462 iState = ERetrieving; |
|
463 iSendMessage = ETrue; |
|
464 } |
|
465 else |
|
466 { |
|
467 if ( iPguUIExtensionPlugin->IsEndCallKeyPressed() ) |
|
468 { |
|
469 iPguUIExtensionPlugin->ClearEndCallKeyPressedFlag(); |
|
470 iState = EStopping; |
|
471 } |
|
472 else |
|
473 { |
|
474 iState = ERetrieving; |
|
475 } |
|
476 } |
|
477 IssueRequest(); |
|
478 } |
|
479 |
|
480 // -------------------------------------------------------------------------- |
|
481 // CPguSendMessageGroupCmd::PrepareAddressSelectL |
|
482 // -------------------------------------------------------------------------- |
|
483 // |
|
484 inline TInt CPguSendMessageGroupCmd::PrepareAddressSelectL |
|
485 ( RVPbkContactFieldDefaultPriorities& aPriorities, |
|
486 TUid aTechType ) |
|
487 { |
|
488 // Precondition |
|
489 __ASSERT_DEBUG( iMtmUid != KNullUid, Panic( EPanicUnknownMedia) ); |
|
490 |
|
491 TInt resourceId = KErrNotFound; |
|
492 |
|
493 // SMS |
|
494 if ( iMtmUid == KSenduiMtmSmsUid || |
|
495 aTechType == KSenduiTechnologySmsUid ) |
|
496 { |
|
497 if ( FeatureManager::FeatureSupported( KFeatureIdEmailOverSms ) ) |
|
498 { |
|
499 resourceId = R_PBK2_EMAIL_OVER_SMS_ADDRESS_SELECT; |
|
500 User::LeaveIfError( aPriorities.Append |
|
501 ( EVPbkDefaultTypeEmailOverSms ) ); |
|
502 } |
|
503 else |
|
504 { |
|
505 resourceId = R_PBK2_PHONE_NUMBER_SELECT; |
|
506 User::LeaveIfError( aPriorities.Append( EVPbkDefaultTypeSms ) ); |
|
507 } |
|
508 } |
|
509 // MMS |
|
510 else if ( iMtmUid == KSenduiMtmMmsUid || |
|
511 aTechType == KSenduiTechnologyMmsUid ) |
|
512 { |
|
513 resourceId = R_PBK2_MMS_ADDRESS_SELECT; |
|
514 User::LeaveIfError( aPriorities.Append( EVPbkDefaultTypeMms ) ); |
|
515 } |
|
516 // E-mail |
|
517 else if ( iMtmUid == KSenduiMtmSmtpUid || |
|
518 aTechType == KSenduiTechnologyMailUid ) |
|
519 { |
|
520 resourceId = R_PBK2_EMAIL_ADDRESS_SELECT; |
|
521 User::LeaveIfError( aPriorities.Append( EVPbkDefaultTypeEmail ) ); |
|
522 } |
|
523 // Unified message |
|
524 else if ( iMtmUid == KSenduiMtmUniMessageUid ) |
|
525 { |
|
526 if ( FeatureManager::FeatureSupported( KFeatureIdMMS ) ) |
|
527 { |
|
528 if (Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
529 LocallyVariatedFeatureEnabled( EVPbkLVShowEmailInSendMsg )) |
|
530 { |
|
531 resourceId = R_PBK2_UNIFIED_EDITOR_MMS_ADDRESS_SELECT; |
|
532 } |
|
533 else |
|
534 { |
|
535 resourceId = R_PBK2_UNIFIED_EDITOR_PHONE_NUMBER_SELECT; |
|
536 } |
|
537 User::LeaveIfError( aPriorities.Append( EVPbkDefaultTypeMms ) ); |
|
538 } |
|
539 |
|
540 if ( FeatureManager::FeatureSupported |
|
541 ( KFeatureIdEmailOverSms ) ) |
|
542 { |
|
543 if ( resourceId == KErrNotFound ) |
|
544 { |
|
545 resourceId = |
|
546 R_PBK2_UNIFIED_EDITOR_EMAIL_OVER_SMS_ADDRESS_SELECT; |
|
547 } |
|
548 // Include SMS default always in unified message, |
|
549 // in addition it has MMS default included with higher priority |
|
550 User::LeaveIfError( aPriorities.Append( |
|
551 EVPbkDefaultTypeEmailOverSms ) ); |
|
552 } |
|
553 else |
|
554 { |
|
555 if ( resourceId == KErrNotFound ) |
|
556 { |
|
557 resourceId = R_PBK2_UNIFIED_EDITOR_PHONE_NUMBER_SELECT; |
|
558 } |
|
559 // Include SMS default always in unified message, |
|
560 // in addition it has MMS default included with higher priority |
|
561 User::LeaveIfError( aPriorities.Append( EVPbkDefaultTypeSms ) ); |
|
562 } |
|
563 } |
|
564 |
|
565 // Postcondition |
|
566 __ASSERT_DEBUG( resourceId != KErrNotFound, Panic( EPanicLogic) ); |
|
567 |
|
568 return resourceId; |
|
569 } |
|
570 |
|
571 // -------------------------------------------------------------------------- |
|
572 // CPguSendMessageGroupCmd::SetAddressFromFieldL |
|
573 // -------------------------------------------------------------------------- |
|
574 // |
|
575 void CPguSendMessageGroupCmd::SetAddressFromFieldL( |
|
576 MVPbkStoreContactField& aField ) |
|
577 { |
|
578 HBufC* address = MVPbkContactFieldTextData::Cast( aField.FieldData() ). |
|
579 Text().AllocL(); |
|
580 CleanupStack::PushL( address ); |
|
581 |
|
582 if ( address && address->Des().Length() > 0 ) |
|
583 { |
|
584 HBufC* nameBuffer = |
|
585 Phonebook2::Pbk2AppUi()->ApplicationServices().NameFormatter(). |
|
586 GetContactTitleOrNullL( |
|
587 static_cast<const MVPbkBaseContactFieldCollection&>( |
|
588 iStoreContact->Fields() ), |
|
589 KDefaultTitleFormat ); |
|
590 if ( nameBuffer ) |
|
591 { |
|
592 CleanupStack::PushL( nameBuffer ); |
|
593 iMessageData->AppendToAddressL( *address, *nameBuffer ); |
|
594 CleanupStack::PopAndDestroy( nameBuffer ); |
|
595 } |
|
596 else |
|
597 { |
|
598 iMessageData->AppendToAddressL( *address ); |
|
599 } |
|
600 } |
|
601 CleanupStack::PopAndDestroy( address ); |
|
602 } |
|
603 |
|
604 // -------------------------------------------------------------------------- |
|
605 // CPguSendMessageGroupCmd::ProcessDismissed |
|
606 // -------------------------------------------------------------------------- |
|
607 // |
|
608 void CPguSendMessageGroupCmd::ProcessDismissed( TInt /*aCancelCode*/ ) |
|
609 { |
|
610 if (iUiControl) |
|
611 { |
|
612 iUiControl->UpdateAfterCommandExecution(); |
|
613 } |
|
614 |
|
615 // Notify command owner that the command has finished |
|
616 if ( iCommandObserver ) |
|
617 { |
|
618 iCommandObserver->CommandFinished( *this ); |
|
619 } |
|
620 } |
|
621 |
|
622 // -------------------------------------------------------------------------- |
|
623 // CPguSendMessageGroupCmd::FilterErrors |
|
624 // -------------------------------------------------------------------------- |
|
625 // |
|
626 TInt CPguSendMessageGroupCmd::FilterErrors( TInt aErrorCode ) |
|
627 { |
|
628 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
629 ("CPguSendMessageGroupCmd::FilterErrors(%d) start"), aErrorCode); |
|
630 |
|
631 TInt result = aErrorCode; |
|
632 switch ( aErrorCode ) |
|
633 { |
|
634 case KErrNotFound: // FALLTHROUGH |
|
635 case KErrInUse: |
|
636 { |
|
637 // Ignore these errors |
|
638 // KErrNotFound means that somebody got the contact first |
|
639 // KErrInUse means that the contact is open |
|
640 result = KErrNone; |
|
641 break; |
|
642 } |
|
643 default: // Something more serious happened -> give up |
|
644 { |
|
645 Cancel(); |
|
646 ProcessDismissed( aErrorCode ); |
|
647 break; |
|
648 } |
|
649 } |
|
650 |
|
651 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING( |
|
652 "CPguSendMessageGroupCmd::FilterErrors(%d) end"), result ); |
|
653 |
|
654 return result; |
|
655 } |
|
656 |
|
657 // -------------------------------------------------------------------------- |
|
658 // CPguSendMessageGroupCmd::IssueRequest |
|
659 // -------------------------------------------------------------------------- |
|
660 // |
|
661 void CPguSendMessageGroupCmd::IssueRequest() |
|
662 { |
|
663 if ( !IsActive() ) |
|
664 { |
|
665 TRequestStatus* status = &iStatus; |
|
666 User::RequestComplete( status, KErrNone ); |
|
667 SetActive(); |
|
668 } |
|
669 } |
|
670 |
|
671 // -------------------------------------------------------------------------- |
|
672 // CPguSendMessageGroupCmd::IssueStopRequest |
|
673 // -------------------------------------------------------------------------- |
|
674 // |
|
675 void CPguSendMessageGroupCmd::IssueStopRequest() |
|
676 { |
|
677 iState = EStopping; |
|
678 if ( !IsActive() ) |
|
679 { |
|
680 IssueRequest(); |
|
681 } |
|
682 } |
|
683 |
|
684 // End of File |