fep/aknfep/src/AknFepPluginManager.cpp
changeset 13 3b79bedfdc20
parent 0 eb1f2e154e89
child 17 9ee990de1aa7
child 24 fc42a86c98e3
equal deleted inserted replaced
0:eb1f2e154e89 13:3b79bedfdc20
    39 #include <AknFepPluginManager.h>
    39 #include <AknFepPluginManager.h>
    40 #include <aknfeppeninputimeplugin.h>
    40 #include <aknfeppeninputimeplugin.h>
    41 #include <UikonInternalPSKeys.h> // KUikGlobalNotesAllowed
    41 #include <UikonInternalPSKeys.h> // KUikGlobalNotesAllowed
    42 #include <AvkonInternalCRKeys.h>    // KAknQwertyInputModeActive
    42 #include <AvkonInternalCRKeys.h>    // KAknQwertyInputModeActive
    43 #include <hlplch.h>
    43 #include <hlplch.h>
    44 #include <peninputgsinterface.h>
    44 //#include <peninputgsinterface.h>
    45 #include <AknFep.rsg>
    45 #include <AknFep.rsg>
    46 #include <avkon.rsg>
    46 #include <avkon.rsg>
    47 #include <AknIndicatorContainer.h>  //CAknIndicatorContainer
    47 #include <AknIndicatorContainer.h>  //CAknIndicatorContainer
    48 #include <StringLoader.h>
    48 #include <StringLoader.h>
    49 #include <peninputgenericitutcustomization.h>
    49 #include <peninputgenericitutcustomization.h>
    72 #include <eikgted.h> 
    72 #include <eikgted.h> 
    73 
    73 
    74 #include <apgwgnam.h>
    74 #include <apgwgnam.h>
    75 
    75 
    76 #include <PtiKeyMappings.h>
    76 #include <PtiKeyMappings.h>
    77 #include <aknpriv.hrh>
    77 #include <AknPriv.hrh>
    78 
    78 
    79 // Constants
    79 // Constants
    80 const TInt KCursorBlinkPerioid = 10000;//300000; // five tenth of a second * 2
    80 const TInt KCursorBlinkPerioid = 10000;//300000; // five tenth of a second * 2
    81 const TInt KMaxServerDataLength = 50;
    81 const TInt KMaxServerDataLength = 50;
    82 const TUint KVkbParagraphSeparator = 0x2029;
    82 const TUint KVkbParagraphSeparator = 0x2029;
   181 // (other items were commented in a header)
   181 // (other items were commented in a header)
   182 // ---------------------------------------------------------------------------
   182 // ---------------------------------------------------------------------------
   183 //     
   183 //     
   184 CAknFepPluginManager::~CAknFepPluginManager()
   184 CAknFepPluginManager::~CAknFepPluginManager()
   185     {  
   185     {  
   186     if ( iConnectAo )
       
   187     	{
       
   188     	iConnectAo->Cancel();
       
   189     	delete iConnectAo;
       
   190     	}
       
   191     
       
   192     delete iAdjustDataQueryTimer;
   186     delete iAdjustDataQueryTimer;
   193 
   187 
   194     iCurrentPluginInputFepUI = NULL; // why not delete????
   188     iCurrentPluginInputFepUI = NULL; // why not delete????
   195     delete iPenInputMenu;
   189     delete iPenInputMenu;
   196     
   190     
   226     iSendAllList.iCandidates.Reset();
   220     iSendAllList.iCandidates.Reset();
   227     iOpenWindowList.Close();
   221     iOpenWindowList.Close();
   228     iEventData.Close();    
   222     iEventData.Close();    
   229     iPreCaption.Close();
   223     iPreCaption.Close();
   230     
   224     
   231     ClosePeninputSetting();
   225 	  ClosePeninputSetting();
   232     }
   226     }
   233     
   227     
   234 // ---------------------------------------------------------------------------
   228 // ---------------------------------------------------------------------------
   235 // CAknFepPluginManager::CAknFepPluginManager
   229 // CAknFepPluginManager::CAknFepPluginManager
   236 // (other items were commented in a header)
   230 // (other items were commented in a header)
   271     
   265     
   272     RThread client;
   266     RThread client;
   273     iHasSWEventCap = client.HasCapability(ECapabilitySwEvent);
   267     iHasSWEventCap = client.HasCapability(ECapabilitySwEvent);
   274     client.Close();
   268     client.Close();
   275     iAvkonRepository = CRepository::NewL( KCRUidAvkon ); 
   269     iAvkonRepository = CRepository::NewL( KCRUidAvkon ); 
   276     
       
   277     iConnectAo = new (ELeave)CConnectAo(this);
       
   278     }
   270     }
   279 
   271 
   280 // -----------------------------------------------------------------------------
   272 // -----------------------------------------------------------------------------
   281 // CAknFepPluginManager::ActivatePenInputL
   273 // CAknFepPluginManager::ActivatePenInputL
   282 // Change to default plugin input mode
   274 // Change to default plugin input mode
   287     {
   279     {
   288     if( !iPenInputSvrConnected || !iPenInputServer.IsVisible() || iPenInputServer.IsDimmed() )
   280     if( !iPenInputSvrConnected || !iPenInputServer.IsVisible() || iPenInputServer.IsDimmed() )
   289         {
   281         {
   290         if( iFepMan.FepAwareTextEditor() )
   282         if( iFepMan.FepAwareTextEditor() )
   291             {
   283             {
       
   284 			iPreferredUiMode = ETrue;
   292             TryChangePluginInputModeByModeL((TPluginInputMode)(iSharedData.PluginInputMode()),
   285             TryChangePluginInputModeByModeL((TPluginInputMode)(iSharedData.PluginInputMode()),
   293                                             EPenInputOpenManually,
   286                                             EPenInputOpenManually,
   294                                             ERangeInvalid);
   287                                             ERangeInvalid);
   295             }
   288             }
   296         }    
   289         }    
   297     iFepMan.PtiEngine()->CancelTimerActivity();    
   290     iFepMan.PtiEngine()->CancelTimerActivity();    
   298     }
   291     }
   299 
   292 
   300 	
       
   301 // ---------------------------------------------------------------------------
   293 // ---------------------------------------------------------------------------
   302 // CAknFepPluginManager::DeactivatePenInputL
   294 // CAknFepPluginManager::DeactivatePenInputL
   303 // (other items were commented in a header)
   295 // (other items were commented in a header)
   304 // ---------------------------------------------------------------------------
   296 // ---------------------------------------------------------------------------
   305 // 
   297 // 
   971     if (! ConnectServer() )
   963     if (! ConnectServer() )
   972         {
   964         {
   973         return EFalse;
   965         return EFalse;
   974         }
   966         }
   975     
   967     
   976     
       
   977     if ((iPenInputServer.PreferredUiMode() != EPluginInputModeNone) && iPreferredUiMode )
   968     if ((iPenInputServer.PreferredUiMode() != EPluginInputModeNone) && iPreferredUiMode )
   978         {
   969         {
   979         aSuggestMode = iPenInputServer.PreferredUiMode();
   970         aSuggestMode = iPenInputServer.PreferredUiMode();
   980         }
   971         }
   981         
   972         
  1098             iIndicatorTextID = 0;           
  1089             iIndicatorTextID = 0;           
  1099             }
  1090             }
  1100 
  1091 
  1101         iPluginInputMode = (TPluginInputMode)iLangMan.CurrentImePlugin()->CurrentMode();
  1092         iPluginInputMode = (TPluginInputMode)iLangMan.CurrentImePlugin()->CurrentMode();
  1102 
  1093 
       
  1094         //following codes is used to tell MFNE editor the Touch Input 
       
  1095         //has been opened. Because MFNE editor has no editorstate, so 
       
  1096         //use this way to implement this.
       
  1097         if ( iFepMan.IsMfneEditor() )
       
  1098             {
       
  1099             MCoeFepAwareTextEditor* mfne( iFepMan.FepAwareTextEditor() );
       
  1100             iMfneChanged = ( iMfne != mfne );
       
  1101             iMfne = mfne;
       
  1102             InformMfneUiStatusL( ETrue );  
       
  1103             }
  1103 
  1104 
  1104         // Addition for ITI features on FSQ
  1105         // Addition for ITI features on FSQ
  1105         // Before open touch window, need to set iPluginPrimaryRange = 0
  1106         // Before open touch window, need to set iPluginPrimaryRange = 0
  1106         // which means use the default range.
  1107         // which means use the default range.
  1107         iPluginPrimaryRange = 0;
  1108         iPluginPrimaryRange = 0;
  1108         
  1109         
  1109         InitializePluginInputL(aOpenMode, aSuggestRange, cleanContent);
  1110         InitializePluginInputL(aOpenMode, aSuggestRange, cleanContent);
  1110 
       
  1111         //following codes is used to tell MFNE editor the Touch Input 
       
  1112         //has been opened. Because MFNE editor has no editorstate, so 
       
  1113         //use this way to implement this.
       
  1114         if ( iFepMan.IsMfneEditor() )
       
  1115             {
       
  1116             MCoeFepAwareTextEditor* mfne( iFepMan.FepAwareTextEditor() );
       
  1117             iMfneChanged = ( iMfne != mfne );
       
  1118             iMfne = mfne;
       
  1119             InformMfneUiStatusL( ETrue );  
       
  1120             }
       
  1121         
  1111         
  1122         //save plugin input mode to repository
  1112         //save plugin input mode to repository
  1123         if( iPenInputServer.PreferredUiMode() == EPluginInputModeNone )
  1113         if( iPenInputServer.PreferredUiMode() == EPluginInputModeNone )
  1124             {
  1114             {
  1125             //do not remember application set input mode
  1115             //do not remember application set input mode
  1126             iSharedData.SetPluginInputMode(iPluginInputMode);
  1116             iSharedData.SetPluginInputMode(iPluginInputMode);
  1127             }
  1117             }
  1128             
  1118             
  1129         if (CurrentFepInputUI())
  1119         if (CurrentFepInputUI())
  1130            	{
  1120            	{
       
  1121            	CurrentFepInputUI()->SetInputLanguageL((TLanguage)inputLang);
  1131            	CurrentFepInputUI()->SetMode(iFepMan.InputMode(), ETrue, EFalse);		
  1122            	CurrentFepInputUI()->SetMode(iFepMan.InputMode(), ETrue, EFalse);		
  1132            	}
  1123            	}
  1133 			
  1124 			
  1134         if(!iOrientationChangedfromUI)
  1125         if(!iOrientationChangedfromUI)
  1135 		    {
  1126 		    {
  1229 //
  1220 //
  1230 void CAknFepPluginManager::ClosePluginInputUiL(TBool aResetState)
  1221 void CAknFepPluginManager::ClosePluginInputUiL(TBool aResetState)
  1231     {
  1222     {
  1232     // For addition of ITI features on FSQ, 
  1223     // For addition of ITI features on FSQ, 
  1233     // need to restore some values stored before opening FSQ    
  1224     // need to restore some values stored before opening FSQ    
  1234     
       
  1235     iConnectAo->Cancel();
       
  1236     ResetItiStateL();
  1225     ResetItiStateL();
  1237 
  1226 
  1238     if( iPenInputSvrConnected )
  1227     if( iPenInputSvrConnected )
  1239         {
  1228         {
  1240         if( iCurrentPluginInputFepUI )
  1229         if( iCurrentPluginInputFepUI )
  2685 // ---------------------------------------------------------------------------
  2674 // ---------------------------------------------------------------------------
  2686 // CAknFepPluginManager::LaunchPenInputLanguageSelectionL
  2675 // CAknFepPluginManager::LaunchPenInputLanguageSelectionL
  2687 // (other items were commented in a header)
  2676 // (other items were commented in a header)
  2688 // ---------------------------------------------------------------------------
  2677 // ---------------------------------------------------------------------------
  2689 //     
  2678 //     
  2690 void CAknFepPluginManager::LaunchPenInputLanguageSelectionL( TBool aLaunchedByTouchWin )
  2679 void CAknFepPluginManager::LaunchPenInputLanguageSelectionL( TBool /*aLaunchedByTouchWin*/ )
  2691     {
  2680     {
  2692     //record langauge
  2681     //record langauge
  2693     TInt oldLang = iSharedData.InputTextLanguage();
  2682 //    TInt oldLang = iSharedData.InputTextLanguage();
  2694     CPenInputGSInterface*  setting = CPenInputGSInterface::NewL();
  2683 //    CPenInputGSInterface*  setting = CPenInputGSInterface::NewL();
  2695     CleanupStack::PushL(setting);
  2684 //    CleanupStack::PushL(setting);
  2696     iFepMan.SetCancelPopupInQwerty( aLaunchedByTouchWin );
  2685 //    iFepMan.SetCancelPopupInQwerty( aLaunchedByTouchWin );
  2697     setting->ShowInputLanguagePageL();
  2686 //    setting->ShowInputLanguagePageL();
  2698     iFepMan.SetCancelPopupInQwerty( EFalse );
  2687 //    iFepMan.SetCancelPopupInQwerty( EFalse );
  2699     CleanupStack::PopAndDestroy(setting); 
  2688 //    CleanupStack::PopAndDestroy(setting); 
  2700     TInt inputLanguage = iSharedData.InputTextLanguage();
  2689 //    TInt inputLanguage = iSharedData.InputTextLanguage();
  2701     if( oldLang != inputLanguage)
  2690 //    if( oldLang != inputLanguage)
  2702         {
  2691 //        {
  2703         iSharedData.SetInputTextLanguage(inputLanguage);
  2692 //        iSharedData.SetInputTextLanguage(inputLanguage);
  2704         iFepMan.ChangeInputLanguageL(inputLanguage);
  2693 //        iFepMan.ChangeInputLanguageL(inputLanguage);
  2705         iFepMan.SetFlag( CAknFepManager::EFlagNewSharedDataInputLanguage 
  2694 //        iFepMan.SetFlag( CAknFepManager::EFlagNewSharedDataInputLanguage 
  2706             | CAknFepManager::EFlagNewSharedDataInputMode );
  2695 //            | CAknFepManager::EFlagNewSharedDataInputMode );
  2707 
  2696 //
  2708         }
  2697 //        }
  2709     }        
  2698     }        
  2710 
  2699 
  2711 // ---------------------------------------------------------------------------
  2700 // ---------------------------------------------------------------------------
  2712 // CAknFepPluginManager::LaunchPenInputRecognitionWithDictionarySelectionL
  2701 // CAknFepPluginManager::LaunchPenInputRecognitionWithDictionarySelectionL
  2713 // (other items were commented in a header)
  2702 // (other items were commented in a header)
  2714 // ---------------------------------------------------------------------------
  2703 // ---------------------------------------------------------------------------
  2715 //     
  2704 //     
  2716 void CAknFepPluginManager::LaunchPenInputRecognitionWithDictionarySelectionL()
  2705 void CAknFepPluginManager::LaunchPenInputRecognitionWithDictionarySelectionL()
  2717     {
  2706     {
  2718     //record langauge
  2707     //record langauge
  2719     CPenInputGSInterface*  setting = CPenInputGSInterface::NewL();
  2708 //    CPenInputGSInterface*  setting = CPenInputGSInterface::NewL();
  2720     CleanupStack::PushL(setting);
  2709 //    CleanupStack::PushL(setting);
  2721     setting->ShowRecognitionWithDictionaryL();
  2710 //    setting->ShowRecognitionWithDictionaryL();
  2722     CleanupStack::PopAndDestroy(setting); 
  2711 //    CleanupStack::PopAndDestroy(setting); 
  2723     TInt inputLanguage = iSharedData.InputTextLanguage();
  2712 //    TInt inputLanguage = iSharedData.InputTextLanguage();
  2724     }  
  2713     }  
  2725 
  2714 
  2726 // ---------------------------------------------------------------------------
  2715 // ---------------------------------------------------------------------------
  2727 // CAknFepPluginManager::LaunchPenInputSettingL
  2716 // CAknFepPluginManager::LaunchPenInputSettingL
  2728 // (other items were commented in a header)
  2717 // (other items were commented in a header)
  2729 // ---------------------------------------------------------------------------
  2718 // ---------------------------------------------------------------------------
  2730 // 
  2719 // 
  2731 void CAknFepPluginManager::LaunchPenInputSettingL()
  2720 void CAknFepPluginManager::LaunchPenInputSettingL()
  2732     {
  2721     {
  2733     //record langauge
  2722     //record langauge
  2734     TInt oldLang = iSharedData.InputTextLanguage();
  2723 //    TInt oldLang = iSharedData.InputTextLanguage();
  2735     if ( !iGsInterface )
  2724 //    if ( !iGsInterface )
  2736         {
  2725 //        {
  2737         iGsInterface = CPenInputGSInterface::NewL();
  2726 //        iGsInterface = CPenInputGSInterface::NewL();
  2738         }    
  2727 //        }    
  2739     iGsInterface->ShowMainViewL();
  2728 //    iGsInterface->ShowMainViewL();
  2740     TInt inputLanguage = iSharedData.InputTextLanguage();
  2729 //    TInt inputLanguage = iSharedData.InputTextLanguage();
  2741     if( oldLang != inputLanguage)
  2730 //    if( oldLang != inputLanguage)
  2742         {
  2731 //        {
  2743         iFepMan.ChangeInputLanguageL(inputLanguage);
  2732 //        iFepMan.ChangeInputLanguageL(inputLanguage);
  2744         }
  2733 //        }
  2745 
  2734 
  2746     }     
  2735     }     
  2747 
  2736 
  2748 // -----------------------------------------------------------------------------
  2737 // -----------------------------------------------------------------------------
  2749 // CAknFepManager::ParseInputContextContent
  2738 // CAknFepManager::ParseInputContextContent
  3409 //     
  3398 //     
  3410 TBool CAknFepPluginManager::ConnectServer()
  3399 TBool CAknFepPluginManager::ConnectServer()
  3411     {
  3400     {
  3412     if(!iPenInputSvrConnected)
  3401     if(!iPenInputSvrConnected)
  3413         {
  3402         {
  3414         if(!iConnectAo->IsActive())
  3403         TInt err = iPenInputServer.Connect();
  3415             {
  3404         //iPenInputServer.AddPeninputServerObserverL(this); //always add the handler
  3416             iConnectAo->RequestConnect();
  3405         if( KErrNone != err )
  3417             iPenInputServer.ConnectAsyc(iConnectAo->RequestStatus());
  3406             {
  3418             }
  3407             iFepMan.UiInterface()->TouchPaneSetInputMethodIconActivated(EFalse);
  3419         // vv 
  3408                 
  3420         return EFalse;
  3409             return EFalse;               
       
  3410             }
       
  3411         TRAP_IGNORE(iPenInputServer.AddPeninputServerObserverL(this)); //always add the handler            
       
  3412         
       
  3413         iPenInputSvrConnected = ETrue;                      
  3421         }
  3414         }
  3422 
  3415 
  3423     iPenInputServer.SetForeground(iOpenPenUiFlag);
  3416     iPenInputServer.SetForeground(iOpenPenUiFlag);
  3424     
  3417     
  3425     return ETrue;
  3418     return ETrue;
  3730             //read resource from resource
  3723             //read resource from resource
  3731             HBufC* keymapRes = HBufC::NewL(2);
  3724             HBufC* keymapRes = HBufC::NewL(2);
  3732             TLocale locale;
  3725             TLocale locale;
  3733             TChar decimalSep = locale.DecimalSeparator(); 
  3726             TChar decimalSep = locale.DecimalSeparator(); 
  3734             TChar minusSign ='-'; 
  3727             TChar minusSign ='-'; 
  3735 
  3728             
  3736             keymapRes->Des().Append(decimalSep);
  3729             keymapRes->Des().Append(decimalSep);
  3737             keymapRes->Des().Append(minusSign);
  3730             keymapRes->Des().Append(minusSign);
  3738 
  3731 
  3739             if( keymapRes )
  3732             CleanupStack::PushL(keymapRes);
  3740                 {
  3733             iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputEditorCustomNumericKeyMap,
  3741                 CleanupStack::PushL(keymapRes);
       
  3742                 iCurrentPluginInputFepUI->HandleCommandL(ECmdPenInputEditorCustomNumericKeyMap,
       
  3743                                                     reinterpret_cast<TInt>(keymapRes) );
  3734                                                     reinterpret_cast<TInt>(keymapRes) );
  3744                 CleanupStack::PopAndDestroy(keymapRes);
  3735             CleanupStack::PopAndDestroy(keymapRes);
  3745                 return;
  3736             return;
  3746                 }
       
  3747             }
  3737             }
  3748 
  3738 
  3749         iCurrentPluginInputFepUI->SetNumberModeKeyMappingL(EAknEditorPlainNumberModeKeymap);
  3739         iCurrentPluginInputFepUI->SetNumberModeKeyMappingL(EAknEditorPlainNumberModeKeymap);
  3750         }
  3740         }
  3751     }    
  3741     }    
  4904     return editingState;
  4894     return editingState;
  4905     }
  4895     }
  4906 
  4896 
  4907 void CAknFepPluginManager::ClosePeninputSetting()
  4897 void CAknFepPluginManager::ClosePeninputSetting()
  4908     {
  4898     {
  4909     if ( iGsInterface )
  4899 //    if ( iGsInterface )
  4910         {
  4900 //        {
  4911         delete iGsInterface;
  4901 //        delete iGsInterface;
  4912         iGsInterface = NULL;
  4902 //        iGsInterface = NULL;
  4913         }
  4903 //        }
  4914     }
  4904     }
  4915 
  4905 
  4916 // ---------------------------------------------------------------------------
  4906 // ---------------------------------------------------------------------------
  4917 // Show tooltip on FSQ to show the best guess word shown inline.
  4907 // Show tooltip on FSQ to show the best guess word shown inline.
  4918 // ---------------------------------------------------------------------------
  4908 // ---------------------------------------------------------------------------
  5438         }
  5428         }
  5439     
  5429     
  5440     return EFalse;
  5430     return EFalse;
  5441     }
  5431     }
  5442 
  5432 
  5443 void CAknFepPluginManager::OnServerReady(TInt aErr)
       
  5444     {
       
  5445     if( KErrNone != aErr )
       
  5446         {
       
  5447         iFepMan.UiInterface()->TouchPaneSetInputMethodIconActivated(EFalse);
       
  5448             
       
  5449         return;               
       
  5450         }
       
  5451     TRAP_IGNORE(iPenInputServer.AddPeninputServerObserverL(this)); //always add the handler            
       
  5452     
       
  5453     iPenInputSvrConnected = ETrue;                     
       
  5454     ActivatePenInputL();
       
  5455     }
       
  5456 
       
  5457 CConnectAo::CConnectAo(CAknFepPluginManager* aClient) 
       
  5458                 : CActive(CActive::EPriorityStandard),
       
  5459                   iClient(aClient)
       
  5460     {
       
  5461     CActiveScheduler::Add(this);
       
  5462     //SetActive();
       
  5463     }
       
  5464 
       
  5465 
       
  5466 void CConnectAo::RunL()
       
  5467     {
       
  5468     iClient->OnServerReady(iStatus.Int());
       
  5469     }
       
  5470 
       
  5471 void CConnectAo::DoCancel()
       
  5472     {
       
  5473     
       
  5474     }
       
  5475 TInt CConnectAo::RunError(TInt aError)
       
  5476     {
       
  5477     return KErrNone;
       
  5478     }
       
  5479 
       
  5480 void CConnectAo::RequestConnect()
       
  5481     {
       
  5482     iStatus = KRequestPending;
       
  5483     SetActive();
       
  5484     }
       
  5485 TRequestStatus& CConnectAo::RequestStatus()
       
  5486     {
       
  5487     return iStatus;
       
  5488     }
       
  5489 
       
  5490 //End of File
  5433 //End of File