fep/aknfep/src/AknFepPluginManager.cpp
branchRCL_3
changeset 19 ac7e4d1d9209
parent 18 b1ea1642412e
equal deleted inserted replaced
18:b1ea1642412e 19:ac7e4d1d9209
   286     iHasSWEventCap = client.HasCapability(ECapabilitySwEvent);
   286     iHasSWEventCap = client.HasCapability(ECapabilitySwEvent);
   287     client.Close();
   287     client.Close();
   288     iAvkonRepository = CRepository::NewL( KCRUidAvkon ); 
   288     iAvkonRepository = CRepository::NewL( KCRUidAvkon ); 
   289     
   289     
   290     iConnectAo = new (ELeave)CConnectAo(this);
   290     iConnectAo = new (ELeave)CConnectAo(this);
       
   291     
       
   292     // iPortraitFSQEnabled indicates whether portrait FSQ feature is enabled.
       
   293     iPortraitFSQEnabled = FeatureManager::FeatureSupported( 
       
   294         KFeatureIdFfVirtualFullscrPortraitQwertyInput );
   291     }
   295     }
   292 
   296 
   293 // -----------------------------------------------------------------------------
   297 // -----------------------------------------------------------------------------
   294 // CAknFepPluginManager::ActivatePenInputL
   298 // CAknFepPluginManager::ActivatePenInputL
   295 // Change to default plugin input mode
   299 // Change to default plugin input mode
   487                 }
   491                 }
   488                 break;
   492                 break;
   489             case ESignalKeyEvent:
   493             case ESignalKeyEvent:
   490                 {
   494                 {
   491                 TPtr ptr( const_cast<TUint16*>(pBuf.Ptr()), pBuf.Length(), pBuf.Length() );
   495                 TPtr ptr( const_cast<TUint16*>(pBuf.Ptr()), pBuf.Length(), pBuf.Length() );
   492                 if(iFepMan.InputMode() == ELatin && (iPluginInputMode == EPluginInputModeVkb || 
   496                 
   493                    iPluginInputMode == EPluginInputModeFSQ))
   497                 // If input mode is latin and Vkb or FSQ (landscape or portrait), 
       
   498                 // data case is adjusted.
       
   499                 if( iFepMan.InputMode() == ELatin && 
       
   500                     ( iPluginInputMode == EPluginInputModeVkb || 
       
   501                       iPluginInputMode == EPluginInputModeFSQ || 
       
   502                       iPluginInputMode == EPluginInputModePortraitFSQ ) )
   494                     {
   503                     {
   495                     AdjustDataCase( ptr );
   504                     AdjustDataCase( ptr );
   496                     }
   505                     }
   497                 OnPenInputServerKeyEventL(pBuf);
   506                 OnPenInputServerKeyEventL(pBuf);
   498               	}
   507               	}
   503                 iFepMan.UpdateCbaL(*cbaData);
   512                 iFepMan.UpdateCbaL(*cbaData);
   504                 }
   513                 }
   505                 break;                    
   514                 break;                    
   506             case ESignalHwNotifySctPopup:
   515             case ESignalHwNotifySctPopup:
   507                 iFepMan.LaunchSpecialCharacterTableL( 0,ETrue );//possible?
   516                 iFepMan.LaunchSpecialCharacterTableL( 0,ETrue );//possible?
   508                 break;                      
   517                 break;  
       
   518             case ESignalChangeAmPm:
       
   519                 {
       
   520                 iFepMan.ChangeMfneAmPm();
       
   521                 }
       
   522                 break;
   509             case ESignalSetAppEditorCursor:
   523             case ESignalSetAppEditorCursor:
   510                 {
   524                 {
   511                 TInt8 *ptrData = (TInt8* )(pBuf.Ptr());
   525                 TInt8 *ptrData = (TInt8* )(pBuf.Ptr());
   512                 TCursorSelection curSel = *(TCursorSelection* )(ptrData);
   526                 TCursorSelection curSel = *(TCursorSelection* )(ptrData);
   513                 TBool sync = *(TBool *)(ptrData + sizeof(TCursorSelection));
   527                 TBool sync = *(TBool *)(ptrData + sizeof(TCursorSelection));
   532                 if (iInMenu || (!iPenInputMenu) || iPenInputMenu->IsShowing())
   546                 if (iInMenu || (!iPenInputMenu) || iPenInputMenu->IsShowing())
   533                     {
   547                     {
   534                     break;    
   548                     break;    
   535                     }
   549                     }
   536                 iLaunchMenu = ETrue;
   550                 iLaunchMenu = ETrue;
   537                 if (PluginInputMode() == EPluginInputModeItut ||
   551                 if ( PluginInputMode() == EPluginInputModeItut ||
   538                     PluginInputMode() == EPluginInputModeFSQ ||
   552                      PluginInputMode() == EPluginInputModeFSQ ||
   539                     PluginInputMode() == EPluginInputModeFingerHwr)
   553                      PluginInputMode() == EPluginInputModeFingerHwr ||
       
   554                      PluginInputMode() == EPluginInputModePortraitFSQ )
   540                     {
   555                     {
   541                     SetMenuState();
   556                     SetMenuState();
   542                     }                
   557                     }                
   543                 else
   558                 else
   544                     {
   559                     {
   596                     TInt subrange = *(TInt* )( (TInt8* )(pBuf.Ptr()) + sizeof(TInt) );
   611                     TInt subrange = *(TInt* )( (TInt8* )(pBuf.Ptr()) + sizeof(TInt) );
   597                     iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputJapaneseSetSubRange, 
   612                     iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputJapaneseSetSubRange, 
   598                                                              subrange);
   613                                                              subrange);
   599                     }
   614                     }
   600                 SyncIndicatorWithPluginRangeL();
   615                 SyncIndicatorWithPluginRangeL();
   601                 if ( PluginInputMode() == EPluginInputModeFSQ )
   616                 // If input mode is FSQ, update indicator accordingly.
       
   617                 if ( PluginInputMode() == EPluginInputModeFSQ || 
       
   618                      PluginInputMode() == EPluginInputModePortraitFSQ )
   602                     {
   619                     {
   603 					UpdateFSQIndicator();
   620 					UpdateFSQIndicator();
   604                     }
   621                     }
   605                 }
   622                 }
   606                 break;
   623                 break;
   860     
   877     
   861     return EFalse;    
   878     return EFalse;    
   862     }
   879     }
   863 
   880 
   864 // -----------------------------------------------------------------------------
   881 // -----------------------------------------------------------------------------
       
   882 // CAknFepPluginManager::ClearDestroyedEditorPointer
       
   883 // Set the editor pointer to NULL
       
   884 // (other items were commented in a header).
       
   885 // -----------------------------------------------------------------------------
       
   886 //
       
   887 void CAknFepPluginManager::ClearDestroyedEditorPointer()
       
   888 	{
       
   889 	iEdwin = NULL;
       
   890 	}
       
   891 
       
   892 // -----------------------------------------------------------------------------
       
   893 // CAknFepPluginManager::EdwinState
       
   894 // Get the editor state
       
   895 // (other items were commented in a header).
       
   896 // -----------------------------------------------------------------------------
       
   897 //
       
   898 CAknEdwinState* CAknFepPluginManager::EdwinState()
       
   899 	{
       
   900 	CAknEdwinState* edwinState( NULL );
       
   901 	if ( iEdwin && iEdwin->Extension1())
       
   902 		{
       
   903 	    // Get the editor state
       
   904 		edwinState = static_cast<CAknEdwinState*>( 
       
   905 				iEdwin->Extension1()->State( KNullUid ));
       
   906 		}
       
   907 	
       
   908 	return edwinState;
       
   909 	}
       
   910 
       
   911 // -----------------------------------------------------------------------------
   865 // CAknFepPluginManager::HandleEventsFromFepL
   912 // CAknFepPluginManager::HandleEventsFromFepL
   866 // Handle events from FEP
   913 // Handle events from FEP
   867 // (other items were commented in a header).
   914 // (other items were commented in a header).
   868 // -----------------------------------------------------------------------------
   915 // -----------------------------------------------------------------------------
   869 //
   916 //
   910             break;
   957             break;
   911         case EPluginFocusItemDestroy:
   958         case EPluginFocusItemDestroy:
   912             if( iFepMan.FepAwareTextEditor() )
   959             if( iFepMan.FepAwareTextEditor() )
   913                 {
   960                 {
   914                 iMfne = NULL;
   961                 iMfne = NULL;
       
   962                 iEdwin = NULL;
   915                 if ( !aEventData )
   963                 if ( !aEventData )
   916                     {
   964                     {
   917                     RemoveLastFocusedWinFromOpenList();
   965                     RemoveLastFocusedWinFromOpenList();
   918                     }
   966                     }
   919                 else
   967                 else
   981             }
  1029             }
   982             break;
  1030             break;
   983         case EPluginUpdateIndicator:
  1031         case EPluginUpdateIndicator:
   984             {
  1032             {
   985             UpdateITUTIndicator();
  1033             UpdateITUTIndicator();
   986             if ( PluginInputMode() == EPluginInputModeFSQ )
  1034             // Update indicator for FSQ (landscape or portrait).
       
  1035             if ( PluginInputMode() == EPluginInputModeFSQ ||
       
  1036                  PluginInputMode() == EPluginInputModePortraitFSQ )
   987                 {
  1037                 {
   988 				UpdateFSQIndicator();
  1038 				UpdateFSQIndicator();
   989                 }
  1039                 }
   990             }
  1040             }
   991             break;
  1041             break;
  1048                     {
  1098                     {
  1049                     defaultMode = EPluginInputModeFSQ;
  1099                     defaultMode = EPluginInputModeFSQ;
  1050                     }
  1100                     }
  1051                 else
  1101                 else
  1052                     {
  1102                     {
  1053                     defaultMode = EPluginInputModeItut;
  1103                     // Use the last used portrait input mode.
       
  1104                     defaultMode = iSharedData.PluginPortraitInputMode();
  1054                     }
  1105                     }
  1055                 }
  1106                 }
  1056             else
  1107             else
  1057                 {
  1108                 {
  1058                 if(landscape)
  1109                 if(landscape)
  1059                     {
  1110                     {
  1060                     defaultMode = EPluginInputModeFSQ;
  1111                     defaultMode = EPluginInputModeFSQ;
  1061                     }
  1112                     }
  1062                 else
  1113                 else
  1063                     {
  1114                     {
  1064                     defaultMode = EPluginInputModeItut;
  1115                     // Use the last used portrait input mode.
       
  1116                     defaultMode = iSharedData.PluginPortraitInputMode();
  1065                     }
  1117                     }
  1066                 }
  1118                 }
  1067             TryChangePluginInputModeByModeL(defaultMode,
  1119             TryChangePluginInputModeByModeL(defaultMode,
  1068                                             EPenInputOpenManually,
  1120                                             EPenInputOpenManually,
  1069                                             ERangeInvalid);
  1121                                             ERangeInvalid);
  1183     
  1235     
  1184     TPixelsTwipsAndRotation size; 
  1236     TPixelsTwipsAndRotation size; 
  1185     CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
  1237     CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
  1186     TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;     
  1238     TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;     
  1187     // For portrait only mode, need to disable FSQ.
  1239     // For portrait only mode, need to disable FSQ.
  1188     TBool disableFSQ = iDefaultOrientation == CAknAppUiBase::EAppUiOrientationPortrait 
  1240     TBool disableFSQ = iDefaultOrientation == CAknAppUiBase::EAppUiOrientationPortrait
  1189     		           || ( !landscape && !iAvkonAppUi->OrientationCanBeChanged() );         
  1241                        || ( !iSharedData.AutoRotateEnabled() 
       
  1242                             && !landscape 
       
  1243                             && !iAvkonAppUi->OrientationCanBeChanged() );                 
       
  1244         
  1190     if ( disableFSQ )
  1245     if ( disableFSQ )
  1191         {
  1246         {
  1192         iPenInputServer.SetDisabledLayout( EPluginInputModeFSQ );
  1247         iPenInputServer.SetDisabledLayout( EPluginInputModeFSQ );
  1193         }
  1248         }
  1194     else
  1249     else
  1201             iPenInputServer.SetDisabledLayout( -1 );//reset disable type
  1256             iPenInputServer.SetDisabledLayout( -1 );//reset disable type
  1202             iPenInputServer.SetDisabledLayout( disableMode & ~EPluginInputModeFSQ );
  1257             iPenInputServer.SetDisabledLayout( disableMode & ~EPluginInputModeFSQ );
  1203             }
  1258             }
  1204         }
  1259         }
  1205     
  1260     
  1206     TBool disableITUT = 
  1261     // Both ITU-T and portrait FSQ are handled here.  Because getting and setting
  1207                ( iDefaultOrientation == CAknAppUiBase::EAppUiOrientationLandscape ||
  1262     // disabled layout separately caused issues.
  1208                       ( landscape && !iAvkonAppUi->OrientationCanBeChanged() ) ) ;
  1263     TBool disablePortraitInputMode = 
       
  1264                iDefaultOrientation == CAknAppUiBase::EAppUiOrientationLandscape 
       
  1265                || ( !iSharedData.AutoRotateEnabled() 
       
  1266                     && landscape 
       
  1267                     && !iAvkonAppUi->OrientationCanBeChanged() );
       
  1268 
  1209  
  1269  
  1210     if( disableITUT )
  1270     if ( disablePortraitInputMode )
  1211          {
  1271         {
  1212          //disable V-ITUT, and if current aSuggestMode is EPluginInputModeItut, replace it with EPluginInputModeFSQ;
  1272         // Disable V-ITUT and portrait FSQ, and if current aSuggestMode is 
  1213          iPenInputServer.SetDisabledLayout( EPluginInputModeItut );
  1273         // EPluginInputModeItut or EPluginInputModePortraitFSQ, replace it with 
  1214          if( aSuggestMode == EPluginInputModeItut )
  1274         // EPluginInputModeFSQ.
  1215              {
  1275         iPenInputServer.SetDisabledLayout( 
  1216              aSuggestMode = EPluginInputModeFSQ;
  1276             EPluginInputModeItut | EPluginInputModePortraitFSQ );
  1217              }
  1277         if( aSuggestMode == EPluginInputModeItut || 
  1218          }
  1278             aSuggestMode == EPluginInputModePortraitFSQ )
       
  1279             {
       
  1280             aSuggestMode = EPluginInputModeFSQ;
       
  1281             }
       
  1282         }
  1219     else
  1283     else
  1220          {
  1284         {
  1221          // if V-ITUT had been disabled before, enable it now;
  1285         // if V-ITUT had been disabled before, enable it now;
  1222          TInt disableMode = iPenInputServer.DisabledLayout();
  1286         TInt disableMode = iPenInputServer.DisabledLayout();
  1223          if( disableMode & EPluginInputModeItut )
  1287         if ( ( disableMode & EPluginInputModeItut ) || 
  1224              {
  1288              ( disableMode & EPluginInputModePortraitFSQ ) )
  1225 			 iPenInputServer.SetDisabledLayout( -1 );//reset
  1289             {
  1226 			 iPenInputServer.SetDisabledLayout( disableMode & ~EPluginInputModeItut );
  1290             iPenInputServer.SetDisabledLayout( -1 ); // Reset
  1227              }
  1291             TInt enableMode( 0 );
  1228          }
  1292             if ( disableMode & EPluginInputModeItut )
  1229 
  1293                 {
       
  1294                 enableMode |= EPluginInputModeItut;
       
  1295                 }
       
  1296             if ( disableMode & EPluginInputModePortraitFSQ )
       
  1297                 {
       
  1298                 enableMode |= EPluginInputModePortraitFSQ;
       
  1299                 }
       
  1300             iPenInputServer.SetDisabledLayout( disableMode & ~enableMode );
       
  1301             }
       
  1302         }
       
  1303 
       
  1304     if(aSuggestMode == EPluginInputModeFingerHwr 
       
  1305             && iSharedData.InputTextLanguage() == ELangArabic)
       
  1306         {
       
  1307         if(IsEditorSupportSplitIme())
       
  1308             {
       
  1309             if(landscape)
       
  1310                 {
       
  1311                 aSuggestMode = EPluginInputModeFSQ;
       
  1312                 }
       
  1313             else
       
  1314                 {
       
  1315                 aSuggestMode = iSharedData.PluginPortraitInputMode();                
       
  1316                 }
       
  1317             }
       
  1318         }
  1230 
  1319 
  1231     if ( aSuggestMode == EPluginInputModeFSQ)
  1320     if ( aSuggestMode == EPluginInputModeFSQ)
  1232         {
  1321         {
  1233         TPluginInputMode tempInputMode = iPluginInputMode;           
  1322         TPluginInputMode tempInputMode = iPluginInputMode;           
  1234         iPluginInputMode = aSuggestMode;
  1323         iPluginInputMode = aSuggestMode;
  1235         
  1324         
  1236         if (disableFSQ && (aSuggestMode != EPluginInputModeFingerHwr))
  1325         if (disableFSQ && (aSuggestMode != EPluginInputModeFingerHwr))
  1237             {
  1326             {
  1238             iPluginInputMode = tempInputMode;
  1327             iPluginInputMode = tempInputMode;
  1239             aSuggestMode = EPluginInputModeItut;
  1328             aSuggestMode = iSharedData.PluginPortraitInputMode();
  1240             }
  1329             }
  1241         else
  1330         else
  1242             {
  1331             {
  1243             if ( (!iSharedData.AutoRotateEnabled() 
  1332             if ( (!iSharedData.AutoRotateEnabled() 
  1244                     && aSuggestMode == EPluginInputModeFSQ))
  1333                     && aSuggestMode == EPluginInputModeFSQ))
  1345         //save plugin input mode to repository
  1434         //save plugin input mode to repository
  1346         if( iPenInputServer.PreferredUiMode() == EPluginInputModeNone )
  1435         if( iPenInputServer.PreferredUiMode() == EPluginInputModeNone )
  1347             {
  1436             {
  1348             //do not remember application set input mode
  1437             //do not remember application set input mode
  1349             iSharedData.SetPluginInputMode(iPluginInputMode);
  1438             iSharedData.SetPluginInputMode(iPluginInputMode);
       
  1439             
       
  1440             // Refresh landscape value
       
  1441             CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation( size );
       
  1442             landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;     
       
  1443             // Remember portrait input mode.  
       
  1444             if ( !landscape )
       
  1445                 {
       
  1446                 iSharedData.SetPluginPortraitInputMode( iPluginInputMode ); 
       
  1447                 }
  1350             }
  1448             }
  1351             
  1449             
  1352         if (CurrentFepInputUI())
  1450         if (CurrentFepInputUI())
  1353            	{
  1451            	{
  1354            	CurrentFepInputUI()->SetMode(iFepMan.InputMode(), ETrue, EFalse);		
  1452            	CurrentFepInputUI()->SetMode(iFepMan.InputMode(), ETrue, EFalse);		
  1357         if(!iOrientationChangedfromUI)
  1455         if(!iOrientationChangedfromUI)
  1358 		    {
  1456 		    {
  1359 		    iFepMan.UpdateCbaL( NULL );
  1457 		    iFepMan.UpdateCbaL( NULL );
  1360 		    }
  1458 		    }
  1361         
  1459         
       
  1460         // inform edwin that Touch Input is opened.
  1362         if ( iFepMan.EditorState() )
  1461         if ( iFepMan.EditorState() )
  1363             {
  1462             {
  1364             iFepMan.EditorState()->SetFlags( 
  1463             SetEdwinFlagsByUiStatus( ETrue );
  1365                 iFepMan.EditorState()->Flags() | EAknEditorFlagTouchInputModeOpened );
  1464             }
  1366             }		
       
  1367 		
  1465 		
  1368         // Notify application touch window state
  1466         // Notify application touch window state
  1369         NotifyAppUiImeTouchWndStateL( ETrue );
  1467         NotifyAppUiImeTouchWndStateL( ETrue );
  1370 
  1468 
  1371         rtn = ETrue;
  1469         rtn = ETrue;
  1445         }
  1543         }
  1446     //iFepMan.UpdateCbaL( NULL ); 
  1544     //iFepMan.UpdateCbaL( NULL ); 
  1447                 
  1545                 
  1448     iFepMan.UiInterface()->TouchPaneSetInputMethodIconActivated(EFalse);
  1546     iFepMan.UiInterface()->TouchPaneSetInputMethodIconActivated(EFalse);
  1449     
  1547     
  1450 	if ( iFepMan.EditorState() )
  1548     // inform edwin that Touch Input is closed.
  1451 	{
  1549     SetEdwinFlagsByUiStatus( EFalse );
  1452 	iFepMan.EditorState()->SetFlags( 
       
  1453 		iFepMan.EditorState()->Flags() & ~EAknEditorFlagTouchInputModeOpened );
       
  1454 	}
       
  1455 	
  1550 	
  1456     if ( prePluginInputMode == EPluginInputModeVkb )
  1551     if ( prePluginInputMode == EPluginInputModeVkb )
  1457         {
  1552         {
  1458         iFepMan.UpdateIndicators();
  1553         iFepMan.UpdateIndicators();
  1459         }        
  1554         }        
  1477         {
  1572         {
  1478         if( iCurrentPluginInputFepUI )
  1573         if( iCurrentPluginInputFepUI )
  1479             {
  1574             {
  1480             //Change for finger support of MFNE editor, it is a requirement for Tube
  1575             //Change for finger support of MFNE editor, it is a requirement for Tube
  1481             InformMfneUiStatusL( EFalse );            
  1576             InformMfneUiStatusL( EFalse );            
       
  1577             SetAknEdwinFlags( iEdwin, EAknEditorFlagHideTextView, EFalse );
  1482             
  1578             
  1483             iPenInputServer.ClearServerEvent();
  1579             iPenInputServer.ClearServerEvent();
  1484 			if(iFocuschangedForSpellEditor)
  1580             if(iFocuschangedForSpellEditor)
  1485 				{
  1581                 {
  1486 				iFocuschangedForSpellEditor = EFalse;
  1582                 iFocuschangedForSpellEditor = EFalse;
  1487 				//disable the redrawing, it will be redrawn in 
  1583                 //disable the redrawing, it will be redrawn in 
  1488 				//iCurrentPluginInputFepUI->HandleCommandL(ECmdPeninputDisableLayoutDrawing,ETrue);
  1584                 //iCurrentPluginInputFepUI->HandleCommandL(ECmdPeninputDisableLayoutDrawing,ETrue);
  1489 				return; //don't close the UI if this is caused by removing spell editor
  1585                 return; //don't close the UI if this is caused by removing spell editor
  1490 				}
  1586                 }
  1491 			else
  1587             else
  1492 				{
  1588                 {
  1493 				iCurrentPluginInputFepUI->CloseUI();
  1589                 iCurrentPluginInputFepUI->CloseUI();
  1494 				}
  1590                 }
  1495             if( aResetState )
  1591             if( aResetState )
  1496                 {
  1592                 {
  1497                 iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputWindowClose);
  1593                 iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputWindowClose);
  1498                 }
  1594                 }
  1499             
  1595             
  1504                 iIndicatorImgID = 0;
  1600                 iIndicatorImgID = 0;
  1505                 iIndicatorTextID = 0;           
  1601                 iIndicatorTextID = 0;           
  1506                 }            
  1602                 }            
  1507             }
  1603             }
  1508         }
  1604         }
  1509 
  1605     
       
  1606     // iITISettingDialogOpen = ETrue: ITI setting dialog is opened.
       
  1607     // iOrientationChanged = ETrue: Phone is forcibly rotated.
       
  1608     // iSharedData.AutoRotateEnabled() = ETrue: Sensor is on.
       
  1609     // ITI setting dialog should be close by restoring orientation. 
       
  1610     // Known case: 
       
  1611     // When sensor is off, ITI setting dialog is opened on FSQ,
       
  1612     // and then sensor is set to on, back to ITI setting dialog,
       
  1613     // ITI setting dialog should be closed and Virtual ITU-T should be launched.
       
  1614     if ( iITISettingDialogOpen && iSharedData.AutoRotateEnabled() && iOrientationChanged)
       
  1615         {
       
  1616         iITISettingDialogOpen = EFalse;
       
  1617         }
       
  1618 
       
  1619     // The orientation should not be restored if ITI setting dialog is opened.
       
  1620     // Otherwise, the orientation should be restored.
  1510     if ( (iPluginInputMode == EPluginInputModeFSQ || (iPluginInputMode == EPluginInputModeFingerHwr 
  1621     if ( (iPluginInputMode == EPluginInputModeFSQ || (iPluginInputMode == EPluginInputModeFingerHwr 
  1511 	     && iSharedData.InputTextLanguage() == ELangArabic)) && iOrientationChanged 
  1622          && iSharedData.InputTextLanguage() == ELangArabic)) && iOrientationChanged 
  1512     	                                            && !iITISettingDialogOpen )
  1623                                                     && !iITISettingDialogOpen )
  1513         {
  1624         {
  1514 		// This TRAP_IGNORE is essential , never delete it
  1625         // This TRAP_IGNORE is essential , never delete it
  1515         TRAP_IGNORE( iAvkonAppUi->SetOrientationL( (CAknAppUiBase::TAppUiOrientation)iDefaultOrientation ) );
  1626         TRAP_IGNORE( iAvkonAppUi->SetOrientationL( (CAknAppUiBase::TAppUiOrientation)iDefaultOrientation ) );
  1516         iOrientationChanged = EFalse;
  1627         iOrientationChanged = EFalse;
  1517         } 
  1628         } 
  1518         
  1629         
  1519     // Notify editor the touch window has been closed
  1630     // Notify editor the touch window has been closed
  1546         return;
  1657         return;
  1547         }    
  1658         }    
  1548 
  1659 
  1549     TInt preInputMode = iPluginInputMode;
  1660     TInt preInputMode = iPluginInputMode;
  1550     if ( iSharedData.AutoRotateEnabled() && 
  1661     if ( iSharedData.AutoRotateEnabled() && 
  1551         ( preInputMode == EPluginInputModeFSQ || preInputMode == EPluginInputModeItut ) )
  1662         ( preInputMode == EPluginInputModeFSQ || preInputMode == EPluginInputModeItut ||
       
  1663           preInputMode == EPluginInputModePortraitFSQ ) )
  1552         {
  1664         {
  1553         // Calculate current input mode by orientation.
  1665         // Calculate current input mode by orientation.
  1554         // even though peninputserver is brought to backgroud, 
  1666         // even though peninputserver is brought to backgroud, 
  1555         // the value for current input mode also needs to be ready. 
  1667         // the value for current input mode also needs to be ready. 
  1556         // For example, when open task switcher, pen ui is invisible and peniput server is background, 
  1668         // For example, when open task switcher, pen ui is invisible and peniput server is background, 
  1558         // After that when focus go back to editor, config FEP must be done before pen ui open,
  1670         // After that when focus go back to editor, config FEP must be done before pen ui open,
  1559         // And FEP must know for which kind of input method it configur.        
  1671         // And FEP must know for which kind of input method it configur.        
  1560         TPixelsTwipsAndRotation size; 
  1672         TPixelsTwipsAndRotation size; 
  1561         CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);        
  1673         CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);        
  1562         iPluginInputMode = ( size.iPixelSize.iWidth < size.iPixelSize.iHeight ) ? 
  1674         iPluginInputMode = ( size.iPixelSize.iWidth < size.iPixelSize.iHeight ) ? 
  1563             EPluginInputModeItut : EPluginInputModeFSQ;            
  1675             iSharedData.PluginPortraitInputMode() : EPluginInputModeFSQ;                       
  1564         }
  1676         }
  1565     
  1677     
  1566     if ( !iPenInputServer.IsForeground() )
  1678     if ( !iPenInputServer.IsForeground() )
  1567 	    {
  1679 	    {
  1568 	    return;
  1680 	    return;
  1569 	    }
  1681 	    }
  1570 
  1682 
  1571     TBool setResChange = EFalse;
  1683     TBool setResChange = EFalse;
  1572     
  1684     
  1573     if ( preInputMode == EPluginInputModeItut || 
  1685     if ( preInputMode == EPluginInputModeItut || 
  1574     	 preInputMode == EPluginInputModeFSQ ||
  1686          preInputMode == EPluginInputModeFSQ ||
  1575     	 preInputMode == EPluginInputModeFingerHwr )
  1687          preInputMode == EPluginInputModePortraitFSQ ||
       
  1688          preInputMode == EPluginInputModeFingerHwr )
  1576         {
  1689         {
  1577         setResChange = ETrue;
  1690         setResChange = ETrue;
  1578         iPenInputServer.SetResourceChange(ETrue);           
  1691         iPenInputServer.SetResourceChange(ETrue);           
  1579         }
  1692         }
  1580     
  1693     
  1581     iResourceChange = ETrue;   
  1694     iResourceChange = ETrue;   
  1582 
  1695 
  1583     TBool needToChangeInputMode = ETrue;
  1696     TBool needToChangeInputMode = ETrue;
  1584     if ( iSharedData.AutoRotateEnabled() && 
  1697     if ( iSharedData.AutoRotateEnabled() && 
  1585          ( preInputMode == EPluginInputModeFSQ || preInputMode == EPluginInputModeItut ) )
  1698          ( preInputMode == EPluginInputModeFSQ || 
       
  1699            preInputMode == EPluginInputModePortraitFSQ || 
       
  1700            preInputMode == EPluginInputModeItut ) )
  1586         {
  1701         {
  1587         if ( IsSpellVisible() )
  1702         if ( IsSpellVisible() )
  1588             {
  1703             {
  1589             iFepMan.ExitPluginSpellModeByCancel();
  1704             iFepMan.ExitPluginSpellModeByCancel();
  1590             iFepMan.SetNotifyPlugin( EFalse );
  1705             iFepMan.SetNotifyPlugin( EFalse );
  1722                     LaunchPenInputSettingL();
  1837                     LaunchPenInputSettingL();
  1723                     }
  1838                     }
  1724                     break;                
  1839                     break;                
  1725                 case EPenInputCmdVITUT:
  1840                 case EPenInputCmdVITUT:
  1726                     {
  1841                     {
  1727                     //Here calling this function is to reset menu state when the focus change caused by
  1842                     ProcessChangingInputModeCmdL(EPluginInputModeItut);
  1728                     //the screen orientation, in the normal circumstance the foucus change should not 
       
  1729                     //occur while the screen orientation is handling. So directly resetting menu state 
       
  1730                     //to avoid the above case, preconditon is that the option menu must be closed.
       
  1731                     ResetMenuState();
       
  1732 					ClosePluginInputModeL(ETrue);             
       
  1733                     iFepMan.TryCloseUiL();  
       
  1734                     TryChangePluginInputModeByModeL(EPluginInputModeItut, 
       
  1735                                                     EPenInputOpenManually,
       
  1736                                                     ERangeInvalid);
       
  1737                     }
  1843                     }
  1738                     break;
  1844                     break;
  1739                 case EPeninputCmdFSQ:
  1845                 case EPeninputCmdFSQ:
  1740                     {
  1846                 // "Edit portrait" menu - switch to portrait FSQ
  1741                     //Here calling this function is to reset menu state when the focus change caused by
  1847                 case EPeninputCmdPortraitEditor:
  1742                     //the screen orientation, in the normal circumstance the foucus change should not 
  1848                     {
  1743                     //occur while the screen orientation is handling. So directly resetting menu state 
  1849                     if ( iPortraitFSQEnabled )
  1744                     //to avoid the above case, preconditon is that the option menu must be closed.                 
  1850                         {
  1745                     ResetMenuState();
  1851                         ProcessChangingInputModeCmdL(EPluginInputModePortraitFSQ);          
  1746 					ClosePluginInputModeL(ETrue);               
  1852                         }
  1747                     iFepMan.TryCloseUiL();  
  1853                     else 
  1748                     TryChangePluginInputModeByModeL(EPluginInputModeFSQ, 
  1854                         {
  1749                                                     EPenInputOpenManually,
  1855                         ProcessChangingInputModeCmdL(EPluginInputModeFSQ);
  1750                                                     ERangeInvalid);
  1856                         }
       
  1857                     }
       
  1858 
       
  1859                     break;
       
  1860                 // "Edit landscape" menu - switch to landscape FSQ
       
  1861                 case EPeninputCmdLandscapeEditor:
       
  1862 
       
  1863                     {
       
  1864                     ProcessChangingInputModeCmdL(EPluginInputModeFSQ);
  1751                     }
  1865                     }
  1752                     break;
  1866                     break;
  1753                 case EPeninputCmdHwr:
  1867                 case EPeninputCmdHwr:
  1754                 	{
  1868                 	{
  1755                     //Here calling this function is to reset menu state when the focus change caused by
  1869                     ProcessChangingInputModeCmdL(EPluginInputModeFingerHwr);  
  1756                     //the screen orientation, in the normal circumstance the foucus change should not 
       
  1757                     //occur while the screen orientation is handling. So directly resetting menu state 
       
  1758                     //to avoid the above case, preconditon is that the option menu must be closed.
       
  1759                 	ResetMenuState();
       
  1760                 	ClosePluginInputModeL(ETrue);               
       
  1761                 	iFepMan.TryCloseUiL();  
       
  1762                 	TryChangePluginInputModeByModeL( EPluginInputModeFingerHwr, 
       
  1763                 	                                 EPenInputOpenManually,
       
  1764                 	                                 ERangeInvalid );
       
  1765                 	}
  1870                 	}
  1766                 	break;
  1871                 	break;
  1767                 case EFepInputCmdHelp:
  1872                 case EFepInputCmdHelp:
  1768                     {
  1873                     {
  1769                     if (iInMenu)
  1874                     if (iInMenu)
  2034            aMenuPane->SetItemDimmed(EAknCmdPredictiveTextCascade, ETrue); 
  2139            aMenuPane->SetItemDimmed(EAknCmdPredictiveTextCascade, ETrue); 
  2035            aMenuPane->SetItemDimmed(EAknCmdMultitapPredictiveT9On, ETrue); 
  2140            aMenuPane->SetItemDimmed(EAknCmdMultitapPredictiveT9On, ETrue); 
  2036            }
  2141            }
  2037                    
  2142                    
  2038        //For Preview bubble
  2143        //For Preview bubble
  2039        if (!(iPluginInputMode == EPluginInputModeVkb ||
  2144        if ( ! (iPluginInputMode == EPluginInputModeVkb ||
  2040              iPluginInputMode == EPluginInputModeFSQ ||
  2145                iPluginInputMode == EPluginInputModeFSQ ||
  2041              iPluginInputMode == EPluginInputModeFingerHwr ))
  2146                iPluginInputMode == EPluginInputModeFingerHwr ||
       
  2147                iPluginInputMode == EPluginInputModePortraitFSQ ) )
  2042            {
  2148            {
  2043            if(!(iPluginInputMode == EPluginInputModeItut &&
  2149            if(!(iPluginInputMode == EPluginInputModeItut &&
  2044              (iSharedData.InputTextLanguage() == ELangPrcChinese ||
  2150              (iSharedData.InputTextLanguage() == ELangPrcChinese ||
  2045              iSharedData.InputTextLanguage() == ELangTaiwanChinese ||
  2151              iSharedData.InputTextLanguage() == ELangTaiwanChinese ||
  2046              iSharedData.InputTextLanguage() == ELangHongKongChinese )))
  2152              iSharedData.InputTextLanguage() == ELangHongKongChinese )))
  2079                {
  2185                {
  2080                aMenuPane->SetItemDimmed(EAknCmdEditInsertSmiley, EFalse);
  2186                aMenuPane->SetItemDimmed(EAknCmdEditInsertSmiley, EFalse);
  2081                }
  2187                }
  2082            }
  2188            }
  2083            
  2189            
  2084         if (iPluginInputMode == EPluginInputModeItut ||
  2190         // Add Insert Symbol for valid input modes.   
  2085             iPluginInputMode == EPluginInputModeVkb ||
  2191         if ( iPluginInputMode == EPluginInputModeItut ||
  2086             iPluginInputMode == EPluginInputModeFSQ )
  2192              iPluginInputMode == EPluginInputModeVkb ||
       
  2193              iPluginInputMode == EPluginInputModeFSQ ||
       
  2194              iPluginInputMode == EPluginInputModePortraitFSQ )
  2087             {
  2195             {
  2088             TInt index = 0;     
  2196             TInt index = 0;     
  2089             if (isLanuchSCT && aMenuPane->MenuItemExists(EAknCmdEditInsertSymbol, index))
  2197             if (isLanuchSCT && aMenuPane->MenuItemExists(EAknCmdEditInsertSymbol, index))
  2090                  {
  2198                  {
  2091                  aMenuPane->SetItemDimmed(EAknCmdEditInsertSymbol, EFalse);
  2199                  aMenuPane->SetItemDimmed(EAknCmdEditInsertSymbol, EFalse);
  2111         // add some input mode in option menu
  2219         // add some input mode in option menu
  2112         
  2220         
  2113     	TInt disabledInputMode = iPenInputServer.DisabledLayout();
  2221     	TInt disabledInputMode = iPenInputServer.DisabledLayout();
  2114     	TInt curInputMode = iLangMan.CurrentImePlugin()->CurrentMode();
  2222     	TInt curInputMode = iLangMan.CurrentImePlugin()->CurrentMode();
  2115     	TBool isChinese = iFepMan.IsChineseInputLanguage();
  2223     	TBool isChinese = iFepMan.IsChineseInputLanguage();
       
  2224     	TBool isKorean = iFepMan.IsKoreanInputLanguage();
       
  2225     	// similar with chinese layout, there is a switching button,so when writing language is korean
       
  2226     	// no need to insert 'Qwerty' or 'Alphabet keypad' item into option menu 
  2116     	
  2227     	
  2117     	if ( !isChinese && ( curInputMode != EPluginInputModeFSQ ) 
  2228     /* US2/US4/US5
  2118     			&& !( disabledInputMode & EPluginInputModeFSQ ))
  2229     1. Orientation sensor off
  2119     	    {
  2230 
  2120     	    aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
  2231         1-1. Portrait orientation
  2121     	    }
  2232             If currently ITU-T mode
  2122     	
  2233             “QWERTY keyboard?-> Port fsq
  2123     	if ( !isChinese && ( curInputMode != EPluginInputModeItut ) 
  2234             “Edit landscape?-> Land fsq
  2124     			&& !( disabledInputMode & EPluginInputModeItut ))
  2235 
  2125     	    {
  2236             If currently Portrait FSQ mode
  2126     	    aMenuPane->SetItemDimmed(EPenInputCmdVITUT, EFalse);
  2237             “Alphanumeric keypad?
  2127     	    }
  2238             “Edit landscape?-> Land fsq
  2128     	
  2239 
  2129     	if ( FeatureManager::FeatureSupported( KFeatureIdArabicHandwritingRecognitionInput )
  2240         1-2. Landscape orientation
  2130             &&iFepMan.IsArabicInputLanguage() 
  2241             “Alphanumeric keypad?
  2131             && ( curInputMode != EPluginInputModeFingerHwr )
  2242             “Edit portrait?- Port fsq
  2132     	    && !( disabledInputMode & EPluginInputModeFingerHwr ))
  2243 
  2133     	    {
  2244     2. Orientation sensor on
  2134     	    aMenuPane->SetItemDimmed( EPeninputCmdHwr, EFalse );
  2245 
  2135     	    }
  2246         2-1.Portrait orientation
       
  2247             If currently ITU-T mode
       
  2248             “QWERTY keyboard?-> Port fsq
       
  2249 
       
  2250             If currently Portrait FSQ mode
       
  2251             “Alphanumeric keypad?
       
  2252 
       
  2253         2-2. Landscape orientation
       
  2254             --- No input switch menu
       
  2255 */
       
  2256 
       
  2257     // Get the current phone's orientation
       
  2258     TPixelsTwipsAndRotation size; 
       
  2259     CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
       
  2260     TBool isPortrait = size.iPixelSize.iWidth < size.iPixelSize.iHeight;
       
  2261 
       
  2262     // "QWERTY keyboard" - EPeninputCmdFSQ menu
       
  2263     if ( iPortraitFSQEnabled )
       
  2264         {
       
  2265         // "QWERTY keyboard" - EPeninputCmdFSQ menu is shown in these conditions
       
  2266         // if portrait FSQ feature flag is enabled
       
  2267         // 1) Non-Chinese language
       
  2268         // 2) Current input mode is not portrait FSQ and also the mode is not disabled
       
  2269         // 3) Current orientation is portrait
       
  2270         if ( !isKorean && !isChinese
       
  2271             && ( curInputMode != EPluginInputModePortraitFSQ ) 
       
  2272             && !( disabledInputMode & EPluginInputModePortraitFSQ ) 
       
  2273             && isPortrait )
       
  2274         {
       
  2275         aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
       
  2276         }
       
  2277         
       
  2278         }
       
  2279     else
       
  2280         {
       
  2281         if ( !isKorean && !isChinese && ( curInputMode != EPluginInputModeFSQ ) 
       
  2282             && !( disabledInputMode & EPluginInputModeFSQ ) 
       
  2283             && FeatureManager::FeatureSupported( KFeatureIdVirtualFullscrQwertyInput ) )
       
  2284             {
       
  2285             aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
       
  2286             }
       
  2287         }
       
  2288 
       
  2289     // "Alphanumeric keypad" - EPenInputCmdVITUT menu is shown in these conditions.
       
  2290     // 1) Non-Chinese language
       
  2291     // 2) Current input mode is not ITU-T and also the mode is not disabled
       
  2292     // 3) ITU-T feature flag is enabled
       
  2293     if ( !isKorean && !isChinese 
       
  2294         && ( curInputMode != EPluginInputModeItut ) 
       
  2295         && !( disabledInputMode & EPluginInputModeItut ) 
       
  2296         && FeatureManager::FeatureSupported( KFeatureIdVirtualItutInput ) )
       
  2297         {
       
  2298         aMenuPane->SetItemDimmed(EPenInputCmdVITUT, EFalse);
       
  2299         }
       
  2300     // "Edit portrait" - EPeninputCmdPortraitEditor menu is shown in these conditions.
       
  2301     // 1) Portrait FSQ feature flag is enabled
       
  2302     // 2) Non-Chinese language
       
  2303     // 3) Current input mode is not portrait FSQ and also the mode is not disabled
       
  2304     // 4) Current orientation is landscape
       
  2305     if ( iPortraitFSQEnabled
       
  2306         && !isKorean && !isChinese 
       
  2307         && ( curInputMode != EPluginInputModePortraitFSQ ) 
       
  2308         && !( disabledInputMode & EPluginInputModePortraitFSQ ) 
       
  2309         && !isPortrait )
       
  2310         {
       
  2311         aMenuPane->SetItemDimmed(EPeninputCmdPortraitEditor, EFalse);
       
  2312         }
       
  2313 
       
  2314     // "Edit landscape" - EPeninputCmdLandscapeEditor menu is shown in these conditions.
       
  2315     // 1) Portrait FSQ feature flag is enabled 
       
  2316     //    This menu needed only when the feature is turned on.
       
  2317     // 2) Landscape FSQ feature flag is enabled
       
  2318     // 3) Non-Chinese language
       
  2319     // 4) Current input mode is not landscape FSQ and also the mode is not disabled
       
  2320     // 5) Current orientation is portrait
       
  2321     if ( iPortraitFSQEnabled
       
  2322         && FeatureManager::FeatureSupported( KFeatureIdVirtualFullscrQwertyInput ) 
       
  2323         && !isKorean && !isChinese 
       
  2324         && ( curInputMode != EPluginInputModeFSQ ) 
       
  2325         && !( disabledInputMode & EPluginInputModeFSQ ) 
       
  2326         && isPortrait )
       
  2327         {
       
  2328         aMenuPane->SetItemDimmed(EPeninputCmdLandscapeEditor, EFalse);
       
  2329         }
       
  2330    	
       
  2331    	if ( FeatureManager::FeatureSupported( KFeatureIdArabicHandwritingRecognitionInput )
       
  2332            &&iFepMan.IsArabicInputLanguage() 
       
  2333            && ( curInputMode != EPluginInputModeFingerHwr )
       
  2334    	    && !( disabledInputMode & EPluginInputModeFingerHwr ))
       
  2335    	    {
       
  2336    	    aMenuPane->SetItemDimmed( EPeninputCmdHwr, EFalse );
       
  2337    	    }
  2136 		
  2338 		
  2137 		// check if this is the arabic finger hwr
  2339 		// check if this is the arabic finger hwr
  2138 		TBool isArabicFingerHwr = (iPluginInputMode == EPluginInputModeFingerHwr
  2340 		TBool isArabicFingerHwr = (iPluginInputMode == EPluginInputModeFingerHwr
  2139 		                            && ELangArabic  == iSharedData.InputTextLanguage());
  2341 		                            && ELangArabic  == iSharedData.InputTextLanguage());
  2140 		
  2342 		
  2186 //		}    			
  2388 //		}    			
  2187 	
  2389 	
  2188 	//Show number mode menu item.
  2390 	//Show number mode menu item.
  2189 	if(iFepMan.InputMode() == ENumber || iFepMan.InputMode() == ENativeNumber)
  2391 	if(iFepMan.InputMode() == ENumber || iFepMan.InputMode() == ENativeNumber)
  2190 	    {
  2392 	    {
  2191         if(iSharedData.DefaultArabicNumberMode())
  2393         CAknEdwinState* editorState = iFepMan.EditorState();
  2192             {
  2394         TUint permittedInputModes;
  2193             aMenuPane->SetItemDimmed(EAknCmdEditModeNumber, EFalse);
  2395         if( editorState )
       
  2396             {
       
  2397             permittedInputModes= editorState->PermittedInputModes();
  2194             }
  2398             }
  2195         else
  2399         else
  2196             {
  2400             {
  2197             aMenuPane->SetItemDimmed(EAknCmdEditModeArabicIndicNumber, EFalse);
  2401             permittedInputModes = EAknEditorNumericInputMode;
       
  2402             }   
       
  2403         TBool IsOnlyNumericPermitted = !(permittedInputModes 
       
  2404                 &(EAknEditorTextInputMode | EAknEditorSecretAlphaInputMode));
       
  2405         if(IsOnlyNumericPermitted)
       
  2406             {
       
  2407             if(iSharedData.DefaultArabicNumberMode())
       
  2408                 {
       
  2409                 aMenuPane->SetItemDimmed(EAknCmdEditModeNumber, EFalse);
       
  2410                 }
       
  2411             else
       
  2412                 {
       
  2413                 aMenuPane->SetItemDimmed(EAknCmdEditModeArabicIndicNumber, EFalse);
       
  2414                 }
  2198             }
  2415             }
  2199 	    }
  2416 	    }
       
  2417 
  2200 	// add the writing speed menu
  2418 	// add the writing speed menu
  2201 	index = 0;
  2419 	index = 0;
  2202 	if(aMenuPane->MenuItemExists(EPenInputCmdWritingSpeed, index))
  2420 	if(aMenuPane->MenuItemExists(EPenInputCmdWritingSpeed, index))
  2203 		{
  2421 		{
  2204 		aMenuPane->SetItemDimmed(EPenInputCmdWritingSpeed,EFalse);
  2422 		aMenuPane->SetItemDimmed(EPenInputCmdWritingSpeed,EFalse);
  2249     if ( !aGainForeground && appId == focusAppId )
  2467     if ( !aGainForeground && appId == focusAppId )
  2250         {
  2468         {
  2251         return;
  2469         return;
  2252         }
  2470         }
  2253         
  2471         
  2254     if( !iLaunchMenu && IsGlobalNotesApp(focusAppId)) 
  2472     // if pen ui is being opened on a non-global editor, which popped by capserver or notify server,    
  2255 
  2473     // and also other global notes from capserver or notify server pop up at the moment,
  2256         {
  2474     // pen ui should be dimmed as the definitino of dim feature.
  2257         if( iPluginInputMode == EPluginInputModeItut ||
  2475     // Set bClose = EFalse is used to prevent from closing pen ui later.  
  2258             iPluginInputMode == EPluginInputModeFSQ ||
  2476 	if( !iLaunchMenu && IsGlobalNotesApp(focusAppId) && !IsInGlobleNoteEditor() )
  2259             iPluginInputMode == EPluginInputModeFingerHwr)
  2477         {
       
  2478         if ( iPluginInputMode == EPluginInputModeItut ||
       
  2479              iPluginInputMode == EPluginInputModeFSQ ||
       
  2480              iPluginInputMode == EPluginInputModeFingerHwr ||
       
  2481              iPluginInputMode == EPluginInputModePortraitFSQ )
  2260             {
  2482             {
  2261             bClose = EFalse;
  2483             bClose = EFalse;
  2262             }
  2484             }
  2263 
  2485 
  2264         }
  2486         }
  2267     // In globsl notes editor, launching global notes not fep dlg or menu
  2489     // In globsl notes editor, launching global notes not fep dlg or menu
  2268     if(focusAppId.iUid == appId.iUid &&
  2490     if(focusAppId.iUid == appId.iUid &&
  2269        IsGlobalNotesApp(appId) &&
  2491        IsGlobalNotesApp(appId) &&
  2270        !iFepMan.IsFepAwareTextEditor())
  2492        !iFepMan.IsFepAwareTextEditor())
  2271         {
  2493         {
  2272         if( iPluginInputMode == EPluginInputModeItut ||
  2494         if ( iPluginInputMode == EPluginInputModeItut ||
  2273             iPluginInputMode == EPluginInputModeFSQ ||
  2495              iPluginInputMode == EPluginInputModeFSQ ||
  2274             iPluginInputMode == EPluginInputModeFingerHwr)
  2496              iPluginInputMode == EPluginInputModeFingerHwr ||
       
  2497              iPluginInputMode == EPluginInputModePortraitFSQ )
  2275             {
  2498             {
  2276              ClosePluginInputUiL(ETrue);
  2499              ClosePluginInputUiL(ETrue);
  2277              if(iPenInputSvrConnected ) //lost foreground
  2500              if(iPenInputSvrConnected ) //lost foreground
  2278                 {
  2501                 {
  2279                 iPenInputServer.LoseForeground();
  2502                 iPenInputServer.LoseForeground();
  2312         if( iInMenu && 
  2535         if( iInMenu && 
  2313         	( iCurEditor == iFepMan.FepAwareTextEditor() || iLaunchSCTInSpell ) )
  2536         	( iCurEditor == iFepMan.FepAwareTextEditor() || iLaunchSCTInSpell ) )
  2314             {            
  2537             {            
  2315             iLaunchSCTInSpell = EFalse;
  2538             iLaunchSCTInSpell = EFalse;
  2316 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
  2539 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
  2317             if ( PluginInputMode() == EPluginInputModeFSQ 
  2540             if ( ( PluginInputMode() == EPluginInputModeFSQ ||
  2318                     && iSharedData.ThemeEffectsEnabled())
  2541                    PluginInputMode() == EPluginInputModePortraitFSQ )
       
  2542                     && iSharedData.ThemeEffectsEnabled() )
  2319                 {
  2543                 {
  2320                 User::After(1);//waiting for menu cancel effect
  2544                 User::After(1);//waiting for menu cancel effect
  2321                 } 
  2545                 } 
  2322 #endif
  2546 #endif
  2323             ResetMenuState();            
  2547             ResetMenuState();            
  2344             if ( iFepMan.IsFindPaneEditor() && iFepMan.IsSupportedAdaptiveSearch() )
  2568             if ( iFepMan.IsFindPaneEditor() && iFepMan.IsSupportedAdaptiveSearch() )
  2345                 {
  2569                 {
  2346                 iAvkonRepository->Get( KAknAvkonAdaptiveSearchEnabled, enableAdaptiveSearch );
  2570                 iAvkonRepository->Get( KAknAvkonAdaptiveSearchEnabled, enableAdaptiveSearch );
  2347                 if ( enableAdaptiveSearch )
  2571                 if ( enableAdaptiveSearch )
  2348                     {
  2572                     {
  2349                     if(!(iInMenu && ( iPluginInputMode == EPluginInputModeItut ||
  2573                     if ( !(iInMenu && 
  2350                                     iPluginInputMode == EPluginInputModeFSQ ||
  2574                             ( iPluginInputMode == EPluginInputModeItut ||
  2351                                     iPluginInputMode ==EPluginInputModeFingerHwr)))
  2575                               iPluginInputMode == EPluginInputModeFSQ ||
       
  2576                               iPluginInputMode ==EPluginInputModeFingerHwr ||
       
  2577                               iPluginInputMode == EPluginInputModePortraitFSQ ) ) )
  2352                         {
  2578                         {
  2353                         ClosePluginInputModeL(ETrue);
  2579                         ClosePluginInputModeL(ETrue);
  2354                         if(iPenInputSvrConnected ) //lost foreground
  2580                         if(iPenInputSvrConnected ) //lost foreground
  2355                             {
  2581                             {
  2356                             iPenInputServer.LoseForeground();
  2582                             iPenInputServer.LoseForeground();
  2362                 {
  2588                 {
  2363 			TInt openMode = EPenInputOpenAutomatically;
  2589 			TInt openMode = EPenInputOpenAutomatically;
  2364 			TPluginInputMode inputMode = (TPluginInputMode)iSharedData.PluginInputMode();                        
  2590 			TPluginInputMode inputMode = (TPluginInputMode)iSharedData.PluginInputMode();                        
  2365 				if ((inputMode == EPluginInputModeFSc || inputMode == EPluginInputModeHwr ||
  2591 				if ((inputMode == EPluginInputModeFSc || inputMode == EPluginInputModeHwr ||
  2366 					 inputMode == EPluginInputModeFingerHwr) &&
  2592 					 inputMode == EPluginInputModeFingerHwr) &&
  2367 				 iFepMan.IsSupportsSecretText())
  2593 				     iFepMan.IsSupportsSecretText())
  2368 				{
  2594 				{
  2369                     openMode = EPenInputOpenManually;
  2595                     openMode = EPenInputOpenManually;
  2370                     }
  2596                     }
  2371                 if(langChange)
  2597                 if(langChange)
  2372                     {
  2598                     {
  2385         if ( iFepMan.IsFindPaneEditor() && iFepMan.IsSupportedAdaptiveSearch() )
  2611         if ( iFepMan.IsFindPaneEditor() && iFepMan.IsSupportedAdaptiveSearch() )
  2386             {
  2612             {
  2387             iAvkonRepository->Get( KAknAvkonAdaptiveSearchEnabled, enableAdaptiveSearch );
  2613             iAvkonRepository->Get( KAknAvkonAdaptiveSearchEnabled, enableAdaptiveSearch );
  2388             if ( enableAdaptiveSearch )
  2614             if ( enableAdaptiveSearch )
  2389                 {
  2615                 {
  2390                 if(iInMenu && ( iPluginInputMode == EPluginInputModeItut ||
  2616                 if ( iInMenu && ( iPluginInputMode == EPluginInputModeItut ||
  2391                                 iPluginInputMode == EPluginInputModeFSQ ||
  2617                     iPluginInputMode == EPluginInputModeFSQ ||
  2392                                 iPluginInputMode == EPluginInputModeFingerHwr))
  2618                     iPluginInputMode == EPluginInputModeFingerHwr ||
       
  2619                     iPluginInputMode == EPluginInputModePortraitFSQ ) )
  2393                     {                
  2620                     {                
  2394                     //iPenInputServer.DimUiLayout(ETrue); //dim the ui
  2621                     //iPenInputServer.DimUiLayout(ETrue); //dim the ui
  2395                     return;
  2622                     return;
  2396                     }                
  2623                     }                
  2397                 
  2624                 
  2403                 }
  2630                 }
  2404             }
  2631             }
  2405         
  2632         
  2406         if ( !enableAdaptiveSearch )
  2633         if ( !enableAdaptiveSearch )
  2407             {
  2634             {
  2408             if(iInMenu && ( iPluginInputMode == EPluginInputModeItut ||
  2635             if( iInMenu && ( iPluginInputMode == EPluginInputModeItut ||
  2409                             iPluginInputMode == EPluginInputModeFSQ ||
  2636                 iPluginInputMode == EPluginInputModeFSQ ||
  2410                             iPluginInputMode == EPluginInputModeFingerHwr))
  2637                 iPluginInputMode == EPluginInputModeFingerHwr || 
       
  2638                 iPluginInputMode == EPluginInputModePortraitFSQ ) )
  2411                 {                
  2639                 {                
  2412                 //iPenInputServer.DimUiLayout(ETrue); //dim the ui
  2640                 //iPenInputServer.DimUiLayout(ETrue); //dim the ui
  2413                 return;
  2641                 return;
  2414                 }            
  2642                 }            
  2415             
  2643             
  3120 	
  3348 	
  3121     TInt previousModes = iCurPermitModes;
  3349     TInt previousModes = iCurPermitModes;
  3122     TBool previousSCT  = isLanuchSCT;
  3350     TBool previousSCT  = isLanuchSCT;
  3123     TInt inputmode = PluginInputMode();
  3351     TInt inputmode = PluginInputMode();
  3124     
  3352     
  3125     if (R_AVKON_PENINPUT_OPTION_MENU_BAR == aResourceId &&
  3353     if ( R_AVKON_PENINPUT_OPTION_MENU_BAR == aResourceId &&
  3126         (inputmode == EPluginInputModeItut ||
  3354            ( inputmode == EPluginInputModeItut ||
  3127          inputmode == EPluginInputModeVkb ||
  3355              inputmode == EPluginInputModeVkb ||
  3128          inputmode == EPluginInputModeFSQ))
  3356              inputmode == EPluginInputModeFSQ ||
       
  3357              inputmode == EPluginInputModePortraitFSQ ) )
  3129         {
  3358         {
  3130         isLanuchSCT = EFalse;
  3359         isLanuchSCT = EFalse;
  3131         iCurPermitModes = iFepMan.PermittedModes(); 
  3360         iCurPermitModes = iFepMan.PermittedModes(); 
  3132         isLanuchSCT = iFepMan.IsAbleToLaunchSCT();  
  3361         isLanuchSCT = iFepMan.IsAbleToLaunchSCT();  
  3133         }
  3362         }
  3815 //     
  4044 //     
  3816 TBool CAknFepPluginManager::GetCurSuggestMode( TPluginInputMode& aSuggestMode )
  4045 TBool CAknFepPluginManager::GetCurSuggestMode( TPluginInputMode& aSuggestMode )
  3817     {
  4046     {
  3818     TInt fepDisableLayoouts = 0;
  4047     TInt fepDisableLayoouts = 0;
  3819     TInt disableLayouts = iPenInputServer.DisabledLayout();
  4048     TInt disableLayouts = iPenInputServer.DisabledLayout();
       
  4049     // Get the current phone orientation.
       
  4050     TPixelsTwipsAndRotation size; 
       
  4051     CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
       
  4052     TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;
  3820 
  4053 
  3821     switch(aSuggestMode)
  4054     switch(aSuggestMode)
  3822         {
  4055         {
  3823 		case EPluginInputModeFingerHwr:
  4056 		case EPluginInputModeFingerHwr:
  3824         case EPluginInputModeFSc:
  4057         case EPluginInputModeFSc:
  3831 		    	          iSharedData.InputTextLanguage() == ELangTaiwanChinese ||
  4064 		    	          iSharedData.InputTextLanguage() == ELangTaiwanChinese ||
  3832 		    	          iSharedData.InputTextLanguage() == ELangHongKongChinese)) &&
  4065 		    	          iSharedData.InputTextLanguage() == ELangHongKongChinese)) &&
  3833 		    	  ((aSuggestMode == EPluginInputModeFingerHwr && 
  4066 		    	  ((aSuggestMode == EPluginInputModeFingerHwr && 
  3834 		    	          iSharedData.InputTextLanguage() != ELangArabic))))   
  4067 		    	          iSharedData.InputTextLanguage() != ELangArabic))))   
  3835 				{
  4068 				{
  3836 				aSuggestMode = EPluginInputModeItut;
  4069                 // If full screen portrait QWERTY feature is enabled, use it 
       
  4070                 // instead of ITU-T.
       
  4071                 aSuggestMode = iSharedData.PluginPortraitInputMode();                        
       
  4072 
       
  4073                 // If portrait FSQ or ITU-T is disabled, use landscape FSQ.
       
  4074                 // If they are disabled, most likely the orientation is landscape. 
  3837 				if ((disableLayouts & aSuggestMode))
  4075 				if ((disableLayouts & aSuggestMode))
  3838 					{
  4076 					{
  3839 					aSuggestMode = EPluginInputModeFSQ;
  4077 					aSuggestMode = EPluginInputModeFSQ;
  3840 					}
  4078 					}
  3841 				fepDisableLayoouts |= EPluginInputModeHwr | EPluginInputModeFSc |
  4079 				fepDisableLayoouts |= EPluginInputModeHwr | EPluginInputModeFSc |
  3847             {
  4085             {
  3848             // When in Capacitive hardware, there should be no MiniVKB.
  4086             // When in Capacitive hardware, there should be no MiniVKB.
  3849             // So we use FSQ for Landscape mode and ITUT for Portrait instead.
  4087             // So we use FSQ for Landscape mode and ITUT for Portrait instead.
  3850             if( FeatureManager::FeatureSupported( KFeatureIdFfCapacitiveDisplay ))
  4088             if( FeatureManager::FeatureSupported( KFeatureIdFfCapacitiveDisplay ))
  3851                 {
  4089                 {
  3852                 TPixelsTwipsAndRotation size; 
       
  3853                 CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
       
  3854                 TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;
       
  3855                 if ( landscape ) // LandScape
  4090                 if ( landscape ) // LandScape
  3856                     {
  4091                     {
  3857                     aSuggestMode = EPluginInputModeFSQ;
  4092                     aSuggestMode = EPluginInputModeFSQ;
  3858                     }
  4093                     }
  3859                 else // Portrait
  4094                 else // Portrait
  3860                     {
  4095                     {
  3861                     aSuggestMode = EPluginInputModeItut;
  4096                     // Use the last used portrait input mode.
       
  4097                     aSuggestMode = iSharedData.PluginPortraitInputMode();
  3862                     }
  4098                     }
  3863                 }
  4099                 }
  3864             }
  4100             }
  3865             break;
  4101             break;
  3866         case EPluginInputModeFSQ:
  4102         case EPluginInputModeFSQ:
  3867             {
  4103             {
  3868             if ((disableLayouts & aSuggestMode))
  4104             if ((disableLayouts & aSuggestMode))
  3869                 {
  4105                 {
  3870                 aSuggestMode = EPluginInputModeItut;
  4106                 // Use the last used portrait input mode.
       
  4107                 aSuggestMode = iSharedData.PluginPortraitInputMode();
  3871                 }
  4108                 }
  3872             }
  4109             }
  3873             break;
  4110             break;
       
  4111         // If ITU-T or portrait FSQ are disabled, use landscape FSQ.    
  3874         case EPluginInputModeItut:
  4112         case EPluginInputModeItut:
       
  4113         case EPluginInputModePortraitFSQ:	
  3875             {
  4114             {
  3876             if ((disableLayouts & aSuggestMode))
  4115             if ((disableLayouts & aSuggestMode))
  3877                 {
  4116                 {
  3878                 aSuggestMode = EPluginInputModeFSQ;
  4117                 aSuggestMode = EPluginInputModeFSQ;
  3879                 }
  4118                 }
  3880             }
  4119             }
  3881             break;
  4120             break;
  3882         default:
  4121         default:
  3883 			{
  4122 			{
  3884 			aSuggestMode = EPluginInputModeItut;
  4123             // Landscape FSQ is used in landscape orientation.
  3885 			if ((disableLayouts & aSuggestMode))
  4124             if ( landscape )
  3886 				{
  4125                 {
  3887 				aSuggestMode = EPluginInputModeFSQ;
  4126                 aSuggestMode = EPluginInputModeFSQ; 
  3888 				}
  4127                 }
  3889 			}
  4128             // If the current orientation is portrait, use the last used portrait input mode.
       
  4129             else
       
  4130                 {
       
  4131                 aSuggestMode = iSharedData.PluginPortraitInputMode();
       
  4132                
       
  4133                 // If the suggested mode is EPluginInputModeNone or disabled, use 
       
  4134                 // EPluginInputModeFSQ.
       
  4135                 // Note: If the suggested mode is landscape FSQ and it it also disabled,
       
  4136                 // still we use landscape FSQ because there is no choice.
       
  4137                 if ( ( aSuggestMode == EPluginInputModeNone ) ||
       
  4138                      ( disableLayouts & aSuggestMode ) )
       
  4139                     {
       
  4140                     aSuggestMode = EPluginInputModeFSQ; 
       
  4141                     }
       
  4142                 }
       
  4143             }
  3890             break;
  4144             break;
  3891         }
  4145         }
  3892 
  4146 
  3893      if (disableLayouts == 0)
  4147      if (disableLayouts == 0)
  3894         {
  4148         {
  4060         UpdateITUTIndicator();       
  4314         UpdateITUTIndicator();       
  4061         }
  4315         }
  4062     else
  4316     else
  4063         {
  4317         {
  4064         HideSpellEditor();
  4318         HideSpellEditor();
  4065         if (PluginInputMode() == EPluginInputModeFSQ ||
  4319         if ( PluginInputMode() == EPluginInputModeFSQ ||
  4066             PluginInputMode() == EPluginInputModeVkb ||
  4320              PluginInputMode() == EPluginInputModeVkb ||
  4067             PluginInputMode() == EPluginInputModeFingerHwr)
  4321              PluginInputMode() == EPluginInputModeFingerHwr ||
       
  4322              PluginInputMode() == EPluginInputModePortraitFSQ )
  4068             {
  4323             {
  4069             iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputCharacterPreview, 
  4324             iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputCharacterPreview, 
  4070                    iFepMan.FepShowVkbPreviewStatus());                 
  4325                    iFepMan.FepShowVkbPreviewStatus());                 
  4071             }
  4326             }
  4072       
  4327       
  4107          //set current case
  4362          //set current case
  4108         iCaseMan.SetCurrentCase(iCaseMan.CurrentCase());
  4363         iCaseMan.SetCurrentCase(iCaseMan.CurrentCase());
  4109         iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputCaseMode, 
  4364         iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputCaseMode, 
  4110                                            iCaseMan.CurrentCase());
  4365                                            iCaseMan.CurrentCase());
  4111         if ( PluginInputMode() == EPluginInputModeFSQ ||
  4366         if ( PluginInputMode() == EPluginInputModeFSQ ||
  4112              PluginInputMode() == EPluginInputModeFingerHwr)
  4367              PluginInputMode() == EPluginInputModeFingerHwr ||
       
  4368              PluginInputMode() == EPluginInputModePortraitFSQ )
  4113             {
  4369             {
  4114             SetPromptText( aCleanContent );
  4370             SetPromptText( aCleanContent );
  4115             }
  4371             }
  4116         }
  4372         }
  4117         iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputEnableSettingBtn, 
  4373         iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputEnableSettingBtn, 
  4143         }                                               
  4399         }                                               
  4144                                               
  4400                                               
  4145                                               
  4401                                               
  4146     iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputDimArrowKeys, 
  4402     iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputDimArrowKeys, 
  4147                                               enableArrowBtn);    
  4403                                               enableArrowBtn);    
  4148     if ( PluginInputMode() == EPluginInputModeFSQ )
  4404     if ( PluginInputMode() == EPluginInputModeFSQ ||
       
  4405          PluginInputMode() == EPluginInputModePortraitFSQ )
  4149     	{
  4406     	{
  4150         iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputDimEnterKey, 
  4407         iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputDimEnterKey, 
  4151         		                                  iFepMan.IsFindPaneEditor() );
  4408         		                                  iFepMan.IsFindPaneEditor() );
  4152     	}
  4409     	}
  4153 
  4410 
  4168     
  4425     
  4169     if ( PluginInputMode() != EPluginInputModeItut )
  4426     if ( PluginInputMode() != EPluginInputModeItut )
  4170         {
  4427         {
  4171         iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputWindowOpen, aOpenMode);
  4428         iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputWindowOpen, aOpenMode);
  4172         }
  4429         }
  4173     if(PluginInputMode() == EPluginInputModeItut 
  4430     if ( PluginInputMode() == EPluginInputModeItut 
  4174        || PluginInputMode() == EPluginInputModeFSQ
  4431           || PluginInputMode() == EPluginInputModeFSQ
  4175 	   || PluginInputMode() == EPluginInputModeFingerHwr)
  4432           || PluginInputMode() == EPluginInputModeFingerHwr 
       
  4433           || PluginInputMode() == EPluginInputModePortraitFSQ )
  4176         {
  4434         {
  4177         iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputInEditWordQueryDlg, iIsInEditWordQueryDlg);
  4435         iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputInEditWordQueryDlg, iIsInEditWordQueryDlg);
  4178         }    
  4436         }    
  4179     if ( PluginInputMode() == EPluginInputModeFSQ )
  4437     // For both landscape portrait FSQ mode, update FSQ indicator.
       
  4438     if ( PluginInputMode() == EPluginInputModeFSQ ||
       
  4439          PluginInputMode() == EPluginInputModePortraitFSQ )
  4180         {
  4440         {
  4181         UpdateFSQIndicator();
  4441         UpdateFSQIndicator();
  4182         }
  4442         }
  4183     }
  4443     }
  4184 
  4444 
  4625     return ret;  
  4885     return ret;  
  4626     }     
  4886     }     
  4627 
  4887 
  4628 void CAknFepPluginManager::UpdateFSQIndicator()    
  4888 void CAknFepPluginManager::UpdateFSQIndicator()    
  4629     {
  4889     {
  4630     if ( EPluginInputModeFSQ != PluginInputMode() )
  4890     // If it is not either portrait or landscape FSQ, return.
       
  4891     if ( !( EPluginInputModeFSQ == PluginInputMode() ||
       
  4892       	    EPluginInputModePortraitFSQ == PluginInputMode() ) )
  4631         {
  4893         {
  4632         return;
  4894         return;
  4633         }
  4895         }
  4634         
  4896         
  4635     TInt indicatorImgID;
  4897     TInt indicatorImgID;
  4798         {
  5060         {
  4799         if (!editorSCTResId || editorSCTResId == R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG)
  5061         if (!editorSCTResId || editorSCTResId == R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG)
  4800             {
  5062             {
  4801             editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_CHINESE;
  5063             editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_CHINESE;
  4802             }
  5064             }
  4803         }
  5065         }    
       
  5066     else if (FeatureManager::FeatureSupported(KFeatureIdKorean))
       
  5067         {
       
  5068         // Use the special sct resource file for Korean variant.
       
  5069         if (!editorSCTResId || editorSCTResId == R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG)
       
  5070             {
       
  5071             editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_KOREAN;
       
  5072             }
       
  5073         }    
  4804     else if (!editorSCTResId)
  5074     else if (!editorSCTResId)
  4805         {
  5075         {
  4806         editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG;
  5076         editorSCTResId = R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG;
  4807         }
  5077         }
  4808  
  5078  
  5116 			}
  5386 			}
  5117 	
  5387 	
  5118 		TRAP_IGNORE(iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputCaseMode, 
  5388 		TRAP_IGNORE(iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputCaseMode, 
  5119 		                                                     iCaseMan.CurrentCase()));	
  5389 		                                                     iCaseMan.CurrentCase()));	
  5120 		UpdateITUTIndicator();
  5390 		UpdateITUTIndicator();
  5121 	    if ( PluginInputMode() == EPluginInputModeFSQ )
  5391     if ( PluginInputMode() == EPluginInputModeFSQ ||
       
  5392          PluginInputMode() == EPluginInputModePortraitFSQ )
  5122 	        {
  5393 	        {
  5123 			UpdateFSQIndicator();
  5394 			UpdateFSQIndicator();
  5124 	        }
  5395 	        }
  5125 		}	
  5396 		}	
  5126 	}
  5397 	}
  5186             context.iContext = KHWR_HLP_MAIN_VIEW;    
  5457             context.iContext = KHWR_HLP_MAIN_VIEW;    
  5187             }
  5458             }
  5188         break;        
  5459         break;        
  5189         case EPluginInputModeVkb:
  5460         case EPluginInputModeVkb:
  5190         case EPluginInputModeFSQ:
  5461         case EPluginInputModeFSQ:
       
  5462         case EPluginInputModePortraitFSQ:	
  5191             {
  5463             {
  5192             context.iContext = KVQWERTY_HLP_MAIN_VIEW;    
  5464             context.iContext = KVQWERTY_HLP_MAIN_VIEW;    
  5193             }
  5465             }
  5194         break;        
  5466         break;        
  5195         default:
  5467         default:
  5241     if(!iPenInputSvrConnected ) 
  5513     if(!iPenInputSvrConnected ) 
  5242         {
  5514         {
  5243         return;
  5515         return;
  5244         }
  5516         }
  5245 
  5517 
  5246     if (!(PluginInputMode() == EPluginInputModeItut ||
  5518     if ( ! ( PluginInputMode() == EPluginInputModeItut ||
  5247         PluginInputMode() == EPluginInputModeFSQ ||
  5519              PluginInputMode() == EPluginInputModeFSQ ||
  5248         PluginInputMode() == EPluginInputModeFingerHwr))
  5520              PluginInputMode() == EPluginInputModeFingerHwr ||
       
  5521              PluginInputMode() == EPluginInputModePortraitFSQ ) )
  5249         {
  5522         {
  5250         return;
  5523         return;
  5251         }
  5524         }
  5252 
  5525 
  5253     //save current Fep aware editor
  5526     //save current Fep aware editor
  5359         {
  5632         {
  5360         SyncFepAwareText();
  5633         SyncFepAwareText();
  5361         }
  5634         }
  5362     }
  5635     }
  5363 #endif // RD_SCALABLE_UI_V2
  5636 #endif // RD_SCALABLE_UI_V2
       
  5637 
       
  5638 // -----------------------------------------------------------------------------
       
  5639 // Update editor state according to current ui state
       
  5640 // -----------------------------------------------------------------------------
       
  5641 //
       
  5642 void CAknFepPluginManager::SetEdwinFlagsByUiStatus( TBool aOpened )
       
  5643     {    
       
  5644     MCoeFepAwareTextEditor* edwin( iFepMan.FepAwareTextEditor() );
       
  5645     
       
  5646     TInt uiStatusFlags( EAknEditorFlagTouchInputModeOpened 
       
  5647                         | EAknEditorFlagHideTextView );
       
  5648     
       
  5649     if ( aOpened ) 
       
  5650         {
       
  5651         // if another editor gets focus, remove flags from previous editor.
       
  5652         if ( iEdwin != edwin )
       
  5653             {                
       
  5654             SetAknEdwinFlags( iEdwin, uiStatusFlags, EFalse );
       
  5655             }
       
  5656         
       
  5657         // set flags to current focused editor
       
  5658         SetAknEdwinFlags( edwin, uiStatusFlags, ETrue );
       
  5659         
       
  5660         //save reference to focused editor
       
  5661         iEdwin = edwin;
       
  5662         }
       
  5663     else 
       
  5664         {            
       
  5665         SetAknEdwinFlags( edwin, uiStatusFlags, EFalse );
       
  5666         iEdwin = NULL;
       
  5667         }
       
  5668     }
       
  5669 
       
  5670 // -----------------------------------------------------------------------------
       
  5671 // Update state flags of specified editor
       
  5672 // -----------------------------------------------------------------------------
       
  5673 //
       
  5674 void CAknFepPluginManager::SetAknEdwinFlags( MCoeFepAwareTextEditor* aEdwin, 
       
  5675                                              TInt aFlags, TBool aSet )
       
  5676     {
       
  5677     if ( aEdwin && aEdwin->Extension1() )
       
  5678         {
       
  5679         CAknEdwinState* edwinState ( static_cast<CAknEdwinState*>( 
       
  5680                                      aEdwin->Extension1()->State( KNullUid ) ) );
       
  5681         if ( edwinState )
       
  5682             {
       
  5683             TInt edwinFlags( edwinState->Flags() );
       
  5684             if ( aSet )
       
  5685                 {
       
  5686                 edwinFlags |= aFlags;
       
  5687                 }
       
  5688             else
       
  5689                 {
       
  5690                 edwinFlags &= ~aFlags;
       
  5691                 }
       
  5692             
       
  5693             edwinState->SetFlags( edwinFlags );
       
  5694             }
       
  5695         }
       
  5696     }
  5364 
  5697 
  5365 void CAknFepPluginManager::InformMfneUiStatusL( TBool aOpened )
  5698 void CAknFepPluginManager::InformMfneUiStatusL( TBool aOpened )
  5366     {
  5699     {
  5367     if ( iMfne && ( iMfneChanged || !aOpened ))
  5700     if ( iMfne && ( iMfneChanged || !aOpened ))
  5368         {
  5701         {
  5420         iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputEnableSettingBtn, 
  5753         iCurrentPluginInputFepUI->HandleCommandL( ECmdPenInputEnableSettingBtn, 
  5421 	                                                  IsEnableSettingBtn() );
  5754 	                                                  IsEnableSettingBtn() );
  5422 		}
  5755 		}
  5423 		
  5756 		
  5424     //if it's in global notes, show it.
  5757     //if it's in global notes, show it.
  5425     if(EPluginInputModeItut == PluginInputMode() ||
  5758     if ( EPluginInputModeItut == PluginInputMode() ||
  5426        EPluginInputModeFSQ == PluginInputMode() ||
  5759          EPluginInputModeFSQ == PluginInputMode() ||
  5427        EPluginInputModeFingerHwr == PluginInputMode())      
  5760          EPluginInputModeFingerHwr == PluginInputMode() ||
       
  5761          EPluginInputModePortraitFSQ == PluginInputMode() )    
  5428 		{
  5762 		{
  5429 		if(iInGlobleNoteEditor && iPenInputSvrConnected)
  5763 		if(iInGlobleNoteEditor && iPenInputSvrConnected)
  5430 			{
  5764 			{
  5431 			iPenInputServer.ActivatePeninputInNotesL();
  5765 			iPenInputServer.ActivatePeninputInNotesL();
  5432 	        return ETrue;	
  5766 	        return ETrue;	
  5672 // -----------------------------------------------------------------------------
  6006 // -----------------------------------------------------------------------------
  5673 //    
  6007 //    
  5674 TBool CAknFepPluginManager::IsSupportITIOnFSQ()
  6008 TBool CAknFepPluginManager::IsSupportITIOnFSQ()
  5675     {
  6009     {
  5676 #ifdef RD_INTELLIGENT_TEXT_INPUT
  6010 #ifdef RD_INTELLIGENT_TEXT_INPUT
  5677     if ( iPluginInputMode == EPluginInputModeFSQ
  6011     if ( ( iPluginInputMode == EPluginInputModeFSQ ||
       
  6012            iPluginInputMode == EPluginInputModePortraitFSQ )
  5678          // Exclude non Latin mode 
  6013          // Exclude non Latin mode 
  5679          && iFepMan.InputMode() == ELatin
  6014          && iFepMan.InputMode() == ELatin
  5680          // Exclude accent range
  6015          // Exclude accent range
  5681          && ( iPluginPrimaryRange == ERangeNative 
  6016          && ( iPluginPrimaryRange == ERangeNative 
  5682               || iPluginPrimaryRange == ERangeEnglish
  6017               || iPluginPrimaryRange == ERangeEnglish
  6074     
  6409     
  6075     iPenInputSvrConnected = ETrue;                     
  6410     iPenInputSvrConnected = ETrue;                     
  6076     TRAP_IGNORE(ActivatePenInputL());
  6411     TRAP_IGNORE(ActivatePenInputL());
  6077     }
  6412     }
  6078 
  6413 
       
  6414 // -----------------------------------------------------------------------------
       
  6415 // Handling the menu cmd for changing the input mode
       
  6416 // -----------------------------------------------------------------------------
       
  6417 //
       
  6418 void CAknFepPluginManager::ProcessChangingInputModeCmdL(TInt aInputMode)
       
  6419     {
       
  6420     // Save iCurEditor and iCurMFNECap to temp variable the curEditor 
       
  6421     // and CurMFNECap respectively before calling ResetMenuState 
       
  6422     // since this function will reset iCurEditor
       
  6423     // but later TryChangePluginInputModeByModeL() will use this as 
       
  6424     // an flag to identify whether the mode to be opened is split one. 
       
  6425     MCoeFepAwareTextEditor* savedCurEditor = iCurEditor;
       
  6426     TUint savedCurMFNECap = iCurMFNECap;
       
  6427     
       
  6428     
       
  6429     //Here calling this function is to reset menu state when the focus change 
       
  6430     // caused by the screen orientation, in the normal circumstance the foucus
       
  6431     // change should not occur while the screen orientation is handling. 
       
  6432     // So directly resetting menu state to avoid the above case, 
       
  6433     // preconditon is that the option menu must be closed.
       
  6434     
       
  6435     // Reset the menu state to clear iInMenu to process focus change message
       
  6436     // following funciton will set iCurEditor to NULL
       
  6437     ResetMenuState(EFalse);
       
  6438     ClosePluginInputModeL(ETrue);  
       
  6439     iFepMan.TryCloseUiL(); 
       
  6440 
       
  6441     // we have to resore iCurEditor's value which was saved before calling 
       
  6442     // ResetMenuState since the iCurEditor will be used as a falg to identify 
       
  6443     // whether the the mode to be opened is split one.
       
  6444     // if it would be NULL, TryChangePluginInputModeByModeL will first open 
       
  6445     // the Normal FSQ/VITUT, and then after a focus change
       
  6446     // [the menu is really dismissed], 
       
  6447     // the correct Split FSQ/VITT will be opened, so the flicker will be seen. 
       
  6448     iCurEditor = savedCurEditor;
       
  6449     iCurMFNECap = savedCurMFNECap;
       
  6450      
       
  6451     TryChangePluginInputModeByModeL((TPluginInputMode)aInputMode, 
       
  6452                                     EPenInputOpenManually,
       
  6453                                     ERangeInvalid);
       
  6454     iCurMFNECap = 0;
       
  6455     iCurEditor = NULL;
       
  6456     }
       
  6457 
  6079 CConnectAo::CConnectAo(CAknFepPluginManager* aClient) 
  6458 CConnectAo::CConnectAo(CAknFepPluginManager* aClient) 
  6080                 : CActive(CActive::EPriorityStandard),
  6459                 : CActive(CActive::EPriorityStandard),
  6081                   iClient(aClient)
  6460                   iClient(aClient)
  6082     {
  6461     {
  6083     CActiveScheduler::Add(this);
  6462     CActiveScheduler::Add(this);