fep/aknfep/src/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.cpp
branchRCL_3
changeset 50 5a1685599b76
parent 0 eb1f2e154e89
child 56 8152b1f1763a
equal deleted inserted replaced
46:bd83ceabce89 50:5a1685599b76
   149                 {            
   149                 {            
   150                 MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
   150                 MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
   151                 fepMan->NewTextL(text);
   151                 fepMan->NewTextL(text);
   152                 fepMan->CommitInlineEditL();
   152                 fepMan->CommitInlineEditL();
   153                 iOwner->PtiEngine()->SetPredictiveChineseChar(text);
   153                 iOwner->PtiEngine()->SetPredictiveChineseChar(text);
   154                 if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull))
   154                 
       
   155                 // For sogou core, the predictive is not endless, so when there
       
   156                 // is no predictive candidates, we should call TryCloseUiL().
       
   157                 TBool noCandidates = EFalse;
       
   158                 
       
   159                 if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
       
   160                     {
       
   161                     // Get the predictive candidates.
       
   162                     CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
       
   163                     CleanupStack::PushL ( phraseCandidates );
       
   164                     phraseCandidates->Reset();
       
   165                     iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
       
   166                     if ( phraseCandidates->Count() == 0 )
       
   167                         {
       
   168                         noCandidates = ETrue;
       
   169                         }
       
   170                     CleanupStack::PopAndDestroy( phraseCandidates );
       
   171                     }
       
   172                 
       
   173                 // If no candidates, call TryCloseUiL().
       
   174                 if ( fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
   155                     {
   175                     {
   156                     fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
   176                     fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
   157                     iOwner->FepMan()->TryCloseUiL();
   177                     iOwner->FepMan()->TryCloseUiL();
   158                     }
   178                     }
   159                 else
   179                 else
   163                 }
   183                 }
   164             }
   184             }
   165         }
   185         }
   166     else if(aKey == EStdKeyRightArrow )
   186     else if(aKey == EStdKeyRightArrow )
   167         {
   187         {
   168     	iOwner->ChangeState(EPredictiveInput);  
       
   169     	UIContainer()->CandidatePane()->SelectNext(); 
   188     	UIContainer()->CandidatePane()->SelectNext(); 
   170         }
   189         }
   171     else if (aKey == EStdKeyLeftArrow)  
   190     else if (aKey == EStdKeyLeftArrow)  
   172     	{
   191     	{
   173     	iOwner->ChangeState(EPredictiveInput);  
   192         UIContainer()->CandidatePane()->SelectPrev();
   174         UIContainer()->CandidatePane()->SelectLastPhrase();
       
   175     	}    
   193     	}    
   176     else if(iOwner->IsValidChineseInputKeyQwerty(aKey))
   194     else if(iOwner->IsValidChineseInputKeyQwerty(aKey))
   177         {
   195         {
   178         if ( aLength == ELongKeyPress )
   196         if ( aLength == ELongKeyPress )
   179             {
   197             {
   279         default:
   297         default:
   280             TAknFepInputStateChineseBase::HandleCommandL( aCommandId );
   298             TAknFepInputStateChineseBase::HandleCommandL( aCommandId );
   281             break;
   299             break;
   282         }
   300         }
   283     }
   301     }
       
   302 void TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase::SubmitTextL( const TDesC& aText )
       
   303 	{
       
   304 	if( aText.Length())
       
   305 	    {            
       
   306 	    MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   307 	    CPtiEngine* engine = iOwner->PtiEngine();
       
   308 	    fepMan->NewTextL(aText);
       
   309 	    fepMan->CommitInlineEditL();
       
   310 	    engine->SetPredictiveChineseChar(aText);
       
   311 	                    
       
   312         // For sogou core, the predictive is not endless, so when there
       
   313         // is no predictive candidates, we should call TryCloseUiL().
       
   314         TBool noCandidates = EFalse;
       
   315         
       
   316         if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
       
   317             {
       
   318             // Get the predictive candidates.
       
   319             CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
       
   320             CleanupStack::PushL ( phraseCandidates );
       
   321             phraseCandidates->Reset();
       
   322             iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
       
   323             if ( phraseCandidates->Count() == 0 )
       
   324                 {
       
   325                 noCandidates = ETrue;
       
   326                 }
       
   327             CleanupStack::PopAndDestroy( phraseCandidates );
       
   328             }
       
   329 	    
       
   330 	    if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
       
   331 	       {
       
   332 	        fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
       
   333 	        fepMan->TryCloseUiL();
       
   334 	        }
       
   335 	    else
       
   336 	        {
       
   337 	    if( iOwner )
       
   338 	    	{
       
   339 	        iOwner->ChangeState(EPredictiveCandidate);
       
   340 	    	}
       
   341 	        }           
       
   342 	    }
       
   343 	}
       
   344 
   284 // End of file
   345 // End of file