--- a/fep/aknfep/src/aknfepuiinputminiqwertypinyinphrasebase.cpp Wed Sep 15 12:34:44 2010 +0300
+++ b/fep/aknfep/src/aknfepuiinputminiqwertypinyinphrasebase.cpp Wed Oct 13 14:55:58 2010 +0300
@@ -121,8 +121,6 @@
{0x02D9, 5}
};
-const TUid KPtiSogouCoreUid = { 0x20031DD6 };
-
// ---------------------------------------------------------------------------
// TAknFepInputStateStrokePhraseCreationBase::TAknFepInputStateStrokePhraseCreationBase
// C++ default constructor
@@ -141,18 +139,6 @@
MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && uiContainer->CandidatePane()->IsFirstPage());
uiContainer->ShowVerticalScrollArrows(multiplePages);
-
- // If sogou core is in use, set plugin to the state
- // machine and enable the plugin.
- // Get current core id. It is used to judge whether sogou core is in use.
- TInt coreID = 0;
- TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- TAknFepInputMiniQwertySogouPinyinPhrasePlugin plugin( aOwner, aUIContainer, iState );
- plugin.Enable( ETrue );
- SetPlugin( plugin );
- }
}
// ---------------------------------------------------------------------------
@@ -400,42 +386,11 @@
}
}
GetKeystrokeCode(keyCode, showKeystroke->MdcaPoint(i) );
-
- // dltBeforeCount is the dlt count before append the key.
- // dltAfterCount is the dlt count after append the key.
- // In sogou core, after appending a new key, the spell length
- // may be the same, but the dlt count will change.
- // In this situation, the appended key is valid.
- TInt dltBeforeCount = 0;
- TInt dltAfterCount = 0;
- TPtrC stringBefore = getCurrentLeastDLTSpell();
- stringBeforeLength = stringBefore.Length();
- for ( TInt k = 0; k < stringBefore.Length(); k++ )
- {
- if ( CheckSpellingDLT( stringBefore.Mid( k )))
- {
- dltBeforeCount++;
- }
- }
-
- // Append the key.
+ stringBeforeLength = getCurrentLeastDLTSpell().Length();
ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
-
- // Get the dlt count after appending the key.
- TPtrC stringAfter = getCurrentLeastDLTSpell();
- stringAfterLength = stringAfter.Length();
- for ( TInt l = 0; l < stringAfter.Length(); l++ )
- {
- if ( CheckSpellingDLT( stringAfter.Mid( l )))
- {
- dltAfterCount++;
- }
- }
-
- // If the spell length is the same and the dlt count is
- // the same, the keystroke is invalid
- if (( stringBeforeLength == stringAfterLength ) &&
- ( dltAfterCount == dltBeforeCount ))
+ stringAfterLength = getCurrentLeastDLTSpell().Length();
+ //the keystroke is invalid.
+ if (stringBeforeLength == stringAfterLength)
{
return EFalse;
}
@@ -460,23 +415,7 @@
TInt count = 0;
TBuf<1> autoDLT;
autoDLT.Append(KAutoDLT);
-
- // If this method is called in construction of the state machine,
- // the plugin is not set. If sogou core is in use now, the phraseCount
- // should be the same as the phrase characters count.
- // For Sogou core, maybe one element of PhraseArray() contains two or more characters.
- TInt coreID = 0;
- TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- CDesCArrayFlat* phraseArray = editPane->PhraseArray();
- phraseCount = 0;
- for ( TInt i = 0; i < phraseArray->Count(); i++ )
- {
- phraseCount += (*phraseArray)[i].Length();
- }
- }
-
+
if ( 0 == index)
{
pos = phraseCount;
@@ -578,26 +517,6 @@
manualDLT.Append( KManualDLT );
autoDLT.Append( KAutoDLT );
- // Get the current core id
- TInt coreID = 0;
- TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
-
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- CDesCArrayFlat* phrase = editPane->PhraseArray();
- phraseCount = 0;
- for ( TInt j = 0; j < phrase->Count(); j++ )
- {
- phraseCount += phrase->MdcaPoint(j).Length();;
- }
- }
-
- if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount )
- {
- iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone);
- return;
- }
-
TBool firstGroup = CheckFirstGroupStroke();
keystrokeArray->InsertL(index, manualDLT);
@@ -954,12 +873,6 @@
//
void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseL()
{
- // If sogou core is actived, use the plugin.
- if ( iPlugin.IsEnable())
- {
- iPlugin.AnalyseL();
- return;
- }
CPtiEngine* ptiengine = iOwner->PtiEngine();
MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
@@ -1065,7 +978,7 @@
if ( ( showKeyCount > 0 ) && (cdtCount > 0 ) )
{
UIContainer()->EditPaneWindow()->SetChangeState(ETrue);
- iOwner->ChangeState(EEntry);
+ iOwner->ChangeState(ECandidate);
return;
}
@@ -1136,15 +1049,17 @@
{
editPane->SetAutoChangeStateFlag(EAutoChangeStateFromCandidate);
}
- //stroke to be shown
- if ( iPlugin.IsEnable())
- {
- iPlugin.AnalyseL();
- }
iOwner->ChangeState(EMiniQwertyEdit);
return;
}
-
+ else
+ {
+ if ( iState == EEntry )
+ {
+ UIContainer()->EditPaneWindow()->SetChangeState( ETrue );
+ iOwner->ChangeState( ECandidate );
+ }
+ }
AnalyseL();
RefreshUI();
}
@@ -1305,31 +1220,9 @@
CDesCArrayFlat* phrase = editPane->PhraseArray();
TBuf<KMaxKeystrokeCount> showInfo;
TBuf<KMaxKeystrokeCount> keyBuf;
-
- // Get the current core id
- TInt coreID = 0;
- TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
- TInt phraseCount = 0;
-
for (TInt i = 0; i < phrase->Count(); ++i)
{
- // If this method is called in construction of the state machine,
- // the plugin is not set. If sogou core is in use now, we should append
- // each characters to showInfo.
- // For Sogou core, maybe one element of PhraseArray() contains two or more characters.
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- for ( TInt k = 0; k < phrase->MdcaPoint(i).Length(); k++ )
- {
- showInfo.Append( phrase->MdcaPoint(i)[k] );
- }
- phraseCount += phrase->MdcaPoint(i).Length();
- }
- else
- {
- // If cpicore is in use, just append the element of phrase
- showInfo.Append(phrase->MdcaPoint(i) );
- }
+ showInfo.Append(phrase->MdcaPoint(i) );
}
for (TInt ii = 0; ii < showKeystroke->Count(); ++ii)
@@ -1341,22 +1234,9 @@
{
keyBuf.Append(keystrokeArray->MdcaPoint(j) );
}
-
- // If this method is called in construction of the state machine,
- // the plugin is not set. If sogou core is in use now, the phraseCount
- // should be the same as the phrase characters count.
- // For Sogou core, maybe one element of PhraseArray() contains two or more characters.
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phraseCount,
- keyBuf, editPane->GetCursorIndexOfKeystroke() );
- }
- else
- {
- // If cpicore is in use, phraseCount is the same as phrase->Count()
- editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phrase->Count(),
+
+ editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phrase->Count(),
keyBuf, editPane->GetCursorIndexOfKeystroke() );
- }
if (iState == ECandidate)
{
@@ -1426,7 +1306,6 @@
uiContainer->SetControlInVisible( EFalse );
}
}
-
//-------------------------------------------------------------------------------
// Purpose: to adjust the scancode to make pinyin works
// Pinyin symbol inheritantly accepts A-Z, any input out of this range will make it crash.
@@ -1447,6 +1326,7 @@
}
}
}
+
// ---------------------------------------------------------------------------
// TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke
//Handle horizontal navigation.
@@ -1656,11 +1536,6 @@
void TAknFepInputMiniQwertyPinyinPhraseBase::AddPhraseToDB(
const TDesC& aPhraseAdd)
{
- if ( iPlugin.IsEnable())
- {
- iPlugin.AddPhrasePinyinToPti();
- return;
- }
TPtiUserDictionaryEntry addUdbEntry(aPhraseAdd);
//Add the phrase to the DB by PTI Engine
iOwner->PtiEngine()->AddUserDictionaryEntry(addUdbEntry);
@@ -1713,12 +1588,6 @@
TBool TAknFepInputMiniQwertyPinyinPhraseBase::CommitInlineEEPL(
const TDesC& aDes)
{
- // If sogou core is actived, use the plugin.
- if ( iPlugin.IsEnable())
- {
- return iPlugin.CommitInlineEEPL( aDes );
- }
-
TInt charCount = aDes.Length();
MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
MAknFepUICtrlEditPane* editpane = UIContainer()->EditPaneWindow();
@@ -1826,33 +1695,17 @@
TInt index = editPane->GetCursorIndexOfKeystroke();
TBuf<1> keystroke;
- // Get the current core id
- TInt coreID = 0;
- TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
-
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- CDesCArrayFlat* phrase = editPane->PhraseArray();
- phraseCount = 0;
- for ( TInt j = 0; j < phrase->Count(); j++ )
- {
- phraseCount += phrase->MdcaPoint(j).Length();;
- }
- }
-
if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount )
{
return EFalse;
}
GetShowKeystroke(aKey, keystroke);
-
//Add this condition to avoid crash in case keystroke is empty.
if(keystroke.Length() == 0)
{
return EFalse;
}
-
if ( index >= keystrokeArray->Count() )
{
keystrokeArray->AppendL(keystroke);
@@ -1985,12 +1838,6 @@
//
void TAknFepInputMiniQwertyPinyinPhraseBase::GetCandidateL()
{
- if ( iPlugin.IsEnable())
- {
- iPlugin.GetCandidateL();
- return;
- }
-
CPtiEngine* ptiengine = iOwner->PtiEngine();
MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
@@ -2012,7 +1859,7 @@
return;
}
- if (( phraseCount == 0 ) && CheckAllGroupStroke())
+ if ( CheckAllGroupStroke() && ( phraseCount == 0 ) )
{
getCurrentLeastDLTSpell();
ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates );
@@ -2127,13 +1974,7 @@
keystrokeArray->Compress();
phrase->Compress();
phraseStroke->Compress();
-
- TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID );
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- // Notify sogoucore that last phrase is cancelled
- iOwner->PtiEngine()->HandleCommandL( EPtiCommandCancelSelectElement );
- }
+
}
// ---------------------------------------------------------
@@ -2159,11 +2000,6 @@
{
editPane->SetHighlight(aPhraseCount + aIndex, aPhraseCount
+ aIndex + aCount - 1 );
- if ( iPlugin.IsEnable())
- {
- iPlugin.CanConvertAll( EFalse );
- iPlugin.ConvertCount( aIndex );
- }
}
else
{
@@ -2188,11 +2024,6 @@
{
editPane->SetHighlight( aPhraseCount + aIndex, aPhraseCount
+ aIndex + aCount - 1);
- if ( iPlugin.IsEnable())
- {
- iPlugin.CanConvertAll( EFalse );
- iPlugin.ConvertCount( aIndex );
- }
}
}
ClearPtiEngineKeystroke();
@@ -2217,68 +2048,26 @@
TInt start = 0;
TInt keyCode = 0;
TInt toneMark = KInvalidToneMark;
-
- if ( iPlugin.IsEnable())
- {
- iPlugin.CanConvertAll( ETrue );
- }
- // Get the current core id
- TInt coreID = 0;
- TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
-
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- CDesCArrayFlat* phrase = editPane->PhraseArray();
- phraseCount = 0;
- for ( TInt j = 0; j < phrase->Count(); j++ )
- {
- phraseCount += phrase->MdcaPoint(j).Length();;
- }
- }
if (showKeystroke->Count() == 0)
{
return;
}
- if ( TUid::Uid( coreID ) != KPtiSogouCoreUid )
+ if (CheckAllGroupStroke() )
{
- if ( CheckAllGroupStroke())
- {
- return;
- }
+ return;
}
-
ClearPtiEngineKeystroke();
if (CheckSpellingDLT(showKeystroke->MdcaPoint( 0) ) || (KInvalidToneMark
!= ToneMark(showKeystroke->MdcaPoint( 0) ) ))
{
start = 1;
editPane->SetHighlight(phraseCount, phraseCount);
-
- if ( iPlugin.IsEnable())
- {
- iPlugin.CanConvertAll( EFalse );
- iPlugin.ConvertCount( index );
- }
-
index = 1;
}
-
- TInt end = showKeystroke->Count();
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- for ( TInt j = showKeystroke->Count() - 1; j >= 0; j-- )
- {
- if ( KAutoDLT == showKeystroke->MdcaPoint(j)[0] )
- {
- end = j + 1;
- break;
- }
- }
- }
- for ( TInt i = start; i < end; ++i )
+ for ( TInt i = start; i < showKeystroke->Count(); ++i )
{
count = count + 1;
// tone mark
@@ -2306,11 +2095,6 @@
{
editPane->SetHighlight(phraseCount + index, phraseCount
+ index + count - 1);
- if ( iPlugin.IsEnable())
- {
- iPlugin.CanConvertAll( EFalse );
- iPlugin.ConvertCount( index );
- }
}
ClearPtiEngineKeystroke();
index = i + 1;
@@ -2322,42 +2106,10 @@
if ( valid )
{
GetKeystrokeCode(keyCode, showKeystroke->MdcaPoint(i) );
-
- // dltBeforeCount is the dlt count before append the key.
- // dltAfterCount is the dlt count after append the key.
- // In sogou core, after appending a new key, the spell length
- // may be the same, but the dlt count will change.
- // In this situation, the appended key is valid.
- TInt dltBeforeCount = 0;
- TInt dltAfterCount = 0;
- TPtrC stringBefore = getCurrentLeastDLTSpell();
- stringBeforeLength = stringBefore.Length();
- for ( TInt j = 0; j < stringBefore.Length(); j++ )
- {
- if ( CheckSpellingDLT( stringBefore.Mid( j )))
- {
- dltBeforeCount++;
- }
- }
-
- // Append the key.
- ptiengine->AppendKeyPress(( TPtiKey )keyCode ).Length();
-
- // Get the dlt count after appending the key.
- TPtrC stringAfter = getCurrentLeastDLTSpell();
- stringAfterLength = stringAfter.Length();
- for ( TInt k = 0; k < stringAfter.Length(); k++ )
- {
- if ( CheckSpellingDLT( stringAfter.Mid( k )))
- {
- dltAfterCount++;
- }
- }
-
- // If the spell length is the same and the dlt count is
- // the same, the keystroke is invalid
- if (( stringBeforeLength == stringAfterLength ) &&
- ( dltAfterCount == dltBeforeCount ))
+ stringBeforeLength = getCurrentLeastDLTSpell().Length();
+ ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
+ stringAfterLength = getCurrentLeastDLTSpell().Length();
+ if ( stringBeforeLength == stringAfterLength )//the keystroke is invalid
{
ClearPtiEngineKeystroke();
valid = EFalse;
@@ -2370,13 +2122,6 @@
editPane->SetHighlight(
phraseCount + index,
phraseCount + index + count - 1 );
-
- if ( iPlugin.IsEnable())
- {
- iPlugin.CanConvertAll( EFalse );
- iPlugin.ConvertCount( index );
- }
-
ClearPtiEngineKeystroke();
}
}
@@ -2432,28 +2177,8 @@
CDesCArrayFlat* showKeyStoke = editPane->ShowKeystrokeArray();
TInt showKeyStokeCount = editPane->ShowKeystrokeArray()->Count();
TInt indexOfKeystroke = editPane->GetCursorIndexOfKeystroke();
-
- TInt cursorPos = 0;
- // Get the current core id
- TInt coreID = 0;
- TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
- TInt phraseCount = 0;
-
- // For Sogou core, maybe on element of PhraseArray() contains two or
- // more characters.
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- for ( TInt l = 0; l < editPane->PhraseArray()->Count(); l++ )
- {
- phraseCount += editPane->PhraseArray()->MdcaPoint( l ).Length();
- }
- cursorPos = editPane->GetCursor() - phraseCount;
- }
- else
- {
- cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count();
- }
-
+ TInt cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count();
+
TBuf<1> autoDLT;
autoDLT.Append(KAutoDLT);
const TInt offset = 2;
@@ -2507,28 +2232,7 @@
CDesCArrayFlat* showKeyStoke = editPane->ShowKeystrokeArray();
TInt showKeyStokeCount = editPane->ShowKeystrokeArray()->Count();
TInt indexOfKeystroke = editPane->GetCursorIndexOfKeystroke();
-
- TInt cursorPos = 0;
- // Get the current core id
- TInt coreID = 0;
- TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
- TInt phraseCount = 0;
-
- // For Sogou core, maybe on element of PhraseArray() contains two or
- // more characters.
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- for ( TInt l = 0; l < editPane->PhraseArray()->Count(); l++ )
- {
- phraseCount += editPane->PhraseArray()->MdcaPoint( l ).Length();
- }
- cursorPos = editPane->GetCursor() - phraseCount;
- }
- else
- {
- cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count();
- }
-
+ TInt cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count();
TBuf<1> autoDLT;
autoDLT.Append(KAutoDLT);
const TInt offset = 2;
@@ -2779,6 +2483,7 @@
void TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyFromCandidateL(
TInt aKey, TKeyPressLength /*aLength*/)
{
+ TInt index = 0;
#ifdef RD_INTELLIGENT_TEXT_INPUT
// it may be one of the 'valid' numbers..
TPtiKeyboardType keyboardtype = iOwner->FepMan()->KeyboardLayout();
@@ -2806,6 +2511,7 @@
if ( (numKeyBind.iChar >= 0x31 && numKeyBind.iChar <= 0x36)
&&(aKey == numKeyBind.iKey))
{
+ index = numKeyBind.iChar - EPtiKey0 -1;
validnumkey = ETrue;
break;
}
@@ -2819,10 +2525,16 @@
return;
}
}
+ else
+ {
+#endif
+ index = MapKeyToIndex(aKey);
+#ifdef RD_INTELLIGENT_TEXT_INPUT
+ }
#endif
MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane();
- if ( aKey == EStdKeyDevice3 || aKey
+ if (candidatePane->SelectIndex(index) || aKey == EStdKeyDevice3 || aKey
== EStdKeyEnter)
{
TPtrC text = candidatePane->CurrentPhraseCandidate();
@@ -2919,42 +2631,10 @@
return EFalse;
}
GetKeystrokeCode(keyCode, keystroke->MdcaPoint(i) );
-
- // dltBeforeCount is the dlt count before append the key.
- // dltAfterCount is the dlt count after append the key.
- // In sogou core, after appending a new key, the spell length
- // may be the same, but the dlt count will change.
- // In this situation, the appended key is valid.
- TInt dltBeforeCount = 0;
- TInt dltAfterCount = 0;
- TPtrC stringBefore = getCurrentLeastDLTSpell();
- stringBeforeLength = stringBefore.Length();
- for ( TInt k = 0; k < stringBefore.Length(); k++ )
- {
- if ( CheckSpellingDLT( stringBefore.Mid( k )))
- {
- dltBeforeCount++;
- }
- }
-
- // Append the key.
- ptiengine->AppendKeyPress(( TPtiKey )keyCode );
-
- // Get the dlt count after appending the key.
- TPtrC stringAfter = getCurrentLeastDLTSpell();
- stringAfterLength = stringAfter.Length();
- for ( TInt l = 0; l < stringAfter.Length(); l++ )
- {
- if ( CheckSpellingDLT( stringAfter.Mid( l )))
- {
- dltAfterCount++;
- }
- }
-
- // If the spell length is the same and the dlt count is
- // the same, the keystroke is invalid
- if (( stringBeforeLength == stringAfterLength ) &&
- ( dltAfterCount == dltBeforeCount ))
+ stringBeforeLength = getCurrentLeastDLTSpell().Length();
+ ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
+ stringAfterLength = getCurrentLeastDLTSpell().Length();
+ if ( stringBeforeLength == stringAfterLength )
{
return EFalse;
}
@@ -3009,27 +2689,8 @@
}
else
{
- // For sogou core, the predictive is not endless, so when there
- // is no predictive candidates, we should call TryCloseUiL().
- TBool noCandidates = EFalse;
-
- TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID );
- if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
- {
- // 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 );
- }
-
UIContainer()->EditPaneWindow()->ResetAllArray();
- if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag() && !noCandidates )
+ if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag() )
{
UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse);
UIContainer()->EditPaneWindow()->SetChangeState(ETrue);