browserutilities/browsertelservice/src/BrowserTelService.cpp
changeset 65 5bfc169077b2
parent 36 0ed94ceaa377
child 68 92a765b5b3e7
equal deleted inserted replaced
42:d39add9822e2 65:5bfc169077b2
    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 <miutset.h>
       
    39 #include <s32strm.h>
    38 #include <s32strm.h>
    40 
    39 
    41 // For email API
    40 // For email API
    42 #include <sendui.h>
    41 #include <sendui.h>
    43 #include <CMessageData.h>
    42 #include <CMessageData.h>
    64 
    63 
    65 #include <f32file.h>
    64 #include <f32file.h>
    66 // Const file name for make call
    65 // Const file name for make call
    67 #include <mmtsy_names.h>
    66 #include <mmtsy_names.h>
    68 
    67 
    69 #include <browseruisdkcrkeys.h>
    68 #include <BrowserUiSDKCRKeys.h>
    70 #include <centralrepository.h>
    69 #include <centralrepository.h>
    71 
    70 
    72 #include <nwx_status.h>
    71 #include <nwx_status.h>
    73 
    72 
    74 #include <DialUtils.h>
    73 #include <DialUtils.h>
    79 
    78 
    80 #include "BrowserUtilitiesVariant.hrh" // KBrowserUtilitiesMailtoSchemeToMmsEditor
    79 #include "BrowserUtilitiesVariant.hrh" // KBrowserUtilitiesMailtoSchemeToMmsEditor
    81 
    80 
    82 const TInt KParseArrayAllocation = 10;
    81 const TInt KParseArrayAllocation = 10;
    83 const TInt KTimerDelay = 2500000;
    82 const TInt KTimerDelay = 2500000;
       
    83 //constants 
       
    84 const TUid KUidMsgTypeSMTP                      = {0x10001028}; // 268439592 
    84 
    85 
    85 _LIT( KValidDTMFChars,"w/p*#0123456789ABCDabcd," );
    86 _LIT( KValidDTMFChars,"w/p*#0123456789ABCDabcd," );
    86 _LIT( KDTMFWaitChars, "/wp,*#" );
    87 _LIT( KDTMFWaitChars, "/wp,*#" );
    87 #ifdef __BROWSER_TEL_SERVICES_CALLUI__
    88 #ifdef __BROWSER_TEL_SERVICES_CALLUI__
    88 _LIT( KDTMFInvalidWaitChars, "/," );
    89 _LIT( KDTMFInvalidWaitChars, "/," );
  1379 								TDesC& aName, 
  1380 								TDesC& aName, 
  1380 								TDesC& aEmail )
  1381 								TDesC& aEmail )
  1381     {
  1382     {
  1382     TELSERVICE_ENTERFN( "AddPBEntryL()" )
  1383     TELSERVICE_ENTERFN( "AddPBEntryL()" )
  1383 
  1384 
  1384     CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
  1385 /*    CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
  1385     CleanupStack::PushL( pbkEngine );
  1386     CleanupStack::PushL( pbkEngine );
  1386 
  1387 
  1387     // Make sure a resource file is available
  1388     // Make sure a resource file is available
  1388     RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() );
  1389     RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() );
  1389     pbkResourceFile.OpenL();
  1390     pbkResourceFile.OpenL();
  1478     dlg->ExecuteLD();
  1479     dlg->ExecuteLD();
  1479 
  1480 
  1480     CleanupStack::PopAndDestroy( 3 ); // contactItem, pbkResourceFile, pbkEngine
  1481     CleanupStack::PopAndDestroy( 3 ); // contactItem, pbkResourceFile, pbkEngine
  1481 
  1482 
  1482     TELSERVICE_LEAVEFN( "AddPBEntryL()" )
  1483     TELSERVICE_LEAVEFN( "AddPBEntryL()" )
  1483 
  1484 */
  1484     return KErrNone;
  1485     return KErrNone;
  1485 	}
  1486 	}
  1486 
  1487 
  1487 //---------------------------------------------------------------------------------------
  1488 //---------------------------------------------------------------------------------------
  1488 // CBrowserTelService::State()
  1489 // CBrowserTelService::State()
  2350     TELSERVICE_ENTERFN( "SearchPbForMatchL()" )
  2351     TELSERVICE_ENTERFN( "SearchPbForMatchL()" )
  2351 
  2352 
  2352     HBufC* matchingName = NULL;
  2353     HBufC* matchingName = NULL;
  2353 	
  2354 	
  2354     // Create phonebook engine
  2355     // Create phonebook engine
  2355     CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
  2356 /*    CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
  2356     CleanupStack::PushL( pbkEngine );
  2357     CleanupStack::PushL( pbkEngine );
  2357 
  2358 
  2358     // Make sure a resource file is available
  2359     // Make sure a resource file is available
  2359     RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() );
  2360     RPbkViewResourceFile pbkResourceFile( *CCoeEnv::Static() );
  2360     pbkResourceFile.OpenL();
  2361     pbkResourceFile.OpenL();
  2374 
  2375 
  2375         CleanupStack::PopAndDestroy( item );
  2376         CleanupStack::PopAndDestroy( item );
  2376         }
  2377         }
  2377 
  2378 
  2378     CleanupStack::PopAndDestroy( 3 );   // idArray, pbkResourceFile, pbkEngine
  2379     CleanupStack::PopAndDestroy( 3 );   // idArray, pbkResourceFile, pbkEngine
  2379 
  2380 */
  2380     TELSERVICE_LEAVEFN("SearchPbForMatchL()")
  2381     TELSERVICE_LEAVEFN("SearchPbForMatchL()")
  2381 
  2382 
  2382     return matchingName;
  2383     return matchingName;
  2383 	}
  2384 	}
  2384 
  2385 
  2393 	{
  2394 	{
  2394     TELSERVICE_ENTERFN( "SearchPbForMatchLC()" )
  2395     TELSERVICE_ENTERFN( "SearchPbForMatchLC()" )
  2395 
  2396 
  2396     CContactIdArray* idArray = NULL;
  2397     CContactIdArray* idArray = NULL;
  2397 
  2398 
  2398 	if( aMatchType == EPhoneNumber )
  2399 /*	if( aMatchType == EPhoneNumber )
  2399 		{
  2400 		{
  2400 		idArray = aPbkEngine.MatchPhoneNumberL( aToMatch, aToMatch.Length() );
  2401 		idArray = aPbkEngine.MatchPhoneNumberL( aToMatch, aToMatch.Length() );
  2401 		}
  2402 		}
  2402 	else if( aMatchType == EEmail )
  2403 	else if( aMatchType == EEmail )
  2403 		{
  2404 		{
  2409 
  2410 
  2410         CleanupStack::Pop( idArray );
  2411         CleanupStack::Pop( idArray );
  2411         CleanupStack::PopAndDestroy( findFrom );
  2412         CleanupStack::PopAndDestroy( findFrom );
  2412 		}
  2413 		}
  2413 
  2414 
  2414 	CleanupStack::PushL( idArray );
  2415 	CleanupStack::PushL( idArray ); */
  2415     TELSERVICE_LEAVEFN( "SearchPbForMatchLC()" )
  2416     TELSERVICE_LEAVEFN( "SearchPbForMatchLC()" )
  2416 	return idArray;
  2417 	return idArray;
  2417 	}
  2418 	}
  2418 
  2419 
  2419 //---------------------------------------------------------------------------------------
  2420 //---------------------------------------------------------------------------------------
  2677 	CContactIdArray* idArrayPhoneNr = SearchPbForMatchLC( aPbkEngine, aNumber, EPhoneNumber );
  2678 	CContactIdArray* idArrayPhoneNr = SearchPbForMatchLC( aPbkEngine, aNumber, EPhoneNumber );
  2678 	CContactIdArray* idArrayEmail = SearchPbForMatchLC( aPbkEngine, aEmail, EEmail );
  2679 	CContactIdArray* idArrayEmail = SearchPbForMatchLC( aPbkEngine, aEmail, EEmail );
  2679 
  2680 
  2680     aNewContact = ETrue;
  2681     aNewContact = ETrue;
  2681 
  2682 
  2682 	if( idArrayPhoneNr->Count() && aNumber.Length() )
  2683 /*	if( idArrayPhoneNr->Count() && aNumber.Length() )
  2683 		{
  2684 		{
  2684 		// Open existing
  2685 		// Open existing
  2685 		if ( ShowDialogL( aNumber, EConfirmAddToPb ) )
  2686 		if ( ShowDialogL( aNumber, EConfirmAddToPb ) )
  2686 			{
  2687 			{
  2687 			contactItem = aPbkEngine.OpenContactL( ( *idArrayPhoneNr )[0] );
  2688 			contactItem = aPbkEngine.OpenContactL( ( *idArrayPhoneNr )[0] );
  2715 		}
  2716 		}
  2716 
  2717 
  2717 	CleanupStack::PopAndDestroy( 2 );		// idArrayEmail,idArrayPhoneNr
  2718 	CleanupStack::PopAndDestroy( 2 );		// idArrayEmail,idArrayPhoneNr
  2718 
  2719 
  2719 	CleanupStack::PushL( contactItem );
  2720 	CleanupStack::PushL( contactItem );
  2720 
  2721 */
  2721     return contactItem;
  2722     return contactItem;
  2722     }
  2723     }
  2723 
  2724 
  2724 // ---------------------------------------------------------------------------
  2725 // ---------------------------------------------------------------------------
  2725 // CBrowserTelService::SetPBEntryField()
  2726 // CBrowserTelService::SetPBEntryField()
  2731                                            const TPtrC& aFieldValue,
  2732                                            const TPtrC& aFieldValue,
  2732                                            TInt& aFormIndex )
  2733                                            TInt& aFormIndex )
  2733     {
  2734     {
  2734     if( aFieldValue.Length() )
  2735     if( aFieldValue.Length() )
  2735 		{
  2736 		{
  2736         TPbkContactItemField *dataField = aContactItem->FindField( aField );
  2737   /*      TPbkContactItemField *dataField = aContactItem->FindField( aField );
  2737 
  2738 
  2738         if( !dataField )
  2739         if( !dataField )
  2739 			{
  2740 			{
  2740             CPbkFieldInfo* newFieldType = NULL;
  2741             CPbkFieldInfo* newFieldType = NULL;
  2741 
  2742 
  2759             dataField->TextStorage()->SetTextL( aFieldValue );
  2760             dataField->TextStorage()->SetTextL( aFieldValue );
  2760             if( aFormIndex == -1 )
  2761             if( aFormIndex == -1 )
  2761 			    {
  2762 			    {
  2762                 aFormIndex = aContactItem->FindFieldIndex( *dataField );
  2763                 aFormIndex = aContactItem->FindFieldIndex( *dataField );
  2763 			    }
  2764 			    }
  2764             }
  2765             }*/
  2765 		}
  2766 		}
  2766     }
  2767     }
  2767 
  2768 
  2768 // ---------------------------------------------------------------------------
  2769 // ---------------------------------------------------------------------------
  2769 // CBrowserTelService::ParseRecipientsLC
  2770 // CBrowserTelService::ParseRecipientsLC