fep/aknfep/src/AknFepManager.cpp
branchRCL_3
changeset 50 5a1685599b76
parent 46 bd83ceabce89
child 56 8152b1f1763a
equal deleted inserted replaced
46:bd83ceabce89 50:5a1685599b76
  1690                     // in inline state is replaced with a digit.
  1690                     // in inline state is replaced with a digit.
  1691                     /*Hindi*/
  1691                     /*Hindi*/
  1692                     //This condition is added for Hindi language in case of multitapping of EKey1 to get 
  1692                     //This condition is added for Hindi language in case of multitapping of EKey1 to get 
  1693                     //a numeral value "1" because of a clasical case of Halant and ZWS getting added 
  1693                     //a numeral value "1" because of a clasical case of Halant and ZWS getting added 
  1694                     //before numeral 1 which may affect incase of limited space in editor   
  1694                     //before numeral 1 which may affect incase of limited space in editor   
  1695                         
  1695                     
  1696                     if (( EditorHasFreeSpace()
  1696 
  1697                         || (!WesternPredictive() && !EditorHasFreeSpace() && 
  1697 
  1698                            (TAknFepUiIndicInputManager::IsIndicLangauge(
  1698 
  1699                             TLanguage(iLanguageCapabilities.iInputLanguageCode)))) 
  1699 
  1700                         || IsFlagSet(EFlagInsideMultitapInlineEditingTransaction)
  1700                     // Is the language Indic?
  1701                         || (IsFlagSet(EFlagInsideInlineEditingTransaction) && aLength == ELongKeyPress)))
  1701                     TBool isIndicLanguage = TAknFepUiIndicInputManager::IsIndicLangauge(
       
  1702                                                TLanguage(iLanguageCapabilities.iInputLanguageCode)); 
       
  1703 
       
  1704                     // Is the state in Multitap of the Inline Text   
       
  1705                     TBool  isFlagInsideMultitapInlineEditingTransaction = 
       
  1706                                                  IsFlagSet(EFlagInsideMultitapInlineEditingTransaction);
       
  1707 
       
  1708                     // Is the state of the text inline when long pressing key event occurs
       
  1709                     TBool  isInlineEditorTransactionLongKeyPress = IsFlagSet(EFlagInsideInlineEditingTransaction)
       
  1710                                                                && ( aLength == ELongKeyPress );
       
  1711 
       
  1712                     // Is the state of the text inline when current mode is Koeran.
       
  1713                     TBool isInlineEditorTranscationKoreanMode = IsFlagSet(EFlagInsideInlineEditingTransaction)
       
  1714                                                                 && ( iMode == EHangul ); 
       
  1715 
       
  1716                     // Don't check the free space of the editor 
       
  1717                     // when current mode is Hangul and current editor state is inline state.
       
  1718                     if ( EditorHasFreeSpace()
       
  1719                         || (!WesternPredictive() && !EditorHasFreeSpace() && isIndicLanguage )
       
  1720                         || isFlagInsideMultitapInlineEditingTransaction
       
  1721                         || isInlineEditorTransactionLongKeyPress  
       
  1722                         || isInlineEditorTranscationKoreanMode )
  1702                         {
  1723                         {
  1703                         ClearFlag(EFlagEditorFull);
  1724                         ClearFlag(EFlagEditorFull);
  1704 
  1725 
  1705                         if (aLength == ELongKeyPress && 
  1726                         if (aLength == ELongKeyPress && 
  1706                            (iMode != ELatin && iMode != ENumber && iMode != ENativeNumber && iMode != EStrokeFind && iMode != EHangul) &&
  1727                            (iMode != ELatin && iMode != ENumber && iMode != ENativeNumber && iMode != EStrokeFind && iMode != EHangul) &&
  5576     else
  5597     else
  5577         {
  5598         {
  5578         AddInputLanguageItemL(aMenuPane, posToInsertItem);
  5599         AddInputLanguageItemL(aMenuPane, posToInsertItem);
  5579         }
  5600         }
  5580     }
  5601     }
       
  5602 
       
  5603 // -----------------------------------------------------------------------------
       
  5604 // To check if the menu with the CascadeId exist in menupane
       
  5605 // -----------------------------------------------------------------------------
       
  5606 TBool CAknFepManager::MenuItemExistL( CAknFepUiInterfaceMenuPane* aMenuPane, 
       
  5607 									 TInt aCascadeId, TInt &aPosition )
       
  5608     {
       
  5609     TInt numOfMenuItems = aMenuPane->NumberOfItemsInPane();
       
  5610     CEikMenuPane* menuPane = aMenuPane->GetMenuPane();
       
  5611 
       
  5612     TInt index;
       
  5613     for( index = 0; index < numOfMenuItems ; ++index )
       
  5614         {
       
  5615         CEikMenuPaneItem::SData& itemData = menuPane->ItemDataByIndexL( index );
       
  5616         if( itemData.iCascadeId == aCascadeId )
       
  5617             {
       
  5618             aPosition = index;
       
  5619             return ETrue;
       
  5620             }
       
  5621         }
       
  5622     return EFalse;
       
  5623     }
       
  5624 
  5581 #endif // RD_INTELLIGENT_TEXT_INPUT
  5625 #endif // RD_INTELLIGENT_TEXT_INPUT
  5582 
  5626 
  5583 
  5627 
  5584 void CAknFepManager::AddEditSubmenuL(CAknFepUiInterfaceMenuPane* aMenuPane)
  5628 void CAknFepManager::AddEditSubmenuL(CAknFepUiInterfaceMenuPane* aMenuPane)
  5585     {
  5629     {
  5612     iRememberLength = iInputCapabilities.FepAwareTextEditor()->DocumentLengthForFep();      
  5656     iRememberLength = iInputCapabilities.FepAwareTextEditor()->DocumentLengthForFep();      
  5613     
  5657     
  5614     if (iRememberLength > 0 || (iEditorCcpuStatus & ECcpuStatusFlagCanPaste))
  5658     if (iRememberLength > 0 || (iEditorCcpuStatus & ECcpuStatusFlagCanPaste))
  5615         {
  5659         {
  5616 		if (aMenuPane->MenuItemExists(EAknCmdEditItemPlaceHolder, index) ||
  5660 		if (aMenuPane->MenuItemExists(EAknCmdEditItemPlaceHolder, index) ||
  5617 				aMenuPane->MenuItemExists(EAknCmdInputLanguage, index) ||
  5661 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  5662             MenuItemExistL( aMenuPane, R_AKNFEP_PRED_INPUT_OPTIONS_SUBMENU, index ) ||
       
  5663 #endif //RD_INTELLIGENT_TEXT_INPUT 
       
  5664             aMenuPane->MenuItemExists(EAknCmdInputLanguage, index) ||
  5618 		    aMenuPane->MenuItemExists(EAknCmdHelp, index) || 
  5665 		    aMenuPane->MenuItemExists(EAknCmdHelp, index) || 
  5619             aMenuPane->MenuItemExists(EAknCmdExit, index))  
  5666             aMenuPane->MenuItemExists(EAknCmdExit, index))  
  5620             {
  5667             {
  5621             TBuf<KMaxFileName> titleStr;
  5668             TBuf<KMaxFileName> titleStr;
  5622             StringLoader::Load(titleStr, R_AKNFEP_OPTIONS_EDIT_SUBMENU_TITLE);          
  5669             StringLoader::Load(titleStr, R_AKNFEP_OPTIONS_EDIT_SUBMENU_TITLE);          
 20005 		if( EStdKeyRightFunc == aKeyEvent.iScanCode )
 20052 		if( EStdKeyRightFunc == aKeyEvent.iScanCode )
 20006 			{
 20053 			{
 20007 			switch(aEventCode)
 20054 			switch(aEventCode)
 20008 				{
 20055 				{
 20009 				case EEventKeyDown:
 20056 				case EEventKeyDown:
 20010 					ActivateFnkeyPressMonitor();
 20057 					{
       
 20058 					  //if current state of fn key is EFnKeyNone or EFnKeyNext..., EFnKeyLock will be set;
       
 20059 					  //otherwise, EFnKeyNone will be set.
       
 20060 				      if ( iFnKeyManager->FnKeyState() ==  CAknFepFnKeyManager::EFnKeyLock )
       
 20061 				    	  {
       
 20062 			                ClearExtendedFlag( EExtendedFlagFnKeyNeedLockMode );
       
 20063 				    	  }
       
 20064 				      else
       
 20065 				    	  {
       
 20066 			                SetExtendedFlag( EExtendedFlagFnKeyNeedLockMode );
       
 20067 				    	  }
       
 20068 					  ActivateFnkeyPressMonitor();
       
 20069 					}
 20011 					break;
 20070 					break;
 20012 				case EEventKeyUp:
 20071 				case EEventKeyUp:
 20013 					{
 20072 					{
 20014 					if(!iFnKeypressMonitor->IsActive())
 20073 					if(!iFnKeypressMonitor->IsActive())
 20015 					   {
 20074 					   {
 20016 					    //when long pressing event occurrs,
 20075 					    //when long pressing event occurrs,
 20017                         //event has been already handled in HandleFnKeyPressMonitorCallback()
 20076                         //event has been already handled in HandleFnKeyPressMonitorCallback()
       
 20077 						if ( !IsExtendedFlagSet ( EExtendedFlagFnKeyNeedLockMode ))
       
 20078 							{
       
 20079 							 iFnKeyManager->SetFnKeyState(CAknFepFnKeyManager::EFnKeyNone);
       
 20080 							}
 20018 						return EKeyWasConsumed;
 20081 						return EKeyWasConsumed;
 20019 					   }
 20082 					   }
 20020 					//when short pressing event occurs, 
 20083 					//when short pressing event occurs, 
 20021                     //only deactive fn Key press monitor and normal event handle flow will work
 20084                     //only deactive fn Key press monitor and normal event handle flow will work
 20022 					DeactivateFnkeyPressMonitor();
 20085 					DeactivateFnkeyPressMonitor();
 20805 	        return ETrue;
 20868 	        return ETrue;
 20806 	        } 
 20869 	        } 
 20807     	}       
 20870     	}       
 20808     return EFalse;    
 20871     return EFalse;    
 20809     }    
 20872     }    
 20810 void CAknFepManager::ChangeMfneAmPm()
 20873 void CAknFepManager::ChangeMfneAmPmL()
 20811     {
 20874     {
 20812 	//trigger when touch at "AM" or "PM" in ICF
 20875 	//trigger when touch at "AM" or "PM" in ICF
 20813     if (iInputCapabilities.FepAwareTextEditor() && IsMfneEditor() )
 20876     if (iInputCapabilities.FepAwareTextEditor() && IsMfneEditor() )
 20814         {
 20877         {
 20815         MObjectProvider* mop = iInputCapabilities.ObjectProvider();
 20878         MObjectProvider* mop = iInputCapabilities.ObjectProvider();
 20976 void CAknFepManager::HideExactWordPopUp()
 21039 void CAknFepManager::HideExactWordPopUp()
 20977 	{
 21040 	{
 20978 	iExactWordPopupContent->HidePopUp();
 21041 	iExactWordPopupContent->HidePopUp();
 20979 	TRAP_IGNORE( SendEventsToPluginManL( EPluginHideTooltip ));
 21042 	TRAP_IGNORE( SendEventsToPluginManL( EPluginHideTooltip ));
 20980 	}
 21043 	}
       
 21044 
       
 21045 //========================================================================
       
 21046 //
       
 21047 // This function judge whether the texts inputted exceed 
       
 21048 // the max length of the editor. 
       
 21049 // 
       
 21050 //========================================================================
       
 21051 TBool CAknFepManager::IsTextExceedLeghthEditor( TInt aNewInlineTextLenght )
       
 21052 	{
       
 21053     
       
 21054     // Get the length of the newest text that contains uncommitted texts 
       
 21055 	TInt curPos = iUncommittedText.iAnchorPos + aNewInlineTextLenght;
       
 21056     
       
 21057     // Get the length of the text that is newly increased in uncommitted texts.
       
 21058 	TInt deltaCur = curPos - iUncommittedText.iCursorPos;
       
 21059 	
       
 21060     // Get the max length of the editor
       
 21061 	TInt maxEdSize = iInputCapabilities.FepAwareTextEditor()->DocumentMaximumLengthForFep();
       
 21062 
       
 21063     // Get the length of current the texts in the editor. The texts contain committed and uncomitted.    
       
 21064 	TInt docLength = iInputCapabilities.FepAwareTextEditor()->DocumentLengthForFep();
       
 21065 	
       
 21066       // DeltaCur is greater than zero.
       
 21067       if((maxEdSize > 0) && ( deltaCur > 0 ) 
       
 21068 							&& (( docLength + deltaCur) > maxEdSize ) )
       
 21069          {
       
 21070          return ETrue;
       
 21071          }
       
 21072       // DeltaCur is negative. For example uncommitted texts contain candidate words.
       
 21073       else if ( (maxEdSize > 0) && (curPos > maxEdSize) )
       
 21074           {
       
 21075           return ETrue;
       
 21076           }
       
 21077         else
       
 21078           {
       
 21079 
       
 21080           // Not exceeding the max length of editor
       
 21081           return EFalse;
       
 21082           }
       
 21083 	}
       
 21084 
 20981 
 21085 
 20982 TBool CAknFepManager::IsExactWordPopUpShown()
 21086 TBool CAknFepManager::IsExactWordPopUpShown()
 20983 	{
 21087 	{
 20984 #ifdef RD_SCALABLE_UI_V2 
 21088 #ifdef RD_SCALABLE_UI_V2 
 20985 	return iExactWordPopupContent->IsPopUpVisible()
 21089 	return iExactWordPopupContent->IsPopUpVisible()
 21245 // CAknFepManager::HandleFnKeyPressMonitor
 21349 // CAknFepManager::HandleFnKeyPressMonitor
 21246 // Handle fnkey press monitor callback
 21350 // Handle fnkey press monitor callback
 21247 // ---------------------------------------------------------------------------
 21351 // ---------------------------------------------------------------------------
 21248 //
 21352 //
 21249 void CAknFepManager::HandleFnKeyPressMonitor()
 21353 void CAknFepManager::HandleFnKeyPressMonitor()
 21250 	{
 21354 	{	
 21251 	DeactivateFnkeyPressMonitor();
 21355 	 DeactivateFnkeyPressMonitor();
 21252 	
 21356 	 if (IsExtendedFlagSet ( EExtendedFlagFnKeyNeedLockMode ) )
 21253 	//if previous state of fn key is EFnKeyNone or EFnKeyNext, EFnKeyLock will be set;
 21357 		 {
 21254 	//otherwise, if previous state is EFnKeyLock, EFnKeyNone will be set.
 21358 	      iFnKeyManager->SetFnKeyState(CAknFepFnKeyManager::EFnKeyLock);
 21255 	switch(iFnKeyManager->FnKeyState())
 21359 		 }
 21256 		{
       
 21257 		case CAknFepFnKeyManager::EFnKeyPressed:
       
 21258 		case CAknFepFnKeyManager::EFnKeyPressedAgain:
       
 21259 			 iFnKeyManager->SetFnKeyState(CAknFepFnKeyManager::EFnKeyLock);
       
 21260 			break;
       
 21261 		case CAknFepFnKeyManager::EFnKeyDown:
       
 21262 			 iFnKeyManager->SetFnKeyState(CAknFepFnKeyManager::EFnKeyNone);
       
 21263 			 break;
       
 21264 		default:
       
 21265 			break;
       
 21266 		}
       
 21267 	}
 21360 	}
 21268 
 21361 
 21269 // ---------------------------------------------------------------------------
 21362 // ---------------------------------------------------------------------------
 21270 // CAknFepManager::ActivateFnkeyPressMonitor
 21363 // CAknFepManager::ActivateFnkeyPressMonitor
 21271 // Activate Fnkey press Monitor
 21364 // Activate Fnkey press Monitor
 21272 // ---------------------------------------------------------------------------
 21365 // ---------------------------------------------------------------------------
 21273 //
 21366 //
 21274 void CAknFepManager::ActivateFnkeyPressMonitor()
 21367 void CAknFepManager::ActivateFnkeyPressMonitor()
 21275 	{
 21368 	{
 21276 	 if( iFnKeypressMonitor )
 21369 	 if( iFnKeypressMonitor )
 21277 		 {
 21370 		 {	      
       
 21371 	      if ( iFnKeypressMonitor->IsActive() )
       
 21372 	    	  {
       
 21373 	           iFnKeypressMonitor->Cancel();
       
 21374 	    	  }
       
 21375 	      
 21278 		  iFnKeypressMonitor->Start(KFnKeyLongPressTimeout, KFnKeyLongPressTimeout, 
 21376 		  iFnKeypressMonitor->Start(KFnKeyLongPressTimeout, KFnKeyLongPressTimeout, 
 21279 							   TCallBack(HandleFnKeyPressMonitorCallback, this));
 21377 							   TCallBack(HandleFnKeyPressMonitorCallback, this));
 21280 		 }
 21378 		 }
 21281 	}
 21379 	}
 21282 
 21380