textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp
branchRCL_3
changeset 50 5a1685599b76
parent 44 ecbabf52600f
child 56 8152b1f1763a
equal deleted inserted replaced
46:bd83ceabce89 50:5a1685599b76
   404                     ( Control( EPeninutWindowCtrlIdVkbCtrl ) );
   404                     ( Control( EPeninutWindowCtrlIdVkbCtrl ) );
   405                 vkbCtrl->DimKeySet( iToneSet, !iVowelChar );
   405                 vkbCtrl->DimKeySet( iToneSet, !iVowelChar );
   406                 }
   406                 }
   407             }
   407             }
   408         }
   408         }
       
   409     else
       
   410     	{
       
   411         // If in virtual QWERTY mode
       
   412 		if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
       
   413 			{
       
   414 			TInt lang = CPeninputDataConverter::AnyToInt
       
   415 					( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ));
       
   416 			TInt curRange = CPeninputDataConverter::AnyToInt
       
   417 					( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ));
       
   418 					
       
   419 			// When writing language is Vietnamese and range is English
       
   420 			if ( lang == ELangVietnamese && curRange == ERangeEnglish )  
       
   421 				{
       
   422 				TBuf<1> charData;
       
   423 				// Get the input character
       
   424 				charData.Append( aData.iText );
       
   425 				iVowelChar = EFalse;
       
   426 				
       
   427                 if ( KNullDesC() != charData )
       
   428                     {
       
   429                     // Check whether the input char is in the list of VietVowelList
       
   430                     for ( TUint i = 0; i < sizeof( VietVowelList ) / sizeof( TText ); ++i )
       
   431                         {
       
   432                         TBuf<1> buf;
       
   433                         buf.Append( VietVowelList[i] );
       
   434                         if ( charData == buf )
       
   435                             {
       
   436                             iVowelChar = ETrue;
       
   437                             break;
       
   438                             }
       
   439                         }
       
   440                     }
       
   441                 
       
   442                 CPeninputVkbCtrlExt* vkbCtrl = static_cast<CPeninputVkbCtrlExt*>
       
   443                     ( Control( EPeninutWindowCtrlIdVkbCtrl ));
       
   444                 // Set the dim status of the tone keys
       
   445                 vkbCtrl->DimKeySet( iToneSet, !iVowelChar );
       
   446 				}
       
   447 			}
       
   448     	}
   409     }  
   449     }  
   410 
   450 
   411 // ---------------------------------------------------------------------------
   451 // ---------------------------------------------------------------------------
   412 // CPeninputLayoutWindowExt::SetEditorTextL
   452 // CPeninputLayoutWindowExt::SetEditorTextL
   413 // (other items were commented in a header)
   453 // (other items were commented in a header)
  1258             vkbLayout = EPeninputVkbLayoutLatinNumber;
  1298             vkbLayout = EPeninputVkbLayoutLatinNumber;
  1259             }
  1299             }
  1260     	}
  1300     	}
  1261     else
  1301     else
  1262     	{
  1302     	{
       
  1303         if ( permittedRange != ERangeNumber )
  1263         ChangeVkbLayout( vkbLayout );
  1304         ChangeVkbLayout( vkbLayout );
  1264     	}
  1305     	}
  1265     
  1306     
  1266     // Synchronize case if needed    
  1307     // Synchronize case if needed    
  1267     if ( ( curRange == ERangeEnglish )  || ( curRange == ERangeAccent ) 
  1308     if ( ( curRange == ERangeEnglish )  || ( curRange == ERangeAccent ) 
  1438     
  1479     
  1439     if( !button )
  1480     if( !button )
  1440         {
  1481         {
  1441         return;
  1482         return;
  1442         }
  1483         }
       
  1484 
       
  1485     const TInt range = CPeninputDataConverter::AnyToInt(
       
  1486             iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
       
  1487 
       
  1488     TBool shiftDown = ( aIsShiftCase > 0 );
       
  1489 
       
  1490     if ( range == ERangeNumber || range == ERangeNativeNumber )
       
  1491         {
       
  1492         TRAP_IGNORE(HandleNumberModePagingL( shiftDown ));
       
  1493         }
       
  1494     else
       
  1495         {
  1443     switch ( aIsCapslockCase * 2 + aIsShiftCase )
  1496     switch ( aIsCapslockCase * 2 + aIsShiftCase )
  1444         {
  1497         {
  1445         case 1: // text case        
  1498         case 1: // text case        
  1446             {
  1499             {
  1447             TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 1 ) );			
  1500             TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 1 ) );			
  1458             {
  1511             {
  1459             TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 0 ) );	
  1512             TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 0 ) );	
  1460         	button->SetHighlight( EFalse );
  1513         	button->SetHighlight( EFalse );
  1461             }
  1514             }
  1462             break;
  1515             break;
       
  1516             }   
  1463 	    }
  1517 	    }
  1464 	}    								 	
  1518 	}    								 	
  1465 // ---------------------------------------------------------------------------
  1519 // ---------------------------------------------------------------------------
  1466 // CPeninputLayoutWindowExt::ChangeLayoutPosition
  1520 // CPeninputLayoutWindowExt::ChangeLayoutPosition
  1467 // (other items were commented in a header)
  1521 // (other items were commented in a header)
  1934 	if ( icf && ConfigInfo()->Language() != ELangNone )
  1988 	if ( icf && ConfigInfo()->Language() != ELangNone )
  1935 		{
  1989 		{
  1936 		icf->SetTextAlignmentL( aAlignment, ConfigInfo()->Language() );
  1990 		icf->SetTextAlignmentL( aAlignment, ConfigInfo()->Language() );
  1937 		}
  1991 		}
  1938 	}
  1992 	}
  1939 	
  1993 
       
  1994 // ------------------------------------------------
       
  1995 // CPeninputLayoutWindowExt::CurrentNumberModeId
       
  1996 // ------------------------------------------------
       
  1997 TInt CPeninputLayoutWindowExt::CurrentNumberModeId(TBool aShifted,
       
  1998         TInt aLanguage, TBool aPagingPermitted)
       
  1999     {
       
  2000     TInt ret = 0;
       
  2001     if (aPagingPermitted)
       
  2002         {
       
  2003         if (aLanguage == ELangArabic || aLanguage == ELangFarsi || aLanguage
       
  2004                 == ELangUrdu)
       
  2005             {
       
  2006             if (aShifted)
       
  2007                 {
       
  2008                 ret = ECaseNumberSpecialPagingArabic22;
       
  2009                 }
       
  2010             else
       
  2011                 {
       
  2012                 ret = ECaseNumberSpecialPagingArabic12;
       
  2013                 }
       
  2014             }
       
  2015         else if (aLanguage == ELangThai)
       
  2016             {
       
  2017             if (aShifted)
       
  2018                 {
       
  2019                 ret = ECaseNumberSpecialPaging12;
       
  2020                 }
       
  2021             else
       
  2022                 {
       
  2023                 ret = ECaseNumberSpecialPaging22;
       
  2024                 }
       
  2025             }
       
  2026         else
       
  2027             {
       
  2028              if ( aShifted )
       
  2029                 {
       
  2030                 ret = ECaseNumberSpecialPaging22;
       
  2031                 }
       
  2032              else
       
  2033                 {
       
  2034                 ret = ECaseNumberSpecialPaging12;
       
  2035                 }            
       
  2036             }
       
  2037         }
       
  2038     else
       
  2039         {
       
  2040         if (aLanguage == ELangArabic || aLanguage == ELangFarsi || aLanguage
       
  2041                 == ELangUrdu)
       
  2042             {
       
  2043             ret = ECaseNumberSpecialPagingArabic11;
       
  2044             }
       
  2045         else
       
  2046             {
       
  2047             ret = ECaseNumberSpecialPaging11;
       
  2048             }
       
  2049         }
       
  2050     return ret;
       
  2051     }
       
  2052 
       
  2053 void CPeninputLayoutWindowExt::HandleNumberModePagingL( TBool aShifted )
       
  2054     {
       
  2055     CAknFepCtrlMultiModeButton* button = static_cast<CAknFepCtrlMultiModeButton*> (ControlById( EPeninutWindowCtrlIdShiftBtn ) );
       
  2056     
       
  2057     if ( !button )
       
  2058         {
       
  2059         return;
       
  2060         }
       
  2061     
       
  2062     const TInt lang = CPeninputDataConverter::AnyToInt( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ) );
       
  2063     TInt permittedRange = CPeninputDataConverter::AnyToInt
       
  2064                      ( iLayoutContext->RequestData( EPeninputDataTypePermittedRange ));
       
  2065     TBool isPagingPermitted = EFalse;
       
  2066     if ( permittedRange == ERangeNumber || permittedRange == ERangeNativeNumber )
       
  2067        {
       
  2068        //if latin number only or native number only is permitted do not allow paging
       
  2069        isPagingPermitted = EFalse;
       
  2070        }
       
  2071     else
       
  2072        {
       
  2073        isPagingPermitted = !button->IsDimmed();
       
  2074        }
       
  2075           
       
  2076     TInt modeId = CurrentNumberModeId( aShifted, lang, isPagingPermitted );
       
  2077     TInt index = button ->ModeIndexByModeId( modeId );
       
  2078 
       
  2079     button->SetCurrentModeL( EBtnBmpActive, index );    
       
  2080     button->SetHighlight( EFalse );
       
  2081     }
  1940 //End Of File
  2082 //End Of File