fep/aknfep/src/aknfepuiinputstateentrypinyinphrasecreation.cpp
branchRCL_3
changeset 3 f5a1e66df979
parent 0 eb1f2e154e89
child 12 5e18d8c489d6
equal deleted inserted replaced
0:eb1f2e154e89 3:f5a1e66df979
    45 #include "AknFepUICtrlPinyinPopup.h"    //Pinyin phrase
    45 #include "AknFepUICtrlPinyinPopup.h"    //Pinyin phrase
    46 #include "aknfepuictrleditpane.h"           //pinyin phrase creation
    46 #include "aknfepuictrleditpane.h"           //pinyin phrase creation
    47 #include "AknFepManager.h"
    47 #include "AknFepManager.h"
    48 
    48 
    49 const TInt KMaxPhraseCreationCount = 7;
    49 const TInt KMaxPhraseCreationCount = 7;
       
    50 const TInt KMaxPinYinSpellLength = 7;
    50 
    51 
    51 // ---------------------------------------------------------
    52 // ---------------------------------------------------------
    52 // C++ construct.
    53 // C++ construct.
    53 // ---------------------------------------------------------
    54 // ---------------------------------------------------------
    54 //
    55 //
   346     TInt validKeystrokeCount = popup->InEffectKeystrokeArray()->Count();
   347     TInt validKeystrokeCount = popup->InEffectKeystrokeArray()->Count();
   347     TInt keystrokeCount = popup->ShowKeystrokeArray()->Count();
   348     TInt keystrokeCount = popup->ShowKeystrokeArray()->Count();
   348     CDesCArrayFlat* chinese = popup->ChooseChineseCharacterArray();
   349     CDesCArrayFlat* chinese = popup->ChooseChineseCharacterArray();
   349     TBuf<KMaxPhraseCreationCount> phraseCreated;
   350     TBuf<KMaxPhraseCreationCount> phraseCreated;
   350     
   351     
       
   352 	CDesCArrayFlat* spellingArray = popup->PhoneticSpellingArray();
       
   353 	TBuf<100> spellingBuf;
       
   354 	for(TInt i=0;i<spellingArray->Count();i++)
       
   355 		{
       
   356 		spellingBuf.Append(spellingArray->MdcaPoint( i ));
       
   357 		}
       
   358     
   351     if ( ( chinese->Count() >= 2 ) && ( 0 == keystrokeCount ) )
   359     if ( ( chinese->Count() >= 2 ) && ( 0 == keystrokeCount ) )
   352         {
   360         {
   353         //commit the chinese character.
   361         //commit the chinese character.
   354         MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
   362         MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
   355         for (TInt i = 0; i < chinese->Count(); ++i )
   363         for (TInt i = 0; i < chinese->Count(); ++i )
   356             {
   364             {
   357             phraseCreated.Append( chinese->MdcaPoint( i ) );
   365             phraseCreated.Append( chinese->MdcaPoint( i ) );
   358             }
   366             }
   359         AddPhraseToDB( phraseCreated );
   367         
   360         fepMan->PinyinPhraseCreation( EFalse );
   368         fepMan->PinyinPhraseCreation( EFalse );
   361         fepMan->NewTextL( phraseCreated );
   369         fepMan->NewTextL( phraseCreated );
       
   370         
       
   371         //here,pass spelling to db
       
   372         CDesCArrayFlat* chooseChineseCharacterArraySpelling = popup->ChooseChineseCharacterArraySpelling();
       
   373         TBuf<(1+KMaxPinYinSpellLength)*KMaxPhraseCreationCount> phraseCreatedWithPinYin;//(Zi+pinyin)* max_Zi
       
   374 		phraseCreatedWithPinYin.FillZ();
       
   375 		for (TInt i = 0; i < chinese->Count(); i++)
       
   376 			{
       
   377 			TPtrC ptrZi = chinese->MdcaPoint(i);
       
   378 			phraseCreatedWithPinYin.Append(ptrZi);
       
   379 			
       
   380 			TPtrC ptrPinYin = chooseChineseCharacterArraySpelling->MdcaPoint(i);
       
   381 			phraseCreatedWithPinYin.Append(ptrPinYin);
       
   382 			
       
   383 			TInt zeroTail = (1+KMaxPinYinSpellLength)-(ptrZi.Length()+ptrPinYin.Length());
       
   384 			phraseCreatedWithPinYin.AppendFill(0,zeroTail);
       
   385 			
       
   386 			}
       
   387         				
       
   388         AddPhraseToDB( phraseCreatedWithPinYin );//pinyin
   362         fepMan->CommitInlineEditL();
   389         fepMan->CommitInlineEditL();
   363         iOwner->FepMan()->TryCloseUiL(); //no more keys, close the UI.
   390         iOwner->FepMan()->TryCloseUiL(); //no more keys, close the UI.
   364         }
   391         }
   365     else if ( 0 != validKeystrokeCount )
   392     else if ( 0 != validKeystrokeCount )
   366         {
   393         {