fep/aknfep/src/AknFepPluginManager.cpp
branchRCL_3
changeset 56 8152b1f1763a
parent 50 5a1685599b76
equal deleted inserted replaced
50:5a1685599b76 56:8152b1f1763a
    58 #include <PtiCompositionDataIF.h> // MPtiEngineCompositionDataInterface
    58 #include <PtiCompositionDataIF.h> // MPtiEngineCompositionDataInterface
    59 #include <eikapp.h>
    59 #include <eikapp.h>
    60 #include <AknFepGlobalEnums.h>
    60 #include <AknFepGlobalEnums.h>
    61 #include <AknFepInternalCRKeys.h>
    61 #include <AknFepInternalCRKeys.h>
    62 #include <AknFepInternalPSKeys.h>
    62 #include <AknFepInternalPSKeys.h>
       
    63 #include <aknFepVietnameseInputTables.h>
    63 
    64 
    64 // User includes
    65 // User includes
    65 #include "AknFepManagerInterface.h" // MAknFepManagerInterface
    66 #include "AknFepManagerInterface.h" // MAknFepManagerInterface
    66 #include "AknFepUiManagerBase.h"
    67 #include "AknFepUiManagerBase.h"
    67 #include "aknfepuimanagerfingeritutchinese.h"
    68 #include "aknfepuimanagerfingeritutchinese.h"
   219     iCurrentPluginInputFepUI = NULL; // why not delete????
   220     iCurrentPluginInputFepUI = NULL; // why not delete????
   220     delete iPenInputMenu;
   221     delete iPenInputMenu;
   221     
   222     
   222     if( iPenInputSvrConnected )
   223     if( iPenInputSvrConnected )
   223         {
   224         {
   224         iPenInputServer.RemovePenUiActivationHandler( this );
       
   225         iPenInputServer.Close();
   225         iPenInputServer.Close();
   226         iPenInputSvrConnected = EFalse;
   226         iPenInputSvrConnected = EFalse;
   227         }
   227         }
   228     delete iFingerItutChineseUI;
   228     delete iFingerItutChineseUI;
   229     
   229     
   315 void CAknFepPluginManager::ActivatePenInputL()
   315 void CAknFepPluginManager::ActivatePenInputL()
   316     {
   316     {
   317     if( !iPenInputSvrConnected || !iPenInputServer.IsVisible() || iPenInputServer.IsDimmed() )
   317     if( !iPenInputSvrConnected || !iPenInputServer.IsVisible() || iPenInputServer.IsDimmed() )
   318         {
   318         {
   319         if( iFepMan.FepAwareTextEditor() )
   319         if( iFepMan.FepAwareTextEditor() )
   320             {
   320             {            
   321             // Enable transition effect when close pen ui 
       
   322             // by pressing close button.
       
   323             iPenInputServer.EnableGfxTransEffect( ETrue );
       
   324   			iPreferredUiMode = ETrue;	
   321   			iPreferredUiMode = ETrue;	
   325             TryChangePluginInputModeByModeL((TPluginInputMode)(iSharedData.PluginInputMode()),
   322             TryChangePluginInputModeByModeL((TPluginInputMode)(iSharedData.PluginInputMode()),
   326                                             EPenInputOpenManually,
   323                                             EPenInputOpenManually,
   327                                             ERangeInvalid);
   324                                             ERangeInvalid);
   328             }
   325             }
   530             case ESignalHwNotifySctPopup:
   527             case ESignalHwNotifySctPopup:
   531                 iFepMan.LaunchSpecialCharacterTableL( 0,ETrue );//possible?
   528                 iFepMan.LaunchSpecialCharacterTableL( 0,ETrue );//possible?
   532                 break;  
   529                 break;  
   533             case ESignalChangeAmPm:
   530             case ESignalChangeAmPm:
   534                 {
   531                 {
   535                 iFepMan.ChangeMfneAmPmL();
   532                 iFepMan.ChangeMfneAmPm();
   536                 }
   533                 }
   537                 break;
   534                 break;
   538             case ESignalSetAppEditorCursor:
   535             case ESignalSetAppEditorCursor:
   539                 {
   536                 {
   540                 TInt8 *ptrData = (TInt8* )(pBuf.Ptr());
   537                 TInt8 *ptrData = (TInt8* )(pBuf.Ptr());
   576                     }           
   573                     }           
   577                 LaunchPenInputMenuL(R_AVKON_PENINPUT_OPTION_MENU_BAR);
   574                 LaunchPenInputMenuL(R_AVKON_PENINPUT_OPTION_MENU_BAR);
   578                 }
   575                 }
   579                 break;
   576                 break;
   580             case ESignalLayoutClosed:
   577             case ESignalLayoutClosed:
   581             	// Enable transition effect when close pen ui by pressing close button.
       
   582             	iPenInputServer.EnableGfxTransEffect( ETrue );
       
   583                 if(iPluginInputMode == EPluginInputModeItut)
   578                 if(iPluginInputMode == EPluginInputModeItut)
   584                 	{
   579                 	{
   585 					iFepMan.PtiEngine()->CancelTimerActivity();
   580 					iFepMan.PtiEngine()->CancelTimerActivity();
   586                 	}
   581                 	}
   587                 ClosePluginInputModeL(ETrue);
   582                 ClosePluginInputModeL(ETrue);
   677                 {
   672                 {
   678                 // Get candidate list
   673                 // Get candidate list
   679                 TInt activeIdx = 0;
   674                 TInt activeIdx = 0;
   680                 CDesCArray* candidates = new (ELeave) CDesCArrayFlat
   675                 CDesCArray* candidates = new (ELeave) CDesCArrayFlat
   681                                                  ( KDefaultCandidateArraySize );
   676                                                  ( KDefaultCandidateArraySize );
   682         		CleanupStack::PushL( candidates );
   677                 CleanupStack::PushL( candidates );
   683         		iFepMan.GetCandidatesL(*candidates, activeIdx);
   678                 iFepMan.GetCandidatesL(*candidates, activeIdx);
   684 
   679 
   685         		TFepITICandidateList candidateListData;
   680                 TFepITICandidateList candidateListData;
   686         		candidateListData.iItemArray = candidates;
   681                 candidateListData.iItemArray = candidates;
   687         		candidateListData.iActiveIndex 
   682                 candidateListData.iActiveIndex 
   688         		            = ( candidates->Count() >= 2 ) ? 1 : activeIdx;  
   683                             = ( candidates->Count() >= 2 ) ? 1 : activeIdx;  
   689         		candidateListData.iLangCode = iFepMan.CurrentInputLangCode();
   684                 candidateListData.iLangCode = iFepMan.CurrentInputLangCode();
   690         		
   685                 if ( iLangMan.IsSplitView() )
   691         		ShowCandidateListL( candidateListData );        		
   686                     {
   692         		CleanupStack::PopAndDestroy( candidates );                
   687                     candidateListData.iRect = iFepMan.InitRectForSplitCandL();
       
   688                     }
       
   689                 
       
   690                 ShowCandidateListL( candidateListData );                
       
   691                 CleanupStack::PopAndDestroy( candidates );                
   693                 }
   692                 }
   694                 break;
   693                 break;
   695                 
   694                 
   696             case ESignalSelectMatchSelectionText:
   695             case ESignalSelectMatchSelectionText:
   697                 {
   696                 {
   922 				iEdwin->Extension1()->State( KNullUid ));
   921 				iEdwin->Extension1()->State( KNullUid ));
   923 		}
   922 		}
   924 	
   923 	
   925 	return edwinState;
   924 	return edwinState;
   926 	}
   925 	}
   927 
   926 	
   928 // -----------------------------------------------------------------------------
   927 // -----------------------------------------------------------------------------
   929 // CAknFepPluginManager::HandleEventsFromFepL
   928 // CAknFepPluginManager::HandleEventsFromFepL
   930 // Handle events from FEP
   929 // Handle events from FEP
   931 // (other items were commented in a header).
   930 // (other items were commented in a header).
   932 // -----------------------------------------------------------------------------
   931 // -----------------------------------------------------------------------------
  1005             break;
  1004             break;
  1006         case EPluginForegroundChanged:
  1005         case EPluginForegroundChanged:
  1007             {
  1006             {
  1008             iForegroundChange = ETrue;   
  1007             iForegroundChange = ETrue;   
  1009             iLaunchHelp = EFalse;    
  1008             iLaunchHelp = EFalse;    
  1010 
       
  1011             // Remove pen ui activation observer
       
  1012             if (iPenInputSvrConnected && !aEventData )
       
  1013                 {
       
  1014                 iPenInputServer.RemovePenUiActivationHandler( this );
       
  1015                 }            
       
  1016             
  1009             
  1017             if (!aEventData && IsInGlobleNoteEditor())
  1010             if (!aEventData && IsInGlobleNoteEditor())
  1018                 {
  1011                 {
  1019                 ClosePluginInputUiL(ETrue);
  1012                 ClosePluginInputUiL(ETrue);
  1020                 if(iPenInputSvrConnected ) //lost foreground
  1013                 if(iPenInputSvrConnected ) //lost foreground
  1337                 }
  1330                 }
  1338             iPenInputServer.SetDisabledLayout( disableMode & ~enableMode );
  1331             iPenInputServer.SetDisabledLayout( disableMode & ~enableMode );
  1339             }
  1332             }
  1340         }
  1333         }
  1341 
  1334 
  1342     if(aSuggestMode == EPluginInputModeFingerHwr 
       
  1343             && iSharedData.InputTextLanguage() == ELangArabic)
       
  1344         {
       
  1345         if(IsEditorSupportSplitIme())
       
  1346             {
       
  1347             if(landscape)
       
  1348                 {
       
  1349                 aSuggestMode = EPluginInputModeFSQ;
       
  1350                 }
       
  1351             else
       
  1352                 {
       
  1353                 aSuggestMode = iSharedData.PluginPortraitInputMode();                
       
  1354                 }
       
  1355             }
       
  1356         }
       
  1357 
  1335 
  1358     if ( aSuggestMode == EPluginInputModeFSQ)
  1336     if ( aSuggestMode == EPluginInputModeFSQ)
  1359         {
  1337         {
  1360         TPluginInputMode tempInputMode = iPluginInputMode;           
  1338         TPluginInputMode tempInputMode = iPluginInputMode;           
  1361         iPluginInputMode = aSuggestMode;
  1339         iPluginInputMode = aSuggestMode;
  1407                 iAvkonAppUi->SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape );
  1385                 iAvkonAppUi->SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape );
  1408                 iOrientationChanged = ETrue;                
  1386                 iOrientationChanged = ETrue;                
  1409                 }
  1387                 }
  1410             }
  1388             }
  1411         }
  1389         }
  1412     else if( aSuggestMode == EPluginInputModePortraitFSQ  )
       
  1413     	{
       
  1414 		// If current input languge is Chinese or Korean, use EPluginInputModeItut instead.
       
  1415 		if ( iPortraitFSQEnabled && 
       
  1416 				( iFepMan.IsChineseInputLanguage() || iFepMan.IsKoreanInputLanguage() ))
       
  1417 			{
       
  1418 			  aSuggestMode = EPluginInputModeItut;
       
  1419 			}
       
  1420     	}
       
  1421     else if ( iOrientationChanged )
  1390     else if ( iOrientationChanged )
  1422         {
  1391         {
  1423         iFepMan.SetNotifyPlugin( EFalse );
  1392         iFepMan.SetNotifyPlugin( EFalse );
  1424         iAvkonAppUi->SetOrientationL( (CAknAppUiBase::TAppUiOrientation)iDefaultOrientation );
  1393         iAvkonAppUi->SetOrientationL( (CAknAppUiBase::TAppUiOrientation)iDefaultOrientation );
  1425         iFepMan.SetNotifyPlugin( ETrue );
  1394         iFepMan.SetNotifyPlugin( ETrue );
  1426         iOrientationChanged = EFalse;
  1395         iOrientationChanged = EFalse;
  1427         }
  1396         }
  1428     
       
  1429     // Add pen ui activation observer
       
  1430     iPenInputServer.AddPenUiActivationHandler( this, EPluginInputModeAll );    
       
  1431     
  1397     
  1432     TBool isSplit = IsEditorSupportSplitIme();
  1398     TBool isSplit = IsEditorSupportSplitIme();
  1433     TInt inputLang = iFepMan.InputLanguageCapabilities().iInputLanguageCode;
  1399     TInt inputLang = iFepMan.InputLanguageCapabilities().iInputLanguageCode;
  1434     // temp code for Chinese split view
  1400     // temp code for Chinese split view
  1435     if ( inputLang == ELangPrcChinese || 
  1401     if ( inputLang == ELangPrcChinese || 
  1513             SetEdwinFlagsByUiStatus( ETrue );
  1479             SetEdwinFlagsByUiStatus( ETrue );
  1514             }
  1480             }
  1515 		
  1481 		
  1516         // Notify application touch window state
  1482         // Notify application touch window state
  1517         NotifyAppUiImeTouchWndStateL( ETrue );
  1483         NotifyAppUiImeTouchWndStateL( ETrue );
       
  1484         if (iPluginInputMode == EPluginInputModeItut)
       
  1485             {
       
  1486             RProperty::Set( KPSUidAknFep, KAknFepVirtualKeyboardType, EPtiKeyboard12Key );
       
  1487             if(iFepMan.PtiEngine())
       
  1488                 {
       
  1489                 iFepMan.PtiEngine()->SetKeyboardType(EPtiKeyboard12Key);
       
  1490                 }
       
  1491             iFepMan.SetQwertyMode( EFalse );    
       
  1492             }
  1518 
  1493 
  1519         rtn = ETrue;
  1494         rtn = ETrue;
  1520         }
  1495         }
  1521     else
  1496     else
  1522         {
  1497         {
  1610 // (other items were commented in a header).
  1585 // (other items were commented in a header).
  1611 // -----------------------------------------------------------------------------
  1586 // -----------------------------------------------------------------------------
  1612 //
  1587 //
  1613 void CAknFepPluginManager::ClosePluginInputUiL(TBool aResetState)
  1588 void CAknFepPluginManager::ClosePluginInputUiL(TBool aResetState)
  1614     {
  1589     {
  1615     iInitiateCloseInputUi = ETrue;
       
  1616     
       
  1617     // For addition of ITI features on FSQ, 
  1590     // For addition of ITI features on FSQ, 
  1618     // need to restore some values stored before opening FSQ    
  1591     // need to restore some values stored before opening FSQ    
  1619     
  1592     
  1620     iConnectAo->Cancel();
  1593     iConnectAo->Cancel();
  1621     ResetItiStateL();
  1594     ResetItiStateL();
  1636                 //iCurrentPluginInputFepUI->HandleCommandL(ECmdPeninputDisableLayoutDrawing,ETrue);
  1609                 //iCurrentPluginInputFepUI->HandleCommandL(ECmdPeninputDisableLayoutDrawing,ETrue);
  1637                 return; //don't close the UI if this is caused by removing spell editor
  1610                 return; //don't close the UI if this is caused by removing spell editor
  1638                 }
  1611                 }
  1639             else
  1612             else
  1640                 {
  1613                 {
  1641                 NotifyAppUiImeTouchWndStateL( EFalse ); //this change is under testing 
       
  1642                 iCurrentPluginInputFepUI->CloseUI();
  1614                 iCurrentPluginInputFepUI->CloseUI();
  1643                 }
  1615                 }
  1644             if( aResetState )
  1616             if( aResetState )
  1645                 {
  1617                 {
  1646                 iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputWindowClose);
  1618                 iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputWindowClose);
  1679         TRAP_IGNORE( iAvkonAppUi->SetOrientationL( (CAknAppUiBase::TAppUiOrientation)iDefaultOrientation ) );
  1651         TRAP_IGNORE( iAvkonAppUi->SetOrientationL( (CAknAppUiBase::TAppUiOrientation)iDefaultOrientation ) );
  1680         iOrientationChanged = EFalse;
  1652         iOrientationChanged = EFalse;
  1681         } 
  1653         } 
  1682         
  1654         
  1683     // Notify editor the touch window has been closed
  1655     // Notify editor the touch window has been closed
  1684     //NotifyAppUiImeTouchWndStateL( EFalse );//this change is under testing
  1656     NotifyAppUiImeTouchWndStateL( EFalse );
  1685     
  1657     
  1686     iCharStartPostion = KInvalidValue;
  1658     iCharStartPostion = KInvalidValue;
  1687     
  1659     
  1688     // Set the KAknFepTouchInputActive PS to 0, 
  1660     // Set the KAknFepTouchInputActive PS to 0, 
  1689     // it means that touch input is inactive now.
  1661     // it means that touch input is inactive now.
  1690     RProperty::Set( KPSUidAknFep, KAknFepTouchInputActive, 0 );
  1662     RProperty::Set( KPSUidAknFep, KAknFepTouchInputActive, 0 );
  1691     
       
  1692     iInitiateCloseInputUi = EFalse;    
       
  1693     }
  1663     }
  1694 
  1664 
  1695 // ---------------------------------------------------------------------------
  1665 // ---------------------------------------------------------------------------
  1696 // CAknFepPluginManager::OnResourceChangedL
  1666 // CAknFepPluginManager::OnResourceChangedL
  1697 // (other items were commented in a header)
  1667 // (other items were commented in a header)
  1896                     {
  1866                     {
  1897                     ProcessChangingInputModeCmdL(EPluginInputModeItut);
  1867                     ProcessChangingInputModeCmdL(EPluginInputModeItut);
  1898                     }
  1868                     }
  1899                     break;
  1869                     break;
  1900                 case EPeninputCmdFSQ:
  1870                 case EPeninputCmdFSQ:
  1901                 	{
       
  1902                 	if ( iPortraitFSQEnabled )
       
  1903                 		{
       
  1904                         TPixelsTwipsAndRotation size; 
       
  1905                         CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
       
  1906                         TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;
       
  1907                         ProcessChangingInputModeCmdL( landscape ? EPluginInputModeFSQ : EPluginInputModePortraitFSQ );
       
  1908                 		}
       
  1909                 	else
       
  1910                 		{
       
  1911                 	    ProcessChangingInputModeCmdL(EPluginInputModeFSQ);
       
  1912                 		}
       
  1913                 	}
       
  1914                 	break;
       
  1915                 // "Edit portrait" menu - switch to portrait FSQ
  1871                 // "Edit portrait" menu - switch to portrait FSQ
  1916                 case EPeninputCmdPortraitEditor:
  1872                 case EPeninputCmdPortraitEditor:
  1917                     {
  1873                     {
  1918                     ProcessChangingInputModeCmdL(EPluginInputModePortraitFSQ);          
  1874                     if ( iPortraitFSQEnabled )
       
  1875                         {
       
  1876                         ProcessChangingInputModeCmdL(EPluginInputModePortraitFSQ);          
       
  1877                         }
       
  1878                     else 
       
  1879                         {
       
  1880                         ProcessChangingInputModeCmdL(EPluginInputModeFSQ);
       
  1881                         }
  1919                     }
  1882                     }
  1920                     break;
  1883                     break;
  1921                 // "Edit landscape" menu - switch to landscape FSQ
  1884                 // "Edit landscape" menu - switch to landscape FSQ
  1922                 case EPeninputCmdLandscapeEditor:
  1885                 case EPeninputCmdLandscapeEditor:
  1923 
  1886 
  2280         // add some input mode in option menu
  2243         // add some input mode in option menu
  2281         
  2244         
  2282     	TInt disabledInputMode = iPenInputServer.DisabledLayout();
  2245     	TInt disabledInputMode = iPenInputServer.DisabledLayout();
  2283     	TInt curInputMode = iLangMan.CurrentImePlugin()->CurrentMode();
  2246     	TInt curInputMode = iLangMan.CurrentImePlugin()->CurrentMode();
  2284     	TBool isChinese = iFepMan.IsChineseInputLanguage();
  2247     	TBool isChinese = iFepMan.IsChineseInputLanguage();
  2285     	TBool isKorean = iFepMan.IsKoreanInputLanguage();
       
  2286     	// similar with chinese layout, there is a switching button,so when writing language is korean
       
  2287     	// no need to insert 'Qwerty' or 'Alphabet keypad' item into option menu 
       
  2288     	
  2248     	
  2289     /* US2/US4/US5
  2249     /* US2/US4/US5
  2290     1. Orientation sensor off
  2250     1. Orientation sensor off
  2291 
  2251 
  2292         1-1. Portrait orientation
  2252         1-1. Portrait orientation
  2323     // "QWERTY keyboard" - EPeninputCmdFSQ menu
  2283     // "QWERTY keyboard" - EPeninputCmdFSQ menu
  2324     if ( iPortraitFSQEnabled )
  2284     if ( iPortraitFSQEnabled )
  2325         {
  2285         {
  2326         // "QWERTY keyboard" - EPeninputCmdFSQ menu is shown in these conditions
  2286         // "QWERTY keyboard" - EPeninputCmdFSQ menu is shown in these conditions
  2327         // if portrait FSQ feature flag is enabled
  2287         // if portrait FSQ feature flag is enabled
  2328         if ( !isKorean && !isChinese )
  2288         // 1) Non-Chinese language
  2329         	{
  2289         // 2) Current input mode is not portrait FSQ and also the mode is not disabled
  2330             // 1) Non-Chinese language and non-Korean language   
  2290         // 3) Current orientation is portrait
  2331             if ( isPortrait )
  2291         if ( !isChinese
  2332             	{
  2292             && ( curInputMode != EPluginInputModePortraitFSQ ) 
  2333                 // 2) On portrait screen, current input mode is not portrait FSQ 
  2293             && !( disabledInputMode & EPluginInputModePortraitFSQ ) 
  2334                 //    and also the mode is not disabled
  2294             && isPortrait )
  2335                 if ( curInputMode != EPluginInputModePortraitFSQ 
  2295         {
  2336                 	 && !( disabledInputMode & EPluginInputModePortraitFSQ ) )
  2296         aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
  2337                 	{
  2297         }
  2338                     aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
  2298         
  2339                 	}                	
       
  2340             	}
       
  2341             else
       
  2342             	{
       
  2343                 // 3) On landscape screen, current input mode is not FSQ 
       
  2344                 // and also the mode is not disabled
       
  2345                 if ( curInputMode != EPluginInputModeFSQ 
       
  2346                    	 && !( disabledInputMode & EPluginInputModeFSQ ) )
       
  2347                 	{
       
  2348                     aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
       
  2349                 	}
       
  2350             	}        
       
  2351         	}
       
  2352         }
  2299         }
  2353     else
  2300     else
  2354         {
  2301         {
  2355         if ( !isKorean && !isChinese && ( curInputMode != EPluginInputModeFSQ ) 
  2302         if ( !isChinese && ( curInputMode != EPluginInputModeFSQ ) 
  2356             && !( disabledInputMode & EPluginInputModeFSQ ) 
  2303             && !( disabledInputMode & EPluginInputModeFSQ ) 
  2357             && FeatureManager::FeatureSupported( KFeatureIdVirtualFullscrQwertyInput ) )
  2304             && FeatureManager::FeatureSupported( KFeatureIdVirtualFullscrQwertyInput ) )
  2358             {
  2305             {
  2359             aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
  2306             aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
  2360             }
  2307             }
  2362 
  2309 
  2363     // "Alphanumeric keypad" - EPenInputCmdVITUT menu is shown in these conditions.
  2310     // "Alphanumeric keypad" - EPenInputCmdVITUT menu is shown in these conditions.
  2364     // 1) Non-Chinese language
  2311     // 1) Non-Chinese language
  2365     // 2) Current input mode is not ITU-T and also the mode is not disabled
  2312     // 2) Current input mode is not ITU-T and also the mode is not disabled
  2366     // 3) ITU-T feature flag is enabled
  2313     // 3) ITU-T feature flag is enabled
  2367     if ( !isKorean && !isChinese 
  2314     if ( !isChinese 
  2368         && ( curInputMode != EPluginInputModeItut ) 
  2315         && ( curInputMode != EPluginInputModeItut ) 
  2369         && !( disabledInputMode & EPluginInputModeItut ) 
  2316         && !( disabledInputMode & EPluginInputModeItut ) 
  2370         && FeatureManager::FeatureSupported( KFeatureIdVirtualItutInput ) )
  2317         && FeatureManager::FeatureSupported( KFeatureIdVirtualItutInput ) )
  2371         {
  2318         {
  2372         aMenuPane->SetItemDimmed(EPenInputCmdVITUT, EFalse);
  2319         aMenuPane->SetItemDimmed(EPenInputCmdVITUT, EFalse);
  2375     // 1) Portrait FSQ feature flag is enabled
  2322     // 1) Portrait FSQ feature flag is enabled
  2376     // 2) Non-Chinese language
  2323     // 2) Non-Chinese language
  2377     // 3) Current input mode is not portrait FSQ and also the mode is not disabled
  2324     // 3) Current input mode is not portrait FSQ and also the mode is not disabled
  2378     // 4) Current orientation is landscape
  2325     // 4) Current orientation is landscape
  2379     if ( iPortraitFSQEnabled
  2326     if ( iPortraitFSQEnabled
  2380         && !isKorean && !isChinese 
  2327         && !isChinese 
  2381         && ( curInputMode != EPluginInputModePortraitFSQ ) 
  2328         && ( curInputMode != EPluginInputModePortraitFSQ ) 
  2382         && !( disabledInputMode & EPluginInputModePortraitFSQ ) 
  2329         && !( disabledInputMode & EPluginInputModePortraitFSQ ) 
  2383         && !isPortrait )
  2330         && !isPortrait )
  2384         {
  2331         {
  2385         aMenuPane->SetItemDimmed(EPeninputCmdPortraitEditor, EFalse);
  2332         aMenuPane->SetItemDimmed(EPeninputCmdPortraitEditor, EFalse);
  2392     // 3) Non-Chinese language
  2339     // 3) Non-Chinese language
  2393     // 4) Current input mode is not landscape FSQ and also the mode is not disabled
  2340     // 4) Current input mode is not landscape FSQ and also the mode is not disabled
  2394     // 5) Current orientation is portrait
  2341     // 5) Current orientation is portrait
  2395     if ( iPortraitFSQEnabled
  2342     if ( iPortraitFSQEnabled
  2396         && FeatureManager::FeatureSupported( KFeatureIdVirtualFullscrQwertyInput ) 
  2343         && FeatureManager::FeatureSupported( KFeatureIdVirtualFullscrQwertyInput ) 
  2397         && !isKorean && !isChinese 
  2344         && !isChinese 
  2398         && ( curInputMode != EPluginInputModeFSQ ) 
  2345         && ( curInputMode != EPluginInputModeFSQ ) 
  2399         && !( disabledInputMode & EPluginInputModeFSQ ) 
  2346         && !( disabledInputMode & EPluginInputModeFSQ ) 
  2400         && isPortrait )
  2347         && isPortrait )
  2401         {
  2348         {
  2402         aMenuPane->SetItemDimmed(EPeninputCmdLandscapeEditor, EFalse);
  2349         aMenuPane->SetItemDimmed(EPeninputCmdLandscapeEditor, EFalse);
  2462 //		}    			
  2409 //		}    			
  2463 	
  2410 	
  2464 	//Show number mode menu item.
  2411 	//Show number mode menu item.
  2465 	if(iFepMan.InputMode() == ENumber || iFepMan.InputMode() == ENativeNumber)
  2412 	if(iFepMan.InputMode() == ENumber || iFepMan.InputMode() == ENativeNumber)
  2466 	    {
  2413 	    {
  2467         CAknEdwinState* editorState = iFepMan.EditorState();
  2414         if(iSharedData.DefaultArabicNumberMode())
  2468         TUint permittedInputModes;
  2415             {
  2469         if( editorState )
  2416             aMenuPane->SetItemDimmed(EAknCmdEditModeNumber, EFalse);
  2470             {
       
  2471             permittedInputModes= editorState->PermittedInputModes();
       
  2472             }
  2417             }
  2473         else
  2418         else
  2474             {
  2419             {
  2475             permittedInputModes = EAknEditorNumericInputMode;
  2420             aMenuPane->SetItemDimmed(EAknCmdEditModeArabicIndicNumber, EFalse);
  2476             }   
       
  2477         TBool IsOnlyNumericPermitted = !(permittedInputModes 
       
  2478                 &(EAknEditorTextInputMode | EAknEditorSecretAlphaInputMode));
       
  2479         if(IsOnlyNumericPermitted)
       
  2480             {
       
  2481             if(iSharedData.DefaultArabicNumberMode())
       
  2482                 {
       
  2483                 aMenuPane->SetItemDimmed(EAknCmdEditModeNumber, EFalse);
       
  2484                 }
       
  2485             else
       
  2486                 {
       
  2487                 aMenuPane->SetItemDimmed(EAknCmdEditModeArabicIndicNumber, EFalse);
       
  2488                 }
       
  2489             }
  2421             }
  2490 	    }
  2422 	    }
  2491 
       
  2492 	// add the writing speed menu
  2423 	// add the writing speed menu
  2493 	index = 0;
  2424 	index = 0;
  2494 	if(aMenuPane->MenuItemExists(EPenInputCmdWritingSpeed, index))
  2425 	if(aMenuPane->MenuItemExists(EPenInputCmdWritingSpeed, index))
  2495 		{
  2426 		{
  2496 		aMenuPane->SetItemDimmed(EPenInputCmdWritingSpeed,EFalse);
  2427 		aMenuPane->SetItemDimmed(EPenInputCmdWritingSpeed,EFalse);
  2541     if ( !aGainForeground && appId == focusAppId )
  2472     if ( !aGainForeground && appId == focusAppId )
  2542         {
  2473         {
  2543         return;
  2474         return;
  2544         }
  2475         }
  2545         
  2476         
  2546     // if pen ui is being opened on a non-global editor, which popped by capserver or notify server,    
  2477     if( !iLaunchMenu && IsGlobalNotesApp(focusAppId)) 
  2547     // and also other global notes from capserver or notify server pop up at the moment,
  2478 
  2548     // pen ui should be dimmed as the definitino of dim feature.
       
  2549     // Set bClose = EFalse is used to prevent from closing pen ui later.  
       
  2550 	if( !iLaunchMenu && IsGlobalNotesApp(focusAppId) && !IsInGlobleNoteEditor() )
       
  2551         {
  2479         {
  2552         if ( iPluginInputMode == EPluginInputModeItut ||
  2480         if ( iPluginInputMode == EPluginInputModeItut ||
  2553              iPluginInputMode == EPluginInputModeFSQ ||
  2481              iPluginInputMode == EPluginInputModeFSQ ||
  2554              iPluginInputMode == EPluginInputModeFingerHwr ||
  2482              iPluginInputMode == EPluginInputModeFingerHwr ||
  2555              iPluginInputMode == EPluginInputModePortraitFSQ )
  2483              iPluginInputMode == EPluginInputModePortraitFSQ )
  2768             {
  2696             {
  2769             TFepInputContextFieldData icfData;
  2697             TFepInputContextFieldData icfData;
  2770             icfData.iCmd = EPeninputICFInitial;
  2698             icfData.iCmd = EPeninputICFInitial;
  2771     	    icfData.iText.Set(*iLastEditorContentBuf);
  2699     	    icfData.iText.Set(*iLastEditorContentBuf);
  2772     	    icfData.iCurSel = iCurSelPre;
  2700     	    icfData.iCurSel = iCurSelPre;
       
  2701     	    // special case for vietnamese, we need en/disable tone marker
       
  2702     	    // when the text in editor changes, 
       
  2703     	    // by checking whether the character before insertion point is vowel or not
       
  2704     	    VietSyncToneMarkerL(*iLastEditorContentBuf, icfData.iCurSel);
       
  2705     	    
  2773     	    if ( iFepMan.IsFlagSet(CAknFepManager::EFlagNoMatches) )
  2706     	    if ( iFepMan.IsFlagSet(CAknFepManager::EFlagNoMatches) )
  2774                 {
  2707                 {
  2775                 icfData.iFlag = EFepICFDataInlineNoMatch;
  2708                 icfData.iFlag = EFepICFDataInlineNoMatch;
  2776                 }
  2709                 }
  2777             if ( ExistInlineText() ) // inline
  2710             if ( ExistInlineText() ) // inline
  2891     
  2824     
  2892     // get current editor content	
  2825     // get current editor content	
  2893     HBufC* currentEditorContentBuf = HBufC::NewLC( editContentLen );
  2826     HBufC* currentEditorContentBuf = HBufC::NewLC( editContentLen );
  2894     TPtr16 currentEditorContent = currentEditorContentBuf->Des();
  2827     TPtr16 currentEditorContent = currentEditorContentBuf->Des();
  2895 	edit->GetEditorContentForFep( currentEditorContent, 0, editContentLen ); 
  2828 	edit->GetEditorContentForFep( currentEditorContent, 0, editContentLen ); 
  2896 	
  2829     // special case for vietnamese, we need en/disable tone marker
       
  2830     // when the text in editor changes, 
       
  2831     // by checking whether the character before insertion point is vowel or not
       
  2832 	VietSyncToneMarkerL(currentEditorContent, icfData.iCurSel);
       
  2833 
  2897 	if (SetSyncIcfDataL( icfData, lastEditorContent, currentEditorContent))
  2834 	if (SetSyncIcfDataL( icfData, lastEditorContent, currentEditorContent))
  2898     	{
  2835     	{
  2899 		iCurrentPluginInputFepUI->HandleCommandL
  2836 		iCurrentPluginInputFepUI->HandleCommandL
  2900 			(ECmdPenInputSendEditorTextAndCurPos, reinterpret_cast<TInt>(&icfData));
  2837 			(ECmdPenInputSendEditorTextAndCurPos, reinterpret_cast<TInt>(&icfData));
  2901 		if ( icfData.iMidPos >= 0 )
  2838 		iFepMan.TryPopExactWordInICFL();
  2902 			{
       
  2903 		    // icfData.iMidPos >= 0 means the text which will be sent to ICF is inline text.
       
  2904 		    iFepMan.TryPopExactWordInICFL();
       
  2905 			}		
       
  2906     	}
  2839     	}
  2907 
  2840 
  2908     if ( secretEditor ) 
  2841     if ( secretEditor ) 
  2909         { 
  2842         { 
  2910         TBool cursorDisabled = IsEditorCursorDisabled(); 
  2843         TBool cursorDisabled = IsEditorCursorDisabled(); 
  2919 	
  2852 	
  2920     iCurSelPre.iCursorPos = iCurSelCur.iCursorPos;
  2853     iCurSelPre.iCursorPos = iCurSelCur.iCursorPos;
  2921     iCurSelPre.iAnchorPos = iCurSelCur.iAnchorPos;
  2854     iCurSelPre.iAnchorPos = iCurSelCur.iAnchorPos;
  2922     iPreDocumentLengthForFep = editContentLen;
  2855     iPreDocumentLengthForFep = editContentLen;
  2923     }
  2856     }
       
  2857 
       
  2858 void CAknFepPluginManager::VietSyncToneMarkerL(
       
  2859 		const TDesC& aEditorContent, const TCursorSelection& aCursorPos)
       
  2860 	{
       
  2861 	if(ELangVietnamese != iLangMan.InputLanguage())
       
  2862 		{
       
  2863 		return;
       
  2864 		}
       
  2865 	
       
  2866 	TBool bEnable = EFalse;
       
  2867 	TInt low = aCursorPos.LowerPos();
       
  2868 	
       
  2869 	if(low > 0)
       
  2870 		{
       
  2871 		ASSERT(aEditorContent.Length() >= low);
       
  2872 		TBuf<1> buf = aEditorContent.Mid(low - 1, 1);
       
  2873 		TBuf<1> vowel; 
       
  2874 		TInt cnt = sizeof(VietVowelList) / sizeof(VietVowelList[0]);
       
  2875 		
       
  2876 		for(TInt i = 0; !bEnable && i < cnt; ++i)
       
  2877 			{
       
  2878 			const TText* text = &VietVowelList[i];
       
  2879 			vowel.SetLength(0);
       
  2880 			vowel.Append(text, 1);
       
  2881 			bEnable = (buf.Compare(vowel) == 0);
       
  2882 			}
       
  2883 		}
       
  2884 	
       
  2885 	iCurrentPluginInputFepUI->HandleCommandL(ECmdPeninputVietSyncToneMarker, bEnable);  
       
  2886 	}
  2924 
  2887 
  2925 TBool CAknFepPluginManager::SetSyncIcfDataL( TFepInputContextFieldData& aIcfData,
  2888 TBool CAknFepPluginManager::SetSyncIcfDataL( TFepInputContextFieldData& aIcfData,
  2926                                             const TDesC& aLastEditorContent,
  2889                                             const TDesC& aLastEditorContent,
  2927                                             const TDesC& aCurrentEditorContent )
  2890                                             const TDesC& aCurrentEditorContent )
  2928 	{
  2891 	{
  4860     
  4823     
  4861     SendMatchListCmd(iSendAllList.iCandidates);
  4824     SendMatchListCmd(iSendAllList.iCandidates);
  4862     }
  4825     }
  4863 
  4826 
  4864 void CAknFepPluginManager::SendMatchListCmd(const RArray<TPtrC>& aList)
  4827 void CAknFepPluginManager::SendMatchListCmd(const RArray<TPtrC>& aList)
  4865 	{
  4828     {
  4866     TFepITICandidateList list;
  4829     TFepITICandidateList list;
  4867     list.iActiveIndex = 0;
  4830     list.iActiveIndex = 0;
  4868     list.iItemArray2 = &aList;
  4831     list.iItemArray2 = &aList;
  4869     list.iLangCode = iFepMan.CurrentInputLangCode();
  4832     list.iLangCode = iFepMan.CurrentInputLangCode();
       
  4833     if ( iLangMan.IsSplitView() )
       
  4834         {
       
  4835         TRAP_IGNORE( list.iRect = iFepMan.InitRectForSplitCandL() );
       
  4836         }
  4870 
  4837 
  4871     TRAP_IGNORE(iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputFingerMatchList, 
  4838     TRAP_IGNORE(iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputFingerMatchList, 
  4872                                                          reinterpret_cast<TInt>(&list)));
  4839                                                          reinterpret_cast<TInt>(&list)));
  4873 	}
  4840     }
  4874 
  4841 
  4875 TBool CAknFepPluginManager::GetIndicatorImgID(const TInt IndicatorUID,TInt &aImage, TInt &aMask)
  4842 TBool CAknFepPluginManager::GetIndicatorImgID(const TInt IndicatorUID,TInt &aImage, TInt &aMask)
  4876     {
  4843     {
  4877     TBool ret = EFalse;
  4844     TBool ret = EFalse;
  4878     TRAP_IGNORE(ret = GetIndicatorImgIDL(IndicatorUID, aImage, aMask));
  4845     TRAP_IGNORE(ret = GetIndicatorImgIDL(IndicatorUID, aImage, aMask));
  5138         {
  5105         {
  5139         if (!editorSCTResId || editorSCTResId == R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG)
  5106         if (!editorSCTResId || editorSCTResId == R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG)
  5140             {
  5107             {
  5141             editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_CHINESE;
  5108             editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_CHINESE;
  5142             }
  5109             }
  5143         }    
  5110         }
  5144     else if (FeatureManager::FeatureSupported(KFeatureIdKorean))
       
  5145         {
       
  5146         // Use the special sct resource file for Korean variant.
       
  5147         if (!editorSCTResId || editorSCTResId == R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG)
       
  5148             {
       
  5149             editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_KOREAN;
       
  5150             }
       
  5151         }    
       
  5152     else if (!editorSCTResId)
  5111     else if (!editorSCTResId)
  5153         {
  5112         {
  5154         editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG;
  5113         editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG;
  5155         }
  5114         }
  5156  
  5115  
  6025          { 
  5984          { 
  6026          return EFalse; 
  5985          return EFalse; 
  6027          } 
  5986          } 
  6028       
  5987       
  6029      TInt flags = editorState->Flags();         
  5988      TInt flags = editorState->Flags();         
  6030      return ( flags & EAknEditorFlagAvkonSecretEditor ) == EAknEditorFlagAvkonSecretEditor; 
  5989      return ( flags & EEikEdwinAvkonDisableCursor ) == EEikEdwinAvkonDisableCursor; 
  6031       
       
  6032      } 
  5990      } 
  6033 
  5991 
  6034 // --------------------------------------------------------------------------- 
  5992 // --------------------------------------------------------------------------- 
  6035 // Check if the cusror in editor is visible. 
  5993 // Check if the cusror in editor is visible. 
  6036 // --------------------------------------------------------------------------- 
  5994 // --------------------------------------------------------------------------- 
  6098               // default range couldn't be accent. 
  6056               // default range couldn't be accent. 
  6099               || !iPluginPrimaryRange )
  6057               || !iPluginPrimaryRange )
  6100          && iFepMan.InputLanguageCapabilities().iSupportsWesternQwertyPredictive
  6058          && iFepMan.InputLanguageCapabilities().iSupportsWesternQwertyPredictive
  6101          && !iSharedData.QwertyInputMode()
  6059          && !iSharedData.QwertyInputMode()
  6102          // No need to support in dialer application.
  6060          // No need to support in dialer application.
  6103          && RProcess().SecureId().iId != KPhoneSecureId && 
  6061          && RProcess().SecureId().iId != KPhoneSecureId )
  6104          !iFepMan.IsNoT9Editor() )
       
  6105         {
  6062         {
  6106         return ETrue;
  6063         return ETrue;
  6107         }        
  6064         }        
  6108 #endif
  6065 #endif
  6109     return EFalse;
  6066     return EFalse;
  6124         // Save the old input mode
  6081         // Save the old input mode
  6125         TPtiEngineInputMode oldInputMode = iFepMan.PtiEngine()->InputMode();
  6082         TPtiEngineInputMode oldInputMode = iFepMan.PtiEngine()->InputMode();
  6126         // Change to input mode to EPtiEngineQwertyPredictive, after that
  6083         // Change to input mode to EPtiEngineQwertyPredictive, after that
  6127         // qwerty keymapping can be got
  6084         // qwerty keymapping can be got
  6128         iFepMan.PtiEngine()->SetInputMode( EPtiEngineQwertyPredictive );
  6085         iFepMan.PtiEngine()->SetInputMode( EPtiEngineQwertyPredictive );
       
  6086         iFepMan.PtiEngine()->SetKeyboardType(EPtiKeyboardQwerty4x12);
  6129         // Find scancode by keycode from qwerty keymapping
  6087         // Find scancode by keycode from qwerty keymapping
  6130         TInt retKey = keymapping->KeyForCharacter( aKeyCode );
  6088         TInt retKey = keymapping->KeyForCharacter( aKeyCode );
  6131         // Restore the old input mode
  6089         // Restore the old input mode
  6132         iFepMan.PtiEngine()->SetInputMode( oldInputMode );
  6090         iFepMan.PtiEngine()->SetInputMode( oldInputMode );
  6133         
  6091         
  6216         }
  6174         }
  6217     
  6175     
  6218     if ( oldInputMode != EPtiEngineQwertyPredictive ) 
  6176     if ( oldInputMode != EPtiEngineQwertyPredictive ) 
  6219     	{
  6177     	{
  6220         // if current input mode isn't EPtiEngineQwertyPredictive, 
  6178         // if current input mode isn't EPtiEngineQwertyPredictive, 
  6221         // current input mode has been set to EPtiEngineQwertyPredictive temporarily before, 
  6179         // current input mode is set to EPtiEngineQwertyPredictive temporarily before, 
  6222         // now we need to restore it,
  6180         // now we need to restore it,
  6223         // because state machine is responsible for changing it practically.
  6181         // because state machine is responsible for changing it practically.
  6224         iFepMan.PtiEngine()->SetInputMode( oldInputMode );
  6182         iFepMan.PtiEngine()->SetInputMode( oldInputMode );
  6225     	}
  6183     	}
  6226     //Now if there is no key mapping found for the character, then use the default TChar
  6184     //Now if there is no key mapping found for the character, then use the default TChar
  6552                                     ERangeInvalid);
  6510                                     ERangeInvalid);
  6553     iCurMFNECap = 0;
  6511     iCurMFNECap = 0;
  6554     iCurEditor = NULL;
  6512     iCurEditor = NULL;
  6555     }
  6513     }
  6556 
  6514 
  6557 // -----------------------------------------------------------------------------
       
  6558 // CAknFepPluginManager::OnPeninputUiDeactivated
       
  6559 // Called when pen input UI is about to be closed
       
  6560 // -----------------------------------------------------------------------------
       
  6561 //
       
  6562 void CAknFepPluginManager::OnPeninputUiDeactivated()
       
  6563     {
       
  6564     if( !iInitiateCloseInputUi )
       
  6565         {
       
  6566         TRAP_IGNORE( ClosePluginInputUiL( ETrue ) );
       
  6567         }
       
  6568     }
       
  6569 
       
  6570 // -----------------------------------------------------------------------------
       
  6571 // CAknFepPluginManager::OnPeninputUiActivated
       
  6572 // Called when pen input UI is about to be open
       
  6573 // -----------------------------------------------------------------------------
       
  6574 //
       
  6575 void CAknFepPluginManager::OnPeninputUiActivated()
       
  6576     {
       
  6577     }
       
  6578 
       
  6579 
       
  6580 CConnectAo::CConnectAo(CAknFepPluginManager* aClient) 
  6515 CConnectAo::CConnectAo(CAknFepPluginManager* aClient) 
  6581                 : CActive(CActive::EPriorityStandard),
  6516                 : CActive(CActive::EPriorityStandard),
  6582                   iClient(aClient)
  6517                   iClient(aClient)
  6583     {
  6518     {
  6584     CActiveScheduler::Add(this);
  6519     CActiveScheduler::Add(this);