emailuis/emailui/src/FreestyleEmailUiContactHandler.cpp
branchRCL_3
changeset 10 f5907b1a1053
parent 8 e1b6206813b4
child 12 4ce476e64c59
equal deleted inserted replaced
8:e1b6206813b4 10:f5907b1a1053
    42 
    42 
    43 
    43 
    44 // Phonebook 2
    44 // Phonebook 2
    45 #include <CPbk2SortOrderManager.h>
    45 #include <CPbk2SortOrderManager.h>
    46 #include <MPbk2ContactNameFormatter.h>
    46 #include <MPbk2ContactNameFormatter.h>
    47 #include <Pbk2ContactNameFormatterFactory.h>        
    47 #include <Pbk2ContactNameFormatterFactory.h>
    48 
    48 
    49 // Send UI
    49 // Send UI
    50 #include <sendui.h>
    50 #include <sendui.h>
    51 #include <SendUiConsts.h>
    51 #include <SendUiConsts.h>
    52 #include <CMessageData.h>
    52 #include <CMessageData.h>
    53 
    53 
    54 #include <aiwdialdataext.h>
    54 #include <aiwdialdataext.h>
    55 #include <MVPbkContactLink.h>
    55 #include <MVPbkContactLink.h>
    56 
    56 
    57 //Remote Contact Lookup
    57 // Remote Contact Lookup
    58 //<cmail>
    58 #include <cpbk2remotecontactlookupaccounts.h>
    59 #include "cpbkxremotecontactlookupenv.h"
    59 #include <pbk2remotecontactlookupfactory.h>
    60 #include "tpbkxremotecontactlookupprotocolaccountid.h"
    60 
    61 #include "cpbkxremotecontactlookupserviceuicontext.h"
    61 
    62 #include <cntitem.h>
       
    63 
       
    64 // <cmail> SF path
       
    65 #include <MPbkGlobalSetting.h> // Global setting data 
    62 #include <MPbkGlobalSetting.h> // Global setting data 
    66 #include <PbkGlobalSettingFactory.h>
    63 #include <PbkGlobalSettingFactory.h>
    67 // </cmail>
       
    68 
    64 
    69 // Aiw launcher
    65 // Aiw launcher
    70 #include <AiwDialDataTypes.h>
    66 #include <AiwDialDataTypes.h>
    71 #include <AiwContactAssignDataTypes.h>
    67 #include <AiwContactAssignDataTypes.h>
    72 #include <AiwContactSelectionDataTypes.h>
    68 #include <AiwContactSelectionDataTypes.h>
    73 #include <AiwServiceHandler.h>
    69 #include <AiwServiceHandler.h>
    74 
    70 
    75 // FS Email framework
    71 // FS Email framework
    76 #include "cfsmailbox.h"
    72 #include "cfsmailbox.h"
    77 //</cmail>
       
    78 
    73 
    79 #include <FreestyleEmailUi.rsg>
    74 #include <FreestyleEmailUi.rsg>
    80 
    75 
    81 #include "FreestyleEmailUiContactHandler.h"
    76 #include "FreestyleEmailUiContactHandler.h"
    82 #include "FreestyleEmailUiCLSListsHandler.h"
    77 #include "FreestyleEmailUiCLSListsHandler.h"
  1492 // CFSEmailUiContactHandler::LaunchRemoteLookupL
  1487 // CFSEmailUiContactHandler::LaunchRemoteLookupL
  1493 // -----------------------------------------------------------------------------
  1488 // -----------------------------------------------------------------------------
  1494 void CFSEmailUiContactHandler::LaunchRemoteLookupL( CFSMailBox& aMailBox )
  1489 void CFSEmailUiContactHandler::LaunchRemoteLookupL( CFSMailBox& aMailBox )
  1495     {
  1490     {
  1496     FUNC_LOG;
  1491     FUNC_LOG;
  1497 
  1492     
  1498     CPbkxRemoteContactLookupServiceUiContext::TResult result;
  1493     CPbkxRemoteContactLookupServiceUiContext::TResult result;
  1499     DoRemoteLookupL( aMailBox, KNullDesC , result, 
  1494     DoRemoteLookupL( aMailBox, KNullDesC , result, 
  1500                      CPbkxRemoteContactLookupServiceUiContext::EModeNormal );
  1495                      CPbkxRemoteContactLookupServiceUiContext::EModeNormal );
  1501 
  1496 
  1502     }
  1497     }
  1503 
  1498 
  1504 // -----------------------------------------------------------------------------
  1499 // -----------------------------------------------------------------------------
  1505 // CFSEmailUiContactHandler::LaunchRemoteLookupL
  1500 // CFSEmailUiContactHandler::LaunchRemoteLookupL
  1506 // -----------------------------------------------------------------------------
  1501 // -----------------------------------------------------------------------------
  1507 HBufC* CFSEmailUiContactHandler::GetNameAndNumberFromRemoteLookupL( CFSMailBox& aMailBox, const TDesC& aQuery, 
  1502 HBufC* CFSEmailUiContactHandler::GetNameAndNumberFromRemoteLookupL(
  1508                                                       RBuf& aPhoneNumber )
  1503     CFSMailBox& aMailBox, const TDesC& aQuery, RBuf& aPhoneNumber )
  1509     {
  1504     {
  1510     FUNC_LOG;
  1505     FUNC_LOG;
  1511 
  1506 
  1512     CPbkxRemoteContactLookupServiceUiContext::TResult result;
  1507     CPbkxRemoteContactLookupServiceUiContext::TResult result;
  1513     DoRemoteLookupL( aMailBox, aQuery , result, 
  1508     DoRemoteLookupL( aMailBox, aQuery , result, 
  1514                      CPbkxRemoteContactLookupServiceUiContext::EModeContactSelector );
  1509         CPbkxRemoteContactLookupServiceUiContext::EModeContactSelector );
  1515 
  1510 
  1516     HBufC* displayName = NULL;
  1511     HBufC* displayName = NULL;
  1517     
       
  1518     if ( result.iExitReason == 
  1512     if ( result.iExitReason == 
  1519     CPbkxRemoteContactLookupServiceUiContext::TResult::EExitContactSelected )
  1513          CPbkxRemoteContactLookupServiceUiContext::TResult::EExitContactSelected )
  1520         {
  1514         {
  1521         displayName = GetPhoneNumberAndNameL( aPhoneNumber, *(result.iSelectedContactItem) );
  1515         displayName = GetPhoneNumberAndNameL( aPhoneNumber, *(result.iSelectedContactItem) );
  1522         } 
  1516         } 
  1523     return displayName;
  1517     return displayName;
  1524     }
  1518     }
  1525 
  1519 
  1526 void CFSEmailUiContactHandler::LaunchRemoteLookupWithQueryL( CFSMailBox& aMailBox, const TDesC& aQuery )
  1520 void CFSEmailUiContactHandler::LaunchRemoteLookupWithQueryL(
  1527     {
  1521     CFSMailBox& aMailBox, const TDesC& aQuery )
  1528     FUNC_LOG;
  1522     {
  1529 
  1523     FUNC_LOG;
  1530     CPbkxRemoteContactLookupServiceUiContext::TResult result;
  1524     CPbkxRemoteContactLookupServiceUiContext::TResult result;
  1531     DoRemoteLookupL( aMailBox, aQuery , result, 
  1525     DoRemoteLookupL( aMailBox, aQuery , result, 
  1532                          CPbkxRemoteContactLookupServiceUiContext::EModeExistingCriteria );
  1526         CPbkxRemoteContactLookupServiceUiContext::EModeExistingCriteria );
  1533 
       
  1534     }
  1527     }
  1535 
  1528 
  1536 HBufC* CFSEmailUiContactHandler::GetLastSearchNameL( const TDesC& aEmailAddress )
  1529 HBufC* CFSEmailUiContactHandler::GetLastSearchNameL( const TDesC& aEmailAddress )
  1537     {
  1530     {
  1538     FUNC_LOG;
  1531     FUNC_LOG;
  1702 // ---------------------------------------------------------------------------
  1695 // ---------------------------------------------------------------------------
  1703 //
  1696 //
  1704 void CFSEmailUiContactHandler::DoRemoteLookupL( CFSMailBox& aMailBox,
  1697 void CFSEmailUiContactHandler::DoRemoteLookupL( CFSMailBox& aMailBox,
  1705     const TDesC& aQueryString,
  1698     const TDesC& aQueryString,
  1706     CPbkxRemoteContactLookupServiceUiContext::TResult& aResult,
  1699     CPbkxRemoteContactLookupServiceUiContext::TResult& aResult,
  1707     CPbkxRemoteContactLookupServiceUiContext::TMode aContext )
  1700     CPbkxRemoteContactLookupServiceUiContext::TMode aLookupMode )
  1708     {
  1701     {
  1709     FUNC_LOG;
  1702     FUNC_LOG;
  1710     TUid protocolUid = TUid::Null();
  1703     TUid protocolUid = TUid::Null();
  1711     TUint accountId = 0;
  1704     TUint accountUid = 0;
  1712     aMailBox.GetRCLInfo( protocolUid, accountId );
  1705     aMailBox.GetRCLInfo( protocolUid, accountUid );
  1713     const TPbkxRemoteContactLookupProtocolAccountId KAccountId(
  1706     const TPbkxRemoteContactLookupProtocolAccountId accountId =
  1714         protocolUid, accountId );
  1707         TPbkxRemoteContactLookupProtocolAccountId( protocolUid, accountUid );
  1715         
  1708 
  1716 
  1709     CPbkxRemoteContactLookupServiceUiContext::TContextParams params = 
  1717     CPbkxRemoteContactLookupEnv* env = CPbkxRemoteContactLookupEnv::NewL();
  1710         { accountId, aLookupMode }; 
  1718     CleanupStack::PushL( env );
  1711 
  1719 
  1712     CPbkxRemoteContactLookupServiceUiContext* context =
  1720     MPbkxRemoteContactLookupServiceUi* serviceUi = env->ServiceUiL();
  1713         Pbk2RemoteContactLookupFactory::NewContextL( params );
  1721 
  1714     CleanupStack::PushL( context );
  1722     // If you want test with RCL dummyContactDatabase, KAccountId = serviceUi->DefaultAccountIdL();
  1715 
  1723     MPbkxRemoteContactLookupServiceUi::TContextParams params = { KAccountId, aContext };
  1716     context->ExecuteL( aQueryString, aResult );
  1724 
  1717     CleanupStack::PopAndDestroy( context );
  1725     CPbkxRemoteContactLookupServiceUiContext* ctx( NULL );
       
  1726     ctx = serviceUi->NewContextL( params );
       
  1727 
       
  1728     CleanupStack::PushL( ctx ); 
       
  1729 
       
  1730     ctx->ExecuteL( aQueryString, aResult );
       
  1731 
       
  1732     CleanupStack::PopAndDestroy( ctx );
       
  1733     CleanupStack::PopAndDestroy( env );
       
  1734 
       
  1735     }
  1718     }
  1736 
  1719 
  1737 
  1720 
  1738 // ---------------------------------------------------------------------------
  1721 // ---------------------------------------------------------------------------
  1739 // Displays call query
  1722 // Displays call query