browserutilities/browsertelservice/src/BrowserTelService.cpp
branchRCL_3
changeset 94 919f36ff910f
parent 93 79859ed3eea9
equal deleted inserted replaced
93:79859ed3eea9 94:919f36ff910f
    20 #include <BrowserTelService.rsg>
    20 #include <BrowserTelService.rsg>
    21 #include <coemain.h>
    21 #include <coemain.h>
    22 #include    <data_caging_path_literals.hrh>
    22 #include    <data_caging_path_literals.hrh>
    23 
    23 
    24 // For phonebook API
    24 // For phonebook API
    25 //#include <CPbkContactItem.h>    // Phonebook Contact
    25 #include <CPbkContactItem.h>    // Phonebook Contact
    26 //#include <CPbkContactEngine.h>  // Phonebook Engine
    26 #include <CPbkContactEngine.h>  // Phonebook Engine
    27 //#include <CPbkFieldsInfo.h>     // Phonebook field types
    27 #include <CPbkFieldsInfo.h>     // Phonebook field types
    28 //#include <RPbkViewResourceFile.h>
    28 #include <RPbkViewResourceFile.h>
    29 //#include <CPbkContactEditorDlg.h>   // Phonebook editor
    29 #include <CPbkContactEditorDlg.h>   // Phonebook editor
    30 // For searching a matching number from contact's db
    30 // For searching a matching number from contact's db
    31 //#include <TPbkContactItemField.h>
    31 #include <TPbkContactItemField.h>
    32 #include <cntfldst.h>
    32 #include <CNTFLDST.H>
    33 
    33 
    34 #include <featmgr.h>
    34 #include <FeatMgr.h>
    35 // 
    35 // 
    36 #include <txtrich.h>
    36 #include <txtrich.h>
    37 #include <badesca.h>
    37 #include <badesca.h>
    38 #include <s32strm.h>
    38 #include <s32strm.h>
    39 
    39 
    55 // Connection management
    55 // Connection management
    56 #include <in_sock.h>
    56 #include <in_sock.h>
    57 #include <es_enum.h>
    57 #include <es_enum.h>
    58 
    58 
    59 #include <ApUtils.h>
    59 #include <ApUtils.h>
    60 #include <ApDataHandler.h>
    60 #include <APDataHandler.h>
    61 #include <ApAccessPointItem.h>
    61 #include <ApAccessPointItem.h>
    62 #include <commdb.h>
    62 #include <commdb.h>
    63 
    63 
    64 #include <f32file.h>
    64 #include <f32file.h>
    65 // Const file name for make call
    65 // Const file name for make call
    66 #include <mmtsy_names.h>
    66 #include <mmtsy_names.h>
    67 
    67 
    68 #include <BrowserUiSDKCRKeys.h>
    68 #include <browseruisdkcrkeys.h>
    69 #include <centralrepository.h>
    69 #include <centralrepository.h>
    70 
    70 
    71 #include <xml/cxml/nwx_status.h>
    71 #include <nwx_status.h>
    72 
    72 
    73 #include <DialUtils.h>
    73 #include <DialUtils.h>
    74 
    74 
    75 #include "BrowserTelService.h"
    75 #include "BrowserTelService.h"
    76 #include "BrowserTelServiceDlgs.h"
    76 #include "BrowserTelServiceDlgs.h"
    78 
    78 
    79 #include "BrowserUtilitiesVariant.hrh" // KBrowserUtilitiesMailtoSchemeToMmsEditor
    79 #include "BrowserUtilitiesVariant.hrh" // KBrowserUtilitiesMailtoSchemeToMmsEditor
    80 
    80 
    81 const TInt KParseArrayAllocation = 10;
    81 const TInt KParseArrayAllocation = 10;
    82 const TInt KTimerDelay = 2500000;
    82 const TInt KTimerDelay = 2500000;
    83 //constants 
    83 
    84 const TUid KUidMsgTypeSMTP                      = {0x10001028}; // 268439592 
    84 //constants
       
    85 const TUid KUidMsgTypeSMTP			= {0x10001028};	// 268439592
       
    86 
    85 
    87 
    86 _LIT( KValidDTMFChars,"w/p*#0123456789ABCDabcd," );
    88 _LIT( KValidDTMFChars,"w/p*#0123456789ABCDabcd," );
    87 _LIT( KDTMFWaitChars, "/wp,*#" );
    89 _LIT( KDTMFWaitChars, "/wp,*#" );
    88 #ifdef __BROWSER_TEL_SERVICES_CALLUI__
    90 #ifdef __BROWSER_TEL_SERVICES_CALLUI__
    89 _LIT( KDTMFInvalidWaitChars, "/," );
    91 _LIT( KDTMFInvalidWaitChars, "/," );
  1072 //
  1074 //
  1073 void CBrowserTelService::FindAndRipVoipParametersL( TDes& aNumber )
  1075 void CBrowserTelService::FindAndRipVoipParametersL( TDes& aNumber )
  1074     {
  1076     {
  1075     TELSERVICE_ENTERFN( "FindAndRipVoipParametersL()" )
  1077     TELSERVICE_ENTERFN( "FindAndRipVoipParametersL()" )
  1076 
  1078 
  1077     HBufC* buf = NULL;    
       
  1078     TInt offset = aNumber.Locate( TChar( '@' ) );
  1079     TInt offset = aNumber.Locate( TChar( '@' ) );
  1079     if( offset > 0 ) // Separator is not allowed to be a first char
  1080     if( offset > 0 ) // Separator is not allowed to be a first char
  1080         {
  1081         {
  1081         __ASSERT_DEBUG( offset <= aNumber.Length(), User::Leave( KErrGeneral ) );
  1082         __ASSERT_DEBUG( offset <= aNumber.Length(), User::Leave( KErrGeneral ) );         
  1082         buf = aNumber.Mid( offset ).AllocL();         
       
  1083         aNumber.SetLength( offset );           
  1083         aNumber.SetLength( offset );           
  1084         }
       
  1085     else
       
  1086         {
       
  1087         buf = HBufC::NewL( 0 );
       
  1088         }
  1084         }
  1089 
  1085 
  1090     TELSERVICE_LEAVEFN( "FindAndRipVoipParametersL()" )
  1086     TELSERVICE_LEAVEFN( "FindAndRipVoipParametersL()" )
  1091     }
  1087     }
  1092 
  1088 
  1380 								TDesC& aName, 
  1376 								TDesC& aName, 
  1381 								TDesC& aEmail )
  1377 								TDesC& aEmail )
  1382     {
  1378     {
  1383     TELSERVICE_ENTERFN( "AddPBEntryL()" )
  1379     TELSERVICE_ENTERFN( "AddPBEntryL()" )
  1384 
  1380 
  1385 /*    CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
  1381     CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
  1386     CleanupStack::PushL( pbkEngine );
  1382     CleanupStack::PushL( pbkEngine );
  1387 
  1383 
  1388     // Make sure a resource file is available
  1384     // Make sure a resource file is available
  1389     RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() );
  1385     RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() );
  1390     pbkResourceFile.OpenL();
  1386     pbkResourceFile.OpenL();
  1479     dlg->ExecuteLD();
  1475     dlg->ExecuteLD();
  1480 
  1476 
  1481     CleanupStack::PopAndDestroy( 3 ); // contactItem, pbkResourceFile, pbkEngine
  1477     CleanupStack::PopAndDestroy( 3 ); // contactItem, pbkResourceFile, pbkEngine
  1482 
  1478 
  1483     TELSERVICE_LEAVEFN( "AddPBEntryL()" )
  1479     TELSERVICE_LEAVEFN( "AddPBEntryL()" )
  1484 */
  1480 
  1485     return KErrNone;
  1481     return KErrNone;
  1486 	}
  1482 	}
  1487 
  1483 
  1488 //---------------------------------------------------------------------------------------
  1484 //---------------------------------------------------------------------------------------
  1489 // CBrowserTelService::State()
  1485 // CBrowserTelService::State()
  1596         {
  1592         {
  1597            ptr = ptr + 1;
  1593            ptr = ptr + 1;
  1598            loopCounter = 1;
  1594            loopCounter = 1;
  1599         }
  1595         }
  1600                    
  1596                    
  1601         for(loopCounter; loopCounter<len; loopCounter++)
  1597         for(; loopCounter<len; loopCounter++)
  1602         {
  1598         {
  1603             if( (*ptr >= '0' && *ptr <= '9') || *ptr == ',')
  1599             if( (*ptr >= '0' && *ptr <= '9') || *ptr == ',')
  1604             {
  1600             {
  1605                 TELSERVICE_WRITE_FORMAT("CBrowserTelService::SendEmailMessageL character: %c", *ptr );
  1601                 TELSERVICE_WRITE_FORMAT("CBrowserTelService::SendEmailMessageL character: %c", *ptr );
  1606                 ptr = ptr + 1;
  1602                 ptr = ptr + 1;
  2351     TELSERVICE_ENTERFN( "SearchPbForMatchL()" )
  2347     TELSERVICE_ENTERFN( "SearchPbForMatchL()" )
  2352 
  2348 
  2353     HBufC* matchingName = NULL;
  2349     HBufC* matchingName = NULL;
  2354 	
  2350 	
  2355     // Create phonebook engine
  2351     // Create phonebook engine
  2356 /*    CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
  2352     CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
  2357     CleanupStack::PushL( pbkEngine );
  2353     CleanupStack::PushL( pbkEngine );
  2358 
  2354 
  2359     // Make sure a resource file is available
  2355     // Make sure a resource file is available
  2360     RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() );
  2356     RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() );
  2361     pbkResourceFile.OpenL();
  2357     pbkResourceFile.OpenL();
  2375 
  2371 
  2376         CleanupStack::PopAndDestroy( item );
  2372         CleanupStack::PopAndDestroy( item );
  2377         }
  2373         }
  2378 
  2374 
  2379     CleanupStack::PopAndDestroy( 3 );   // idArray, pbkResourceFile, pbkEngine
  2375     CleanupStack::PopAndDestroy( 3 );   // idArray, pbkResourceFile, pbkEngine
  2380 */
  2376 
  2381     TELSERVICE_LEAVEFN("SearchPbForMatchL()")
  2377     TELSERVICE_LEAVEFN("SearchPbForMatchL()")
  2382 
  2378 
  2383     return matchingName;
  2379     return matchingName;
  2384 	}
  2380 	}
  2385 
  2381 
  2394 	{
  2390 	{
  2395     TELSERVICE_ENTERFN( "SearchPbForMatchLC()" )
  2391     TELSERVICE_ENTERFN( "SearchPbForMatchLC()" )
  2396 
  2392 
  2397     CContactIdArray* idArray = NULL;
  2393     CContactIdArray* idArray = NULL;
  2398 
  2394 
  2399 /*	if( aMatchType == EPhoneNumber )
  2395 	if( aMatchType == EPhoneNumber )
  2400 		{
  2396 		{
  2401 		idArray = aPbkEngine.MatchPhoneNumberL( aToMatch, aToMatch.Length() );
  2397 		idArray = aPbkEngine.MatchPhoneNumberL( aToMatch, aToMatch.Length() );
  2402 		}
  2398 		}
  2403 	else if( aMatchType == EEmail )
  2399 	else if( aMatchType == EEmail )
  2404 		{
  2400 		{
  2410 
  2406 
  2411         CleanupStack::Pop( idArray );
  2407         CleanupStack::Pop( idArray );
  2412         CleanupStack::PopAndDestroy( findFrom );
  2408         CleanupStack::PopAndDestroy( findFrom );
  2413 		}
  2409 		}
  2414 
  2410 
  2415 	CleanupStack::PushL( idArray ); */
  2411 	CleanupStack::PushL( idArray );
  2416     TELSERVICE_LEAVEFN( "SearchPbForMatchLC()" )
  2412     TELSERVICE_LEAVEFN( "SearchPbForMatchLC()" )
  2417 	return idArray;
  2413 	return idArray;
  2418 	}
  2414 	}
  2419 
  2415 
  2420 //---------------------------------------------------------------------------------------
  2416 //---------------------------------------------------------------------------------------
  2678 	CContactIdArray* idArrayPhoneNr = SearchPbForMatchLC( aPbkEngine, aNumber, EPhoneNumber );
  2674 	CContactIdArray* idArrayPhoneNr = SearchPbForMatchLC( aPbkEngine, aNumber, EPhoneNumber );
  2679 	CContactIdArray* idArrayEmail = SearchPbForMatchLC( aPbkEngine, aEmail, EEmail );
  2675 	CContactIdArray* idArrayEmail = SearchPbForMatchLC( aPbkEngine, aEmail, EEmail );
  2680 
  2676 
  2681     aNewContact = ETrue;
  2677     aNewContact = ETrue;
  2682 
  2678 
  2683 /*	if( idArrayPhoneNr->Count() && aNumber.Length() )
  2679 	if( idArrayPhoneNr->Count() && aNumber.Length() )
  2684 		{
  2680 		{
  2685 		// Open existing
  2681 		// Open existing
  2686 		if ( ShowDialogL( aNumber, EConfirmAddToPb ) )
  2682 		if ( ShowDialogL( aNumber, EConfirmAddToPb ) )
  2687 			{
  2683 			{
  2688 			contactItem = aPbkEngine.OpenContactL( ( *idArrayPhoneNr )[0] );
  2684 			contactItem = aPbkEngine.OpenContactL( ( *idArrayPhoneNr )[0] );
  2716 		}
  2712 		}
  2717 
  2713 
  2718 	CleanupStack::PopAndDestroy( 2 );		// idArrayEmail,idArrayPhoneNr
  2714 	CleanupStack::PopAndDestroy( 2 );		// idArrayEmail,idArrayPhoneNr
  2719 
  2715 
  2720 	CleanupStack::PushL( contactItem );
  2716 	CleanupStack::PushL( contactItem );
  2721 */
  2717 
  2722     return contactItem;
  2718     return contactItem;
  2723     }
  2719     }
  2724 
  2720 
  2725 // ---------------------------------------------------------------------------
  2721 // ---------------------------------------------------------------------------
  2726 // CBrowserTelService::SetPBEntryField()
  2722 // CBrowserTelService::SetPBEntryField()
  2732                                            const TPtrC& aFieldValue,
  2728                                            const TPtrC& aFieldValue,
  2733                                            TInt& aFormIndex )
  2729                                            TInt& aFormIndex )
  2734     {
  2730     {
  2735     if( aFieldValue.Length() )
  2731     if( aFieldValue.Length() )
  2736 		{
  2732 		{
  2737   /*      TPbkContactItemField *dataField = aContactItem->FindField( aField );
  2733         TPbkContactItemField *dataField = aContactItem->FindField( aField );
  2738 
  2734 
  2739         if( !dataField )
  2735         if( !dataField )
  2740 			{
  2736 			{
  2741             CPbkFieldInfo* newFieldType = NULL;
  2737             CPbkFieldInfo* newFieldType = NULL;
  2742 
  2738 
  2760             dataField->TextStorage()->SetTextL( aFieldValue );
  2756             dataField->TextStorage()->SetTextL( aFieldValue );
  2761             if( aFormIndex == -1 )
  2757             if( aFormIndex == -1 )
  2762 			    {
  2758 			    {
  2763                 aFormIndex = aContactItem->FindFieldIndex( *dataField );
  2759                 aFormIndex = aContactItem->FindFieldIndex( *dataField );
  2764 			    }
  2760 			    }
  2765             }*/
  2761             }
  2766 		}
  2762 		}
  2767     }
  2763     }
  2768 
  2764 
  2769 // ---------------------------------------------------------------------------
  2765 // ---------------------------------------------------------------------------
  2770 // CBrowserTelService::ParseRecipientsLC
  2766 // CBrowserTelService::ParseRecipientsLC