diff -r bd83ceabce89 -r 5a1685599b76 fep/aknfep/src/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.cpp --- a/fep/aknfep/src/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.cpp Tue Sep 14 21:59:06 2010 +0300 +++ b/fep/aknfep/src/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.cpp Wed Sep 15 12:34:44 2010 +0300 @@ -151,7 +151,27 @@ 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(); @@ -165,13 +185,11 @@ } else if(aKey == EStdKeyRightArrow ) { - iOwner->ChangeState(EPredictiveInput); UIContainer()->CandidatePane()->SelectNext(); } else if (aKey == EStdKeyLeftArrow) { - iOwner->ChangeState(EPredictiveInput); - UIContainer()->CandidatePane()->SelectLastPhrase(); + UIContainer()->CandidatePane()->SelectPrev(); } else if(iOwner->IsValidChineseInputKeyQwerty(aKey)) { @@ -281,4 +299,47 @@ break; } } +void TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase::SubmitTextL( const TDesC& aText ) + { + if( aText.Length()) + { + MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); + CPtiEngine* engine = iOwner->PtiEngine(); + fepMan->NewTextL(aText); + fepMan->CommitInlineEditL(); + engine->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); + fepMan->TryCloseUiL(); + } + else + { + if( iOwner ) + { + iOwner->ChangeState(EPredictiveCandidate); + } + } + } + } + // End of file