fep/aknfep/src/AknFepUIInputStatePredictiveInputMiniQwertyChinesePhrase.cpp
branchRCL_3
changeset 50 5a1685599b76
parent 0 eb1f2e154e89
child 56 8152b1f1763a
equal deleted inserted replaced
46:bd83ceabce89 50:5a1685599b76
   125             {            
   125             {            
   126             MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
   126             MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
   127             fepMan->NewTextL(text);
   127             fepMan->NewTextL(text);
   128             fepMan->CommitInlineEditL();
   128             fepMan->CommitInlineEditL();
   129             iOwner->PtiEngine()->SetPredictiveChineseChar(text);
   129             iOwner->PtiEngine()->SetPredictiveChineseChar(text);
   130             if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull))
   130             
       
   131             // For sogou core, the predictive is not endless, so when there
       
   132             // is no predictive candidates, we should call TryCloseUiL().
       
   133             TBool noCandidates = EFalse;
       
   134             if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
       
   135                 {
       
   136                 // Get the predictive candidates.
       
   137                 CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
       
   138                 CleanupStack::PushL ( phraseCandidates );
       
   139                 phraseCandidates->Reset();
       
   140                 iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
       
   141                 if ( phraseCandidates->Count() == 0 )
       
   142                     {
       
   143                     noCandidates = ETrue;
       
   144                     }
       
   145                 CleanupStack::PopAndDestroy( phraseCandidates );
       
   146                 }
       
   147             // If no candidates, call TryCloseUiL().
       
   148             if ( fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
   131                 {
   149                 {
   132                 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
   150                 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
   133                 iOwner->FepMan()->TryCloseUiL();
   151                 iOwner->FepMan()->TryCloseUiL();
   134                 }
   152                 }
   135             else
   153             else
   207     default:
   225     default:
   208         TAknFepInputStateChineseBase::HandleCommandL( aCommandId );
   226         TAknFepInputStateChineseBase::HandleCommandL( aCommandId );
   209         break;
   227         break;
   210     }
   228     }
   211 }
   229 }
       
   230 
       
   231 void TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase::SubmitTextL( const TDesC& aText )
       
   232 	{
       
   233 	MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   234 	if ( aText.Length() )
       
   235 	   {
       
   236 	   fepMan->NewTextL( aText );
       
   237 	   fepMan->CommitInlineEditL();
       
   238 	   iOwner->PtiEngine()->SetPredictiveChineseChar( aText );
       
   239       
       
   240        // For sogou core, the predictive is not endless, so when there
       
   241        // is no predictive candidates, we should call TryCloseUiL().
       
   242        TBool noCandidates = EFalse;
       
   243        
       
   244        if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
       
   245            {
       
   246            // Get the predictive candidates.
       
   247            CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
       
   248            CleanupStack::PushL ( phraseCandidates );
       
   249            phraseCandidates->Reset();
       
   250            iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
       
   251            if ( phraseCandidates->Count() == 0 )
       
   252                {
       
   253                noCandidates = ETrue;
       
   254                }
       
   255            CleanupStack::PopAndDestroy( phraseCandidates );
       
   256            }
       
   257        
       
   258        if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
       
   259 	      {
       
   260 	      fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
       
   261 	      iOwner->FepMan()->TryCloseUiL();
       
   262 	      }
       
   263 	   else
       
   264 	      {
       
   265 	      iOwner->ChangeState( EPredictiveCandidate );
       
   266 	      }
       
   267 	    }
       
   268 	}
       
   269 	
   212 // End of file
   270 // End of file