fep/aknfep/src/AknFepUIInputStatePredictiveInputMiniQwertyChinesePhrase.cpp
branchRCL_3
changeset 50 5a1685599b76
parent 0 eb1f2e154e89
child 56 8152b1f1763a
--- a/fep/aknfep/src/AknFepUIInputStatePredictiveInputMiniQwertyChinesePhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUIInputStatePredictiveInputMiniQwertyChinesePhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -127,7 +127,25 @@
             fepMan->NewTextL(text);
             fepMan->CommitInlineEditL();
             iOwner->PtiEngine()->SetPredictiveChineseChar(text);
-            if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull))
+            
+            // For sogou core, the predictive is not endless, so when there
+            // is no predictive candidates, we should call TryCloseUiL().
+            TBool noCandidates = EFalse;
+            if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
+                {
+                // Get the predictive candidates.
+                CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
+                CleanupStack::PushL ( phraseCandidates );
+                phraseCandidates->Reset();
+                iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
+                if ( phraseCandidates->Count() == 0 )
+                    {
+                    noCandidates = ETrue;
+                    }
+                CleanupStack::PopAndDestroy( phraseCandidates );
+                }
+            // If no candidates, call TryCloseUiL().
+            if ( fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
                 {
                 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
                 iOwner->FepMan()->TryCloseUiL();
@@ -209,4 +227,44 @@
         break;
     }
 }
+
+void TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase::SubmitTextL( const TDesC& aText )
+	{
+	MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
+	if ( aText.Length() )
+	   {
+	   fepMan->NewTextL( aText );
+	   fepMan->CommitInlineEditL();
+	   iOwner->PtiEngine()->SetPredictiveChineseChar( aText );
+      
+       // For sogou core, the predictive is not endless, so when there
+       // is no predictive candidates, we should call TryCloseUiL().
+       TBool noCandidates = EFalse;
+       
+       if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
+           {
+           // Get the predictive candidates.
+           CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
+           CleanupStack::PushL ( phraseCandidates );
+           phraseCandidates->Reset();
+           iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
+           if ( phraseCandidates->Count() == 0 )
+               {
+               noCandidates = ETrue;
+               }
+           CleanupStack::PopAndDestroy( phraseCandidates );
+           }
+       
+       if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
+	      {
+	      fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
+	      iOwner->FepMan()->TryCloseUiL();
+	      }
+	   else
+	      {
+	      iOwner->ChangeState( EPredictiveCandidate );
+	      }
+	    }
+	}
+	
 // End of file