idlehomescreen/xmluirendering/renderingplugins/xntexteditorfactory/src/xntexteditoradapter.cpp
branchRCL_3
changeset 9 f966699dea19
parent 0 f72a12da539e
child 15 ff572dfe6d86
equal deleted inserted replaced
5:c743ef5928ba 9:f966699dea19
    44 #include "xntexteditoradapter.h"
    44 #include "xntexteditoradapter.h"
    45 #include "xntexteditorpublisher.h"
    45 #include "xntexteditorpublisher.h"
    46 #include "xnnodepluginif.h"
    46 #include "xnnodepluginif.h"
    47 #include "xneditmode.h"
    47 #include "xneditmode.h"
    48 #include "c_xnutils.h"
    48 #include "c_xnutils.h"
       
    49 #include "xntexteditor.h" 
    49 
    50 
    50 const TInt KMaxLength = 100;
    51 const TInt KMaxLength = 100;
    51 
    52 
    52 _LIT8( KCpsPublishing, "cpspublishing" );
    53 _LIT8( KCpsPublishing, "cpspublishing" );
    53 _LIT8( KMaxLineAmount, "max-line-amount" );
    54 _LIT8( KMaxLineAmount, "max-line-amount" );
    54 _LIT8( KMaxCharAmount, "max-char-amount" );
    55 _LIT8( KMaxCharAmount, "max-char-amount" );
       
    56 _LIT8( KEnablePartialInput, "splitinputenabled" );
    55 
    57 
    56 _LIT( KEnterChar, "\x2029" );
    58 _LIT( KEnterChar, "\x2029" );
    57 
    59 
    58 // Local macros
    60 // Local macros
    59 #define IS_ARROW_KEY( k ) \
    61 #define IS_ARROW_KEY( k ) \
   168                                      
   170                                      
   169     // Set numeric keymap
   171     // Set numeric keymap
   170     iEditor->SetAknEditorNumericKeymap( EAknEditorPlainNumberModeKeymap );
   172     iEditor->SetAknEditorNumericKeymap( EAknEditorPlainNumberModeKeymap );
   171     
   173     
   172     iEditor->SetSuppressBackgroundDrawing( ETrue );
   174     iEditor->SetSuppressBackgroundDrawing( ETrue );
   173                       
   175 
       
   176     // Enable partial Screen
       
   177     CXnProperty* enablepartialinput( iNode.GetPropertyL( KEnablePartialInput ) );
       
   178     iPartialInputEnabled = EFalse;
       
   179     iPartialInputOpen = EFalse;
       
   180      
       
   181     if ( enablepartialinput && 
       
   182          enablepartialinput->StringValue() == XnPropertyNames::KTrue )
       
   183         {
       
   184         iEditor->SetAknEditorFlags( EAknEditorFlagEnablePartialScreen );
       
   185         iPartialInputEnabled = ETrue;
       
   186         }
       
   187     
   174     iEditor->SetObserver( this );
   188     iEditor->SetObserver( this );
   175                                         
   189                                         
   176     // Default not focused                                  
   190     // Default not focused                                  
   177     iEditor->SetFocus( EFalse );                              
   191     iEditor->SetFocus( EFalse );                              
   178         
   192         
   293     TInt value;
   307     TInt value;
   294 
   308 
   295     if ( isFocused )
   309     if ( isFocused )
   296         {      
   310         {      
   297         value = EPSAiDontForwardNumericKeysToPhone;
   311         value = EPSAiDontForwardNumericKeysToPhone;
   298                        
   312 
   299         TRAP_IGNORE( appui->AddToStackL( appui->View(), iEditor ) );
   313         if( !iPartialInputEnabled )
   300         
   314             {
   301         // AddToStackL calls iEditor->SetFocus( ETrue ); 
   315             TRAP_IGNORE( appui->AddToStackL( appui->View(), iEditor ) );            
       
   316             // AddToStackL calls iEditor->SetFocus( ETrue ); 
       
   317             }
       
   318 
   302         }
   319         }
   303     else
   320     else
   304         {
   321         {
   305         value = EPSAiForwardNumericKeysToPhone;
   322         value = EPSAiForwardNumericKeysToPhone;
   306                                       
   323                                       
   307         appui->RemoveFromStack( iEditor );
   324         if( !iPartialInputEnabled )
   308         
   325             {    
   309         iEditor->SetFocus( EFalse, aDrawNow );
   326             appui->RemoveFromStack( iEditor );            
   310         }
   327             iEditor->SetFocus( EFalse, aDrawNow );
   311     
   328             }
       
   329         else if(iPartialInputEnabled && iRemoveSplitInputFromStack )
       
   330             {
       
   331             appui->RemoveFromStack( iEditor );            
       
   332             iEditor->SetFocus( EFalse, aDrawNow );
       
   333             iPartialInputOpen = EFalse;
       
   334             iRemoveSplitInputFromStack = EFalse;
       
   335             }
       
   336             
       
   337         }
       
   338 
       
   339     if(iPartialInputOpen)
       
   340         {
       
   341         value = EPSAiDontForwardNumericKeysToPhone;
       
   342         }
       
   343 
   312     iRefusesFocusLoss = isFocused;
   344     iRefusesFocusLoss = isFocused;
   313     
   345     
   314     RProperty::Set( KPSUidAiInformation,            
   346     RProperty::Set( KPSUidAiInformation,            
   315                     KActiveIdleForwardNumericKeysToPhone,
   347                     KActiveIdleForwardNumericKeysToPhone,
   316                     value );    
   348                     value );    
   350 // -----------------------------------------------------------------------------
   382 // -----------------------------------------------------------------------------
   351 //
   383 //
   352 void CXnTextEditorAdapter::SetTextL( const TDesC& aText )
   384 void CXnTextEditorAdapter::SetTextL( const TDesC& aText )
   353     {
   385     {
   354     iEditor->SetTextL( &aText );
   386     iEditor->SetTextL( &aText );
       
   387     iNode.SetDirtyL();
   355     }
   388     }
   356     
   389     
   357 // -----------------------------------------------------------------------------
   390 // -----------------------------------------------------------------------------
   358 // CXnTextEditorAdapter::Text
   391 // CXnTextEditorAdapter::Text
   359 // Returns the text contained in the underlying CEikEdwin
   392 // Returns the text contained in the underlying CEikEdwin
   365     
   398     
   366     TRAP_IGNORE( text = iEditor->GetTextInHBufL() );
   399     TRAP_IGNORE( text = iEditor->GetTextInHBufL() );
   367     
   400     
   368     // Ownership is transfered to the calller
   401     // Ownership is transfered to the calller
   369     return text;
   402     return text;
       
   403     }
       
   404 
       
   405 // -----------------------------------------------------------------------------
       
   406 // CXnTextEditorAdapter::HandleEditorEvent
       
   407 // -----------------------------------------------------------------------------
       
   408 //
       
   409 void CXnTextEditorAdapter::HandleEditorEvent( TInt aReason )
       
   410     {
       
   411     CXnAppUiAdapter* appui( 
       
   412         static_cast< CXnAppUiAdapter* >( iAvkonAppUi ) );
       
   413 
       
   414     switch( aReason )
       
   415             {           
       
   416             case CXnTextEditor::KActivateTextEditor:
       
   417                 {
       
   418                 if( !iPartialInputOpen )
       
   419                      {
       
   420                      iUiEngine->EnablePartialTouchInput(iNode , ETrue);
       
   421                      TRAP_IGNORE( appui->AddToStackL( appui->View(), iEditor ) ); 
       
   422                      iPartialInputOpen = ETrue;
       
   423                      }  
       
   424                 break;
       
   425                 }
       
   426             case CXnTextEditor::KDeactivateTextEditor:
       
   427                 {
       
   428                 if( iPartialInputOpen )
       
   429                      {
       
   430                      iUiEngine->EnablePartialTouchInput(iNode, EFalse);
       
   431                      iPartialInputOpen = EFalse;
       
   432                      appui->RemoveFromStack( iEditor );
       
   433                      iEditor->SetFocus( EFalse );
       
   434                      }              
       
   435                 break;
       
   436                 }
       
   437             case CXnTextEditor::KRemoveSplitInputFromStack:
       
   438                 {
       
   439                 iRemoveSplitInputFromStack = ETrue;
       
   440                 break;
       
   441                 }
       
   442             case CXnTextEditor::KKeepSplitInputInStack:
       
   443                 {
       
   444                 iRemoveSplitInputFromStack = EFalse;
       
   445                 break;
       
   446                 }
       
   447             default:                    
       
   448                 break;    
       
   449             }
   370     }
   450     }
   371 
   451 
   372 // -----------------------------------------------------------------------------
   452 // -----------------------------------------------------------------------------
   373 // CXnTextEditorAdapter::SetPropertiesL
   453 // CXnTextEditorAdapter::SetPropertiesL
   374 // Sets text properties
   454 // Sets text properties