81 #include "FreestyleEmailUiCLSItem.h" |
81 #include "FreestyleEmailUiCLSItem.h" |
82 #include "FreestyleEmailUiAppui.h" |
82 #include "FreestyleEmailUiAppui.h" |
83 |
83 |
84 //Constants |
84 //Constants |
85 const TInt KInternetCallPreferred = 1; |
85 const TInt KInternetCallPreferred = 1; |
86 /** UID of the CCA details view plugin implementation |
86 |
87 * ( from ccappdetailsviewpluginuids.hrh ) */ |
|
88 const TInt KCCADetailsViewPluginImplmentationUid = 0x200159E7; |
|
89 /** CCA Application |
|
90 * ( from ccauids.h )*/ |
|
91 const TInt KCCAAppUID = 0x2000B609; |
|
92 /** Phonebook2 App UID */ |
|
93 const TInt KPbkUID3 = 0x101f4cce; |
|
94 |
87 |
95 CFSEmailUiContactHandler* CFSEmailUiContactHandler::NewL( RFs& aSession ) |
88 CFSEmailUiContactHandler* CFSEmailUiContactHandler::NewL( RFs& aSession ) |
96 { |
89 { |
97 FUNC_LOG; |
90 FUNC_LOG; |
98 CFSEmailUiContactHandler* self = CFSEmailUiContactHandler::NewLC( aSession ); |
91 CFSEmailUiContactHandler* self = CFSEmailUiContactHandler::NewLC( aSession ); |
341 } |
334 } |
342 if ( aVoipOverride || SelectBetweenCsAndVoip() == EAiwVoIPCall ) |
335 if ( aVoipOverride || SelectBetweenCsAndVoip() == EAiwVoIPCall ) |
343 { |
336 { |
344 dialData->SetCallType( CAiwDialData::EAIWVoiP ); |
337 dialData->SetCallType( CAiwDialData::EAIWVoiP ); |
345 } |
338 } |
|
339 // <cmail> video call |
346 else if ( iVideoCall ) |
340 else if ( iVideoCall ) |
347 { |
341 { |
348 iVideoCall = EFalse; |
342 iVideoCall = EFalse; |
349 dialData->SetCallType( CAiwDialData::EAIWForcedVideo ); |
343 dialData->SetCallType( CAiwDialData::EAIWForcedVideo ); |
350 } |
344 } |
|
345 // </cmail> |
351 else |
346 else |
352 { |
347 { |
353 dialData->SetCallType( CAiwDialData::EAIWVoice ); |
348 dialData->SetCallType( CAiwDialData::EAIWVoice ); |
354 } |
349 } |
355 } |
350 } |
502 0, |
499 0, |
503 this); |
500 this); |
504 } |
501 } |
505 } |
502 } |
506 |
503 |
|
504 // <cmail> video call |
507 // --------------------------------------------------------------------------- |
505 // --------------------------------------------------------------------------- |
508 // Enables/disables video call. |
506 // Enables/disables video call. |
509 // --------------------------------------------------------------------------- |
507 // --------------------------------------------------------------------------- |
510 // |
508 // |
511 void CFSEmailUiContactHandler::SetVideoCall( TBool aState ) |
509 void CFSEmailUiContactHandler::SetVideoCall( TBool aState ) |
512 { |
510 { |
513 FUNC_LOG; |
|
514 iVideoCall = aState; |
511 iVideoCall = aState; |
515 } |
512 } |
516 |
513 // </cmail> |
517 // --------------------------------------------------------------------------- |
514 |
|
515 ///////////////////////////////////////////////////////////////////////////// |
518 // CFSEmailUiContactHandler::GetSmsAddressFromPhonebookAndSendL |
516 // CFSEmailUiContactHandler::GetSmsAddressFromPhonebookAndSendL |
519 // --------------------------------------------------------------------------- |
|
520 // |
517 // |
521 void CFSEmailUiContactHandler::GetSmsAddressFromPhonebookAndSendL( |
518 ///////////////////////////////////////////////////////////////////////////// |
522 MVPbkContactLink* aContactLink ) |
519 void CFSEmailUiContactHandler::GetSmsAddressFromPhonebookAndSendL( MVPbkContactLink* aContactLink ) |
523 { |
520 { |
524 FUNC_LOG; |
521 FUNC_LOG; |
525 if ( iState == EContactHandlerIdle ) |
522 if ( iState == EContactHandlerIdle ) |
526 { |
523 { |
527 iState = EContactHandlerGetSmsAddressFromPhonebook; |
524 iState = EContactHandlerGetSmsAddressFromPhonebook; |
551 0, |
548 0, |
552 this); |
549 this); |
553 } |
550 } |
554 } |
551 } |
555 |
552 |
556 // --------------------------------------------------------------------------- |
553 ///////////////////////////////////////////////////////////////////////////// |
557 // CFSEmailUiContactHandler::GetMmsAddressFromPhonebookAndSendL |
554 // CFSEmailUiContactHandler::GetMmsAddressFromPhonebookAndSendL |
558 // --------------------------------------------------------------------------- |
|
559 // |
555 // |
560 void CFSEmailUiContactHandler::GetMmsAddressFromPhonebookAndSendL( |
556 ///////////////////////////////////////////////////////////////////////////// |
561 MVPbkContactLink* aContactLink, TBool aIsVoiceMessage ) |
557 void CFSEmailUiContactHandler::GetMmsAddressFromPhonebookAndSendL( MVPbkContactLink* aContactLink, |
|
558 TBool aIsVoiceMessage ) |
562 { |
559 { |
563 FUNC_LOG; |
560 FUNC_LOG; |
564 if ( iState == EContactHandlerIdle ) |
561 if ( iState == EContactHandlerIdle ) |
565 { |
562 { |
566 if ( aIsVoiceMessage ) |
563 if ( aIsVoiceMessage ) |
597 0, |
594 0, |
598 this); |
595 this); |
599 } |
596 } |
600 } |
597 } |
601 |
598 |
602 // --------------------------------------------------------------------------- |
599 ///////////////////////////////////////////////////////////////////////////// |
603 // Retrieves the first contact in contact link set. |
600 // CFSEmailUiContactHandler::ArrayUpdatedL |
604 // --------------------------------------------------------------------------- |
|
605 // |
601 // |
606 void CFSEmailUiContactHandler::RetrieveContactsL() |
602 ///////////////////////////////////////////////////////////////////////////// |
607 { |
|
608 FUNC_LOG; |
|
609 if ( iLinksSet->Count() ) |
|
610 { |
|
611 delete iCurrentLink; |
|
612 iCurrentLink = NULL; |
|
613 |
|
614 iCurrentLink = iLinksSet->At(0).CloneLC(); |
|
615 CleanupStack::Pop(); |
|
616 |
|
617 delete iLinkOperationFetch; |
|
618 iLinkOperationFetch = NULL; |
|
619 |
|
620 //Async operation, callback VPbkSingleContactOperationCompleteL |
|
621 //Error situations: VPbkSingleContactOperationFailed |
|
622 iLinkOperationFetch = iContactManager->RetrieveContactL( |
|
623 *iCurrentLink, *this ); |
|
624 } |
|
625 } |
|
626 |
|
627 // --------------------------------------------------------------------------- |
|
628 // CFSEmailUiContactHandler::ArrayUpdatedL |
|
629 // --------------------------------------------------------------------------- |
|
630 // |
|
631 void CFSEmailUiContactHandler::ArrayUpdatedL( |
603 void CFSEmailUiContactHandler::ArrayUpdatedL( |
632 const RPointerArray<CFSEmailUiClsItem>& aMatchingItems ) |
604 const RPointerArray<CFSEmailUiClsItem>& aMatchingItems ) |
633 { |
605 { |
634 FUNC_LOG; |
606 FUNC_LOG; |
635 |
607 |
697 // handle only if caching was in progress |
669 // handle only if caching was in progress |
698 if ( iCachingInProgressError ) |
670 if ( iCachingInProgressError ) |
699 { |
671 { |
700 iCachingInProgressError = EFalse; |
672 iCachingInProgressError = EFalse; |
701 iState = EContactHandlerIdle; |
673 iState = EContactHandlerIdle; |
702 iHandlerObserver->OperationErrorL( ESearchContacts, aErrorCode ); |
674 iHandlerObserver->OperationErrorL( ESearchContacts, aErrorCode ); |
703 } |
675 } |
704 } |
676 } |
705 else |
677 else |
706 { |
678 { |
707 iState = EContactHandlerIdle; |
679 iState = EContactHandlerIdle; |
708 iHandlerObserver->OperationErrorL( ESearchContacts, aErrorCode ); |
680 iHandlerObserver->OperationErrorL( ESearchContacts, aErrorCode ); |
709 } |
681 } |
718 void CFSEmailUiContactHandler::VPbkSingleContactOperationComplete( |
690 void CFSEmailUiContactHandler::VPbkSingleContactOperationComplete( |
719 MVPbkContactOperationBase& aOperation, |
691 MVPbkContactOperationBase& aOperation, |
720 MVPbkStoreContact* aContact ) |
692 MVPbkStoreContact* aContact ) |
721 { |
693 { |
722 FUNC_LOG; |
694 FUNC_LOG; |
723 //inform also client in case of error to enable client's actions (i.e. return search priority) |
695 //inform also client in case of error to enable client's actions (i.e. return search priority) |
|
696 // TRAP_IGNORE( VPbkSingleContactOperationCompleteL( aOperation, aContact) ); |
724 TRAPD(error, VPbkSingleContactOperationCompleteL( aOperation, aContact) ); |
697 TRAPD(error, VPbkSingleContactOperationCompleteL( aOperation, aContact) ); |
725 if ( error != KErrNone ) |
698 if ( error != KErrNone ) |
726 { |
699 { |
727 TRAP_IGNORE(ObserverOperationErrorL( CurrentCommand(), error )); |
700 TRAP_IGNORE(ObserverOperationErrorL( CurrentCommand(), error )); |
728 } |
701 } |
|
702 // |
729 } |
703 } |
730 |
704 |
731 void CFSEmailUiContactHandler::VPbkSingleContactOperationCompleteL( |
705 void CFSEmailUiContactHandler::VPbkSingleContactOperationCompleteL( |
732 MVPbkContactOperationBase& aOperation, |
706 MVPbkContactOperationBase& aOperation, |
733 MVPbkStoreContact* aContact ) |
707 MVPbkStoreContact* aContact ) |
744 CleanupResetAndDestroyClosePushL( lastname ); |
718 CleanupResetAndDestroyClosePushL( lastname ); |
745 RPointerArray<HBufC> emailAddresses; |
719 RPointerArray<HBufC> emailAddresses; |
746 CleanupResetAndDestroyClosePushL( emailAddresses ); |
720 CleanupResetAndDestroyClosePushL( emailAddresses ); |
747 GetContactFieldsL( iFirstnameFields, firstname, aContact ); |
721 GetContactFieldsL( iFirstnameFields, firstname, aContact ); |
748 GetContactFieldsL( iLastnameFields, lastname, aContact ); |
722 GetContactFieldsL( iLastnameFields, lastname, aContact ); |
749 |
723 |
750 // Create display name, this will be used in UI. |
724 // Create display name, this will be used in UI. |
751 TInt dispNameLength = 1; |
725 TInt dispNameLength = 1; |
752 if ( firstname.Count() ) dispNameLength += firstname[0]->Length(); |
726 if ( firstname.Count() ) dispNameLength += firstname[0]->Length(); |
753 if ( lastname.Count() ) dispNameLength += lastname[0]->Length(); |
727 if ( lastname.Count() ) dispNameLength += lastname[0]->Length(); |
754 HBufC* displayname = HBufC::NewLC( dispNameLength ); |
728 HBufC* displayname = HBufC::NewLC( dispNameLength ); |
755 TPtr displaynamePtr = displayname->Des(); |
729 |
756 if ( firstname.Count() && firstname[0]->Length() ) |
730 if ( firstname.Count() ) |
757 { |
731 { |
758 displaynamePtr.Copy( *firstname[0] ); |
732 displayname->Des().Copy( *firstname[0] ); |
759 |
733 displayname->Des().Append( KSpace ); |
760 // Append space only when both firstname and lastname are present. |
|
761 if ( lastname.Count() && lastname[0]->Length() ) |
|
762 { |
|
763 displaynamePtr.Append( KSpace ); |
|
764 } |
|
765 } |
734 } |
766 if ( lastname.Count() ) |
735 if ( lastname.Count() ) |
767 { |
736 { |
768 displaynamePtr.Append( *lastname[0] ); |
737 displayname->Des().Append( *lastname[0] ); |
769 } |
738 } |
770 |
739 |
771 // retrieve selected email address |
740 // retrieve selected email address |
772 MVPbkStoreContactFieldCollection& fields = aContact->Fields(); |
741 MVPbkStoreContactFieldCollection& fields = aContact->Fields(); |
773 MVPbkBaseContactField* selectedField = fields.RetrieveField( *iCurrentLink ); |
742 MVPbkBaseContactField* selectedField = fields.RetrieveField( *iCurrentLink ); |
774 HBufC* selectedEmailAddress = MVPbkContactFieldTextData::Cast( |
743 HBufC* selectedEmailAddress = MVPbkContactFieldTextData::Cast( |
775 selectedField->FieldData() ).Text().AllocLC(); |
744 selectedField->FieldData() ).Text().AllocLC(); |
790 iContactObjects.Append( item ); |
759 iContactObjects.Append( item ); |
791 |
760 |
792 CleanupStack::PopAndDestroy( selectedEmailAddress ); |
761 CleanupStack::PopAndDestroy( selectedEmailAddress ); |
793 selectedEmailAddress = NULL; |
762 selectedEmailAddress = NULL; |
794 |
763 |
|
764 |
795 CleanupStack::PopAndDestroy( displayname ); |
765 CleanupStack::PopAndDestroy( displayname ); |
796 CleanupStack::PopAndDestroy( &emailAddresses ); |
766 CleanupStack::PopAndDestroy( &emailAddresses ); |
797 CleanupStack::PopAndDestroy( &lastname ); |
767 CleanupStack::PopAndDestroy( &lastname ); |
798 CleanupStack::PopAndDestroy( &firstname ); |
768 CleanupStack::PopAndDestroy( &firstname ); |
799 CleanupStack::PopAndDestroy( aContact ); |
769 CleanupStack::PopAndDestroy( aContact ); |
800 |
770 |
801 // Get index of Next ContactLink if there's no LinkSet |
771 // Get index of Next ContactLink if there's no LinkSet |
802 // or iCurrenLink index is set to 0 |
772 // or iCurrenLink index is set to 0 |
803 TInt index = ( iLinksSet && iCurrentLink ? |
773 TInt index = (iLinksSet && iCurrentLink ? iLinksSet->Find |
804 iLinksSet->Find( *iCurrentLink ) + 1 : 0 ); |
774 (*iCurrentLink) + 1 : 0); |
805 |
775 |
806 if ( iLinksSet && index < iLinksSet->Count() ) |
776 if (iLinksSet && index < iLinksSet->Count()) |
807 { |
777 { |
808 delete iCurrentLink; |
778 iCurrentLink = &iLinksSet->At(index); |
809 iCurrentLink = NULL; |
|
810 |
|
811 iCurrentLink = iLinksSet->At(index).CloneLC(); |
|
812 CleanupStack::Pop(); |
|
813 |
|
814 delete iLinkOperationFetch; |
779 delete iLinkOperationFetch; |
815 iLinkOperationFetch = NULL; |
780 iLinkOperationFetch = NULL; |
816 |
781 |
817 //Async operation, callback VPbkSingleContactOperationCompleteL |
782 //Async operation, callback VPbkSingleContactOperationCompleteL |
818 //Error situations: VPbkSingleContactOperationFailed |
783 //Error situations: VPbkSingleContactOperationFailed |
839 } |
802 } |
840 } |
803 } |
841 } |
804 } |
842 |
805 |
843 else if ( (iLinkOperationFetch == &aOperation) && (iState == EContactHandlerCallToContactByEmail ) ) |
806 else if ( (iLinkOperationFetch == &aOperation) && (iState == EContactHandlerCallToContactByEmail ) ) |
844 { |
807 { |
845 CleanupDeletePushL( aContact ); |
808 CleanupDeletePushL( aContact ); |
846 |
809 |
847 RPointerArray<HBufC> phonenumbers; |
810 RPointerArray<HBufC> phonenumbers; |
848 CleanupResetAndDestroyClosePushL( phonenumbers ); |
811 CleanupResetAndDestroyClosePushL( phonenumbers ); |
849 GetContactFieldsL( iPhoneNumberFields, phonenumbers, aContact ); |
812 GetContactFieldsL( iPhoneNumberFields, phonenumbers, aContact ); |
869 { |
832 { |
870 RemoteContactQueryL(); |
833 RemoteContactQueryL(); |
871 } |
834 } |
872 else |
835 else |
873 { |
836 { |
874 TFsEmailUiUtility::ShowErrorNoteL( R_FREESTYLE_EMAIL_UI_VIEWER_NO_PHONE_NUMBER ); |
837 TFsEmailUiUtility::ShowErrorNoteL( R_FREESTYLE_EMAIL_UI_VIEWER_NO_PHONE_NUMBER ); |
875 //no phone number found - inform client to enable its actions (i.e. return search priority) |
838 //no phone number found - inform client to enable its actions (i.e. return search priority) |
876 ObserverOperationErrorL( EFindAndCallToContactByEmailL, KErrNotFound ); |
839 ObserverOperationErrorL( EFindAndCallToContactByEmailL, KErrNotFound ); |
877 } |
840 } |
878 iState = EContactHandlerIdle; |
841 iState = EContactHandlerIdle; |
879 } |
842 } |
880 |
843 |
881 CleanupStack::PopAndDestroy( aContact ); |
844 CleanupStack::PopAndDestroy( aContact ); |
882 } |
845 } |
883 // Addition to get contact for message creation. |
846 // Addition to get contact for message creation. |
884 else if ( (iLinkOperationFetch == &aOperation) && |
847 else if ( (iLinkOperationFetch == &aOperation) && ( iMsgCreationHelperState == EContactHandlerGetSmsAddressFromPhonebook || |
885 ( iMsgCreationHelperState == EContactHandlerGetSmsAddressFromPhonebook || |
848 iMsgCreationHelperState == EContactHandlerGetMmsAddressFromPhonebook || iMsgCreationHelperState == EContactHandlerGetVoiceMsgAddressFromPhonebook ) ) |
886 iMsgCreationHelperState == EContactHandlerGetMmsAddressFromPhonebook || |
|
887 iMsgCreationHelperState == EContactHandlerGetVoiceMsgAddressFromPhonebook ) ) |
|
888 { |
849 { |
889 if ( iContactForMsgCreation ) |
850 if ( iContactForMsgCreation ) |
890 { |
851 { |
891 delete iContactForMsgCreation; |
852 delete iContactForMsgCreation; |
892 iContactForMsgCreation = NULL; |
853 iContactForMsgCreation = NULL; |
897 // State is now idle. |
858 // State is now idle. |
898 iState = EContactHandlerIdle; |
859 iState = EContactHandlerIdle; |
899 // Store contact |
860 // Store contact |
900 iContactForMsgCreation = aContact; |
861 iContactForMsgCreation = aContact; |
901 // Create clonelink for address selection |
862 // Create clonelink for address selection |
902 MVPbkContactLink* cloneLink = iCurrentLink->CloneLC(); |
863 MVPbkContactLink* cloneLink = iCurrentLink->CloneLC(); |
903 CleanupStack::Pop(); |
864 CleanupStack::Pop(); |
904 switch ( iMsgCreationHelperState ) |
865 switch ( iMsgCreationHelperState ) |
905 { |
866 { |
906 case EContactHandlerGetSmsAddressFromPhonebook: |
867 case EContactHandlerGetSmsAddressFromPhonebook: |
907 // Select SMS address, sending is done when callback completes |
868 // Select SMS address, sending is done when callback completes |
947 iHandlerObserver->OperationErrorL( EFindAndCallToContactByEmailL, aError ); |
908 iHandlerObserver->OperationErrorL( EFindAndCallToContactByEmailL, aError ); |
948 iHandlerObserver = NULL; |
909 iHandlerObserver = NULL; |
949 } |
910 } |
950 } |
911 } |
951 |
912 |
952 // --------------------------------------------------------------------------- |
913 |
953 // From MVPbkContactStoreListObserver. |
|
954 // Called when the opening process is complete. |
|
955 // --------------------------------------------------------------------------- |
|
956 // |
|
957 void CFSEmailUiContactHandler::OpenComplete() |
914 void CFSEmailUiContactHandler::OpenComplete() |
958 { |
915 { |
959 FUNC_LOG; |
916 FUNC_LOG; |
960 if ( iStoreReady ) |
917 if ( iStoreReady ) |
961 { |
918 { |
962 iOpenComplete = ETrue; |
919 iOpenComplete = ETrue; |
963 } |
|
964 |
|
965 if ( iState == EContactHandlerGetAddressesFromPhonebook ) |
|
966 { |
|
967 // Start retrieving contacts when stores are opened. |
|
968 TRAP_IGNORE( RetrieveContactsL() ); |
|
969 } |
920 } |
970 } |
921 } |
971 |
922 |
972 void CFSEmailUiContactHandler::StoreReady(MVPbkContactStore& /*aContactStore*/) |
923 void CFSEmailUiContactHandler::StoreReady(MVPbkContactStore& /*aContactStore*/) |
973 { |
924 { |
1009 RPointerArray<CFSEmailUiClsItem> emptyItems; |
960 RPointerArray<CFSEmailUiClsItem> emptyItems; |
1010 iHandlerObserver->OperationCompleteL( EAddToContactL, emptyItems ); |
961 iHandlerObserver->OperationCompleteL( EAddToContactL, emptyItems ); |
1011 emptyItems.Close(); |
962 emptyItems.Close(); |
1012 iHandlerObserver = NULL; |
963 iHandlerObserver = NULL; |
1013 } |
964 } |
|
965 |
1014 } |
966 } |
1015 else if ( (aCmdId == KAiwCmdSelect) && (iState == EContactHandlerGetAddressesFromPhonebook) && |
967 else if ( (aCmdId == KAiwCmdSelect) && (iState == EContactHandlerGetAddressesFromPhonebook) && |
1016 (aEventId == KAiwEventCompleted)) |
968 (aEventId == KAiwEventCompleted)) |
1017 { |
969 { |
|
970 |
1018 TInt index = 0; |
971 TInt index = 0; |
1019 const TAiwGenericParam* param = |
972 const TAiwGenericParam* param = |
1020 aEventParamList.FindFirst( index, EGenericParamContactLinkArray ); |
973 aEventParamList.FindFirst(index, EGenericParamContactLinkArray); |
1021 if ( param ) |
974 if (param) |
1022 { |
975 { |
1023 TPtrC8 contactLinks = param->Value().AsData(); |
976 TPtrC8 contactLinks = param->Value().AsData(); |
1024 iLinksSet = iContactManager->CreateLinksLC( contactLinks ); |
977 |
|
978 iLinksSet = iContactManager->CreateLinksLC(contactLinks); |
1025 CleanupStack::Pop(); |
979 CleanupStack::Pop(); |
1026 |
980 if ( iLinksSet->Count() ) |
1027 // Open all stores before retrieving contact details. |
981 { |
1028 // Async operation, calls OpenComplete when all stores are opened. |
982 iCurrentLink = &iLinksSet->At(0); |
|
983 //Async operation, callback VPbkSingleContactOperationCompleteL |
|
984 //Error situations: VPbkSingleContactOperationFailed |
|
985 iLinkOperationFetch = iContactManager->RetrieveContactL( iLinksSet->At(0), *this ); |
|
986 } |
|
987 |
1029 iContactManager->ContactStoresL().OpenAllL( *this ); |
988 iContactManager->ContactStoresL().OpenAllL( *this ); |
1030 } |
989 } |
|
990 |
1031 } |
991 } |
1032 else if ( (aCmdId == KAiwCmdSelect) && (iState == EContactHandlerGetSmsAddressFromPhonebook) && |
992 else if ( (aCmdId == KAiwCmdSelect) && (iState == EContactHandlerGetSmsAddressFromPhonebook) && |
1033 (aEventId == KAiwEventCompleted)) |
993 (aEventId == KAiwEventCompleted)) |
1034 { |
994 { |
1035 iState = EContactHandlerIdle; |
995 iState = EContactHandlerIdle; |
1093 iOpenComplete(EFalse), |
1053 iOpenComplete(EFalse), |
1094 iStoreReady(EFalse), |
1054 iStoreReady(EFalse), |
1095 iUseSenderText(EFalse), |
1055 iUseSenderText(EFalse), |
1096 iFs( aSession ), |
1056 iFs( aSession ), |
1097 iCachingInProgressError(EFalse), |
1057 iCachingInProgressError(EFalse), |
|
1058 // <cmail> video call |
1098 iVideoCall( EFalse ) |
1059 iVideoCall( EFalse ) |
|
1060 // </cmail> |
1099 { |
1061 { |
1100 FUNC_LOG; |
1062 FUNC_LOG; |
1101 } |
1063 } |
1102 |
1064 |
1103 void CFSEmailUiContactHandler::ConstructL( RFs& aSession ) |
1065 void CFSEmailUiContactHandler::ConstructL( RFs& aSession ) |
1137 { |
1099 { |
1138 RemoteContactQueryL(); |
1100 RemoteContactQueryL(); |
1139 } |
1101 } |
1140 else |
1102 else |
1141 { |
1103 { |
1142 TFsEmailUiUtility::ShowErrorNoteL( R_FREESTYLE_EMAIL_UI_VIEWER_NO_PHONE_NUMBER ); |
1104 TFsEmailUiUtility::ShowErrorNoteL( R_FREESTYLE_EMAIL_UI_VIEWER_NO_PHONE_NUMBER ); |
1143 } |
1105 } |
|
1106 // <cmail> video call flag needs to be cleared |
1144 iVideoCall = EFalse; |
1107 iVideoCall = EFalse; |
|
1108 // </cmail> |
1145 iState = EContactHandlerIdle; |
1109 iState = EContactHandlerIdle; |
1146 } |
1110 } |
1147 else if ( aMatchingItems.Count() > 0 ) // Call to one directly |
1111 else if ( aMatchingItems.Count() > 0 ) // Call to one directly |
1148 { |
1112 { |
1149 // Create contact item in which to copy number or address, async operation. |
1113 // Create contact item in which to copy number or address, async operation. |
1150 delete iCurrentLink; |
1114 delete iCurrentLink; |
1151 iCurrentLink = NULL; |
1115 iCurrentLink = NULL; |
1155 if ( iLinkOperationFetch ) |
1119 if ( iLinkOperationFetch ) |
1156 { |
1120 { |
1157 delete iLinkOperationFetch; |
1121 delete iLinkOperationFetch; |
1158 iLinkOperationFetch = NULL; |
1122 iLinkOperationFetch = NULL; |
1159 } |
1123 } |
1160 |
1124 |
1161 //Async operation, callback VPbkSingleContactOperationCompleteL |
1125 //Async operation, callback VPbkSingleContactOperationCompleteL |
1162 //Error situations: VPbkSingleContactOperationFailed |
1126 //Error situations: VPbkSingleContactOperationFailed |
1163 iLinkOperationFetch = iContactManager->RetrieveContactL( |
1127 iLinkOperationFetch = iContactManager->RetrieveContactL |
1164 *iCurrentLink, *this ); |
1128 (*iCurrentLink, *this); |
|
1129 |
1165 } |
1130 } |
1166 } |
1131 } |
1167 |
1132 |
1168 void CFSEmailUiContactHandler::CreateMessageL( const RPointerArray<CFSEmailUiClsItem>& aMatchingItems ) |
1133 void CFSEmailUiContactHandler::CreateMessageL( const RPointerArray<CFSEmailUiClsItem>& aMatchingItems ) |
1169 { |
1134 { |
1271 iLinkOperationFetch = NULL; |
1236 iLinkOperationFetch = NULL; |
1272 } |
1237 } |
1273 |
1238 |
1274 //Async operation, callback VPbkSingleContactOperationCompleteL |
1239 //Async operation, callback VPbkSingleContactOperationCompleteL |
1275 //Error situations: VPbkSingleContactOperationFailed |
1240 //Error situations: VPbkSingleContactOperationFailed |
1276 iLinkOperationFetch = iContactManager->RetrieveContactL( |
1241 iLinkOperationFetch = iContactManager->RetrieveContactL |
1277 *iCurrentLink, *this); |
1242 (*iCurrentLink, *this); |
1278 } |
1243 } |
1279 } |
1244 } |
1280 } |
1245 } |
1281 |
1246 |
1282 // ----------------------------------------------------------------------------- |
1247 // ----------------------------------------------------------------------------- |
1435 param->SetConnectionFlag(MCCAParameter::ENormal); |
1400 param->SetConnectionFlag(MCCAParameter::ENormal); |
1436 param->SetContactDataFlag(MCCAParameter::EContactLink); |
1401 param->SetContactDataFlag(MCCAParameter::EContactLink); |
1437 param->SetContactDataL( link16->Des() ); |
1402 param->SetContactDataL( link16->Des() ); |
1438 |
1403 |
1439 // switch to details view |
1404 // switch to details view |
1440 const TUid uid = TUid::Uid( KCCADetailsViewPluginImplmentationUid ); |
1405 const TUid uid = TUid::Uid( 0x200159E7 ); |
1441 param->SetLaunchedViewUid( uid ); |
1406 param->SetLaunchedViewUid( uid); |
1442 |
1407 |
1443 // Launching the CCA application |
1408 // Launching the CCA application |
1444 iConnection->LaunchAppL( *param, this ); |
1409 iConnection->LaunchAppL( *param, this ); |
1445 |
1410 |
1446 CleanupStack::Pop( param ); // parameter is taken care by MCCAConnection |
1411 CleanupStack::Pop( param ); // parameter is taken care by MCCAConnection |
1455 |
1420 |
1456 iState = EContactHandlerIdle; |
1421 iState = EContactHandlerIdle; |
1457 } |
1422 } |
1458 |
1423 |
1459 // --------------------------------------------------------------------------- |
1424 // --------------------------------------------------------------------------- |
1460 // Return contact details view Id |
|
1461 // --------------------------------------------------------------------------- |
|
1462 // |
|
1463 TUid CFSEmailUiContactHandler::GetDetailsViewUid() |
|
1464 { |
|
1465 return TUid::Uid( KCCADetailsViewPluginImplmentationUid ); |
|
1466 } |
|
1467 |
|
1468 // --------------------------------------------------------------------------- |
|
1469 // Return contact detail App Id (CCAPP) |
|
1470 // --------------------------------------------------------------------------- |
|
1471 // |
|
1472 TUid CFSEmailUiContactHandler::GetDetailsAppUid() |
|
1473 { |
|
1474 return TUid::Uid( KCCAAppUID ); |
|
1475 } |
|
1476 |
|
1477 // --------------------------------------------------------------------------- |
|
1478 // Close Details view using CCApplication |
|
1479 // --------------------------------------------------------------------------- |
|
1480 // |
|
1481 void CFSEmailUiContactHandler::CloseContactDetailsL() |
|
1482 { |
|
1483 CCASimpleNotifyL( MCCAObserver::EExitEvent,0 ); |
|
1484 iContactDetailsClosed = ETrue; |
|
1485 } |
|
1486 |
|
1487 // --------------------------------------------------------------------------- |
|
1488 // Check if Contact Details view was closed using CloseContactDetailsL method |
|
1489 // --------------------------------------------------------------------------- |
|
1490 // |
|
1491 TBool CFSEmailUiContactHandler::WasDetailsClosed() |
|
1492 { |
|
1493 return iContactDetailsClosed; |
|
1494 } |
|
1495 |
|
1496 // --------------------------------------------------------------------------- |
|
1497 // Reopen Details view for last addres or bring contacts app to foreground |
|
1498 // --------------------------------------------------------------------------- |
|
1499 // |
|
1500 void CFSEmailUiContactHandler::ReopenContactDetailsL(RWsSession& session ) |
|
1501 { |
|
1502 if( iPreviousEmailAddress ) |
|
1503 { |
|
1504 HBufC* emailAddress = iPreviousEmailAddress->AllocLC(); |
|
1505 ShowContactDetailsL( *emailAddress, EContactUpdateEmail, NULL ); |
|
1506 CleanupStack::PopAndDestroy( emailAddress ); |
|
1507 iContactDetailsClosed = EFalse; |
|
1508 } |
|
1509 else // if contact wasn't open from email |
|
1510 { |
|
1511 // Try to bring calling external app into foreground if found |
|
1512 TApaTaskList taskList( session ); |
|
1513 TApaTask contAppTask = taskList.FindApp( TUid::Uid( KPbkUID3 ) ); |
|
1514 if ( contAppTask.Exists() ) |
|
1515 { |
|
1516 contAppTask.BringToForeground(); |
|
1517 iContactDetailsClosed = EFalse; |
|
1518 } |
|
1519 } |
|
1520 } |
|
1521 |
|
1522 |
|
1523 // --------------------------------------------------------------------------- |
|
1524 // CFSEmailUiContactHandler::FindContactLinkL |
1425 // CFSEmailUiContactHandler::FindContactLinkL |
1525 // Searches contacts matching with the given email address |
1426 // Searches contacts matching with the given email address |
1526 // --------------------------------------------------------------------------- |
1427 // --------------------------------------------------------------------------- |
1527 // |
1428 // |
1528 void CFSEmailUiContactHandler::FindContactLinkL( const TDesC& aDes ) |
1429 void CFSEmailUiContactHandler::FindContactLinkL( const TDesC& aDes ) |
1541 { |
1442 { |
1542 FUNC_LOG; |
1443 FUNC_LOG; |
1543 iEmailFields.Append( R_VPBK_FIELD_TYPE_EMAILGEN ); |
1444 iEmailFields.Append( R_VPBK_FIELD_TYPE_EMAILGEN ); |
1544 iEmailFields.Append( R_VPBK_FIELD_TYPE_EMAILWORK ); |
1445 iEmailFields.Append( R_VPBK_FIELD_TYPE_EMAILWORK ); |
1545 iEmailFields.Append( R_VPBK_FIELD_TYPE_EMAILHOME ); |
1446 iEmailFields.Append( R_VPBK_FIELD_TYPE_EMAILHOME ); |
1546 |
1447 |
1547 iFirstnameFields.Append( R_VPBK_FIELD_TYPE_FIRSTNAME ); |
1448 iFirstnameFields.Append( R_VPBK_FIELD_TYPE_FIRSTNAME ); |
1548 iLastnameFields.Append( R_VPBK_FIELD_TYPE_LASTNAME ); |
1449 iLastnameFields.Append( R_VPBK_FIELD_TYPE_LASTNAME ); |
1549 |
1450 |
1550 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_LANDPHONEHOME ); |
1451 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_LANDPHONEHOME ); |
1551 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_MOBILEPHONEWORK ); |
1452 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_MOBILEPHONEWORK ); |
1552 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_MOBILEPHONEHOME ); |
1453 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_MOBILEPHONEHOME ); |
1553 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_LANDPHONEWORK ); |
1454 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_LANDPHONEWORK ); |
1554 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_LANDPHONEGEN ); |
1455 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_LANDPHONEGEN ); |
1555 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_MOBILEPHONEGEN ); |
1456 iPhoneNumberFields.Append( R_VPBK_FIELD_TYPE_MOBILEPHONEGEN ); |
|
1457 |
1556 } |
1458 } |
1557 |
1459 |
1558 void CFSEmailUiContactHandler::ResetFieldIds() |
1460 void CFSEmailUiContactHandler::ResetFieldIds() |
1559 { |
1461 { |
1560 FUNC_LOG; |
1462 FUNC_LOG; |
1564 iPhoneNumberFields.Reset(); |
1466 iPhoneNumberFields.Reset(); |
1565 } |
1467 } |
1566 |
1468 |
1567 |
1469 |
1568 // ----------------------------------------------------------------------------- |
1470 // ----------------------------------------------------------------------------- |
1569 // CFSEmailUiContactHandler::GetNameAndEmailFromRemoteLookupL |
1471 // CFSEmailUiContactHandler::LaunchRemoteLookupL |
1570 // ----------------------------------------------------------------------------- |
1472 // ----------------------------------------------------------------------------- |
1571 TBool CFSEmailUiContactHandler::GetNameAndEmailFromRemoteLookupL( CFSMailBox& aMailBox, |
1473 TBool CFSEmailUiContactHandler::GetNameAndEmailFromRemoteLookupL( CFSMailBox& aMailBox, |
1572 const TDesC& aQueryString, TDes& aDisplayname, TDes& aEmailAddress ) |
1474 const TDesC& aQueryString, TDes& aDisplayname, TDes& aEmailAddress ) |
1573 { |
1475 { |
1574 FUNC_LOG; |
1476 FUNC_LOG; |
1600 CPbkxRemoteContactLookupServiceUiContext::EModeNormal ); |
1501 CPbkxRemoteContactLookupServiceUiContext::EModeNormal ); |
1601 |
1502 |
1602 } |
1503 } |
1603 |
1504 |
1604 // ----------------------------------------------------------------------------- |
1505 // ----------------------------------------------------------------------------- |
1605 // CFSEmailUiContactHandler::GetNameAndNumberFromRemoteLookupL |
1506 // CFSEmailUiContactHandler::LaunchRemoteLookupL |
1606 // ----------------------------------------------------------------------------- |
1507 // ----------------------------------------------------------------------------- |
1607 HBufC* CFSEmailUiContactHandler::GetNameAndNumberFromRemoteLookupL( |
1508 HBufC* CFSEmailUiContactHandler::GetNameAndNumberFromRemoteLookupL( |
1608 CFSMailBox& aMailBox, const TDesC& aQuery, RBuf& aPhoneNumber ) |
1509 CFSMailBox& aMailBox, const TDesC& aQuery, RBuf& aPhoneNumber ) |
1609 { |
1510 { |
1610 FUNC_LOG; |
1511 FUNC_LOG; |
1651 void CFSEmailUiContactHandler::Reset() |
1552 void CFSEmailUiContactHandler::Reset() |
1652 { |
1553 { |
1653 FUNC_LOG; |
1554 FUNC_LOG; |
1654 iContactObjects.ResetAndDestroy(); |
1555 iContactObjects.ResetAndDestroy(); |
1655 iState = EContactHandlerIdle; |
1556 iState = EContactHandlerIdle; |
1656 delete iCurrentLink; |
|
1657 iCurrentLink = NULL; |
|
1658 delete iLinksSet; |
1557 delete iLinksSet; |
1659 iLinksSet = NULL; |
1558 iLinksSet = NULL; |
1660 delete iLinkOperation; |
1559 delete iLinkOperation; |
1661 iLinkOperation = NULL; |
1560 iLinkOperation = NULL; |
1662 delete iLinkOperationFetch; |
1561 delete iLinkOperationFetch; |
1965 void CFSEmailUiContactHandler::ClearObservers() |
1864 void CFSEmailUiContactHandler::ClearObservers() |
1966 { |
1865 { |
1967 iHandlerObserver = NULL; |
1866 iHandlerObserver = NULL; |
1968 } |
1867 } |
1969 |
1868 |
1970 // Call observer's MFSEmailUiContactHandlerObserver::OperationErrorL( TContactHandlerCmd aCmd, TInt aError ) |
1869 // <cmail> call observer's MFSEmailUiContactHandlerObserver::OperationErrorL( TContactHandlerCmd aCmd, TInt aError ) |
1971 void CFSEmailUiContactHandler::ObserverOperationErrorL( TContactHandlerCmd aCmd, TInt aErrorCode ) |
1870 void CFSEmailUiContactHandler::ObserverOperationErrorL( TContactHandlerCmd aCmd, TInt aErrorCode ) |
1972 { |
1871 { |
1973 if( ( iHandlerObserver ) && ( KErrNone != aErrorCode ) ) |
1872 if( ( iHandlerObserver ) && ( KErrNone != aErrorCode ) ) |
1974 { |
1873 { |
1975 iHandlerObserver->OperationErrorL( aCmd, aErrorCode ); |
1874 iHandlerObserver->OperationErrorL( aCmd, aErrorCode ); |