fep/aknfep/src/aknfepuiinputstateminiqwertyzhuyinphrase.cpp
branchRCL_3
changeset 3 f5a1e66df979
parent 0 eb1f2e154e89
child 7 6defe5d1bd39
equal deleted inserted replaced
0:eb1f2e154e89 3:f5a1e66df979
    49 const TInt KMaxKeystrokeCount = 31;
    49 const TInt KMaxKeystrokeCount = 31;
    50 const TInt KMaxKeystrokeSize = 130;
    50 const TInt KMaxKeystrokeSize = 130;
    51 const TInt KMaxPhraseLength = 7;
    51 const TInt KMaxPhraseLength = 7;
    52 const TInt KMinCandidateCount = 1;
    52 const TInt KMinCandidateCount = 1;
    53 const TInt KKeystrokeMaxLength = 4;
    53 const TInt KKeystrokeMaxLength = 4;
       
    54 const TInt KMaxSpellLength = 7;//max zhuyin length for one chinese Zi
       
    55 const TInt KMaxPhraseCreationCount = 7;
    54 //const TInt KTonemarkCount = 5;
    56 //const TInt KTonemarkCount = 5;
    55 
    57 
    56 const TUint16 KToneMark1 = 0x0020;
    58 const TUint16 KToneMark1 = 0x0020;
    57 const TUint16 KToneMark2 = 0x02CA;
    59 const TUint16 KToneMark2 = 0x02CA;
    58 const TUint16 KToneMark3 = 0x02c7;
    60 const TUint16 KToneMark3 = 0x02c7;
   517         {
   519         {
   518         fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
   520         fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
   519         }
   521         }
   520     if ( aAddUDB )
   522     if ( aAddUDB )
   521         {
   523         {
   522         AddPhraseToDB( currentText );
   524 		//here,we pass zhuyin-spelling to db together with phrase.
       
   525 		CDesCArrayFlat* phraseZhuYinSpellingArray = UIContainer()->EditPaneWindow()->PhraseZhuYinSpellingArray();
       
   526 		TBuf<(1+KMaxSpellLength)*KMaxPhraseCreationCount> phraseCreatedWithZhuYin;//(Zi+Zhuyin)* max_Zi
       
   527 		phraseCreatedWithZhuYin.FillZ();
       
   528 		for (TInt ii = 0; ii < phraseCount; ++ii)
       
   529 			{
       
   530 			TPtrC ptrZi = phraseArray->MdcaPoint(ii);
       
   531 			phraseCreatedWithZhuYin.Append(ptrZi);
       
   532 			
       
   533 			TPtrC ptrZhuYin = phraseZhuYinSpellingArray->MdcaPoint(ii);
       
   534 			phraseCreatedWithZhuYin.Append(ptrZhuYin);
       
   535 			
       
   536 			TInt zeroTail = (1+KMaxSpellLength)-(ptrZi.Length()+ptrZhuYin.Length());
       
   537 			phraseCreatedWithZhuYin.AppendFill(0,zeroTail);
       
   538 			
       
   539 			}
       
   540 		AddPhraseToDB( phraseCreatedWithZhuYin );
   523         }
   541         }
   524     fepMan->TryCloseUiL();
   542     fepMan->TryCloseUiL();
   525     }
   543     }
   526 
   544 
   527 // ---------------------------------------------------------
   545 // ---------------------------------------------------------
  1071 void TAknFepInputStateCanindateSelectingMiniQwertyZhuyin::CommitCandidateL()
  1089 void TAknFepInputStateCanindateSelectingMiniQwertyZhuyin::CommitCandidateL()
  1072     {
  1090     {
  1073     CDesCArrayFlat* keyStrokeArray = UIContainer()->EditPaneWindow()->KeystrokeArray();
  1091     CDesCArrayFlat* keyStrokeArray = UIContainer()->EditPaneWindow()->KeystrokeArray();
  1074     CDesCArrayFlat* phraseKeyStrokeArray = UIContainer()->EditPaneWindow()->PhraseShowKeyStrokeArray();
  1092     CDesCArrayFlat* phraseKeyStrokeArray = UIContainer()->EditPaneWindow()->PhraseShowKeyStrokeArray();
  1075     CDesCArrayFlat* phraseArray = UIContainer()->EditPaneWindow()->PhraseArray();
  1093     CDesCArrayFlat* phraseArray = UIContainer()->EditPaneWindow()->PhraseArray();
       
  1094     CDesCArrayFlat* phraseZhuYinSpellingArray = UIContainer()->EditPaneWindow()->PhraseZhuYinSpellingArray();
  1076     TPtrC candidate = UIContainer()->CandidatePane()->CurrentPhraseCandidate();
  1095     TPtrC candidate = UIContainer()->CandidatePane()->CurrentPhraseCandidate();
  1077     
  1096     
  1078     RArray<TInt>* keyCodeArray = UIContainer()->EditPaneWindow()->KeycodeArray();
  1097     RArray<TInt>* keyCodeArray = UIContainer()->EditPaneWindow()->KeycodeArray();
  1079     RArray<TInt>* keyCodePhraseArray = UIContainer()->EditPaneWindow()->PhraseKeycodeArray();
  1098     RArray<TInt>* keyCodePhraseArray = UIContainer()->EditPaneWindow()->PhraseKeycodeArray();
  1080     TBuf<KMaxKeystrokeCount> spellingText;
  1099     TBuf<KMaxKeystrokeCount> spellingText;
       
  1100     
  1081     UIContainer()->InputPane()->GetText( spellingText );
  1101     UIContainer()->InputPane()->GetText( spellingText );
       
  1102     
       
  1103     //phraseZhuYinSpellingArray must keep same count with phraseArray
       
  1104     TInt delCount = phraseZhuYinSpellingArray->Count()-phraseArray->Count();//we can sure delCount>=0,impossible <0
       
  1105 	if(delCount>0)
       
  1106 		{
       
  1107 		phraseZhuYinSpellingArray->Delete(phraseArray->Count(),delCount);//delete from tail 
       
  1108 		}
       
  1109 	phraseZhuYinSpellingArray->AppendL(spellingText); 
  1082     phraseArray->AppendL( candidate );
  1110     phraseArray->AppendL( candidate );
       
  1111     
  1083     TBuf<KMaxKeystrokeCount> keyStoke;
  1112     TBuf<KMaxKeystrokeCount> keyStoke;
  1084     TInt replaceCount = 0;
  1113     TInt replaceCount = 0;
  1085     TInt delimiterIndex = spellingText.Find( KDelimiter );
  1114     TInt delimiterIndex = spellingText.Find( KDelimiter );
  1086     if ( KErrNotFound ==delimiterIndex )
  1115     if ( KErrNotFound ==delimiterIndex )
  1087         {
  1116         {