fep/aknfep/src/aknfepuiinputstateminiqwertyzhuyinphrase.cpp
branchRCL_3
changeset 3 f5a1e66df979
parent 0 eb1f2e154e89
child 7 6defe5d1bd39
--- a/fep/aknfep/src/aknfepuiinputstateminiqwertyzhuyinphrase.cpp	Tue Feb 02 01:02:04 2010 +0200
+++ b/fep/aknfep/src/aknfepuiinputstateminiqwertyzhuyinphrase.cpp	Fri Feb 19 23:09:27 2010 +0200
@@ -51,6 +51,8 @@
 const TInt KMaxPhraseLength = 7;
 const TInt KMinCandidateCount = 1;
 const TInt KKeystrokeMaxLength = 4;
+const TInt KMaxSpellLength = 7;//max zhuyin length for one chinese Zi
+const TInt KMaxPhraseCreationCount = 7;
 //const TInt KTonemarkCount = 5;
 
 const TUint16 KToneMark1 = 0x0020;
@@ -519,7 +521,23 @@
         }
     if ( aAddUDB )
         {
-        AddPhraseToDB( currentText );
+		//here,we pass zhuyin-spelling to db together with phrase.
+		CDesCArrayFlat* phraseZhuYinSpellingArray = UIContainer()->EditPaneWindow()->PhraseZhuYinSpellingArray();
+		TBuf<(1+KMaxSpellLength)*KMaxPhraseCreationCount> phraseCreatedWithZhuYin;//(Zi+Zhuyin)* max_Zi
+		phraseCreatedWithZhuYin.FillZ();
+		for (TInt ii = 0; ii < phraseCount; ++ii)
+			{
+			TPtrC ptrZi = phraseArray->MdcaPoint(ii);
+			phraseCreatedWithZhuYin.Append(ptrZi);
+			
+			TPtrC ptrZhuYin = phraseZhuYinSpellingArray->MdcaPoint(ii);
+			phraseCreatedWithZhuYin.Append(ptrZhuYin);
+			
+			TInt zeroTail = (1+KMaxSpellLength)-(ptrZi.Length()+ptrZhuYin.Length());
+			phraseCreatedWithZhuYin.AppendFill(0,zeroTail);
+			
+			}
+		AddPhraseToDB( phraseCreatedWithZhuYin );
         }
     fepMan->TryCloseUiL();
     }
@@ -1073,13 +1091,24 @@
     CDesCArrayFlat* keyStrokeArray = UIContainer()->EditPaneWindow()->KeystrokeArray();
     CDesCArrayFlat* phraseKeyStrokeArray = UIContainer()->EditPaneWindow()->PhraseShowKeyStrokeArray();
     CDesCArrayFlat* phraseArray = UIContainer()->EditPaneWindow()->PhraseArray();
+    CDesCArrayFlat* phraseZhuYinSpellingArray = UIContainer()->EditPaneWindow()->PhraseZhuYinSpellingArray();
     TPtrC candidate = UIContainer()->CandidatePane()->CurrentPhraseCandidate();
     
     RArray<TInt>* keyCodeArray = UIContainer()->EditPaneWindow()->KeycodeArray();
     RArray<TInt>* keyCodePhraseArray = UIContainer()->EditPaneWindow()->PhraseKeycodeArray();
     TBuf<KMaxKeystrokeCount> spellingText;
+    
     UIContainer()->InputPane()->GetText( spellingText );
+    
+    //phraseZhuYinSpellingArray must keep same count with phraseArray
+    TInt delCount = phraseZhuYinSpellingArray->Count()-phraseArray->Count();//we can sure delCount>=0,impossible <0
+	if(delCount>0)
+		{
+		phraseZhuYinSpellingArray->Delete(phraseArray->Count(),delCount);//delete from tail 
+		}
+	phraseZhuYinSpellingArray->AppendL(spellingText); 
     phraseArray->AppendL( candidate );
+    
     TBuf<KMaxKeystrokeCount> keyStoke;
     TInt replaceCount = 0;
     TInt delimiterIndex = spellingText.Find( KDelimiter );