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 |
154 if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull)) |
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 ) |
|
175 { |
155 { |
176 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull); |
156 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull); |
177 iOwner->FepMan()->TryCloseUiL(); |
157 iOwner->FepMan()->TryCloseUiL(); |
178 } |
158 } |
179 else |
159 else |
183 } |
163 } |
184 } |
164 } |
185 } |
165 } |
186 else if(aKey == EStdKeyRightArrow ) |
166 else if(aKey == EStdKeyRightArrow ) |
187 { |
167 { |
|
168 iOwner->ChangeState(EPredictiveInput); |
188 UIContainer()->CandidatePane()->SelectNext(); |
169 UIContainer()->CandidatePane()->SelectNext(); |
189 } |
170 } |
190 else if (aKey == EStdKeyLeftArrow) |
171 else if (aKey == EStdKeyLeftArrow) |
191 { |
172 { |
192 UIContainer()->CandidatePane()->SelectPrev(); |
173 iOwner->ChangeState(EPredictiveInput); |
|
174 UIContainer()->CandidatePane()->SelectLastPhrase(); |
193 } |
175 } |
194 else if(iOwner->IsValidChineseInputKeyQwerty(aKey)) |
176 else if(iOwner->IsValidChineseInputKeyQwerty(aKey)) |
195 { |
177 { |
196 if ( aLength == ELongKeyPress ) |
178 if ( aLength == ELongKeyPress ) |
197 { |
179 { |
297 default: |
279 default: |
298 TAknFepInputStateChineseBase::HandleCommandL( aCommandId ); |
280 TAknFepInputStateChineseBase::HandleCommandL( aCommandId ); |
299 break; |
281 break; |
300 } |
282 } |
301 } |
283 } |
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 |
|
345 // End of file |
284 // End of file |