emailuis/emailui/src/ncsaddressinputfield.cpp
branchRCL_3
changeset 34 cd2816114bd1
parent 33 da5135c61bad
child 19 b13141f05c3d
equal deleted inserted replaced
33:da5135c61bad 34:cd2816114bd1
    30 #include <eikenv.h>
    30 #include <eikenv.h>
    31 #include <AknsDrawUtils.h>
    31 #include <AknsDrawUtils.h>
    32 #include <sysutil.h>
    32 #include <sysutil.h>
    33 #include <AknUtils.h>
    33 #include <AknUtils.h>
    34 #include <FreestyleEmailUi.rsg>
    34 #include <FreestyleEmailUi.rsg>
       
    35 #include <AknPhysics.h>
       
    36 
    35 #include "FreestyleEmailUiAppui.h"
    37 #include "FreestyleEmailUiAppui.h"
    36 #include "FreestyleEmailUiLayoutData.h"
    38 #include "FreestyleEmailUiLayoutData.h"
    37 #include "FreestyleEmailUiLayoutHandler.h"
    39 #include "FreestyleEmailUiLayoutHandler.h"
    38 #include "ncsaddressinputfield.h"
    40 #include "ncsaddressinputfield.h"
    39 #include "ncsconstants.h"
    41 #include "ncsconstants.h"
    51 	TNcsInputFieldType aFieldType,
    53 	TNcsInputFieldType aFieldType,
    52 	MNcsFieldSizeObserver* aSizeObserver,
    54 	MNcsFieldSizeObserver* aSizeObserver,
    53 	MNcsAddressPopupList* aAddressPopupList,
    55 	MNcsAddressPopupList* aAddressPopupList,
    54 	CNcsHeaderContainer* aParentControl ):
    56 	CNcsHeaderContainer* aParentControl ):
    55 	MNcsControl( aSizeObserver ),
    57 	MNcsControl( aSizeObserver ),
    56     // <cmail>
       
    57 	iParentControl( aParentControl ),
    58 	iParentControl( aParentControl ),
    58 	iAddressPopupList( aAddressPopupList ),
    59 	iAddressPopupList( aAddressPopupList ),
    59     // </cmail>
       
    60 	iFieldType( aFieldType )
    60 	iFieldType( aFieldType )
    61     {
    61     {
    62     FUNC_LOG;
    62     FUNC_LOG;
    63     }
    63     }
    64 
    64 
   350     iTextEditor->HandlePointerEventL(aPointerEvent);
   350     iTextEditor->HandlePointerEventL(aPointerEvent);
   351     if( iButton )
   351     if( iButton )
   352         {
   352         {
   353         iButton->HandlePointerEventL( aPointerEvent );
   353         iButton->HandlePointerEventL( aPointerEvent );
   354         }
   354         }
   355     iTextEditor->HandleTextChangedL();    
   355     iTextEditor->HandleTextChangedL();
       
   356     
       
   357     switch( aPointerEvent.iType )
       
   358     	{
       
   359     	case TPointerEvent::EButton1Down:
       
   360     		{
       
   361             // Save start position so that it can be used in
       
   362             // drag/scrolling calculations
       
   363             iStartPosition = aPointerEvent.iPosition;
       
   364             iIsDraggingStarted = EFalse;
       
   365             break;
       
   366     		}
       
   367     		
       
   368     	case TPointerEvent::EDrag:
       
   369     		{
       
   370             if ( !iIsDraggingStarted && iPhysics )
       
   371                 {
       
   372                 TInt drag( iStartPosition.iY - aPointerEvent.iPosition.iY );
       
   373                 if ( Abs( drag ) > iPhysics->DragThreshold() )
       
   374                     {
       
   375 					iIsDraggingStarted = ETrue;
       
   376                     }
       
   377                 }
       
   378             break;
       
   379     		}
       
   380     	}
   356     }
   381     }
   357 
   382 
   358 // -----------------------------------------------------------------------------
   383 // -----------------------------------------------------------------------------
   359 // CNcsAddressInputField::HandleControlEventL()
   384 // CNcsAddressInputField::HandleControlEventL()
   360 // 
   385 // 
   362 //
   387 //
   363 void CNcsAddressInputField::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
   388 void CNcsAddressInputField::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
   364     {
   389     {
   365     if( aEventType == EEventStateChanged )
   390     if( aEventType == EEventStateChanged )
   366         {
   391         {
   367         if( aControl == iButton )
   392         if( aControl == iButton && !iIsDraggingStarted )
   368             {
   393             {
   369             iParentControl->OpenPhonebookL();
   394             iParentControl->OpenPhonebookL();
   370             }
   395             }
   371         }
   396         }
   372     }
   397     }
   830             iTextEditor->SetCursorPosL( rt->DocumentLength(), EFalse );
   855             iTextEditor->SetCursorPosL( rt->DocumentLength(), EFalse );
   831             iTextEditor->CheckAddressWhenFocusLostL();
   856             iTextEditor->CheckAddressWhenFocusLostL();
   832             }
   857             }
   833         }
   858         }
   834 	}
   859 	}
       
   860 
       
   861 void CNcsAddressInputField::EnableKineticScrollingL( CAknPhysics* aPhysics )
       
   862     {
       
   863 	iPhysics = aPhysics;
       
   864     iTextEditor->EnableKineticScrollingL( aPhysics );
       
   865     }