fep/aknfep/src/AknFepPluginManager.cpp
branchRCL_3
changeset 10 6defe5d1bd39
parent 8 6ceef9a83b1a
child 12 4eb1ae11334f
equal deleted inserted replaced
8:6ceef9a83b1a 10:6defe5d1bd39
   103 _LIT(KVITU_HLP_MAIN_VIEW, "VITU_HLP_MAIN_VIEW");
   103 _LIT(KVITU_HLP_MAIN_VIEW, "VITU_HLP_MAIN_VIEW");
   104 
   104 
   105 const TInt KDefaultCandidateArraySize = 16;
   105 const TInt KDefaultCandidateArraySize = 16;
   106 const TInt KNumberOfCases = 6;
   106 const TInt KNumberOfCases = 6;
   107 
   107 
       
   108 const TInt KChineseSpellMode = 100;
       
   109 const TInt KWesternSpellMode = 101;
   108  _LIT_SECURE_ID(KPhoneSecureId, 0x100058b3);
   110  _LIT_SECURE_ID(KPhoneSecureId, 0x100058b3);
   109 
   111 
   110 #define iAvkonAppUi ((CAknAppUi*)CEikonEnv::Static()->EikAppUi())
   112 #define iAvkonAppUi ((CAknAppUi*)CEikonEnv::Static()->EikAppUi())
   111 TUid AppUidFromWndGroupIdL(TInt aWndGrpId)
   113 TUid AppUidFromWndGroupIdL(TInt aWndGrpId)
   112     {
   114     {
   251     iLastDataQueryWin = NULL;
   253     iLastDataQueryWin = NULL;
   252     iDefaultOrientation = -1;
   254     iDefaultOrientation = -1;
   253     iIsInEditWordQueryDlg = EFalse;    
   255     iIsInEditWordQueryDlg = EFalse;    
   254     iClosePluginInputMode = EFalse;
   256     iClosePluginInputMode = EFalse;
   255     iDimGainForeground = ETrue;
   257     iDimGainForeground = ETrue;
   256 	// Modify for bug ELZG-7WZC35 begin
       
   257     iAlignment = 0;
   258     iAlignment = 0;
   258     // Modify for bug ELZG-7WZC35 end
       
   259     }
   259     }
   260 
   260 
   261 // ---------------------------------------------------------------------------
   261 // ---------------------------------------------------------------------------
   262 // CAknFepPluginManager::ConstructL
   262 // CAknFepPluginManager::ConstructL
   263 // (other items were commented in a header)
   263 // (other items were commented in a header)
   415                                     }
   415                                     }
   416                                 else
   416                                 else
   417                                     {
   417                                     {
   418                                     curSor.iAnchorPos = iCharStartPostion;  
   418                                     curSor.iAnchorPos = iCharStartPostion;  
   419                                     iLastSubmitCount = curSor.iCursorPos - iCharStartPostion;
   419                                     iLastSubmitCount = curSor.iCursorPos - iCharStartPostion;
   420                                     //Fixed bug ID SAHN-7JDDC8
       
   421                                     }
   420                                     }
   422                                 }
   421                                 }
   423                             
   422                             
   424                             if (curSor.iAnchorPos<0 || 
   423                             if (curSor.iAnchorPos<0 || 
   425                                 curSor.iAnchorPos>edit->DocumentLengthForFep())
   424                                 curSor.iAnchorPos>edit->DocumentLengthForFep())
   959             TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;
   958             TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;
   960             if(iSharedData.AutoRotateEnabled())
   959             if(iSharedData.AutoRotateEnabled())
   961                 {
   960                 {
   962                 if(landscape)
   961                 if(landscape)
   963                     {
   962                     {
   964                     defaultMode = EPluginInputModeVkb;
   963                     defaultMode = EPluginInputModeFSQ;
   965                     }
   964                     }
   966                 else
   965                 else
   967                     {
   966                     {
   968                     defaultMode = EPluginInputModeItut;
   967                     defaultMode = EPluginInputModeItut;
   969                     }
   968                     }
   970                 }
   969                 }
   971             else
   970             else
   972                 {
   971                 {
   973                 defaultMode = EPluginInputModeItut;
   972                 if(landscape)
       
   973                     {
       
   974                     defaultMode = EPluginInputModeFSQ;
       
   975                     }
       
   976                 else
       
   977                     {
       
   978                     defaultMode = EPluginInputModeItut;
       
   979                     }
   974                 }
   980                 }
   975             TryChangePluginInputModeByModeL(defaultMode,
   981             TryChangePluginInputModeByModeL(defaultMode,
   976                                             EPenInputOpenManually,
   982                                             EPenInputOpenManually,
   977                                             ERangeInvalid);
   983                                             ERangeInvalid);
   978             }
   984             }
   979             break;
   985             break;
       
   986         case EPluginUpdatePenInputITIStatus:
       
   987         	{
       
   988         	if ( iCurrentPluginInputFepUI )
       
   989         		{
       
   990                 iCurrentPluginInputFepUI->HandleCommandL( ECmdPeninputITIStatus,
       
   991                                               iFepMan.WesternPredictive() );        	
       
   992         		}
       
   993         	}
       
   994         	break;
   980         default:
   995         default:
   981             break;
   996             break;
   982         }
   997         }
   983     }
   998     }
   984             
   999             
  1088                 iAvkonAppUi->SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape );
  1103                 iAvkonAppUi->SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape );
  1089                 iFepMan.SetNotifyPlugin( ETrue );
  1104                 iFepMan.SetNotifyPlugin( ETrue );
  1090                 iOrientationChanged = ETrue;
  1105                 iOrientationChanged = ETrue;
  1091                 }
  1106                 }
  1092         
  1107         
  1093 		    CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
  1108 		    /*CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
  1094             landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;  
  1109               landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;  
  1095             if( !landscape )
  1110               if( !landscape )
  1096                 {
  1111                   {
  1097                 iPluginInputMode = tempInputMode;
  1112                   iPluginInputMode = tempInputMode;
  1098                 aSuggestMode = EPluginInputModeItut;
  1113                   aSuggestMode = EPluginInputModeItut;
  1099                 }
  1114                   }*/
       
  1115             //
       
  1116             
  1100             }
  1117             }
  1101         }
  1118         }
  1102     else if(aSuggestMode == EPluginInputModeFingerHwr 
  1119     else if(aSuggestMode == EPluginInputModeFingerHwr 
  1103             && iSharedData.InputTextLanguage() == ELangArabic
  1120             && iSharedData.InputTextLanguage() == ELangArabic
  1104             && !iSharedData.AutoRotateEnabled())
  1121             && !iSharedData.AutoRotateEnabled())
  1147                                                     &iPenInputServer); 
  1164                                                     &iPenInputServer); 
  1148     iCurrentPluginInputFepUI = fepUI;
  1165     iCurrentPluginInputFepUI = fepUI;
  1149     
  1166     
  1150     if ( iCurrentPluginInputFepUI )     
  1167     if ( iCurrentPluginInputFepUI )     
  1151         {
  1168         {
  1152         // fix EVWG-7U73HS
       
  1153         iPenInputServer.DimUiLayout(EFalse);
  1169         iPenInputServer.DimUiLayout(EFalse);
  1154         
  1170         
  1155         AddCurrentWinToOpenListL();
  1171         AddCurrentWinToOpenListL();
  1156         if (iPluginInputMode == EPluginInputModeItut)
  1172         if (iPluginInputMode == EPluginInputModeItut)
  1157             {
  1173             {
  1263     
  1279     
  1264     if( aRestore && !iSharedData.QwertyInputMode() && iFepMan.InputMode() == ELatin)
  1280     if( aRestore && !iSharedData.QwertyInputMode() && iFepMan.InputMode() == ELatin)
  1265         {
  1281         {
  1266 	    RestorePredictStateL();
  1282 	    RestorePredictStateL();
  1267         
  1283         
  1268         // Fix bug EAHN-82C9M7, comment out the following code
  1284         //  comment out the following code
  1269         //if ( iFepMan.EditorType() == CAknExtendedInputCapabilities::EPhoneNumberEditor )
  1285         //if ( iFepMan.EditorType() == CAknExtendedInputCapabilities::EPhoneNumberEditor )
  1270         //    {
  1286         //    {
  1271         //    if( AknTextUtils::NumericEditorDigitType() == EDigitTypeEasternArabicIndic || 
  1287         //    if( AknTextUtils::NumericEditorDigitType() == EDigitTypeEasternArabicIndic || 
  1272         //        AknTextUtils::NumericEditorDigitType() == EDigitTypeDevanagari ||
  1288         //        AknTextUtils::NumericEditorDigitType() == EDigitTypeDevanagari ||
  1273         //        AknTextUtils::NumericEditorDigitType() == EDigitTypeArabicIndic )
  1289         //        AknTextUtils::NumericEditorDigitType() == EDigitTypeArabicIndic )
  1278         //        {
  1294         //        {
  1279         //        iFepMan.TryChangeModeL( ENumber );
  1295         //        iFepMan.TryChangeModeL( ENumber );
  1280         //        }
  1296         //        }
  1281         //    }
  1297         //    }
  1282         }
  1298         }
  1283     //iFepMan.UpdateCbaL( NULL ); //pls refer to bug ESZG-7G7CGF
  1299     //iFepMan.UpdateCbaL( NULL ); 
  1284                 
  1300                 
  1285     iFepMan.UiInterface()->TouchPaneSetInputMethodIconActivated(EFalse);
  1301     iFepMan.UiInterface()->TouchPaneSetInputMethodIconActivated(EFalse);
  1286     
  1302     
  1287 	if ( iFepMan.EditorState() )
  1303 	if ( iFepMan.EditorState() )
  1288 	{
  1304 	{
  1322             if( aResetState )
  1338             if( aResetState )
  1323                 {
  1339                 {
  1324                 iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputWindowClose);
  1340                 iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputWindowClose);
  1325                 }
  1341                 }
  1326             
  1342             
  1327             //iFepMan.UpdateCbaL(NULL); //pls refer to bug ESZG-7G7CGF
  1343             //iFepMan.UpdateCbaL(NULL); 
  1328             
  1344             
  1329             if (iPluginInputMode == EPluginInputModeItut)
  1345             if (iPluginInputMode == EPluginInputModeItut)
  1330                 {
  1346                 {
  1331                 iIndicatorImgID = 0;
  1347                 iIndicatorImgID = 0;
  1332                 iIndicatorTextID = 0;           
  1348                 iIndicatorTextID = 0;           
  1336 
  1352 
  1337     if ( (iPluginInputMode == EPluginInputModeFSQ || (iPluginInputMode == EPluginInputModeFingerHwr 
  1353     if ( (iPluginInputMode == EPluginInputModeFSQ || (iPluginInputMode == EPluginInputModeFingerHwr 
  1338 	     && iSharedData.InputTextLanguage() == ELangArabic)) && iOrientationChanged 
  1354 	     && iSharedData.InputTextLanguage() == ELangArabic)) && iOrientationChanged 
  1339     	                                            && !iITISettingDialogOpen )
  1355     	                                            && !iITISettingDialogOpen )
  1340         {
  1356         {
  1341 		// This TRAP_IGNORE is essential to fix bug ECJA-7JDCKR, never delete it
  1357 		// This TRAP_IGNORE is essential , never delete it
  1342         TRAP_IGNORE( iAvkonAppUi->SetOrientationL( (CAknAppUiBase::TAppUiOrientation)iDefaultOrientation ) );
  1358         TRAP_IGNORE( iAvkonAppUi->SetOrientationL( (CAknAppUiBase::TAppUiOrientation)iDefaultOrientation ) );
  1343         iOrientationChanged = EFalse;
  1359         iOrientationChanged = EFalse;
  1344         } 
  1360         } 
  1345         
  1361         
  1346     // Notify editor the touch window has been closed
  1362     // Notify editor the touch window has been closed
  1724             break;
  1740             break;
  1725         case EKeyEscape:
  1741         case EKeyEscape:
  1726             {
  1742             {
  1727 			ClosePluginInputUiL( ETrue );			
  1743 			ClosePluginInputUiL( ETrue );			
  1728 			iFepMan.SetNotifyPlugin( EFalse );
  1744 			iFepMan.SetNotifyPlugin( EFalse );
  1729             DestroySpellEditor();
  1745             HideSpellEditor();
  1730             }
  1746             }
  1731             break;
  1747             break;
  1732        }
  1748        }
  1733     }
  1749     }
  1734     
  1750     
  2053         if( iInMenu && iCurEditor == iFepMan.FepAwareTextEditor() )
  2069         if( iInMenu && iCurEditor == iFepMan.FepAwareTextEditor() )
  2054             {
  2070             {
  2055             ResetMenuState();
  2071             ResetMenuState();
  2056             InformMfneUiStatusL( EFalse );
  2072             InformMfneUiStatusL( EFalse );
  2057 			// If need to open setting app automatically, 
  2073 			// If need to open setting app automatically, 
  2058 			// do not open Touch window again. Fix for ESCN-7NVAWF
  2074 			// do not open Touch window again. 
  2059 			TBool langChange = iCurLanguage != iSharedData.InputTextLanguage();
  2075 			TBool langChange = iCurLanguage != iSharedData.InputTextLanguage();
  2060 					
  2076 					
  2061 			TryChangePluginInputModeByModeL(
  2077 			TryChangePluginInputModeByModeL(
  2062 							(TPluginInputMode)iSharedData.PluginInputMode(),
  2078 							(TPluginInputMode)iSharedData.PluginInputMode(),
  2063 				langChange?EPenInputOpenManually:EPenInputOpenAutomatically,
  2079 				langChange?EPenInputOpenManually:EPenInputOpenAutomatically,
  2492         return EFalse;
  2508         return EFalse;
  2493         }
  2509         }
  2494     return ETrue;
  2510     return ETrue;
  2495 	}
  2511 	}
  2496 	
  2512 	
       
  2513 void CAknFepPluginManager::SetICFTextForSpellL()
       
  2514 	{
       
  2515 	MCoeFepAwareTextEditor* edit = iFepMan.FepAwareTextEditor();
       
  2516 	
       
  2517 	if ( edit )
       
  2518 		{
       
  2519 		TInt length = edit->DocumentLengthForFep();
       
  2520 		HBufC* icfTextBuf = HBufC::NewLC( length );
       
  2521     	TPtr icfText = icfTextBuf->Des();
       
  2522 
       
  2523 		edit->GetEditorContentForFep( icfText, 0, length );
       
  2524 		
       
  2525 		TCursorSelection curSel;
       
  2526 		edit->GetCursorSelectionForFep( curSel );
       
  2527 		TInt curPos = curSel.iCursorPos;
       
  2528 		
       
  2529 		HBufC* titleStr = StringLoader::LoadL(R_AKNFEP_PROMPT_TEXT);                          
       
  2530 		CleanupStack::PushL( titleStr );
       
  2531 		TPtr16 promptText = titleStr->Des();
       
  2532 		
       
  2533 		TFepSpellICFDisplayContent displayContent;
       
  2534 		displayContent.iCurPos = curPos;
       
  2535 		displayContent.iICFText.Set( icfText );
       
  2536 		displayContent.iPromptText.Set( promptText );
       
  2537 		
       
  2538 		iCurrentPluginInputFepUI->HandleCommandL( 
       
  2539         	ECmdPeninputSpellICFDisplayContent,
       
  2540             reinterpret_cast<TInt>(&displayContent));
       
  2541         
       
  2542         CleanupStack::PopAndDestroy( titleStr );
       
  2543 		CleanupStack::PopAndDestroy( icfTextBuf );
       
  2544 		}
       
  2545 	}
  2497 TBool CAknFepPluginManager::SetSyncCurSelIcfDataL( TFepInputContextFieldData& aIcfData )
  2546 TBool CAknFepPluginManager::SetSyncCurSelIcfDataL( TFepInputContextFieldData& aIcfData )
  2498 	{
  2547 	{
  2499 	MCoeFepAwareTextEditor* edit = iFepMan.FepAwareTextEditor();
  2548 	MCoeFepAwareTextEditor* edit = iFepMan.FepAwareTextEditor();
  2500 	if ( ExistInlineText() ) // inline
  2549 	if ( ExistInlineText() ) // inline
  2501         {
  2550         {
  3162                     CCoeEnv::Static()->WsSession().SimulateRawEvent( eventDown ); 
  3211                     CCoeEnv::Static()->WsSession().SimulateRawEvent( eventDown ); 
  3163                     
  3212                     
  3164                     TRawEvent eventUp; 
  3213                     TRawEvent eventUp; 
  3165                     eventUp.Set( TRawEvent::EKeyUp, EStdKeyBackspace); 
  3214                     eventUp.Set( TRawEvent::EKeyUp, EStdKeyBackspace); 
  3166                     eventUp.SetTip( ETrue );
  3215                     eventUp.SetTip( ETrue );
  3167                     CCoeEnv::Static()->WsSession().SimulateRawEvent( eventUp ); 
  3216                     CCoeEnv::Static()->WsSession().SimulateRawEvent( eventUp );
       
  3217                     
       
  3218                     break;
  3168                     }
  3219                     }
  3169                 else if ( keyEvent.iScanCode == EStdKeyEnter && iHasSWEventCap )
  3220                 else if ( keyEvent.iScanCode == EStdKeyEnter && iHasSWEventCap )
  3170                     {
  3221                     {
  3171                     TRawEvent eventDown; 
  3222                     TRawEvent eventDown; 
  3172                     eventDown.Set( TRawEvent::EKeyDown, EStdKeyEnter ); 
  3223                     eventDown.Set( TRawEvent::EKeyDown, EStdKeyEnter ); 
  3179                     }
  3230                     }
  3180                 else if ( EnableITIOnFSQ() )
  3231                 else if ( EnableITIOnFSQ() )
  3181                     {
  3232                     {
  3182                     // For addition of ITI features on FSQ.
  3233                     // For addition of ITI features on FSQ.
  3183                     // If FSQ is opened with ITI enabled, ensure keycatcher to handle key events
  3234                     // If FSQ is opened with ITI enabled, ensure keycatcher to handle key events
  3184                     // else, remain the old logic.                   
  3235                     // else, remain the old logic.
       
  3236                     // But, simulating raw key events is needed, as raw key down + raw key up is a complete key process, 
       
  3237                     // then EEventDown, EEventKey, EEventUp will be generated, each event may be used differently.
  3185                     if ( IsITISupportedKey( keyEvent ) )
  3238                     if ( IsITISupportedKey( keyEvent ) )
  3186                         {                            
  3239                         {                            
  3187                         // check if need to change current text case
  3240                         // check if need to change current text case
  3188                         TPtiTextCase textCase = 
  3241                         TPtiTextCase textCase = 
  3189                         CaseForMappedCharacter( TChar( keyEvent.iCode ) );                                                        
  3242                         CaseForMappedCharacter( TChar( keyEvent.iCode ) );                                                        
  3190 						if ( !IsDeadKeyCode( keyEvent.iCode ) && IsNeedToChangeTextCase( textCase ) )
  3243 						if ( !IsDeadKeyCode( keyEvent.iCode ) && IsNeedToChangeTextCase( textCase ) )
  3191                             {
  3244                             {
  3192                             iFepMan.PtiEngine()->SetCase( textCase );
  3245                             iFepMan.PtiEngine()->SetCase( textCase );
  3193                             }                        
  3246                             }                        
  3194                         env->SimulateKeyEventL(keyEvent, EEventKey);
  3247                         TRawEvent eventDown; 
  3195                         }
  3248                         eventDown.Set( TRawEvent::EKeyDown, keyEvent.iScanCode ); 
  3196                     else if ( keyEvent.iScanCode == EStdKeyBackspace 
  3249                         iAvkonAppUi->DisableNextKeySound( keyEvent.iScanCode ); 
  3197                               || keyEvent.iScanCode == EStdKeyEnter
  3250                         CCoeEnv::Static()->WsSession().SimulateRawEvent( eventDown ); 
  3198                               || keyEvent.iScanCode == EStdKeySpace )
  3251                         
  3199                         {
  3252                         TRawEvent eventUp; 
  3200                         // For these keys, clear the flag to make sure ptiengine handle this key.                            
  3253                         eventUp.Set( TRawEvent::EKeyUp, keyEvent.iScanCode ); 
  3201                         env->SimulateKeyEventL(keyEvent, EEventKey);
  3254                         CCoeEnv::Static()->WsSession().SimulateRawEvent( eventUp );                        
  3202                         }
  3255                         }
  3203                     else
  3256                     else
  3204                         {
  3257                         {
  3205                         // When FSQ opened with ITI features enabled, 
  3258                         // When FSQ opened with ITI features enabled, 
  3206                         // but key is not supported by ITI
  3259                         // but key is not supported by ITI
  3517 				}
  3570 				}
  3518 			}
  3571 			}
  3519 			break;
  3572 			break;
  3520         case EPluginInputModeVkb:
  3573         case EPluginInputModeVkb:
  3521             {
  3574             {
       
  3575             // When in Capacitive hardware, there should be no MiniVKB.
       
  3576             // So we use FSQ for Landscape mode and ITUT for Portrait instead.
       
  3577             if( FeatureManager::FeatureSupported( KFeatureIdFfCapacitiveDisplay ))
       
  3578                 {
       
  3579                 TPixelsTwipsAndRotation size; 
       
  3580                 CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
       
  3581                 TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;
       
  3582                 if ( landscape ) // LandScape
       
  3583                     {
       
  3584                     aSuggestMode = EPluginInputModeFSQ;
       
  3585                     }
       
  3586                 else // Portrait
       
  3587                     {
       
  3588                     aSuggestMode = EPluginInputModeItut;
       
  3589                     }
       
  3590                 }
  3522             }
  3591             }
  3523             break;
  3592             break;
  3524         case EPluginInputModeFSQ:
  3593         case EPluginInputModeFSQ:
  3525             {
  3594             {
  3526             if ((disableLayouts & aSuggestMode))
  3595             if ((disableLayouts & aSuggestMode))
  3717             }    
  3786             }    
  3718         UpdateITUTIndicator();       
  3787         UpdateITUTIndicator();       
  3719         }
  3788         }
  3720     else
  3789     else
  3721         {
  3790         {
  3722         DestroySpellEditor();
  3791         HideSpellEditor();
  3723         if (PluginInputMode() == EPluginInputModeFSQ ||
  3792         if (PluginInputMode() == EPluginInputModeFSQ ||
  3724             PluginInputMode() == EPluginInputModeVkb ||
  3793             PluginInputMode() == EPluginInputModeVkb ||
  3725             PluginInputMode() == EPluginInputModeFingerHwr)
  3794             PluginInputMode() == EPluginInputModeFingerHwr)
  3726             {
  3795             {
  3727             iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputCharacterPreview, 
  3796             iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputCharacterPreview, 
  3928             TChar minusSign ='-'; 
  3997             TChar minusSign ='-'; 
  3929 
  3998 
  3930             keymapRes->Des().Append(decimalSep);
  3999             keymapRes->Des().Append(decimalSep);
  3931             keymapRes->Des().Append(minusSign);
  4000             keymapRes->Des().Append(minusSign);
  3932 
  4001 
  3933             if( keymapRes )
  4002             CleanupStack::PushL(keymapRes);
  3934                 {
  4003             iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputEditorCustomNumericKeyMap,
  3935                 CleanupStack::PushL(keymapRes);
       
  3936                 iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputEditorCustomNumericKeyMap,
       
  3937                                                     reinterpret_cast<TInt>(keymapRes) );
  4004                                                     reinterpret_cast<TInt>(keymapRes) );
  3938                 CleanupStack::PopAndDestroy(keymapRes);
  4005             CleanupStack::PopAndDestroy(keymapRes);
  3939                 return;
  4006             return;
  3940                 }
       
  3941             }
  4007             }
  3942 
  4008 
  3943         iCurrentPluginInputFepUI->SetNumberModeKeyMappingL(EAknEditorPlainNumberModeKeymap);
  4009         iCurrentPluginInputFepUI->SetNumberModeKeyMappingL(EAknEditorPlainNumberModeKeymap);
  3944         }
  4010         }
  3945     }    
  4011     }    
  4425 
  4491 
  4426 void CAknFepPluginManager::SetITUTSpellingStateL(TBool aState)
  4492 void CAknFepPluginManager::SetITUTSpellingStateL(TBool aState)
  4427     {
  4493     {
  4428     if (aState)
  4494     if (aState)
  4429         {
  4495         {
       
  4496 		SetICFTextForSpellL();
  4430         iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputFingerSpelling, 1);
  4497         iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputFingerSpelling, 1);
  4431 
  4498 
  4432         HBufC* titleStr = StringLoader::LoadL(R_AKNFEP_PROMPT_TEXT);                          
  4499         HBufC* titleStr = StringLoader::LoadL(R_AKNFEP_PROMPT_TEXT);                          
  4433         CleanupStack::PushL(titleStr);
  4500         CleanupStack::PushL(titleStr);
  4434 
  4501 
  4467     }
  4534     }
  4468 void CAknFepPluginManager::DisplaySpellEditorL(const TInt aEditorFlag, 
  4535 void CAknFepPluginManager::DisplaySpellEditorL(const TInt aEditorFlag, 
  4469                                               const TDesC& aInitText, 
  4536                                               const TDesC& aInitText, 
  4470                                               TCursorSelection aCurSel)
  4537                                               TCursorSelection aCurSel)
  4471     {
  4538     {
       
  4539 	TInt inputLang = iFepMan.InputLanguageCapabilities().iInputLanguageCode;
       
  4540 	if ( inputLang == ELangPrcChinese || inputLang == ELangHongKongChinese ||
       
  4541 		 inputLang == ELangTaiwanChinese )
       
  4542 		{
       
  4543 	    iCurrentPluginInputFepUI->HandleCommandL( 
       
  4544 	    		ECmdPeninputSpellLanguageMode, KChineseSpellMode );
       
  4545 		}
       
  4546 	else
       
  4547 		{
       
  4548 		iCurrentPluginInputFepUI->HandleCommandL( 
       
  4549 				ECmdPeninputSpellLanguageMode, KWesternSpellMode );
       
  4550 		}
  4472     TInt editorFlag = 0;
  4551     TInt editorFlag = 0;
  4473     TInt editorCase = 0;
  4552     TInt editorCase = 0;
  4474     TInt editorSCTResId = 0;
  4553     TInt editorSCTResId = 0;
  4475     
  4554     
  4476     if (aEditorFlag)
  4555     if (aEditorFlag)
  4502     else if (!editorSCTResId)
  4581     else if (!editorSCTResId)
  4503         {
  4582         {
  4504         editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG;
  4583         editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG;
  4505         }
  4584         }
  4506  
  4585  
  4507     delete iSpell;
       
  4508     iSpell = NULL;
       
  4509     iSpellCba = ESpellCBACancelEmpty;
  4586     iSpellCba = ESpellCBACancelEmpty;
  4510     iSpellOn = ETrue;
  4587     iSpellOn = ETrue;
  4511     iSpell = CAknFepUiSpellContainer::NewL(editorFlag, editorCase, editorSCTResId, IsEditorSupportSplitIme());
  4588    if( !iSpell )
       
  4589     	{
       
  4590         iSpell = CAknFepUiSpellContainer::NewL(editorFlag, editorCase, editorSCTResId, IsEditorSupportSplitIme());
       
  4591     	}
       
  4592     else
       
  4593     	{
       
  4594         iSpell->MakeVisible( ETrue );
       
  4595         iSpell->SetInputWinFocus( ETrue );
       
  4596     	}
  4512    
  4597    
  4513     iSpell->SetInputWinObserver(this);
  4598     iSpell->SetInputWinObserver(this);
  4514    
  4599    
  4515     iSpell->InputPane()->SetInputWinTextL(&aInitText);
  4600     iSpell->InputPane()->SetInputWinTextL(&aInitText);
  4516     iSpell->InputPane()->InputWin()->SetSelectionL(aCurSel.iCursorPos, aCurSel.iAnchorPos);
  4601     iSpell->InputPane()->InputWin()->SetSelectionL(aCurSel.iCursorPos, aCurSel.iAnchorPos);
  4517     AddWinToOpenListL( iSpell->DrawableWindow() );
  4602     AddWinToOpenListL( iSpell->DrawableWindow() );
  4518     }    
  4603     }    
  4519 
  4604 
  4520 void CAknFepPluginManager:: DestroySpellEditor()
  4605 void CAknFepPluginManager::HideSpellEditor()
  4521     {
  4606     {
  4522     iSpellOn = EFalse;
  4607     iSpellOn = EFalse;
  4523     iSpellCba = ESpellCBANone;
  4608     iSpellCba = ESpellCBANone;
  4524     delete iSpell;
  4609     // Hide spell container instead to delete spell container to avoid flicker
  4525     iSpell = NULL;
  4610     if( iSpell )
       
  4611     	{
       
  4612         iSpell->SetInputWinObserver( NULL );
       
  4613         iSpell->SetInputWinFocus( EFalse );
       
  4614         iSpell->MakeVisible( EFalse );
       
  4615     	}
  4526     }
  4616     }
  4527 
  4617 
  4528 HBufC*  CAknFepPluginManager::SpellTextInput()
  4618 HBufC*  CAknFepPluginManager::SpellTextInput()
  4529     {
  4619     {
  4530     HBufC* textInput = NULL;
  4620     HBufC* textInput = NULL;
  4635                                                          reinterpret_cast<TInt>(&promptText)));        
  4725                                                          reinterpret_cast<TInt>(&promptText)));        
  4636     }
  4726     }
  4637 
  4727 
  4638 void CAknFepPluginManager::SetIcfAlignment()
  4728 void CAknFepPluginManager::SetIcfAlignment()
  4639     {
  4729     {
  4640 	// Modify for bug ELZG-7WZC35 begin
  4730     // spell editor is not really background editor.
  4641     // fix TINA-7HNEKA, spell editor is not really background editor.
       
  4642     //if ( iSpellOn )
  4731     //if ( iSpellOn )
  4643     //    {
  4732     //    {
  4644     //    return;
  4733     //    return;
  4645     //    }
  4734     //    }
  4646 	// Modify for bug ELZG-7WZC35 end
       
  4647     
  4735     
  4648     TUint cap = iFepMan.ExtendedInputCapabilities();
  4736     TUint cap = iFepMan.ExtendedInputCapabilities();
  4649 
  4737 
  4650     TInt alignment = EAknEditorAlignNone;
  4738     TInt alignment = EAknEditorAlignNone;
  4651 
  4739 
  4663         }
  4751         }
  4664     else if (cap & CAknExtendedInputCapabilities::EInputEditorAlignLeft)
  4752     else if (cap & CAknExtendedInputCapabilities::EInputEditorAlignLeft)
  4665         {
  4753         {
  4666         alignment = EAknEditorAlignLeft;
  4754         alignment = EAknEditorAlignLeft;
  4667         }
  4755         }
  4668 	// Modify for bug ELZG-7WZC35 begin
       
  4669     else
  4756     else
  4670         {
  4757         {
  4671         alignment = iAlignment;
  4758         alignment = iAlignment;
  4672         }
  4759         }
  4673     // Modify for bug ELZG-7WZC35 end
       
  4674 		
  4760 		
  4675     TRAP_IGNORE(iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputSetTextAlignment,
  4761     TRAP_IGNORE(iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputSetTextAlignment,
  4676                                                          alignment));
  4762                                                          alignment));
  4677 														 
  4763 														 
  4678 	// Modify for bug ELZG-7WZC35 begin
       
  4679     iAlignment = alignment;
  4764     iAlignment = alignment;
  4680     // Modify for bug ELZG-7WZC35 end
       
  4681     }
  4765     }
  4682     
  4766     
  4683 void CAknFepPluginManager::HasNoFreeSpace()
  4767 void CAknFepPluginManager::HasNoFreeSpace()
  4684 	{
  4768 	{
  4685     if ( iCurrentPluginInputFepUI &&
  4769     if ( iCurrentPluginInputFepUI &&
  4816                 aData.LowerCase();
  4900                 aData.LowerCase();
  4817                 return;
  4901                 return;
  4818                 }
  4902                 }
  4819             for( TInt i = 0; i<aData.Length(); i++ )
  4903             for( TInt i = 0; i<aData.Length(); i++ )
  4820 	   			{
  4904 	   			{
  4821 	   			if ( aData[i] != 0x03C2 ) //fix CSTI-7THJR2, final sigma exists in capslock mode
  4905 	   			if ( aData[i] != 0x03C2 ) //final sigma exists in capslock mode
  4822 	   				{
  4906 	   				{
  4823 	   				aData.UpperCase();
  4907 	   				aData.UpperCase();
  4824 	   				}
  4908 	   				}
  4825     			}
  4909     			}
  4826     		}
  4910     		}
  5382         iFepMan.PtiEngine()->SetInputMode( EPtiEngineQwertyPredictive );
  5466         iFepMan.PtiEngine()->SetInputMode( EPtiEngineQwertyPredictive );
  5383         // Find scancode by keycode from qwerty keymapping
  5467         // Find scancode by keycode from qwerty keymapping
  5384         TInt retKey = keymapping->KeyForCharacter( aKeyCode );
  5468         TInt retKey = keymapping->KeyForCharacter( aKeyCode );
  5385         // Restore the old input mode
  5469         // Restore the old input mode
  5386         iFepMan.PtiEngine()->SetInputMode( oldInputMode );
  5470         iFepMan.PtiEngine()->SetInputMode( oldInputMode );
       
  5471         
       
  5472 #if defined(__WINS__)
       
  5473     // In Emulator, Window server will not handle EPtiKeyQwertyPlus key raw event
       
  5474     // as normal, it will not produce EKeyEvent event for EPtiKeyQwertyPlus key.
       
  5475     // And winodw server will handle EStdKeyNkpPlus key raw event as normal.
       
  5476     if (retKey == EPtiKeyQwertyPlus)
       
  5477         {
       
  5478         retKey = EStdKeyNkpPlus;
       
  5479         }
       
  5480 #endif
  5387         return retKey;
  5481         return retKey;
  5388         }
  5482         }
  5389     return EPtiKeyNone;
  5483     return EPtiKeyNone;
  5390 #else
  5484 #else
  5391     return EPtiKeyNone;
  5485     return EPtiKeyNone;
  5397 // --------------------------------------------------------------------------- 
  5491 // --------------------------------------------------------------------------- 
  5398 //  
  5492 //  
  5399 TBool CAknFepPluginManager::IsITISupportedKey( const TKeyEvent& aKeyEvent )
  5493 TBool CAknFepPluginManager::IsITISupportedKey( const TKeyEvent& aKeyEvent )
  5400     {
  5494     {
  5401 // ITI supported conditions
  5495 // ITI supported conditions
  5402 // 1. scan code != EPtiKeyNone
  5496 // 1. Not in keymapping: some function keys, space, enter, backspace
  5403 // 2. Basic alpha characters
  5497 // 2. In keymappings: keys on AB/Native range.
  5404 // 3. 
       
  5405 #ifdef RD_INTELLIGENT_TEXT_INPUT
  5498 #ifdef RD_INTELLIGENT_TEXT_INPUT
  5406     if ( aKeyEvent.iScanCode != EPtiKeyNone 
  5499     if ( aKeyEvent.iScanCode == EStdKeySpace
  5407          && ( iPluginPrimaryRange == ERangeNative 
  5500     	 || aKeyEvent.iScanCode == EStdKeyEnter
  5408               || iPluginPrimaryRange == ERangeEnglish
  5501     	 || aKeyEvent.iScanCode == EStdKeyBackspace
  5409               || ( iPluginPrimaryRange == 0 && iFepMan.InputMode() != ENumber 
  5502     	 || ( aKeyEvent.iScanCode != EPtiKeyNone 
  5410                    && iFepMan.InputMode() != ENativeNumber) ) )
  5503     	      && ( iPluginPrimaryRange == ERangeNative 
       
  5504     	           || iPluginPrimaryRange == ERangeEnglish
       
  5505     	           || ( iPluginPrimaryRange == 0 && iFepMan.InputMode() != ENumber 
       
  5506     	                   && iFepMan.InputMode() != ENativeNumber ) ) ) )
  5411         {
  5507         {
  5412         return ETrue;
  5508         return ETrue;
  5413         }
  5509         }
  5414     return EFalse;
  5510     return EFalse;
  5415 #else
  5511 #else