fep/aknfep/src/AknFepPluginManager.cpp
branchRCL_3
changeset 9 e6a39382bb9c
parent 8 4eb1ae11334f
child 11 c8fb4cf7b3ae
equal deleted inserted replaced
8:4eb1ae11334f 9:e6a39382bb9c
   256     iDefaultOrientation = -1;
   256     iDefaultOrientation = -1;
   257     iIsInEditWordQueryDlg = EFalse;    
   257     iIsInEditWordQueryDlg = EFalse;    
   258     iClosePluginInputMode = EFalse;
   258     iClosePluginInputMode = EFalse;
   259     iDimGainForeground = ETrue;
   259     iDimGainForeground = ETrue;
   260     iAlignment = 0;
   260     iAlignment = 0;
       
   261 	iNeedFetchDimState = ETrue;
   261     }
   262     }
   262 
   263 
   263 // ---------------------------------------------------------------------------
   264 // ---------------------------------------------------------------------------
   264 // CAknFepPluginManager::ConstructL
   265 // CAknFepPluginManager::ConstructL
   265 // (other items were commented in a header)
   266 // (other items were commented in a header)
   626                     {
   627                     {
   627                     iFepMan.PluginUIManager()->SetFingerMatchSelectionState(EFalse);
   628                     iFepMan.PluginUIManager()->SetFingerMatchSelectionState(EFalse);
   628                     }    
   629                     }    
   629                 }
   630                 }
   630                 break;
   631                 break;
       
   632             case ESignalShowCandidate:
       
   633                 {
       
   634                 // Get candidate list
       
   635                 TInt activeIdx = 0;
       
   636                 CDesCArray* candidates = new (ELeave) CDesCArrayFlat
       
   637                                                  ( KDefaultCandidateArraySize );
       
   638         		CleanupStack::PushL( candidates );
       
   639         		iFepMan.GetCandidatesL(*candidates, activeIdx);
       
   640 
       
   641         		TFepITICandidateList candidateListData;
       
   642         		candidateListData.iItemArray = candidates;
       
   643         		candidateListData.iActiveIndex 
       
   644         		            = ( candidates->Count() >= 2 ) ? 1 : activeIdx;  
       
   645         		candidateListData.iLangCode = iFepMan.CurrentInputLangCode();
       
   646         		
       
   647         		ShowCandidateListL( candidateListData );        		
       
   648         		CleanupStack::PopAndDestroy( candidates );                
       
   649                 }
       
   650                 break;
       
   651                 
   631             case ESignalSelectMatchSelectionText:
   652             case ESignalSelectMatchSelectionText:
   632                 {
   653                 {
   633                 TInt* ptrData = (TInt*)(pBuf.Ptr());
   654                 TInt* ptrData = (TInt*)(pBuf.Ptr());
   634                 TInt itemidx = *(ptrData);
   655                 TInt itemidx = *(ptrData);
   635                 TBool commit = *(ptrData + 1);
   656                 TBool commit = *(ptrData + 1);
   705                     }
   726                     }
   706                 else
   727                 else
   707                     {
   728                     {
   708                     iCharStartPostion = KInvalidValue;
   729                     iCharStartPostion = KInvalidValue;
   709                     }
   730                     }
   710                 }
       
   711                 break;
       
   712             case ESignalShowCandidate:
       
   713                 {
       
   714                 // Get candidate list
       
   715                 TInt activeIdx = 0;
       
   716                 CDesCArray* candidates = new (ELeave) CDesCArrayFlat
       
   717                                                  ( KDefaultCandidateArraySize );
       
   718         		CleanupStack::PushL( candidates );
       
   719         		iFepMan.GetCandidatesL( *candidates, activeIdx );
       
   720         		TFepITICandidateList candidateListData;
       
   721         		candidateListData.iItemArray = candidates;
       
   722         		candidateListData.iActiveIndex 
       
   723         		            = ( candidates->Count() >= 2 ) ? 1 : activeIdx;        		
       
   724         		ShowCandidateListL( candidateListData );        		
       
   725         		CleanupStack::PopAndDestroy( candidates );                
       
   726                 }
   731                 }
   727                 break;
   732                 break;
   728             case ESignalSelectCandidate:
   733             case ESignalSelectCandidate:
   729                 {
   734                 {
   730                 // Select candidate word on fsq
   735                 // Select candidate word on fsq
   992         	if ( iCurrentPluginInputFepUI )
   997         	if ( iCurrentPluginInputFepUI )
   993         		{
   998         		{
   994                 iCurrentPluginInputFepUI->HandleCommandL( ECmdPeninputITIStatus,
   999                 iCurrentPluginInputFepUI->HandleCommandL( ECmdPeninputITIStatus,
   995                                               iFepMan.WesternPredictive() );        	
  1000                                               iFepMan.WesternPredictive() );        	
   996         		}
  1001         		}
       
  1002         	}
       
  1003         	break;
       
  1004         case EPluginEnableFetchDimState:
       
  1005         	{
       
  1006         	iNeedFetchDimState = ETrue;
   997         	}
  1007         	}
   998         	break;
  1008         	break;
   999         default:
  1009         default:
  1000             break;
  1010             break;
  1001         }
  1011         }
  1923     			&& !( disabledInputMode & EPluginInputModeItut ))
  1933     			&& !( disabledInputMode & EPluginInputModeItut ))
  1924     	    {
  1934     	    {
  1925     	    aMenuPane->SetItemDimmed(EPenInputCmdVITUT, EFalse);
  1935     	    aMenuPane->SetItemDimmed(EPenInputCmdVITUT, EFalse);
  1926     	    }
  1936     	    }
  1927     	
  1937     	
  1928     	if ( iFepMan.IsArabicInputLanguage() && ( curInputMode != EPluginInputModeFingerHwr )
  1938     	//if ( iFepMan.IsArabicInputLanguage() && ( curInputMode != EPluginInputModeFingerHwr )
  1929     			&& !( disabledInputMode & EPluginInputModeFingerHwr ))
  1939     	//		&& !( disabledInputMode & EPluginInputModeFingerHwr ))
  1930     	    {
  1940     	//    {
  1931     	    aMenuPane->SetItemDimmed( EPeninputCmdHwr, EFalse );
  1941     	//    aMenuPane->SetItemDimmed( EPeninputCmdHwr, EFalse );
  1932     	    }
  1942     	//    }
  1933         //For arabic finger hwr input orientation.
  1943         //For arabic finger hwr input orientation.
  1934         TInt index = 0;        
  1944         TInt index = 0;        
  1935         if(iPluginInputMode == EPluginInputModeFingerHwr
  1945         if(iPluginInputMode == EPluginInputModeFingerHwr
  1936                 && (ELangArabic == iSharedData.InputTextLanguage())
  1946                 && (ELangArabic == iSharedData.InputTextLanguage())
  1937                 && (!iSharedData.AutoRotateEnabled()))
  1947                 && (!iSharedData.AutoRotateEnabled()))
  2009     if (iLaunchHelp)
  2019     if (iLaunchHelp)
  2010         {
  2020         {
  2011         return;    
  2021         return;    
  2012         }
  2022         }
  2013     
  2023     
  2014     if ( iFepMan.StopProcessFocus()  )
  2024     if ( !iForegroundChange && iFepMan.StopProcessFocus()  )
  2015         {
  2025         {
  2016         if (iFepMan.CloseUiOnFocusChange())
  2026         if (iFepMan.CloseUiOnFocusChange())
  2017             {
  2027             {
  2018             ClosePluginInputUiL(ETrue);   
  2028             ClosePluginInputUiL(ETrue);   
  2019             }
  2029             }
  2075         {
  2085         {
  2076         if(!iPenInputServer.IsDimmed())
  2086         if(!iPenInputServer.IsDimmed())
  2077             bOpen = EFalse;						
  2087             bOpen = EFalse;						
  2078         }*/
  2088         }*/
  2079 
  2089 
       
  2090     // The state means: when current app with dim state lose foreground by non-capserver or notify server
       
  2091     // Need to cancel dim state
       
  2092     if ( iForegroundChange && !aGainForeground && !IsGlobalNotesApp( focusAppId ) && iInMenu )
       
  2093     	{
       
  2094 		ResetMenuState();
       
  2095     	}  
       
  2096     
  2080     if ( aGainForeground && iFepMan.FepAwareTextEditor() && IsCurrentWindInOpenList() )
  2097     if ( aGainForeground && iFepMan.FepAwareTextEditor() && IsCurrentWindInOpenList() )
  2081         {
  2098         {
  2082         if(!iPenInputSvrConnected) 
  2099         if(!iPenInputSvrConnected) 
  2083             {
  2100             {
  2084             HandleEventsFromFepL(EPluginEditorActivate,0);
  2101             HandleEventsFromFepL(EPluginEditorActivate,0);
  2395 	    // if content is the same, sync cursor selection only
  2412 	    // if content is the same, sync cursor selection only
  2396     if ( !iModeChanged && 
  2413     if ( !iModeChanged && 
  2397         aLastEditorContent.Compare( aCurrentEditorContent ) == 0 )
  2414         aLastEditorContent.Compare( aCurrentEditorContent ) == 0 )
  2398     	{
  2415     	{
  2399         if ( aIcfData.iCurSel.HigherPos() > edit->DocumentLengthForFep() || 
  2416         if ( aIcfData.iCurSel.HigherPos() > edit->DocumentLengthForFep() || 
  2400          aIcfData.iCurSel.LowerPos() < 0 )
  2417          aIcfData.iCurSel.LowerPos() < 0 || IsDimed() )
  2401             {
  2418             {
  2402             return EFalse;
  2419             return EFalse;
  2403             }
  2420             }
  2404     	return SetSyncCurSelIcfDataL( aIcfData );    	
  2421     	return SetSyncCurSelIcfDataL( aIcfData );    	
  2405     	}
  2422     	}
  2875 // (other items were commented in a header).
  2892 // (other items were commented in a header).
  2876 // -----------------------------------------------------------------------------
  2893 // -----------------------------------------------------------------------------
  2877 //
  2894 //
  2878 void CAknFepPluginManager::LaunchPenInputMenuL(TInt aResourceId, TBool aRemeber)
  2895 void CAknFepPluginManager::LaunchPenInputMenuL(TInt aResourceId, TBool aRemeber)
  2879     {
  2896     {
       
  2897 	// when launch option menu, dim state changes, 
       
  2898 	// so need fetch the state next time.
       
  2899 	iNeedFetchDimState = ETrue;
       
  2900 	
  2880     TInt previousModes = iCurPermitModes;
  2901     TInt previousModes = iCurPermitModes;
  2881     TBool previousSCT  = isLanuchSCT;
  2902     TBool previousSCT  = isLanuchSCT;
  2882     TInt inputmode = PluginInputMode();
  2903     TInt inputmode = PluginInputMode();
  2883     
  2904     
  2884     if (R_AVKON_PENINPUT_OPTION_MENU_BAR == aResourceId &&
  2905     if (R_AVKON_PENINPUT_OPTION_MENU_BAR == aResourceId &&
  3258                     if ( IsITISupportedKey( keyEvent ) )
  3279                     if ( IsITISupportedKey( keyEvent ) )
  3259                         {                            
  3280                         {                            
  3260                         // check if need to change current text case
  3281                         // check if need to change current text case
  3261                         TPtiTextCase textCase = 
  3282                         TPtiTextCase textCase = 
  3262                         CaseForMappedCharacter( TChar( keyEvent.iCode ) );                                                        
  3283                         CaseForMappedCharacter( TChar( keyEvent.iCode ) );                                                        
  3263 						if ( !IsDeadKeyCode( keyEvent.iCode ) && IsNeedToChangeTextCase( textCase ) )
  3284 						if ( IsNeedToChangeTextCase( textCase ) )
  3264                             {
  3285                             {
  3265                             iFepMan.PtiEngine()->SetCase( textCase );
  3286                             iFepMan.PtiEngine()->SetCase( textCase );
  3266                             }                        
  3287                             }
       
  3288                                                                        
       
  3289 						env->SimulateKeyEventL(keyEvent, EEventKeyDown);
       
  3290 						env->SimulateKeyEventL(keyEvent, EEventKey);
       
  3291 						env->SimulateKeyEventL(keyEvent, EEventKeyUp);
       
  3292                         }
       
  3293                     else if ( keyEvent.iScanCode == EStdKeySpace )
       
  3294                         {
  3267                         TRawEvent eventDown; 
  3295                         TRawEvent eventDown; 
  3268                         eventDown.Set( TRawEvent::EKeyDown, keyEvent.iScanCode ); 
  3296                         eventDown.Set( TRawEvent::EKeyDown, keyEvent.iScanCode ); 
  3269                         iAvkonAppUi->DisableNextKeySound( keyEvent.iScanCode ); 
  3297                         iAvkonAppUi->DisableNextKeySound( keyEvent.iScanCode ); 
  3270                         CCoeEnv::Static()->WsSession().SimulateRawEvent( eventDown ); 
  3298                         CCoeEnv::Static()->WsSession().SimulateRawEvent( eventDown ); 
  3271                         
  3299                         
  3321 // Handle key event sent from pen input server
  3349 // Handle key event sent from pen input server
  3322 // (other items were commented in a header).
  3350 // (other items were commented in a header).
  3323 // -----------------------------------------------------------------------------
  3351 // -----------------------------------------------------------------------------
  3324 //
  3352 //
  3325 void CAknFepPluginManager::OnPenInputServerKeyEventL(const TDesC& aData)
  3353 void CAknFepPluginManager::OnPenInputServerKeyEventL(const TDesC& aData)
  3326     {
  3354     {	
  3327     
  3355     if ( !EnableITIOnFSQ() )
  3328     iFepMan.PtiEngine()->CancelTimerActivity();
  3356     	{
       
  3357         iFepMan.PtiEngine()->CancelTimerActivity();
       
  3358     	}    
  3329     
  3359     
  3330     if( aData.Length() <= 0 )
  3360     if( aData.Length() <= 0 )
  3331         {
  3361         {
  3332         return;
  3362         return;
  3333         }
  3363         }
  3895         }                                               
  3925         }                                               
  3896                                               
  3926                                               
  3897                                               
  3927                                               
  3898     iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputDimArrowKeys, 
  3928     iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputDimArrowKeys, 
  3899                                               enableArrowBtn);    
  3929                                               enableArrowBtn);    
  3900                                                                                         
  3930     if ( PluginInputMode() == EPluginInputModeFSQ )
       
  3931     	{
       
  3932         iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputDimEnterKey, 
       
  3933         		                                  iFepMan.IsFindPaneEditor() );
       
  3934     	}
       
  3935 
  3901     SetIcfAlignment();
  3936     SetIcfAlignment();
  3902     
  3937     
  3903     iModeChanged = ETrue;
  3938     iModeChanged = ETrue;
  3904     SendIcfDataL( EPluginSyncAll );
  3939     SendIcfDataL( EPluginSyncAll );
  3905     iModeChanged = EFalse;
  3940     iModeChanged = EFalse;
  4263     if (!iCandidateList.Count())
  4298     if (!iCandidateList.Count())
  4264         return;
  4299         return;
  4265 
  4300 
  4266     for (TInt i = 0; i < iCandidateList.Count(); i++)
  4301     for (TInt i = 0; i < iCandidateList.Count(); i++)
  4267         iSendAllList.iCandidates.Append(iCandidateList[i]->Des());
  4302         iSendAllList.iCandidates.Append(iCandidateList[i]->Des());
       
  4303     
       
  4304     SendMatchListCmd(iSendAllList.iCandidates);
       
  4305     }
       
  4306 
       
  4307 void CAknFepPluginManager::SendMatchListCmd(const RArray<TPtrC>& aList)
       
  4308 	{
       
  4309     TFepITICandidateList list;
       
  4310     list.iActiveIndex = 0;
       
  4311     list.iItemArray2 = &aList;
       
  4312     list.iLangCode = iFepMan.CurrentInputLangCode();
  4268 
  4313 
  4269     TRAP_IGNORE(iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputFingerMatchList, 
  4314     TRAP_IGNORE(iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputFingerMatchList, 
  4270                                                          reinterpret_cast<TInt>(&iSendAllList)));
  4315                                                          reinterpret_cast<TInt>(&list)));
  4271     }
  4316 	}
  4272 
  4317 
  4273 TBool CAknFepPluginManager::GetIndicatorImgID(const TInt IndicatorUID,TInt &aImage, TInt &aMask)
  4318 TBool CAknFepPluginManager::GetIndicatorImgID(const TInt IndicatorUID,TInt &aImage, TInt &aMask)
  4274     {
  4319     {
  4275     TBool ret = EFalse;
  4320     TBool ret = EFalse;
  4276     TRAP_IGNORE(ret = GetIndicatorImgIDL(IndicatorUID, aImage, aMask));
  4321     TRAP_IGNORE(ret = GetIndicatorImgIDL(IndicatorUID, aImage, aMask));
  5015     {
  5060     {
  5016     if(!iPenInputSvrConnected ) 
  5061     if(!iPenInputSvrConnected ) 
  5017         {
  5062         {
  5018         return EFalse;
  5063         return EFalse;
  5019         }    
  5064         }    
  5020     return iPenInputServer.IsDimmed();    
  5065     if( iNeedFetchDimState )
       
  5066         {
       
  5067         iCurrentDimState = iPenInputServer.IsDimmed();  
       
  5068         iNeedFetchDimState = EFalse;
       
  5069         }
       
  5070     return iCurrentDimState;
  5021     }
  5071     }
  5022 void CAknFepPluginManager::HandleiDimGainForeground(TBool aGain)
  5072 void CAknFepPluginManager::HandleiDimGainForeground(TBool aGain)
  5023     {
  5073     {
  5024     if (aGain)
  5074     if (aGain)
  5025         {
  5075         {
  5453     {
  5503     {
  5454 // ITI supported conditions
  5504 // ITI supported conditions
  5455 // 1. Not in keymapping: some function keys, space, enter, backspace
  5505 // 1. Not in keymapping: some function keys, space, enter, backspace
  5456 // 2. In keymappings: keys on AB/Native range.
  5506 // 2. In keymappings: keys on AB/Native range.
  5457 #ifdef RD_INTELLIGENT_TEXT_INPUT
  5507 #ifdef RD_INTELLIGENT_TEXT_INPUT
  5458     if ( aKeyEvent.iScanCode == EStdKeySpace
  5508     if ( aKeyEvent.iScanCode != EPtiKeyNone 
  5459     	 || aKeyEvent.iScanCode == EStdKeyEnter
  5509     	  && ( iPluginPrimaryRange == ERangeNative 
  5460     	 || aKeyEvent.iScanCode == EStdKeyBackspace
  5510     	       || iPluginPrimaryRange == ERangeEnglish
  5461     	 || ( aKeyEvent.iScanCode != EPtiKeyNone 
  5511     	       || ( iPluginPrimaryRange == 0 && iFepMan.InputMode() != ENumber 
  5462     	      && ( iPluginPrimaryRange == ERangeNative 
  5512     	               && iFepMan.InputMode() != ENativeNumber ) ) )
  5463     	           || iPluginPrimaryRange == ERangeEnglish
       
  5464     	           || ( iPluginPrimaryRange == 0 && iFepMan.InputMode() != ENumber 
       
  5465     	                   && iFepMan.InputMode() != ENativeNumber ) ) ) )
       
  5466         {
  5513         {
  5467         return ETrue;
  5514         return ETrue;
  5468         }
  5515         }
  5469     return EFalse;
  5516     return EFalse;
  5470 #else
  5517 #else
  5517     }
  5564     }
  5518     
  5565     
  5519 TBool CAknFepPluginManager::IsNeedToChangeTextCase( const TPtiTextCase& aTextCase )
  5566 TBool CAknFepPluginManager::IsNeedToChangeTextCase( const TPtiTextCase& aTextCase )
  5520     {
  5567     {
  5521 #ifdef RD_INTELLIGENT_TEXT_INPUT
  5568 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  5569 	// Not need change case if it is supported in language
       
  5570 	if ( iCaseMan.IsAbleChangeCase() )
       
  5571 		{
       
  5572 	    return EFalse;
       
  5573 		}
       
  5574 	
  5522     TPtiTextCase textCase = aTextCase;
  5575     TPtiTextCase textCase = aTextCase;
  5523     if( EPtiKeyboardHalfQwerty != iFepMan.PtiEngine()->KeyboardType() )
  5576     if( EPtiKeyboardHalfQwerty != iFepMan.PtiEngine()->KeyboardType() )
  5524 		{
  5577 		{
  5525 		if ( textCase  == EPtiCaseChrLower )
  5578 		if ( textCase  == EPtiCaseChrLower )
  5526 			{
  5579 			{