191 CPbk2ServerAppAppUi& appUi = |
209 CPbk2ServerAppAppUi& appUi = |
192 static_cast<CPbk2ServerAppAppUi&>(*CEikonEnv::Static()->EikAppUi()); |
210 static_cast<CPbk2ServerAppAppUi&>(*CEikonEnv::Static()->EikAppUi()); |
193 |
211 |
194 ixSPManager = CVPbkxSPContacts::NewL( |
212 ixSPManager = CVPbkxSPContacts::NewL( |
195 appUi.ApplicationServices().ContactManager() ); |
213 appUi.ApplicationServices().ContactManager() ); |
196 |
|
197 // Create contact presence manager if chat fields should be shown |
|
198 if ( ( iCommMethod == |
|
199 VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ) || |
|
200 ( iCommMethod == |
|
201 VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) ) |
|
202 |
|
203 { |
|
204 iContactPresence = TContactPresenceFactory::NewContactPresenceL( |
|
205 *this ); |
|
206 // ...and start presence icons retrieving |
|
207 HBufC8* packedLink = iContactLink->PackLC(); |
|
208 TInt opId = iContactPresence->GetPresenceInfoL( *packedLink ); |
|
209 CleanupStack::PopAndDestroy( packedLink ); |
|
210 } |
|
211 else |
|
212 { |
|
213 iPresenceIconsRetrieved = ETrue; |
|
214 } |
|
215 } |
214 } |
216 |
215 |
217 // -------------------------------------------------------------------------- |
216 // -------------------------------------------------------------------------- |
218 // CPbk2CommAddressSelectPhase::NewL |
217 // CPbk2CommAddressSelectPhase::NewL |
219 // -------------------------------------------------------------------------- |
218 // -------------------------------------------------------------------------- |
352 // |
356 // |
353 void CPbk2CommAddressSelectPhase::VPbkSingleContactOperationComplete |
357 void CPbk2CommAddressSelectPhase::VPbkSingleContactOperationComplete |
354 ( MVPbkContactOperationBase& /*aOperation*/, |
358 ( MVPbkContactOperationBase& /*aOperation*/, |
355 MVPbkStoreContact* aContact ) |
359 MVPbkStoreContact* aContact ) |
356 { |
360 { |
357 if ( iState == EMainContactRetrieving ) |
361 __ASSERT_DEBUG( iState == EInitialState || iState == ExSPLinksRetrieved || |
358 { |
362 iState == ExSPContactRetrieved, |
|
363 Panic( EPanicPreCond_ContactOperationComplete ) ); |
|
364 |
|
365 if ( iState == EInitialState ) |
|
366 { |
|
367 iState = EMainContactRetrieved; |
359 // Contact retrieval complete, take contact ownership |
368 // Contact retrieval complete, take contact ownership |
360 delete iStoreContact; |
369 delete iStoreContact; |
361 iStoreContact = aContact; |
370 iStoreContact = aContact; |
362 |
371 StartLoadingxSPContactLinks(); |
363 // Start fetching xSP contact links |
372 } |
364 iState = ExSPLinksRetrieving; |
373 else if ( iState == ExSPLinksRetrieved || iState == ExSPContactRetrieved ) |
365 |
374 { |
366 TRAPD( err, |
375 iState = ExSPContactRetrieved; |
367 ixSPContactOperation = ixSPManager->GetxSPContactLinksL( |
376 |
368 *iStoreContact, *this, *this ); |
377 // xSP contact retrieval complete. Ignore errors, just try next one |
369 ); |
378 // or go to next state. |
370 |
379 /*TInt err = */ixSPStoreContactsArray.Append( aContact ); |
371 if ( err != KErrNone ) |
|
372 { |
|
373 // Run the address select dialog for the main contact at least |
|
374 TRAPD( err, DoSelectAddressesL() ); |
|
375 if ( err != KErrNone ) |
|
376 { |
|
377 iObserver.PhaseError( *this, err ); |
|
378 } |
|
379 iState = EDialogWaitsUserInput; |
|
380 } |
|
381 } |
|
382 |
|
383 if ( iState == ExSPContactsRetrieving ) |
|
384 { |
|
385 // xSP contact retrieval complete |
|
386 TInt err = ixSPStoreContactsArray.Append( aContact ); |
|
387 |
|
388 // If error, stop retrieving xSP contacts and show address select |
|
389 // dialog. |
|
390 |
380 |
391 // Start retrieving next xSP contact, if there are some contacts left |
381 // Start retrieving next xSP contact, if there are some contacts left |
392 if ( ixSPContactsArray->Count() != 0 && err == KErrNone ) |
382 if ( ixSPContactsArray->Count() > 0 ) |
393 { |
383 { |
394 TRAP( err, RetrieveContactL(); ); |
384 RetrieveContact(); |
395 if ( err != KErrNone ) |
|
396 { |
|
397 iState = EDialogWaitsUserInput; |
|
398 } |
|
399 } |
385 } |
400 else |
386 else |
401 { |
387 { |
402 FilterXspContactsL(); |
388 iState = ExSPContactsRetrieved; |
403 // Run the address select, if no more contacts to retrieve |
389 StartLoadingPresenceIconInfo(); |
404 TRAP( err, DoSelectAddressesL() ); |
|
405 if ( err != KErrNone ) |
|
406 { |
|
407 iObserver.PhaseError( *this, err ); |
|
408 } |
|
409 } |
390 } |
410 } |
391 } |
411 } |
392 } |
412 |
393 |
413 // -------------------------------------------------------------------------- |
394 // -------------------------------------------------------------------------- |
444 // |
425 // |
445 void CPbk2CommAddressSelectPhase::VPbkOperationFailed( |
426 void CPbk2CommAddressSelectPhase::VPbkOperationFailed( |
446 MVPbkContactOperationBase* /*aOperation*/, TInt /*aError*/ ) |
427 MVPbkContactOperationBase* /*aOperation*/, TInt /*aError*/ ) |
447 { |
428 { |
448 // Ignore an error, xSP info can be omitted. Just run address select dialog |
429 // Ignore an error, xSP info can be omitted. Just run address select dialog |
449 TRAPD( err, DoSelectAddressesL() ); |
430 DoSelectAddresses(); |
450 if ( err != KErrNone ) |
|
451 { |
|
452 iObserver.PhaseError( *this, err ); |
|
453 } |
|
454 |
|
455 iState = EDialogWaitsUserInput; |
|
456 } |
431 } |
457 // -------------------------------------------------------------------------- |
432 // -------------------------------------------------------------------------- |
458 // CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted |
433 // CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted |
459 // -------------------------------------------------------------------------- |
434 // -------------------------------------------------------------------------- |
460 // |
435 // |
461 void CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted( |
436 void CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted( |
462 MVPbkContactOperationBase* /*aOperation*/, |
437 MVPbkContactOperationBase* /*aOperation*/, |
463 MVPbkContactLinkArray* aArray ) |
438 MVPbkContactLinkArray* aArray ) |
464 { |
439 { |
465 if ( aArray == NULL || aArray->Count() == 0 ) |
440 iState = ExSPLinksRetrieved; |
466 { |
441 if ( !aArray || aArray->Count() == 0 ) |
467 // No xSP contacts, run address select dialog |
442 { |
468 TRAPD( err, DoSelectAddressesL() ); |
443 StartLoadingPresenceIconInfo(); |
469 if ( err != KErrNone ) |
|
470 { |
|
471 iObserver.PhaseError( *this, err ); |
|
472 } |
|
473 } |
444 } |
474 else |
445 else |
475 { |
446 { |
476 TRAPD( err, |
447 StartLoadingxSPContacts( *aArray ); |
477 // Take a own copy of supplied contact links |
|
478 ixSPContactsArray = CVPbkContactLinkArray::NewL(); |
|
479 CopyContactLinksL( *aArray, *ixSPContactsArray ); |
|
480 |
|
481 // Start fetching xSP contacts |
|
482 iState = ExSPContactsRetrieving; |
|
483 RetrieveContactL(); |
|
484 ); |
|
485 |
|
486 // If error happened, show address select dialog |
|
487 if ( err != KErrNone ) |
|
488 { |
|
489 TRAP( err, DoSelectAddressesL() ); |
|
490 if ( err != KErrNone ) |
|
491 { |
|
492 iObserver.PhaseError( *this, err ); |
|
493 } |
|
494 } |
|
495 |
|
496 ixSPStoreContactsArray.ResetAndDestroy(); |
|
497 } |
448 } |
498 } |
449 } |
499 |
450 |
500 // -------------------------------------------------------------------------- |
451 // -------------------------------------------------------------------------- |
501 // CPbk2CommAddressSelectPhase::ReceiveIconInfoL |
452 // CPbk2CommAddressSelectPhase::ReceiveIconInfoL |
540 } |
486 } |
541 } |
487 } |
542 } |
488 } |
543 |
489 |
544 // check if all icon files received |
490 // check if all icon files received |
545 iPresenceIconsRetrieved = ETrue; |
491 iState = EPresenceIconsRetrieved; |
546 for ( TInt j = 0; j < count && iPresenceIconsRetrieved; j++ ) |
492 for ( TInt j = 0; j < count && iState == EPresenceIconsRetrieved; j++ ) |
547 { |
493 { |
548 if ( iPresenceIconArray[j]->IconBitmap() == NULL || |
494 if ( iPresenceIconArray[j]->IconBitmap() == NULL || |
549 iPresenceIconArray[j]->IconBitmapMask() == NULL ) |
495 iPresenceIconArray[j]->IconBitmapMask() == NULL ) |
550 { |
496 { |
551 iPresenceIconsRetrieved = EFalse; |
497 // Not all retrieved, still in state EPresenceIconRetrieved. |
|
498 iState = EPresenceIconRetrieved; |
552 } |
499 } |
553 } |
500 } |
554 |
501 |
555 // start address fetch dialog, if it waits for presence icons |
502 // start address fetch dialog, if it waits for presence icons |
556 if ( iPresenceIconsRetrieved && iState == EWaitForPresenceIcons ) |
503 if ( iState == EPresenceIconsRetrieved ) |
557 { |
504 { |
558 TRAPD( err, DoSelectAddressesL() ); |
505 DoSelectAddresses(); |
559 if ( err != KErrNone ) |
|
560 { |
|
561 iObserver.PhaseError( *this, err ); |
|
562 } |
|
563 } |
506 } |
564 } |
507 } |
565 |
508 |
566 // -------------------------------------------------------------------------- |
509 // -------------------------------------------------------------------------- |
567 // CPbk2CommAddressSelectPhase::PresenceSubscribeError |
510 // CPbk2CommAddressSelectPhase::PresenceSubscribeError |
580 // |
523 // |
581 void CPbk2CommAddressSelectPhase::ErrorOccured( |
524 void CPbk2CommAddressSelectPhase::ErrorOccured( |
582 TInt /*aOpId*/, |
525 TInt /*aOpId*/, |
583 TInt /*aStatus*/ ) |
526 TInt /*aStatus*/ ) |
584 { |
527 { |
585 // Incase of several errors from contact precense avoid |
528 if (iState == EPresenceIconInfoRetrieved || |
586 // multiple launching of the select dialog |
529 iState == EPresenceIconRetrieved ) |
587 // TODO: How should the errors be hanlded? |
530 { |
588 if (!iPresenceIconsRetrieved) |
|
589 { |
|
590 // Error occured, destroy presence icon array |
|
591 iPresenceIconsRetrieved = ETrue; |
|
592 iPresenceIconArray.ResetAndDestroy(); |
531 iPresenceIconArray.ResetAndDestroy(); |
593 //Needn't to launch address fetch dialog if contact had been retrieved, |
532 DoSelectAddresses(); |
594 //because it will start this dialog after retrieve the contact, |
|
595 //avoid multiple launching of the select dialog |
|
596 if ( !iContactRetrieved ) |
|
597 { |
|
598 // Launch the address fetch dialog if it's waiting for presence icons. |
|
599 TRAPD( err, DoSelectAddressesL() ); |
|
600 if ( err != KErrNone ) |
|
601 { |
|
602 iObserver.PhaseError( *this, err ); |
|
603 } |
|
604 } |
|
605 } |
533 } |
606 } |
534 } |
607 |
535 |
608 // -------------------------------------------------------------------------- |
536 // -------------------------------------------------------------------------- |
609 // CPbk2CommAddressSelectPhase::ReceiveIconInfosL |
537 // CPbk2CommAddressSelectPhase::ReceiveIconInfosL |
610 // -------------------------------------------------------------------------- |
538 // -------------------------------------------------------------------------- |
611 // |
539 // |
612 void CPbk2CommAddressSelectPhase::ReceiveIconInfosL( |
540 void CPbk2CommAddressSelectPhase::ReceiveIconInfosL( |
613 const TDesC8& /*aPackedLink*/, |
541 const TDesC8& aPackedLink, |
614 RPointerArray <MContactPresenceInfo>& aInfoArray, |
542 RPointerArray <MContactPresenceInfo>& aInfoArray, |
615 TInt /*aOpId*/ ) |
543 TInt aOpId ) |
616 { |
544 { |
|
545 iState = EPresenceIconInfoRetrieved; |
|
546 // Must be TRAPped here because presence framework ignores the leave |
|
547 // and this instance will be jammed if ReceiveIconInfosL leaves. |
|
548 TRAPD( res, HandleReceiveIconInfosL( aPackedLink, aInfoArray, aOpId ) ); |
|
549 if ( res != KErrNone ) |
|
550 { |
|
551 DoSelectAddresses(); |
|
552 } |
|
553 |
|
554 } |
|
555 // -------------------------------------------------------------------------- |
|
556 // CPbk2AddressSelectPhase::StoreReady |
|
557 // -------------------------------------------------------------------------- |
|
558 // |
|
559 void CPbk2CommAddressSelectPhase::StoreReady( |
|
560 MVPbkContactStore& /*aContactStore*/ ) |
|
561 { |
|
562 // not interested |
|
563 } |
|
564 |
|
565 // -------------------------------------------------------------------------- |
|
566 // CPbk2AddressSelectPhase::StoreUnavailable |
|
567 // -------------------------------------------------------------------------- |
|
568 // |
|
569 void CPbk2CommAddressSelectPhase::StoreUnavailable( |
|
570 MVPbkContactStore& /*aContactStore*/, |
|
571 TInt /*aReason*/ ) |
|
572 { |
|
573 // not interested |
|
574 } |
|
575 |
|
576 // -------------------------------------------------------------------------- |
|
577 // CPbk2AttributeAddressSelectPhase::StoreUnavailable |
|
578 // -------------------------------------------------------------------------- |
|
579 // |
|
580 void CPbk2CommAddressSelectPhase::HandleStoreEventL( |
|
581 MVPbkContactStore& /*aContactStore*/, |
|
582 TVPbkContactStoreEvent aEvent ) |
|
583 { |
|
584 if ( aEvent.iContactLink != NULL && iStoreContact != NULL ) |
|
585 { |
|
586 if ( aEvent.iContactLink->RefersTo( *iStoreContact ) ) |
|
587 { |
|
588 CancelServicePhase(); |
|
589 } |
|
590 } |
|
591 } |
|
592 |
|
593 // -------------------------------------------------------------------------- |
|
594 // CPbk2CommAddressSelectPhase::HandleReceiveIconInfosL |
|
595 // -------------------------------------------------------------------------- |
|
596 // |
|
597 void CPbk2CommAddressSelectPhase::HandleReceiveIconInfosL( |
|
598 const TDesC8& /*aPackedLink*/, |
|
599 RPointerArray<MContactPresenceInfo>& aInfoArray, TInt /*aOpId*/) |
|
600 { |
617 // service specific icons received |
601 // service specific icons received |
618 TInt count = aInfoArray.Count(); |
602 TInt count = aInfoArray.Count(); |
619 |
603 |
620 // calculate and set preferred icon size |
604 // calculate and set preferred icon size |
621 TRect mainPane; |
605 TRect mainPane; |
654 TInt opId = iContactPresence->GetPresenceIconFileL( |
638 TInt opId = iContactPresence->GetPresenceIconFileL( |
655 aInfoArray[i]->BrandId(), aInfoArray[i]->ElementId() ); |
639 aInfoArray[i]->BrandId(), aInfoArray[i]->ElementId() ); |
656 } |
640 } |
657 } |
641 } |
658 } |
642 } |
|
643 |
659 if ( iPresenceIconArray.Count() == 0 ) |
644 if ( iPresenceIconArray.Count() == 0 ) |
660 { |
645 { |
661 iPresenceIconsRetrieved = ETrue; |
646 DoSelectAddresses(); |
662 } |
647 } |
663 if ( iPresenceIconsRetrieved && iState == EWaitForPresenceIcons ) |
648 } |
664 { |
649 |
665 TRAPD( err, DoSelectAddressesL() ); |
650 // -------------------------------------------------------------------------- |
666 if ( err != KErrNone ) |
651 // CPbk2CommAddressSelectPhase::RetrieveContact |
667 { |
652 // -------------------------------------------------------------------------- |
668 iObserver.PhaseError( *this, err ); |
653 // |
669 } |
654 void CPbk2CommAddressSelectPhase::RetrieveContact() |
670 } |
655 { |
671 } |
656 TRAPD( res, RetrieveContactL() ); |
672 // -------------------------------------------------------------------------- |
657 if ( res != KErrNone ) |
673 // CPbk2AddressSelectPhase::StoreReady |
658 { |
674 // -------------------------------------------------------------------------- |
659 DoSelectAddresses(); |
675 // |
|
676 void CPbk2CommAddressSelectPhase::StoreReady( |
|
677 MVPbkContactStore& /*aContactStore*/ ) |
|
678 { |
|
679 // not interested |
|
680 } |
|
681 |
|
682 // -------------------------------------------------------------------------- |
|
683 // CPbk2AddressSelectPhase::StoreUnavailable |
|
684 // -------------------------------------------------------------------------- |
|
685 // |
|
686 void CPbk2CommAddressSelectPhase::StoreUnavailable( |
|
687 MVPbkContactStore& /*aContactStore*/, |
|
688 TInt /*aReason*/ ) |
|
689 { |
|
690 // not interested |
|
691 } |
|
692 |
|
693 // -------------------------------------------------------------------------- |
|
694 // CPbk2AttributeAddressSelectPhase::StoreUnavailable |
|
695 // -------------------------------------------------------------------------- |
|
696 // |
|
697 void CPbk2CommAddressSelectPhase::HandleStoreEventL( |
|
698 MVPbkContactStore& /*aContactStore*/, |
|
699 TVPbkContactStoreEvent aEvent ) |
|
700 { |
|
701 if ( aEvent.iContactLink != NULL && iStoreContact != NULL ) |
|
702 { |
|
703 if ( aEvent.iContactLink->RefersTo( *iStoreContact ) ) |
|
704 { |
|
705 CancelServicePhase(); |
|
706 } |
|
707 } |
660 } |
708 } |
661 } |
709 |
662 |
710 // -------------------------------------------------------------------------- |
663 // -------------------------------------------------------------------------- |
711 // CPbk2CommAddressSelectPhase::RetrieveContactL |
664 // CPbk2CommAddressSelectPhase::RetrieveContactL |
712 // -------------------------------------------------------------------------- |
665 // -------------------------------------------------------------------------- |
713 // |
666 // |
714 void CPbk2CommAddressSelectPhase::RetrieveContactL() |
667 void CPbk2CommAddressSelectPhase::RetrieveContactL() |
715 { |
668 { |
|
669 __ASSERT_DEBUG( iState == EInitialState || iState == ExSPLinksRetrieved || |
|
670 iState == ExSPContactRetrieved, |
|
671 Panic( EPanicPreCond_RetrieveContactL ) ); |
|
672 |
716 CPbk2ServerAppAppUi& appUi = |
673 CPbk2ServerAppAppUi& appUi = |
717 static_cast<CPbk2ServerAppAppUi&> |
674 static_cast<CPbk2ServerAppAppUi&> |
718 ( *iEikenv->EikAppUi() ); |
675 ( *iEikenv->EikAppUi() ); |
719 |
676 |
720 // Fetch one contact at a time if service cancellation is not |
677 // Fetch one contact at a time if service cancellation is not |
721 // commanded. |
678 // commanded. |
722 delete iRetrieveOperation; |
679 delete iRetrieveOperation; |
723 iRetrieveOperation = NULL; |
680 iRetrieveOperation = NULL; |
724 |
681 |
725 if ( iState == EMainContactRetrieving ) |
682 if ( iState == EInitialState ) |
726 { |
683 { |
727 iRetrieveOperation = appUi.ApplicationServices().ContactManager(). |
684 iRetrieveOperation = appUi.ApplicationServices().ContactManager(). |
728 RetrieveContactL( *iContactLink, *this ); |
685 RetrieveContactL( *iContactLink, *this ); |
729 } |
686 } |
730 else if ( iState == ExSPContactsRetrieving ) |
687 else if ( iState == ExSPLinksRetrieved || iState == ExSPContactRetrieved ) |
731 { |
688 { |
732 iRetrieveOperation = appUi.ApplicationServices().ContactManager(). |
689 iRetrieveOperation = appUi.ApplicationServices().ContactManager(). |
733 RetrieveContactL( ixSPContactsArray->At( 0 ), *this ); |
690 RetrieveContactL( ixSPContactsArray->At( 0 ), *this ); |
734 ixSPContactsArray->Delete( 0 ); |
691 ixSPContactsArray->Delete( 0 ); |
735 } |
692 } |
736 } |
693 } |
737 |
694 |
738 // -------------------------------------------------------------------------- |
695 // -------------------------------------------------------------------------- |
|
696 // CPbk2CommAddressSelectPhase::DoSelectAddresses |
|
697 // -------------------------------------------------------------------------- |
|
698 // |
|
699 void CPbk2CommAddressSelectPhase::DoSelectAddresses() |
|
700 { |
|
701 TRAPD( res, DoSelectAddressesL() ); |
|
702 if ( res != KErrNone ) |
|
703 { |
|
704 iState = EAddressSelectError; |
|
705 iObserver.PhaseError( *this, res ); |
|
706 } |
|
707 } |
|
708 |
|
709 // -------------------------------------------------------------------------- |
739 // CPbk2CommAddressSelectPhase::DoSelectAddressesL |
710 // CPbk2CommAddressSelectPhase::DoSelectAddressesL |
740 // -------------------------------------------------------------------------- |
711 // -------------------------------------------------------------------------- |
741 // |
712 // |
742 void CPbk2CommAddressSelectPhase::DoSelectAddressesL() |
713 void CPbk2CommAddressSelectPhase::DoSelectAddressesL() |
743 { |
714 { |
744 |
715 __ASSERT_DEBUG(iStoreContact, Panic(EPanicPreCond_DoSelectAddressesL)); |
745 if ( !iStoreContact ) |
716 |
746 { |
717 FilterXspContactsL(); |
747 return; |
718 |
748 } |
|
749 |
|
750 if ( !iPresenceIconsRetrieved ) |
|
751 { |
|
752 // wait for presence icons |
|
753 iState = EWaitForPresenceIcons; |
|
754 return; |
|
755 } |
|
756 |
|
757 TResourceReader reader; |
719 TResourceReader reader; |
758 CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId ); |
720 CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId ); |
759 |
721 |
760 CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&> |
722 CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&> |
761 ( *iEikenv->EikAppUi() ); |
723 ( *iEikenv->EikAppUi() ); |
772 params.SetDefaultPriorities( iPriorities ); |
734 params.SetDefaultPriorities( iPriorities ); |
773 |
735 |
774 // Launch call directly using default values. |
736 // Launch call directly using default values. |
775 params.SetUseDefaultDirectly( ETrue ); |
737 params.SetUseDefaultDirectly( ETrue ); |
776 |
738 |
|
739 TArray<MVPbkStoreContact*> storeContactsArray = |
|
740 ixSPStoreContactsArray.Array(); |
|
741 TArray<CPbk2PresenceIconInfo*> presenceIconsArray = |
|
742 iPresenceIconArray.Array(); |
777 CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL( |
743 CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL( |
778 params, iFieldTypeSelector, &ixSPStoreContactsArray.Array(), |
744 params, iFieldTypeSelector, &storeContactsArray, |
779 &iPresenceIconArray.Array() ); |
745 &presenceIconsArray ); |
780 |
746 |
781 // Correct CBA buttons |
747 // Correct CBA buttons |
782 TInt correctedCba = CorrectRSK( iResourceId ); |
748 TInt correctedCba = CorrectRSK( iResourceId ); |
783 if ( correctedCba > KErrNone ) |
749 if ( correctedCba > KErrNone ) |
784 { |
750 { |
985 CleanupStack::PopAndDestroy(); // xspContcatXspIdArray |
953 CleanupStack::PopAndDestroy(); // xspContcatXspIdArray |
986 CleanupStack::PopAndDestroy(); // storeContactXspIdArray |
954 CleanupStack::PopAndDestroy(); // storeContactXspIdArray |
987 |
955 |
988 return result; |
956 return result; |
989 } |
957 } |
|
958 |
|
959 // -------------------------------------------------------------------------- |
|
960 // CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinks |
|
961 // -------------------------------------------------------------------------- |
|
962 // |
|
963 void CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinks() |
|
964 { |
|
965 TRAPD( res, StartLoadingxSPContactLinksL() ); |
|
966 if (res != KErrNone) |
|
967 { |
|
968 DoSelectAddresses(); |
|
969 } |
|
970 } |
|
971 |
|
972 // -------------------------------------------------------------------------- |
|
973 // CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinksL |
|
974 // -------------------------------------------------------------------------- |
|
975 // |
|
976 void CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinksL() |
|
977 { |
|
978 delete ixSPContactOperation; |
|
979 ixSPContactOperation = NULL; |
|
980 ixSPContactOperation = ixSPManager->GetxSPContactLinksL( |
|
981 *iStoreContact, *this, *this); |
|
982 } |
|
983 |
|
984 // -------------------------------------------------------------------------- |
|
985 // CPbk2CommAddressSelectPhase::StartLoadingxSPContacts |
|
986 // -------------------------------------------------------------------------- |
|
987 // |
|
988 void CPbk2CommAddressSelectPhase::StartLoadingxSPContacts( |
|
989 MVPbkContactLinkArray& aArray ) |
|
990 { |
|
991 TRAPD( res, StartLoadingxSPContactsL( aArray ) ); |
|
992 if ( res != KErrNone ) |
|
993 { |
|
994 DoSelectAddresses(); |
|
995 } |
|
996 } |
|
997 |
|
998 // -------------------------------------------------------------------------- |
|
999 // CPbk2CommAddressSelectPhase::StartLoadingxSPContactsL |
|
1000 // -------------------------------------------------------------------------- |
|
1001 // |
|
1002 void CPbk2CommAddressSelectPhase::StartLoadingxSPContactsL( |
|
1003 MVPbkContactLinkArray& aArray ) |
|
1004 { |
|
1005 // Take a own copy of supplied contact links |
|
1006 if (!ixSPContactsArray) |
|
1007 { |
|
1008 ixSPContactsArray = CVPbkContactLinkArray::NewL(); |
|
1009 } |
|
1010 ixSPStoreContactsArray.ResetAndDestroy(); |
|
1011 |
|
1012 CopyContactLinksL( aArray, *ixSPContactsArray ); |
|
1013 RetrieveContactL(); |
|
1014 } |
|
1015 |
|
1016 |
|
1017 // -------------------------------------------------------------------------- |
|
1018 // CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfo |
|
1019 // -------------------------------------------------------------------------- |
|
1020 // |
|
1021 void CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfo() |
|
1022 { |
|
1023 TRAPD( res, StartLoadingPresenceIconInfoL()); |
|
1024 if ( res != KErrNone ) |
|
1025 { |
|
1026 // In error case continue like there are no presence icons. |
|
1027 DoSelectAddresses(); |
|
1028 } |
|
1029 } |
|
1030 |
|
1031 // -------------------------------------------------------------------------- |
|
1032 // CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfoL |
|
1033 // -------------------------------------------------------------------------- |
|
1034 // |
|
1035 void CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfoL() |
|
1036 { |
|
1037 const TInt oneAddress = 1; |
|
1038 if ( ( iCommMethod == |
|
1039 VPbkFieldTypeSelectorFactory::EInstantMessagingSelector || |
|
1040 iCommMethod == |
|
1041 VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) && |
|
1042 NumOfAddressesL() > oneAddress ) |
|
1043 { |
|
1044 GetPresenceInfoL(); |
|
1045 } |
|
1046 else |
|
1047 { |
|
1048 DoSelectAddresses(); |
|
1049 } |
|
1050 } |
|
1051 |
|
1052 // -------------------------------------------------------------------------- |
|
1053 // CPbk2CommAddressSelectPhase::NumOfAddressesL |
|
1054 // -------------------------------------------------------------------------- |
|
1055 // |
|
1056 TInt CPbk2CommAddressSelectPhase::NumOfAddressesL( |
|
1057 MVPbkStoreContact& aStoreContact ) |
|
1058 { |
|
1059 CVPbkFieldFilter::TConfig config( aStoreContact.Fields(), |
|
1060 &iFieldTypeSelector ); |
|
1061 CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config ); |
|
1062 TInt result = fieldFilter->FieldCount(); |
|
1063 delete fieldFilter; |
|
1064 return result; |
|
1065 } |
|
1066 |
|
1067 // -------------------------------------------------------------------------- |
|
1068 // CPbk2CommAddressSelectPhase::NumOfAddressesL |
|
1069 // -------------------------------------------------------------------------- |
|
1070 // |
|
1071 TInt CPbk2CommAddressSelectPhase::NumOfAddressesL() |
|
1072 { |
|
1073 TInt numOfAddresses = 0; |
|
1074 if ( iStoreContact ) |
|
1075 { |
|
1076 numOfAddresses += NumOfAddressesL( *iStoreContact ); |
|
1077 } |
|
1078 |
|
1079 const TInt count = ixSPStoreContactsArray.Count(); |
|
1080 for ( TInt i = 0; i < count; ++i ) |
|
1081 { |
|
1082 numOfAddresses += NumOfAddressesL( *ixSPStoreContactsArray[i] ); |
|
1083 } |
|
1084 return numOfAddresses; |
|
1085 } |
|
1086 |
|
1087 // -------------------------------------------------------------------------- |
|
1088 // CPbk2CommAddressSelectPhase::GetPresenceInfoL |
|
1089 // -------------------------------------------------------------------------- |
|
1090 // |
|
1091 void CPbk2CommAddressSelectPhase::GetPresenceInfoL() |
|
1092 { |
|
1093 if ( !iContactPresence ) |
|
1094 { |
|
1095 iContactPresence = TContactPresenceFactory::NewContactPresenceL( |
|
1096 *this ); |
|
1097 } |
|
1098 // ...and start presence icons retrieving |
|
1099 HBufC8* packedLink = iContactLink->PackLC(); |
|
1100 // Operation id no needed because CancelAll is used. |
|
1101 /*TInt opId =*/iContactPresence->GetPresenceInfoL( *packedLink ); |
|
1102 CleanupStack::PopAndDestroy( packedLink ); |
|
1103 } |
|
1104 |
990 // End of File |
1105 // End of File |