textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp
branchRCL_3
changeset 19 ac7e4d1d9209
parent 11 c8fb4cf7b3ae
equal deleted inserted replaced
18:b1ea1642412e 19:ac7e4d1d9209
   488         file.Close();
   488         file.Close();
   489         
   489         
   490         return ETrue;
   490         return ETrue;
   491         }
   491         }
   492     }
   492     }
   493   
   493 
       
   494 // ---------------------------------------------------------------------------
       
   495 // CPeninputLayoutWindowExt::CancelDeadKey
       
   496 // (other items were commented in a header)
       
   497 // ---------------------------------------------------------------------------
       
   498 //
       
   499 void CPeninputLayoutWindowExt::CancelDeadKey()
       
   500 	{
       
   501     // Get the dead key status
       
   502 	TInt latchedFlag = CPeninputDataConverter::AnyToInt(
       
   503 		iLayoutContext->RequestData( EAkninputDataTypeLatchedSet ));
       
   504 	// If the DeadKey is latched, cancel it
       
   505 	if ( latchedFlag )
       
   506 		{
       
   507 		RPointerArray<CPeninputVkbLayoutInfo> vkbListInfo;
       
   508 		RPointerArray<CPeninputVkbKeyInfo> keyInfoList;
       
   509 		
       
   510 		// Get the vkb layout list supportted by current writing language
       
   511 		vkbListInfo = iVkbLayout->VkbLayoutInfoList();
       
   512 		TInt vkbListNum = vkbListInfo.Count();
       
   513 		
       
   514 		CVirtualKey* pKey;
       
   515 		TBool deadKeyChange = EFalse;
       
   516 		
       
   517 		// Find the latched DeadKey in all kinds of vkb layout 
       
   518 		// which supportted by current writing language
       
   519 		for ( TInt i = 0; i < vkbListNum && !deadKeyChange ; i++ )
       
   520 			{
       
   521 			// Get the key info list in one vkb layout
       
   522 			keyInfoList = vkbListInfo[i]->KeyInfoList();
       
   523 			TInt keyListNum = keyInfoList.Count();
       
   524 			for ( TInt j = 0; j < keyListNum && !deadKeyChange ; j++ )
       
   525 				{
       
   526 				pKey = keyInfoList[j]->Key();
       
   527 				// If the Dead key is latched
       
   528 				if ( pKey->Latched())
       
   529 					{
       
   530 					// Unlatch the DeadKey
       
   531 					pKey->SetLatched( EFalse );
       
   532 					
       
   533 					// Set the DeadKey state
       
   534 					iLayoutContext->SetData( 
       
   535 						EAkninputDataTypeLatchedSet, &deadKeyChange );
       
   536 					
       
   537 					deadKeyChange = ETrue;
       
   538 					} 
       
   539 				}
       
   540 			}
       
   541 		}	
       
   542 	}
       
   543 
   494 // ---------------------------------------------------------------------------
   544 // ---------------------------------------------------------------------------
   495 // CPeninputLayoutWindowExt::ChangeInputLanguageL
   545 // CPeninputLayoutWindowExt::ChangeInputLanguageL
   496 // (other items were commented in a header)
   546 // (other items were commented in a header)
   497 // ---------------------------------------------------------------------------
   547 // ---------------------------------------------------------------------------
   498 //
   548 //
   516         found = CheckResourceExist( GetWindowConfigResFileName( aLangID ) );
   566         found = CheckResourceExist( GetWindowConfigResFileName( aLangID ) );
   517         }
   567         }
   518         
   568         
   519     if ( found ) 
   569     if ( found ) 
   520         {
   570         {
       
   571         // Remove the dead key's latched status
       
   572 		CancelDeadKey();
       
   573     
   521         // Store language
   574         // Store language
   522         iLayoutContext->SetData( EPeninputDataTypeInputLanguage, &aLangID );
   575         iLayoutContext->SetData( EPeninputDataTypeInputLanguage, &aLangID );
   523    
   576    
   524         if ( iLayoutContext->LayoutType() == EPluginInputModeVkb || 
   577         if ( iLayoutContext->LayoutType() == EPluginInputModeVkb || 
   525             iLayoutContext->LayoutType() == EPluginInputModeFSQ )
   578             iLayoutContext->LayoutType() == EPluginInputModeFSQ )
   818 // (other items were commented in a header)
   871 // (other items were commented in a header)
   819 // ---------------------------------------------------------------------------
   872 // ---------------------------------------------------------------------------
   820 //
   873 //
   821 EXPORT_C void CPeninputLayoutWindowExt::ChangeVkbLayout( TInt aVkbLayoutId )
   874 EXPORT_C void CPeninputLayoutWindowExt::ChangeVkbLayout( TInt aVkbLayoutId )
   822     {
   875     {
   823     TInt latchedFlag = CPeninputDataConverter::AnyToInt(
   876 
   824                        iLayoutContext->RequestData(EAkninputDataTypeLatchedSet));
   877 	// Remove the dead key's latched status
   825     // If the DeadKey is latched, cancel it and then change the VKB layout
   878 	CancelDeadKey();
   826     if(latchedFlag)
   879 
   827         {
       
   828         RPointerArray<CPeninputVkbLayoutInfo> vkbListInfo;
       
   829         RPointerArray<CPeninputVkbKeyInfo> keyInfoList;
       
   830         
       
   831         vkbListInfo = iVkbLayout->VkbLayoutInfoList();
       
   832         TInt vkbListNum = vkbListInfo.Count();
       
   833         
       
   834         CVirtualKey* pKey;
       
   835         TBool deadKeyChange = EFalse;
       
   836         // Find the latched DeadKey in all the Vkb layout
       
   837         for(TInt i = 0; i < vkbListNum; i++)
       
   838             {
       
   839             // Get key info list in one VKB layout
       
   840             keyInfoList = vkbListInfo[i]->KeyInfoList();
       
   841             TInt keyListNum = keyInfoList.Count();
       
   842             for(TInt j = 0; j < keyListNum; j++)
       
   843                 {
       
   844                 pKey = keyInfoList[j]->Key();
       
   845                 if(pKey->Latched())
       
   846                     {
       
   847                     // Unlatch the DeadKey
       
   848                     pKey->SetLatched(EFalse);
       
   849                     
       
   850                     // Set the DeadKey state
       
   851                     iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange);
       
   852                     deadKeyChange = ETrue;
       
   853                     break;
       
   854                     } 
       
   855                 }
       
   856             if(deadKeyChange)
       
   857                 {
       
   858                 break;
       
   859                 }
       
   860             }
       
   861         }
       
   862     
   880     
   863     TInt curVkbId = CPeninputDataConverter::AnyToInt
   881     TInt curVkbId = CPeninputDataConverter::AnyToInt
   864         ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) );
   882         ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) );
   865                            
   883                            
   866     if ( ( curVkbId != aVkbLayoutId ) || ( iLangOrSizeChanged ) )
   884     if ( ( curVkbId != aVkbLayoutId ) || ( iLangOrSizeChanged ) )