diff -r b1ea1642412e -r ac7e4d1d9209 textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp --- a/textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp Thu Jul 15 19:01:13 2010 +0300 +++ b/textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp Thu Aug 19 10:15:25 2010 +0300 @@ -490,7 +490,57 @@ return ETrue; } } - + +// --------------------------------------------------------------------------- +// CPeninputLayoutWindowExt::CancelDeadKey +// (other items were commented in a header) +// --------------------------------------------------------------------------- +// +void CPeninputLayoutWindowExt::CancelDeadKey() + { + // Get the dead key status + TInt latchedFlag = CPeninputDataConverter::AnyToInt( + iLayoutContext->RequestData( EAkninputDataTypeLatchedSet )); + // If the DeadKey is latched, cancel it + if ( latchedFlag ) + { + RPointerArray vkbListInfo; + RPointerArray keyInfoList; + + // Get the vkb layout list supportted by current writing language + vkbListInfo = iVkbLayout->VkbLayoutInfoList(); + TInt vkbListNum = vkbListInfo.Count(); + + CVirtualKey* pKey; + TBool deadKeyChange = EFalse; + + // Find the latched DeadKey in all kinds of vkb layout + // which supportted by current writing language + for ( TInt i = 0; i < vkbListNum && !deadKeyChange ; i++ ) + { + // Get the key info list in one vkb layout + keyInfoList = vkbListInfo[i]->KeyInfoList(); + TInt keyListNum = keyInfoList.Count(); + for ( TInt j = 0; j < keyListNum && !deadKeyChange ; j++ ) + { + pKey = keyInfoList[j]->Key(); + // If the Dead key is latched + if ( pKey->Latched()) + { + // Unlatch the DeadKey + pKey->SetLatched( EFalse ); + + // Set the DeadKey state + iLayoutContext->SetData( + EAkninputDataTypeLatchedSet, &deadKeyChange ); + + deadKeyChange = ETrue; + } + } + } + } + } + // --------------------------------------------------------------------------- // CPeninputLayoutWindowExt::ChangeInputLanguageL // (other items were commented in a header) @@ -518,6 +568,9 @@ if ( found ) { + // Remove the dead key's latched status + CancelDeadKey(); + // Store language iLayoutContext->SetData( EPeninputDataTypeInputLanguage, &aLangID ); @@ -820,45 +873,10 @@ // EXPORT_C void CPeninputLayoutWindowExt::ChangeVkbLayout( TInt aVkbLayoutId ) { - TInt latchedFlag = CPeninputDataConverter::AnyToInt( - iLayoutContext->RequestData(EAkninputDataTypeLatchedSet)); - // If the DeadKey is latched, cancel it and then change the VKB layout - if(latchedFlag) - { - RPointerArray vkbListInfo; - RPointerArray keyInfoList; - - vkbListInfo = iVkbLayout->VkbLayoutInfoList(); - TInt vkbListNum = vkbListInfo.Count(); - - CVirtualKey* pKey; - TBool deadKeyChange = EFalse; - // Find the latched DeadKey in all the Vkb layout - for(TInt i = 0; i < vkbListNum; i++) - { - // Get key info list in one VKB layout - keyInfoList = vkbListInfo[i]->KeyInfoList(); - TInt keyListNum = keyInfoList.Count(); - for(TInt j = 0; j < keyListNum; j++) - { - pKey = keyInfoList[j]->Key(); - if(pKey->Latched()) - { - // Unlatch the DeadKey - pKey->SetLatched(EFalse); - - // Set the DeadKey state - iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange); - deadKeyChange = ETrue; - break; - } - } - if(deadKeyChange) - { - break; - } - } - } + + // Remove the dead key's latched status + CancelDeadKey(); + TInt curVkbId = CPeninputDataConverter::AnyToInt ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) );