fep/aknfep/src/AknFepPluginManager.cpp
branchRCL_3
changeset 16 857bebeecec0
parent 15 6c2c2d3ab788
child 18 b1ea1642412e
--- a/fep/aknfep/src/AknFepPluginManager.cpp	Wed Jun 09 10:03:19 2010 +0300
+++ b/fep/aknfep/src/AknFepPluginManager.cpp	Mon Jun 21 16:02:35 2010 +0300
@@ -827,6 +827,15 @@
 //                OnPenInputServerKeyEventL(pBuf);                
                 }
                 break;
+            case ESignalDeactivateSprite:
+            	{
+                ClosePluginInputUiL( ETrue );
+                if(iPenInputSvrConnected ) //lost foreground
+                    {
+                    iPenInputServer.LoseForeground();
+                    }
+            	}
+            	break;
             default:
                 break;
             }
@@ -1525,8 +1534,8 @@
 // 
 void CAknFepPluginManager::OnResourceChangedL( TInt aType )
     { 
-    if ( !iCurrentPluginInputFepUI || !iPenInputServer.IsForeground() || 
-         iPluginInputMode == EPluginInputModeNone )
+    if ( !iCurrentPluginInputFepUI 
+    	 || iPluginInputMode == EPluginInputModeNone )
         {
         return;
         }
@@ -1536,23 +1545,45 @@
 	     && !iSharedData.AutoRotateEnabled() )
         {
         return;
-        }
-        
+        }    
+
+    TInt preInputMode = iPluginInputMode;
+    if ( iSharedData.AutoRotateEnabled() && 
+        ( preInputMode == EPluginInputModeFSQ || preInputMode == EPluginInputModeItut ) )
+        {
+        // Calculate current input mode by orientation.
+        // even though peninputserver is brought to backgroud, 
+        // the value for current input mode also needs to be ready. 
+        // For example, when open task switcher, pen ui is invisible and peniput server is background, 
+        // then switch orientation...
+        // After that when focus go back to editor, config FEP must be done before pen ui open,
+        // And FEP must know for which kind of input method it configur.        
+        TPixelsTwipsAndRotation size; 
+        CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);        
+        iPluginInputMode = ( size.iPixelSize.iWidth < size.iPixelSize.iHeight ) ? 
+            EPluginInputModeItut : EPluginInputModeFSQ;            
+        }
+    
+    if ( !iPenInputServer.IsForeground() )
+	    {
+	    return;
+	    }
+
     TBool setResChange = EFalse;
     
-    if (iPluginInputMode == EPluginInputModeItut || 
-         iPluginInputMode == EPluginInputModeFSQ ||
-        iPluginInputMode == EPluginInputModeFingerHwr)
+    if ( preInputMode == EPluginInputModeItut || 
+    	 preInputMode == EPluginInputModeFSQ ||
+    	 preInputMode == EPluginInputModeFingerHwr )
         {
         setResChange = ETrue;
-        iPenInputServer.SetResourceChange(ETrue);    
+        iPenInputServer.SetResourceChange(ETrue);           
         }
     
     iResourceChange = ETrue;   
 
     TBool needToChangeInputMode = ETrue;
     if ( iSharedData.AutoRotateEnabled() && 
-        ( iPluginInputMode == EPluginInputModeFSQ || iPluginInputMode == EPluginInputModeItut ) )
+         ( preInputMode == EPluginInputModeFSQ || preInputMode == EPluginInputModeItut ) )
         {
         if ( IsSpellVisible() )
             {
@@ -1561,22 +1592,16 @@
             iFepMan.HandleChangeInFocusForSettingFep();
             iFepMan.SetNotifyPlugin( ETrue );
             }
-        TPixelsTwipsAndRotation size; 
-        CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
-
-        TPluginInputMode inputModeBeforeOri = ( size.iPixelSize.iWidth < size.iPixelSize.iHeight ) ? 
-            EPluginInputModeItut : EPluginInputModeFSQ;
         
-            if ( iPenInputMenu && iPenInputMenu->IsShowing() )
-                {
-                iPenInputMenu->Hide();
-                ResetMenuState(EFalse);
-                }
+         if ( iPenInputMenu && iPenInputMenu->IsShowing() )
+             {
+             iPenInputMenu->Hide();
+             ResetMenuState(EFalse);
+             }
             
-        if(inputModeBeforeOri != iPluginInputMode)
-            {
-            iPluginInputMode = inputModeBeforeOri; 
-            ClosePluginInputModeL(ETrue);               
+        if( preInputMode != iPluginInputMode )
+            {            
+            ClosePluginInputModeL(ETrue);
             iFepMan.TryCloseUiL();
             }
         else
@@ -1591,6 +1616,16 @@
                                      EPenInputOpenManually,
                                      ERangeInvalid ); 
 		}
+    else 
+        {
+        if ( !NotifyInGlobalNoteEditorL() )
+            {
+            iFocuschangedForSpellEditor = EFalse; 
+            iCurrentPluginInputFepUI->ActivateUI(); 
+            iNeedFetchDimState = ETrue;
+            }
+        }
+
     
     /*if(size.iPixelSize.iWidth > size.iPixelSize.iHeight ) //landscape
         {