574 { |
574 { |
575 executeContactAction = ETrue; |
575 executeContactAction = ETrue; |
576 iHasBeenDragged = EFalse; |
576 iHasBeenDragged = EFalse; |
577 } |
577 } |
578 |
578 |
579 if ( executeContactAction && iPlugin.CommandState().IsRunning() ) |
579 if ( executeContactAction && iPlugin.CommandState().IsRunning() ) |
580 { |
580 { |
581 executeContactAction = EFalse; |
581 executeContactAction = EFalse; |
582 } |
582 } |
583 |
583 |
584 if (executeContactAction) |
584 if ( executeContactAction ) |
585 { |
585 { |
|
586 SetInputBlockerL(); |
|
587 |
586 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector |
588 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector |
587 contactActionType = iPlugin.Container().SelectedCommunicationMethod(); |
589 contactActionType = iPlugin.Container().SelectedCommunicationMethod(); |
588 |
590 |
589 if ( contactActionType |
591 if ( contactActionType |
590 == VPbkFieldTypeSelectorFactory::EFindOnMapSelector ) |
592 == VPbkFieldTypeSelectorFactory::EFindOnMapSelector ) |
591 { |
593 { |
592 if ( !iLongTap ) |
594 HandleFindOnMapContactActionL(); |
593 { |
|
594 DoShowMapCmdL( (TPbk2CommandId)EPbk2ExtensionShowOnMap ); |
|
595 } |
|
596 else |
|
597 { |
|
598 iLongTap = EFalse; |
|
599 } |
|
600 } |
595 } |
601 else |
596 else |
602 { |
597 { |
603 TPtrC fullName; |
598 HandleGenericContactActionL( contactActionType ); |
604 |
599 } |
605 iPlugin.ContactHandler().ContactFieldItemDataL( |
|
606 CCmsContactFieldItem::ECmsFullName, fullName); |
|
607 |
|
608 TUint paramFlag = CCAContactorService::TCSParameter::EEnableDefaults; |
|
609 |
|
610 CCAContactorService::TCSParameter param( |
|
611 contactActionType, |
|
612 *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray |
|
613 paramFlag, |
|
614 fullName); |
|
615 |
600 |
616 iPlugin.ExecuteServiceL(param); |
601 RemoveInputBlocker(); |
|
602 } |
|
603 } |
|
604 |
|
605 // ---------------------------------------------------------------------------- |
|
606 // CCCAppCommLauncherContainer::HandleFindOnMapContactActionL() |
|
607 // ---------------------------------------------------------------------------- |
|
608 // |
|
609 void CCCAppCommLauncherContainer::HandleFindOnMapContactActionL() |
|
610 { |
|
611 if ( !iLongTap ) |
|
612 { |
|
613 DoShowMapCmdL( (TPbk2CommandId)EPbk2ExtensionShowOnMap ); |
|
614 } |
|
615 else |
|
616 { |
|
617 iLongTap = EFalse; |
|
618 } |
|
619 } |
|
620 |
|
621 // ---------------------------------------------------------------------------- |
|
622 // CCCAppCommLauncherContainer::HandleGenericContactActionL() |
|
623 // ---------------------------------------------------------------------------- |
|
624 // |
|
625 void CCCAppCommLauncherContainer::HandleGenericContactActionL( |
|
626 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aActionType ) |
|
627 { |
|
628 TPtrC fullName; |
|
629 iPlugin.ContactHandler().ContactFieldItemDataL( |
|
630 CCmsContactFieldItem::ECmsFullName, fullName ); |
|
631 |
|
632 //contactlinkarray |
|
633 HBufC8* contactIdentifier = iPlugin.ContactHandler().ContactIdentifierLC(); |
|
634 |
|
635 TBool fieldSelectionReq(ETrue); |
|
636 TPtrC selectedField; |
|
637 if ( VPbkFieldTypeSelectorFactory::EVoiceCallSelector == aActionType ) |
|
638 { |
|
639 fieldSelectionReq = IsVoiceCallFieldSelectionAmbiguous( aActionType, selectedField ); |
|
640 } |
|
641 |
|
642 |
|
643 if( fieldSelectionReq ) |
|
644 { |
|
645 ExecuteContactActionServiceWithFieldSelectionL( |
|
646 aActionType, |
|
647 *contactIdentifier, |
|
648 fullName ); |
|
649 } |
|
650 else |
|
651 { |
|
652 // Speed up contact action by skipping slow field selection operation |
|
653 ExecuteContactActionServiceWithoutFieldSelectionL( |
|
654 aActionType, |
|
655 *contactIdentifier, |
|
656 fullName, |
|
657 selectedField ); |
|
658 } |
|
659 |
|
660 //The Timer can be started after user selected any call item |
|
661 if ( iPlugin.ContactorService()->IsSelected() && |
|
662 ( aActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector || |
|
663 aActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector || |
|
664 aActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) ) |
|
665 { |
|
666 iPlugin.StartTimerL(); |
|
667 } |
|
668 |
|
669 CleanupStack::PopAndDestroy(1);// contactlinkarray |
|
670 } |
|
671 |
|
672 // ---------------------------------------------------------------------------- |
|
673 // CCCAppCommLauncherContainer::IsVoiceCallFieldSelectionAmbiguous() |
|
674 // ---------------------------------------------------------------------------- |
|
675 // |
|
676 TBool CCCAppCommLauncherContainer::IsVoiceCallFieldSelectionAmbiguous( |
|
677 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aActionType, |
|
678 TPtrC& aSelectedField ) |
|
679 { |
|
680 CCCAppCommLauncherContactHandler& handler = iPlugin.ContactHandler(); |
|
681 |
|
682 if ( HasContactSingleAddress( aActionType, handler ) ) |
|
683 { |
|
684 RPointerArray<CCmsContactField>& fields = handler.ContactFieldDataArray(); |
|
685 |
|
686 for( TInt i=0; i < fields.Count(); i++ ) |
|
687 { |
|
688 CCmsContactField* field = fields[i]; |
617 |
689 |
618 //The Timer can be started after user selected any call item |
690 if ( HasFieldOnlyOneItem( *field ) && |
619 if ( iPlugin.ContactorService()->IsSelected() && |
691 IsVoiceCallType( *field ) ) |
620 (contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector || |
|
621 contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector || |
|
622 contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) ) |
|
623 { |
692 { |
624 iPlugin.StartTimerL(); |
693 const CCmsContactFieldItem* fieldItem = NULL; |
625 } |
694 |
626 |
695 TInt error = KErrNone; |
627 CleanupStack::PopAndDestroy(1);// contactlinkarray |
696 TRAP( error, fieldItem = &field->ItemL( 0 ) ); |
628 } |
697 |
629 } |
698 if( error == KErrNone ) |
|
699 { |
|
700 aSelectedField.Set(fieldItem->Data()); |
|
701 //Its safe to exit here |
|
702 //Making of Voice Call is not tedious |
|
703 //we have only one number |
|
704 return EFalse; |
|
705 } |
|
706 } |
|
707 } |
|
708 } |
|
709 |
|
710 return ETrue; |
|
711 } |
|
712 |
|
713 // ---------------------------------------------------------------------------- |
|
714 // CCCAppCommLauncherContainer::HasContactSingleAddress() |
|
715 // ---------------------------------------------------------------------------- |
|
716 // |
|
717 TBool CCCAppCommLauncherContainer::HasContactSingleAddress( |
|
718 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aActionType, |
|
719 CCCAppCommLauncherContactHandler& aHandler ) |
|
720 { |
|
721 TInt amount = aHandler.AddressAmount( aActionType ); |
|
722 if( 1 == amount ) |
|
723 { |
|
724 return ETrue; |
|
725 } |
|
726 |
|
727 return EFalse; |
|
728 } |
|
729 |
|
730 // ---------------------------------------------------------------------------- |
|
731 // CCCAppCommLauncherContainer::HasFieldOnlyOneItem() |
|
732 // ---------------------------------------------------------------------------- |
|
733 // |
|
734 TBool CCCAppCommLauncherContainer::HasFieldOnlyOneItem( const CCmsContactField& field ) const |
|
735 { |
|
736 const RPointerArray<CCmsContactFieldItem>& items = field.Items(); |
|
737 |
|
738 if ( 1 == items.Count() ) |
|
739 { |
|
740 return ETrue; |
|
741 } |
|
742 |
|
743 return EFalse; |
|
744 } |
|
745 |
|
746 // ---------------------------------------------------------------------------- |
|
747 // CCCAppCommLauncherContainer::IsVoiceCallType() |
|
748 // ---------------------------------------------------------------------------- |
|
749 // |
|
750 TBool CCCAppCommLauncherContainer::IsVoiceCallType( const CCmsContactField& field ) const |
|
751 { |
|
752 CCmsContactFieldItem::TCmsContactField fieldType = field.Type(); |
|
753 |
|
754 if( fieldType == CCmsContactFieldItem::ECmsLandPhoneGeneric || |
|
755 fieldType == CCmsContactFieldItem::ECmsLandPhoneHome || |
|
756 fieldType == CCmsContactFieldItem::ECmsLandPhoneWork || |
|
757 fieldType == CCmsContactFieldItem::ECmsMobilePhoneGeneric || |
|
758 fieldType == CCmsContactFieldItem::ECmsMobilePhoneHome || |
|
759 fieldType == CCmsContactFieldItem::ECmsMobilePhoneWork ) |
|
760 { |
|
761 return ETrue; |
|
762 } |
|
763 |
|
764 return EFalse; |
|
765 } |
|
766 |
|
767 |
|
768 // ---------------------------------------------------------------------------- |
|
769 // CCCAppCommLauncherContainer::ExecuteContactActionServiceWithFieldSelectionL() |
|
770 // ---------------------------------------------------------------------------- |
|
771 // |
|
772 void CCCAppCommLauncherContainer::ExecuteContactActionServiceWithFieldSelectionL( |
|
773 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aActionType, |
|
774 TDesC8& aContactIdentifier, |
|
775 TDesC& aFullName ) |
|
776 { |
|
777 TUint paramFlag = CCAContactorService::TCSParameter::EEnableDefaults; |
|
778 |
|
779 CCAContactorService::TCSParameter param( |
|
780 aActionType, |
|
781 aContactIdentifier, |
|
782 paramFlag, |
|
783 aFullName ); |
|
784 |
|
785 iPlugin.ExecuteServiceL(param); |
|
786 } |
|
787 |
|
788 // ---------------------------------------------------------------------------- |
|
789 // CCCAppCommLauncherContainer::ExecuteContactActionServiceWithoutFieldSelectionL() |
|
790 // ---------------------------------------------------------------------------- |
|
791 // |
|
792 void CCCAppCommLauncherContainer::ExecuteContactActionServiceWithoutFieldSelectionL( |
|
793 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aActionType, |
|
794 TDesC8& aContactIdentifier, |
|
795 TDesC& aFullName, |
|
796 TDesC& aSelectedField ) |
|
797 { |
|
798 CCAContactorService::TCSParameter param( |
|
799 aActionType, |
|
800 aContactIdentifier, |
|
801 CCAContactorService::TCSParameter::EUseFieldParam, |
|
802 aFullName, |
|
803 aSelectedField ); |
|
804 |
|
805 iPlugin.ExecuteServiceL(param); |
630 } |
806 } |
631 |
807 |
632 // ---------------------------------------------------------------------------- |
808 // ---------------------------------------------------------------------------- |
633 // CCCAppCommLauncherContainer::ContactInfoFetchedNotifyL() |
809 // CCCAppCommLauncherContainer::ContactInfoFetchedNotifyL() |
634 // ---------------------------------------------------------------------------- |
810 // ---------------------------------------------------------------------------- |