meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrlocationfield.cpp
changeset 0 8466d47a6819
child 16 4ce476e64c59
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14  *  Description : ESMR location field implementation
       
    15  *  Version     : %version: tr1sido#10 %
       
    16  *
       
    17  */
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include "cesmrlocationfield.h"
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <calentry.h>
       
    24 #include <StringLoader.h>
       
    25 #include <AknUtils.h>
       
    26 #include <AknsUtils.h>
       
    27 #include <AknIconUtils.h>
       
    28 #include <esmrgui.rsg>
       
    29 #include <AknsDrawUtils.h>
       
    30 #include <AknsFrameBackgroundControlContext.h>
       
    31 #include <data_caging_path_literals.hrh>
       
    32 
       
    33 // INCLUDES
       
    34 #include "esmrfieldbuilderdef.h"
       
    35 #include "cesmreditor.h"
       
    36 #include "cesmrfeaturesettings.h"
       
    37 #include "esmrhelper.h"
       
    38 #include "cesmrborderlayer.h"
       
    39 #include "mesmrfieldevent.h"
       
    40 #include "cesmrgenericfieldevent.h"
       
    41 #include "cesmrlayoutmgr.h"
       
    42 #include "cesmrglobalnote.h"
       
    43 
       
    44 // ======== MEMBER FUNCTIONS ========
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // CESMRLocationField::NewL
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CESMRLocationField* CESMRLocationField::NewL( )
       
    51     {
       
    52     FUNC_LOG;
       
    53     CESMRLocationField* self = new (ELeave) CESMRLocationField;
       
    54     CleanupStack::PushL ( self );
       
    55     self->ConstructL ( );
       
    56     CleanupStack::Pop ( self );
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CESMRLocationField::~CESMRLocationField
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CESMRLocationField::~CESMRLocationField( )
       
    65     {
       
    66     FUNC_LOG;
       
    67     delete iIcon;
       
    68     delete iWaypointIcon;
       
    69     delete iWaypointIconMask;
       
    70     delete iFrameBgContext;
       
    71     delete iFeatures;
       
    72     delete iLocationText;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CESMRLocationField::InitializeL
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CESMRLocationField::InitializeL()
       
    80     {
       
    81     FUNC_LOG;
       
    82     iLocation->SetFontL( iLayout->Font(iCoeEnv, iFieldId ), iLayout );
       
    83     AknLayoutUtils::OverrideControlColorL( *iLocation, 
       
    84                                             EColorControlBackground,
       
    85                                             iLayout->NormalTextBgColor() );
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CESMRLocationField::InternalizeL
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 void CESMRLocationField::InternalizeL( MESMRCalEntry& aEntry )
       
    93     {
       
    94     FUNC_LOG;
       
    95     CCalEntry& entry = aEntry.Entry();
       
    96     HBufC* location = entry.LocationL().AllocLC();
       
    97 
       
    98     // if there is no text available, don't overwrite the default text
       
    99     // with empty descriptor.
       
   100     if ( location->Length() > 0 )
       
   101         {
       
   102         iLocation->ClearSelectionAndSetTextL( *location );
       
   103         }
       
   104 
       
   105     CleanupStack::PopAndDestroy( location );
       
   106 
       
   107     // this is needed to be re-called here, otherwise the CEikEdwin
       
   108     // does not get correctly instantiated with default text
       
   109     iLocation->FocusChanged( EDrawNow );
       
   110     }
       
   111 
       
   112 // ---------------------------------------------------------------------------
       
   113 // CESMRLocationField::ExternalizeL
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 void CESMRLocationField::ExternalizeL( MESMRCalEntry& aEntry )
       
   117     {
       
   118     FUNC_LOG;
       
   119     HBufC* loc = iLocation->GetTextInHBufL( );
       
   120 
       
   121     if ( loc )
       
   122         {
       
   123         CleanupStack::PushL( loc );
       
   124 
       
   125         // externalize the text only if it differs from the
       
   126         // default text. In other words, default text is not
       
   127         // externalized.
       
   128         HBufC* defaultText = StringLoader::LoadLC( R_QTN_MEET_REQ_LOCATION_FIELD );
       
   129         if ( defaultText->Compare( *loc ) != 0 )
       
   130             {
       
   131             CCalEntry& entry = aEntry.Entry();
       
   132             entry.SetLocationL( *loc );
       
   133             }
       
   134 
       
   135         CleanupStack::PopAndDestroy( defaultText );
       
   136         CleanupStack::PopAndDestroy( loc );
       
   137         }
       
   138     else
       
   139         {
       
   140         CCalEntry& entry = aEntry.Entry();
       
   141         entry.SetLocationL( KNullDesC );
       
   142         }
       
   143     }
       
   144 
       
   145 // ---------------------------------------------------------------------------
       
   146 // CESMRLocationField::SetOutlineFocusL
       
   147 // ---------------------------------------------------------------------------
       
   148 //
       
   149 void CESMRLocationField::SetOutlineFocusL( TBool aFocus )
       
   150     {
       
   151     FUNC_LOG;
       
   152     CESMRField::SetOutlineFocusL ( aFocus );
       
   153     
       
   154     if ( FeaturesL().FeatureSupported(
       
   155             CESMRFeatureSettings::EESMRUILocationFeatures ) )
       
   156         {
       
   157         if ( aFocus )
       
   158             {
       
   159             ChangeMiddleSoftKeyL( EAknSoftkeyContextOptions, R_QTN_MSK_OPEN );
       
   160             }
       
   161         else
       
   162             {
       
   163             if ( iLocationText )
       
   164                 {
       
   165                 delete iLocationText;
       
   166                 iLocationText = NULL;
       
   167                 }
       
   168             iLocationText = iLocation->GetTextInHBufL();
       
   169             
       
   170             HBufC* defaultText = StringLoader::LoadLC( R_QTN_MEET_REQ_LOCATION_FIELD );
       
   171                         
       
   172             if ( iLocationText && iLocationText->Compare( *defaultText ) != 0 )
       
   173                 {
       
   174                 // Create field change event
       
   175                 CESMRGenericFieldEvent* event = CESMRGenericFieldEvent::NewLC(
       
   176                         this,
       
   177                         MESMRFieldEvent::EESMRFieldChangeEvent );
       
   178                 
       
   179                 // Add this field as parameter
       
   180                 TInt fieldId = iFieldId;
       
   181                 CESMRFieldEventValue* field = CESMRFieldEventValue::NewLC(
       
   182                         MESMRFieldEventValue::EESMRInteger,
       
   183                         &fieldId );
       
   184                 event->AddParamL( field );
       
   185                 CleanupStack::Pop( field );
       
   186                 
       
   187                 // Add new value as parameter
       
   188                 CESMRFieldEventValue* value = CESMRFieldEventValue::NewLC(
       
   189                         CESMRFieldEventValue::EESMRString,
       
   190                         iLocationText );
       
   191                 iLocationText = NULL; // Ownership transferred to value
       
   192                 // Encapsulate value, so receiver gets the field value type
       
   193                 event->AddParamL( value, ETrue );
       
   194                 CleanupStack::Pop( value );
       
   195                 
       
   196                 // Send event
       
   197                 NotifyEventAsyncL( event );
       
   198                 CleanupStack::Pop( event );
       
   199                 }
       
   200             CleanupStack::PopAndDestroy( defaultText );
       
   201             }
       
   202         }
       
   203     }
       
   204 
       
   205 // ---------------------------------------------------------------------------
       
   206 // CESMRLocationField::ExpandedHeight
       
   207 // ---------------------------------------------------------------------------
       
   208 //
       
   209 TInt CESMRLocationField::ExpandedHeight( ) const
       
   210     {
       
   211     FUNC_LOG;
       
   212     return iSize.iHeight;
       
   213     }
       
   214 
       
   215 // ---------------------------------------------------------------------------
       
   216 // CESMRLocationField::HandleEdwinSizeEventL
       
   217 // ---------------------------------------------------------------------------
       
   218 //
       
   219 TBool CESMRLocationField::HandleEdwinSizeEventL( CEikEdwin* aEdwin,
       
   220         TEdwinSizeEvent /*aType*/, TSize aSize )
       
   221     {
       
   222     FUNC_LOG;
       
   223     TBool ret( EFalse );
       
   224     
       
   225     TSize newSize = CalculateEditorSize( aSize );
       
   226 
       
   227     if ( aEdwin == iLocation && iSize != newSize )
       
   228             {
       
   229         iSize = newSize;
       
   230 
       
   231             if ( iObserver && aEdwin->IsFocused() )
       
   232             {
       
   233             iObserver->ControlSizeChanged (this );
       
   234             }
       
   235 
       
   236         if ( iFrameBgContext )
       
   237             {
       
   238             TRect visibleRect = CalculateVisibleRect( iLocation->Rect() );
       
   239             iFrameBgContext->SetFrameRects( visibleRect, visibleRect );
       
   240             }
       
   241         
       
   242         ret = ETrue;
       
   243         }
       
   244     return ret;
       
   245     }
       
   246 
       
   247 // ---------------------------------------------------------------------------
       
   248 // CESMRLocationField::HandleEdwinEventL
       
   249 // ---------------------------------------------------------------------------
       
   250 //
       
   251 void CESMRLocationField::HandleEdwinEventL(CEikEdwin* aEdwin, TEdwinEvent aEventType)
       
   252 	{
       
   253     FUNC_LOG;
       
   254     if ( aEdwin == iLocation && aEventType == EEventTextUpdate )
       
   255         {
       
   256         HBufC* text = iLocation->GetTextInHBufL();
       
   257         if ( text )
       
   258             {
       
   259             CleanupStack::PushL( text );
       
   260             TInt textLength( text->Length() );
       
   261             if ( iLocation->GetLimitLength() <= textLength )
       
   262             	{
       
   263             	NotifyEventAsyncL( EESMRCmdSizeExceeded );
       
   264             	}            
       
   265             CleanupStack::PopAndDestroy( text );
       
   266             }
       
   267         }	
       
   268 	}
       
   269 // ---------------------------------------------------------------------------
       
   270 // CESMRLocationField::CESMRLocationField
       
   271 // ---------------------------------------------------------------------------
       
   272 //
       
   273 CESMRLocationField::CESMRLocationField()
       
   274     : iSize( TSize( 0, 0 ) )
       
   275     {
       
   276     FUNC_LOG;
       
   277     //do nothing
       
   278     }
       
   279 
       
   280 // ---------------------------------------------------------------------------
       
   281 // CESMRLocationField::ActivateL
       
   282 // ---------------------------------------------------------------------------
       
   283 //
       
   284 void CESMRLocationField::ActivateL()
       
   285     {
       
   286     FUNC_LOG;
       
   287     CCoeControl::ActivateL();
       
   288     TRect rect( iLocation->Rect() );
       
   289     TRect inner(rect);
       
   290     TRect outer(rect);
       
   291 
       
   292     delete iFrameBgContext;
       
   293     iFrameBgContext = NULL;
       
   294     iFrameBgContext = CAknsFrameBackgroundControlContext::NewL( 
       
   295             KAknsIIDQsnFrInput, 
       
   296             outer, 
       
   297             inner, 
       
   298             EFalse ) ;
       
   299 
       
   300     iFrameBgContext->SetParentContext( iBackground );
       
   301     iLocation->SetSkinBackgroundControlContextL( iFrameBgContext );
       
   302     }
       
   303 
       
   304 
       
   305 // ---------------------------------------------------------------------------
       
   306 // CESMRLocationField::PositionChanged()
       
   307 // ---------------------------------------------------------------------------
       
   308 //
       
   309 void CESMRLocationField::PositionChanged()
       
   310     {
       
   311     FUNC_LOG;
       
   312     CCoeControl::PositionChanged();
       
   313     
       
   314     if ( iFrameBgContext )
       
   315         {
       
   316         TRect visibleRect = CalculateVisibleRect( iLocation->Rect() );
       
   317         iFrameBgContext->SetFrameRects( visibleRect, visibleRect );
       
   318         }
       
   319     }
       
   320 
       
   321 // ---------------------------------------------------------------------------
       
   322 // CESMRLocationField::ConstructL
       
   323 // ---------------------------------------------------------------------------
       
   324 //
       
   325 void CESMRLocationField::ConstructL()
       
   326     {
       
   327     FUNC_LOG;
       
   328     SetFieldId( EESMRFieldLocation );
       
   329     SetExpandable();
       
   330 
       
   331     iLocation = CESMREditor::NewL( this, 
       
   332                                    1,
       
   333                                    KMaxTextLength, //from ICAL spec.
       
   334                                    // do not change. other text fields do not
       
   335                                    // have this limitation
       
   336                                    CEikEdwin::EResizable |
       
   337                                    CEikEdwin::EAvkonEditor );
       
   338 
       
   339     iLocation->SetEdwinSizeObserver( this );
       
   340     iLocation->SetEdwinObserver( this );
       
   341 
       
   342     HBufC* buf = StringLoader::LoadLC( R_QTN_MEET_REQ_LOCATION_FIELD );
       
   343     iLocation->SetDefaultTextL( buf ); // ownership is transferred
       
   344     CleanupStack::Pop( buf );
       
   345 
       
   346     CESMRIconField::ConstructL( KAknsIIDQgnMeetReqIndiLocation, iLocation );
       
   347     }
       
   348 
       
   349 // ---------------------------------------------------------------------------
       
   350 // CESMRLocationField::GetMinimumVisibleVerticalArea
       
   351 // ---------------------------------------------------------------------------
       
   352 //
       
   353 void CESMRLocationField::GetMinimumVisibleVerticalArea(TInt& aUpper, TInt& aLower)
       
   354     {
       
   355     FUNC_LOG;
       
   356     aLower = iLocation->CurrentLineNumber() * iLocation->RowHeight();
       
   357     aUpper = aLower - iLocation->RowHeight();
       
   358     }
       
   359 
       
   360 // ---------------------------------------------------------------------------
       
   361 // CESMRLocationField::ListObserverSet
       
   362 // ---------------------------------------------------------------------------
       
   363 //
       
   364 void CESMRLocationField::ListObserverSet()
       
   365     {
       
   366     FUNC_LOG;
       
   367     iLocation->SetListObserver( iObserver );
       
   368     }
       
   369 
       
   370 // ---------------------------------------------------------------------------
       
   371 // CESMRLocationField::ListObserverSet
       
   372 // ---------------------------------------------------------------------------
       
   373 //
       
   374 CESMRFeatureSettings& CESMRLocationField::FeaturesL()
       
   375     {
       
   376     FUNC_LOG;
       
   377     if ( !iFeatures )
       
   378         {
       
   379         iFeatures = CESMRFeatureSettings::NewL();
       
   380         }
       
   381     
       
   382     return *iFeatures;
       
   383     }
       
   384 
       
   385 // ---------------------------------------------------------------------------
       
   386 // CESMRCheckbox::SetWaypointIconL
       
   387 // ---------------------------------------------------------------------------
       
   388 //
       
   389 void CESMRLocationField::SetWaypointIconL( TBool aEnabled )
       
   390     {
       
   391     FUNC_LOG;
       
   392     delete iIcon;
       
   393     iIcon = NULL;
       
   394     delete iWaypointIcon;
       
   395     iWaypointIcon = NULL;
       
   396     delete iWaypointIconMask;
       
   397     iWaypointIconMask = NULL;
       
   398 
       
   399     if( aEnabled )
       
   400         {
       
   401         TAknsItemID iconID;
       
   402         TInt fileIndex(-1);
       
   403         TInt fileMaskIndex(-1);
       
   404         iconID = KAknsIIDQgnPropBlidWaypoint;
       
   405         CESMRLayoutManager::SetBitmapFallback( iconID,
       
   406                                                fileIndex,
       
   407                                                fileMaskIndex );
       
   408 
       
   409         TFileName bitmapFilePath;
       
   410         ESMRHelper::LocateResourceFile(
       
   411                 KESMRMifFile,
       
   412                 KDC_APP_BITMAP_DIR,
       
   413                 bitmapFilePath);
       
   414 
       
   415         AknsUtils::CreateIconL( AknsUtils::SkinInstance(),
       
   416                                 iconID,
       
   417                                 iWaypointIcon,
       
   418                                 iWaypointIconMask,
       
   419                                 bitmapFilePath,
       
   420                                 fileIndex,
       
   421                                 fileMaskIndex
       
   422                                 );
       
   423 
       
   424         // Even if creating mask failed, bitmap can be used (background is just not displayed correctly)
       
   425         if( iWaypointIcon )
       
   426             {
       
   427             AknIconUtils::SetSize( iWaypointIcon, KIconSize, EAspectRatioPreserved );
       
   428             iIcon = new (ELeave) CEikImage;
       
   429             iIcon->SetPictureOwnedExternally(ETrue);
       
   430             iIcon->SetPicture( iWaypointIcon, iWaypointIconMask );
       
   431 
       
   432             LayoutWaypointIcon();
       
   433             
       
   434             // change text rect size to fit icon
       
   435             iBorder->SetSize( BorderSize() );
       
   436             }
       
   437         }
       
   438     }
       
   439 
       
   440 // ---------------------------------------------------------------------------
       
   441 // CESMRLocationField::CountComponentControls
       
   442 // ---------------------------------------------------------------------------
       
   443 //
       
   444 TInt CESMRLocationField::CountComponentControls( ) const
       
   445     {
       
   446     FUNC_LOG;
       
   447     TInt count = CESMRIconField::CountComponentControls ( );
       
   448     if ( iIcon )
       
   449         {
       
   450         ++count;
       
   451         }
       
   452     return count;
       
   453     }
       
   454 
       
   455 // ---------------------------------------------------------------------------
       
   456 // CESMRLocationField::ComponentControl
       
   457 // ---------------------------------------------------------------------------
       
   458 //
       
   459 CCoeControl* CESMRLocationField::ComponentControl( TInt aInd ) const
       
   460     {
       
   461     FUNC_LOG;
       
   462     if ( aInd == 2 )
       
   463         {
       
   464         return iIcon;
       
   465         }
       
   466     return CESMRIconField::ComponentControl ( aInd );
       
   467     }
       
   468 
       
   469 // ---------------------------------------------------------------------------
       
   470 // CESMRLocationField::SizeChanged
       
   471 // ---------------------------------------------------------------------------
       
   472 //
       
   473 void CESMRLocationField::SizeChanged( )
       
   474     {
       
   475     FUNC_LOG;
       
   476     CESMRIconField::SizeChanged();
       
   477     
       
   478     PositionFieldElements(); 
       
   479     }
       
   480 
       
   481 // ---------------------------------------------------------------------------
       
   482 // CESMRLocationField::PositionFieldElements
       
   483 // ---------------------------------------------------------------------------
       
   484 //
       
   485 void CESMRLocationField::PositionFieldElements()
       
   486     {
       
   487     FUNC_LOG;
       
   488     // editor (editor is wrapped inside the 'iBorder' member)
       
   489     if ( iIcon )
       
   490         {
       
   491         LayoutWaypointIcon();
       
   492         
       
   493         if ( iFrameBgContext && iBorder )
       
   494             {
       
   495             TRect visibleRect = CalculateVisibleRect( iLocation->Rect() );
       
   496             iFrameBgContext->SetFrameRects( visibleRect, visibleRect );
       
   497             }
       
   498         }
       
   499     }
       
   500 
       
   501 // ---------------------------------------------------------------------------
       
   502 // CESMRLocationField::HandleFieldEventL
       
   503 // ---------------------------------------------------------------------------
       
   504 //
       
   505 void CESMRLocationField::HandleFieldEventL( const MESMRFieldEvent& aEvent )
       
   506     {
       
   507     FUNC_LOG;
       
   508     if ( aEvent.Type() == MESMRFieldEvent::EESMRFieldCommandEvent )
       
   509         {
       
   510         TInt* command = static_cast< TInt* >( aEvent.Param( 0 ) );
       
   511         
       
   512         switch ( *command )
       
   513             {
       
   514             case EESMRCmdDisableWaypointIcon:
       
   515                 {
       
   516                 SetWaypointIconL( EFalse );
       
   517                 break;
       
   518                 }
       
   519             case EESMRCmdEnableWaypointIcon:
       
   520                 {
       
   521                 SetWaypointIconL( ETrue );
       
   522                 break;
       
   523                 }
       
   524             default:
       
   525                 {
       
   526                 break;
       
   527                 }
       
   528             }
       
   529         }
       
   530     }
       
   531 
       
   532 // ---------------------------------------------------------------------------
       
   533 // CESMRLocationField::ExecuteGenericCommandL
       
   534 // ---------------------------------------------------------------------------
       
   535 //
       
   536 void CESMRLocationField::ExecuteGenericCommandL( 
       
   537 		TInt aCommand )
       
   538 	{
       
   539     FUNC_LOG;
       
   540 	if ( EESMRCmdSizeExceeded == aCommand )
       
   541 		{
       
   542 		CESMRGlobalNote::ExecuteL( 
       
   543 				CESMRGlobalNote::EESMRCannotDisplayMuchMore );
       
   544 		
       
   545 		HBufC* text = iLocation->GetTextInHBufL();
       
   546 		CleanupDeletePushL( text );
       
   547 		if ( text )
       
   548 			{    
       
   549 	    	TInt curPos = iLocation->CursorPos();    	
       
   550 	    	if ( curPos > iLocation->GetLimitLength() - 1 )
       
   551 	    		curPos = iLocation->GetLimitLength() - 1;
       
   552 	    	HBufC* newText = 
       
   553 	    		text->Mid( 0, iLocation->GetLimitLength() - 1 ).AllocLC();    	
       
   554 	    	
       
   555 	    	iLocation->SetTextL ( newText );
       
   556 	    	CleanupStack::PopAndDestroy( newText );
       
   557 	    	newText = NULL;
       
   558 	    	
       
   559 	    	iLocation->SetCursorPosL( curPos, EFalse );
       
   560 	    	iLocation->HandleTextChangedL();
       
   561 	    	iLocation->UpdateScrollBarsL();
       
   562 	    	SetFocus( ETrue );
       
   563 			}
       
   564 		CleanupStack::PopAndDestroy( text );	
       
   565 		}
       
   566 	}
       
   567 
       
   568 // ---------------------------------------------------------------------------
       
   569 // CESMRLocationField::CalculateEditorSize
       
   570 // ---------------------------------------------------------------------------
       
   571 //
       
   572 TSize CESMRLocationField::CalculateEditorSize( const TSize& aSize )
       
   573     {
       
   574     FUNC_LOG;
       
   575     TSize size( aSize );
       
   576     size.iHeight -= KEditorDifference;
       
   577 
       
   578     if ( iLayout->CurrentFontZoom() == EAknUiZoomSmall ||
       
   579         iLayout->CurrentFontZoom() == EAknUiZoomVerySmall)
       
   580         {
       
   581         size.iHeight -= KEditorDifference;
       
   582         }
       
   583     
       
   584     return size;
       
   585     }
       
   586 
       
   587 // ---------------------------------------------------------------------------
       
   588 // CESMRLocationField::BorderSize
       
   589 // ---------------------------------------------------------------------------
       
   590 //
       
   591 TSize CESMRLocationField::BorderSize() const
       
   592     {
       
   593     FUNC_LOG;
       
   594     TSize borderSize( CESMRIconField::BorderSize() );
       
   595     
       
   596     // If icon exists, we have to adjust the border width
       
   597     if ( iIcon )
       
   598         {
       
   599         borderSize.iWidth -= ( KIconSize.iWidth + 2 * KEditorDifference );
       
   600         }
       
   601     
       
   602     return borderSize;
       
   603     }
       
   604 
       
   605 // ---------------------------------------------------------------------------
       
   606 // CESMRLocationField::LayoutWaypointIcon
       
   607 // ---------------------------------------------------------------------------
       
   608 //
       
   609 void CESMRLocationField::LayoutWaypointIcon()
       
   610     {
       
   611     FUNC_LOG;
       
   612     if ( iIcon )
       
   613         {
       
   614         // Layout the icon
       
   615         TRect fieldRect( Rect() );
       
   616         TPoint iconPos( fieldRect.iBr.iX - KIconSize.iWidth,
       
   617                         fieldRect.iTl.iY + iLayout->IconTopMargin() );
       
   618         
       
   619         if ( CESMRLayoutManager::IsMirrored() )
       
   620             {
       
   621             iconPos.iX = fieldRect.iTl.iX;
       
   622             }
       
   623         
       
   624         iIcon->SetPosition( iconPos );
       
   625         iIcon->SetSize( KIconSize );
       
   626         }
       
   627     }
       
   628 
       
   629 // EOF