textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp
branchRCL_3
changeset 50 5a1685599b76
parent 44 ecbabf52600f
child 56 8152b1f1763a
--- a/textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -406,6 +406,46 @@
                 }
             }
         }
+    else
+    	{
+        // If in virtual QWERTY mode
+		if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
+			{
+			TInt lang = CPeninputDataConverter::AnyToInt
+					( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ));
+			TInt curRange = CPeninputDataConverter::AnyToInt
+					( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ));
+					
+			// When writing language is Vietnamese and range is English
+			if ( lang == ELangVietnamese && curRange == ERangeEnglish )  
+				{
+				TBuf<1> charData;
+				// Get the input character
+				charData.Append( aData.iText );
+				iVowelChar = EFalse;
+				
+                if ( KNullDesC() != charData )
+                    {
+                    // Check whether the input char is in the list of VietVowelList
+                    for ( TUint i = 0; i < sizeof( VietVowelList ) / sizeof( TText ); ++i )
+                        {
+                        TBuf<1> buf;
+                        buf.Append( VietVowelList[i] );
+                        if ( charData == buf )
+                            {
+                            iVowelChar = ETrue;
+                            break;
+                            }
+                        }
+                    }
+                
+                CPeninputVkbCtrlExt* vkbCtrl = static_cast<CPeninputVkbCtrlExt*>
+                    ( Control( EPeninutWindowCtrlIdVkbCtrl ));
+                // Set the dim status of the tone keys
+                vkbCtrl->DimKeySet( iToneSet, !iVowelChar );
+				}
+			}
+    	}
     }  
 
 // ---------------------------------------------------------------------------
@@ -1260,6 +1300,7 @@
     	}
     else
     	{
+        if ( permittedRange != ERangeNumber )
         ChangeVkbLayout( vkbLayout );
     	}
     
@@ -1440,6 +1481,18 @@
         {
         return;
         }
+
+    const TInt range = CPeninputDataConverter::AnyToInt(
+            iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
+
+    TBool shiftDown = ( aIsShiftCase > 0 );
+
+    if ( range == ERangeNumber || range == ERangeNativeNumber )
+        {
+        TRAP_IGNORE(HandleNumberModePagingL( shiftDown ));
+        }
+    else
+        {
     switch ( aIsCapslockCase * 2 + aIsShiftCase )
         {
         case 1: // text case        
@@ -1460,6 +1513,7 @@
         	button->SetHighlight( EFalse );
             }
             break;
+            }   
 	    }
 	}    								 	
 // ---------------------------------------------------------------------------
@@ -1936,5 +1990,93 @@
 		icf->SetTextAlignmentL( aAlignment, ConfigInfo()->Language() );
 		}
 	}
-	
+
+// ------------------------------------------------
+// CPeninputLayoutWindowExt::CurrentNumberModeId
+// ------------------------------------------------
+TInt CPeninputLayoutWindowExt::CurrentNumberModeId(TBool aShifted,
+        TInt aLanguage, TBool aPagingPermitted)
+    {
+    TInt ret = 0;
+    if (aPagingPermitted)
+        {
+        if (aLanguage == ELangArabic || aLanguage == ELangFarsi || aLanguage
+                == ELangUrdu)
+            {
+            if (aShifted)
+                {
+                ret = ECaseNumberSpecialPagingArabic22;
+                }
+            else
+                {
+                ret = ECaseNumberSpecialPagingArabic12;
+                }
+            }
+        else if (aLanguage == ELangThai)
+            {
+            if (aShifted)
+                {
+                ret = ECaseNumberSpecialPaging12;
+                }
+            else
+                {
+                ret = ECaseNumberSpecialPaging22;
+                }
+            }
+        else
+            {
+             if ( aShifted )
+                {
+                ret = ECaseNumberSpecialPaging22;
+                }
+             else
+                {
+                ret = ECaseNumberSpecialPaging12;
+                }            
+            }
+        }
+    else
+        {
+        if (aLanguage == ELangArabic || aLanguage == ELangFarsi || aLanguage
+                == ELangUrdu)
+            {
+            ret = ECaseNumberSpecialPagingArabic11;
+            }
+        else
+            {
+            ret = ECaseNumberSpecialPaging11;
+            }
+        }
+    return ret;
+    }
+
+void CPeninputLayoutWindowExt::HandleNumberModePagingL( TBool aShifted )
+    {
+    CAknFepCtrlMultiModeButton* button = static_cast<CAknFepCtrlMultiModeButton*> (ControlById( EPeninutWindowCtrlIdShiftBtn ) );
+    
+    if ( !button )
+        {
+        return;
+        }
+    
+    const TInt lang = CPeninputDataConverter::AnyToInt( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ) );
+    TInt permittedRange = CPeninputDataConverter::AnyToInt
+                     ( iLayoutContext->RequestData( EPeninputDataTypePermittedRange ));
+    TBool isPagingPermitted = EFalse;
+    if ( permittedRange == ERangeNumber || permittedRange == ERangeNativeNumber )
+       {
+       //if latin number only or native number only is permitted do not allow paging
+       isPagingPermitted = EFalse;
+       }
+    else
+       {
+       isPagingPermitted = !button->IsDimmed();
+       }
+          
+    TInt modeId = CurrentNumberModeId( aShifted, lang, isPagingPermitted );
+    TInt index = button ->ModeIndexByModeId( modeId );
+
+    button->SetCurrentModeL( EBtnBmpActive, index );    
+    button->SetHighlight( EFalse );
+    }
 //End Of File