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