contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/TestSuiteInputData.cpp
branchRCL_3
changeset 74 6b5524b4f673
parent 63 f4a778e096c2
child 85 38bb213f60ba
equal deleted inserted replaced
68:9da50d567e3c 74:6b5524b4f673
    20 #include <CPsQueryItem.h>
    20 #include <CPsQueryItem.h>
    21 #include "TestSuiteInputData.h"
    21 #include "TestSuiteInputData.h"
    22 #include "pstestcontactshandler.h"
    22 #include "pstestcontactshandler.h"
    23 #include "psclienttestsuitedefs.h"
    23 #include "psclienttestsuitedefs.h"
    24 #include <vpbkeng.rsg>
    24 #include <vpbkeng.rsg>
       
    25 #include <f32file.h>
       
    26 #include <CHARCONV.H>
       
    27 
       
    28 void CTestSuiteInputData::ConvUtf2UniL( const TDesC& aOriginal, TDes& aRes )
       
    29     {
       
    30     HBufC8* buf8 = HBufC8::NewLC( aOriginal.Length() * 2 );
       
    31     buf8->Des().Copy( aOriginal );
       
    32     TPtrC8 str = buf8->Des();
       
    33 
       
    34     HBufC* InfoText = CnvUtfConverter::ConvertToUnicodeFromUtf8L( str );
       
    35     CleanupStack::PushL( InfoText );
       
    36     TPtr16 ptr = InfoText->Des();
       
    37 
       
    38     aRes.Zero();
       
    39     aRes.Copy( ptr );
       
    40 
       
    41     CleanupStack::PopAndDestroy( 2 );
       
    42     }
    25 
    43 
    26 // ============================== MEMBER FUNCTIONS ============================
    44 // ============================== MEMBER FUNCTIONS ============================
    27 
    45 
    28 // ----------------------------------------------------------------------------
    46 // ----------------------------------------------------------------------------
    29 // Two Phase constructor
    47 // Two Phase constructor
   420 
   438 
   421         while ( (j < aInput.Length()) && (aInput[j] != comma) )
   439         while ( (j < aInput.Length()) && (aInput[j] != comma) )
   422             j++;
   440             j++;
   423 
   441 
   424         TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos);	
   442         TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos);	
   425 
   443         
       
   444         HBufC* buf = dataPtr.AllocLC();
       
   445         TPtr uniPtr = buf->Des();
       
   446         ConvUtf2UniL( dataPtr, uniPtr);
       
   447         
   426         // Add data to the class
   448         // Add data to the class
   427         tempcacheData->data.Append(dataPtr.AllocL());
   449         tempcacheData->data.Append(uniPtr.AllocL());
       
   450         CleanupStack::PopAndDestroy();
   428 
   451 
   429         commaPos = j ;  
   452         commaPos = j ;  
   430         j++;   
   453         j++;   
   431 	}
   454 	}
   432 
   455 
   546 		// Get the data for each contact
   569 		// Get the data for each contact
   547         while ( (j < aInput.Length()) && (aInput[j] != aSeparator) )
   570         while ( (j < aInput.Length()) && (aInput[j] != aSeparator) )
   548             j++;
   571             j++;
   549 			      
   572 			      
   550         TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos);	
   573         TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos);	
       
   574         HBufC* buf = dataPtr.AllocLC();
       
   575         TPtr uniPtr = buf->Des();
       
   576         ConvUtf2UniL( dataPtr, uniPtr);
   551 			
   577 			
   552         // Add data to the output
   578         // Add data to the output
   553         HBufC* tempData = dataPtr.AllocL();
   579         HBufC* tempData = uniPtr.AllocL();
   554         aSeparatedData.Append(tempData);
   580         aSeparatedData.Append(tempData);
   555         SeparatorPos = j;  
   581         SeparatorPos = j;  
   556         j++;   
   582         j++;   
       
   583         CleanupStack::PopAndDestroy();
   557 	}
   584 	}
   558 }
   585 }
   559 
   586 
   560 // -----------------------------------------------------------------------------
   587 // -----------------------------------------------------------------------------
   561 // This function parses the input for search query
   588 // This function parses the input for search query
   844 // -----------------------------------------------------------------------------
   871 // -----------------------------------------------------------------------------
   845 // This function parses the input search string
   872 // This function parses the input search string
   846 // -----------------------------------------------------------------------------
   873 // -----------------------------------------------------------------------------
   847 void CTestSuiteInputData::ParseInputInputSearchStringL(TDesC& aInput)
   874 void CTestSuiteInputData::ParseInputInputSearchStringL(TDesC& aInput)
   848 {
   875 {
   849 	iInputSearchString = aInput.AllocL();
   876 	HBufC* buf = aInput.AllocLC();
       
   877 	TPtr uniPtr = buf->Des();
       
   878 	ConvUtf2UniL( aInput, uniPtr);
       
   879 	iInputSearchString = uniPtr.AllocL();
       
   880 	CleanupStack::PopAndDestroy();
   850 }
   881 }
   851 
   882 
   852 // -----------------------------------------------------------------------------
   883 // -----------------------------------------------------------------------------
   853 // This function parses the input expected result string
   884 // This function parses the input expected result string
   854 // -----------------------------------------------------------------------------
   885 // -----------------------------------------------------------------------------
   948 	gropName->Des().Copy(aInput.Left(commaPos));
   979 	gropName->Des().Copy(aInput.Left(commaPos));
   949 	TInt len = aInput.Length() - commaPos;
   980 	TInt len = aInput.Length() - commaPos;
   950 	HBufC* temp2 = aInput.Right(len - 1).AllocL();
   981 	HBufC* temp2 = aInput.Right(len - 1).AllocL();
   951 	ParseInputForContactsDataL(*temp2,0);
   982 	ParseInputForContactsDataL(*temp2,0);
   952 	
   983 	
       
   984     HBufC* buf = gropName->AllocLC();
       
   985     TPtr uniPtr = buf->Des();
       
   986     ConvUtf2UniL( gropName->Des(), uniPtr);
       
   987 	
   953 	//Add the group
   988 	//Add the group
   954 	iContactHandler->AddGroupL(*gropName);
   989 	iContactHandler->AddGroupL(*buf);
       
   990 	CleanupStack::PopAndDestroy();
   955 	CActiveScheduler :: Start();
   991 	CActiveScheduler :: Start();
   956 	
   992 	
   957 	//Create Contacts 
   993 	//Create Contacts 
   958 	CreateContactsL();
   994 	CreateContactsL();
   959 	iContactHandler->AddCreatedContactsToGroup();
   995 	iContactHandler->AddCreatedContactsToGroup();
   962 // -----------------------------------------------------------------------------
   998 // -----------------------------------------------------------------------------
   963 // This function parse the input for the group to seach in that particular group
   999 // This function parse the input for the group to seach in that particular group
   964 // -----------------------------------------------------------------------------
  1000 // -----------------------------------------------------------------------------
   965 void CTestSuiteInputData::ParseInputForSearchWithinGroupL(TDesC& aInput)
  1001 void CTestSuiteInputData::ParseInputForSearchWithinGroupL(TDesC& aInput)
   966 {
  1002 {
   967 	iGroupToBeSearched = aInput.AllocL();	
  1003 	HBufC* buf = aInput.AllocLC();
       
  1004 	TPtr uniPtr = buf->Des();
       
  1005 	ConvUtf2UniL( aInput, uniPtr);
       
  1006 	iGroupToBeSearched = uniPtr.AllocL();
       
  1007 	CleanupStack::PopAndDestroy();
   968 }
  1008 }
   969 
  1009 
   970 // -----------------------------------------------------------------------------
  1010 // -----------------------------------------------------------------------------
   971 // Return the input language
  1011 // Return the input language
   972 // -----------------------------------------------------------------------------
  1012 // -----------------------------------------------------------------------------