meetingrequest/mrgui/src/cesmrview.cpp
branchRCL_3
changeset 64 3533d4323edc
child 80 726fba06891a
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 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 UI Container class
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cesmrview.h"
       
    19 #include "mesmrmeetingrequestentry.h"
       
    20 #include "esmrinternaluid.h"
       
    21 #include "cesmrtitlepane.h"
       
    22 #include "cesmrfield.h"
       
    23 #include "mesmrcalentry.h"
       
    24 #include "nmrlayoutmanager.h"
       
    25 #include "mesmrfieldstorage.h"
       
    26 #include "FreestyleEmailUiConstants.h"
       
    27 #include "cesmrcaldbmgr.h"
       
    28 #include "mmrfocusstrategy.h"
       
    29 #include "cmrnaviarrow.h"
       
    30 #include "mesmrlistobserver.h"
       
    31 #include "cmrtoolbar.h"
       
    32 #include "cmrattachmentindicator.h"
       
    33 #include "esmrdef.h"
       
    34 #include "mesmrfieldevent.h"
       
    35 #include "cesmrgenericfieldevent.h"
       
    36 
       
    37 #include <eiklabel.h>
       
    38 #include <avkon.hrh>
       
    39 #include <MAgnEntryUi.h>
       
    40 #include <StringLoader.h>
       
    41 #include <gulcolor.h>
       
    42 #include <eikimage.h>
       
    43 #include <esmrgui.rsg>
       
    44 #include <AknIconUtils.h>
       
    45 #include <eikenv.h>
       
    46 #include <AknsConstants.h>
       
    47 #include <AknUtils.h>
       
    48 #include <AknsDrawUtils.h>
       
    49 #include <AknsBasicBackgroundControlContext.h>
       
    50 #include <hlplch.h>
       
    51 #include <csxhelp/cmail.hlp.hrh>
       
    52 #include <touchfeedback.h>
       
    53 #include <akntoolbar.h>
       
    54 #include <eikcolib.h>
       
    55 #include <featdiscovery.h>
       
    56 #include <bldvariant.hrh>
       
    57 #include <layoutmetadata.cdl.h>
       
    58 
       
    59 #include "emailtrace.h"
       
    60 
       
    61 // ======== MEMBER FUNCTIONS ========
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // CESMRView::CESMRView()
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CESMRView::CESMRView( MESMRFieldStorage* aStorage,
       
    68         MESMRCalEntry& aEntry,
       
    69         MMRFocusStrategy& aFocusStrategy,
       
    70         MESMRNaviArrowEventObserver* aObserver, 
       
    71         CMRToolbar& aToolbar )
       
    72     : iStorage( aStorage ),
       
    73       iEntry( &aEntry ),
       
    74 	  iFocusStrategy( aFocusStrategy ),
       
    75 	  iObserver( aObserver ),
       
    76 	  iToolbar( aToolbar )
       
    77     {
       
    78     FUNC_LOG;
       
    79     // Do nothing
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CESMRView::NewL()
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CESMRView* CESMRView::NewL(
       
    87         MESMRFieldStorage* aStorage,
       
    88         MESMRCalEntry& aEntry,
       
    89         const TRect& aRect,
       
    90         MMRFocusStrategy& aFocusStrategy,
       
    91         CMRToolbar& aToolbar,
       
    92         MESMRNaviArrowEventObserver* aObserver )
       
    93     {
       
    94     FUNC_LOG;
       
    95     CESMRView* self = new (ELeave) CESMRView( 
       
    96             aStorage, aEntry, aFocusStrategy, aObserver, aToolbar );
       
    97     CleanupStack::PushL( self );
       
    98     self->ConstructL( aRect );
       
    99     CleanupStack::Pop( self );
       
   100     return self;
       
   101     }
       
   102 
       
   103 // ---------------------------------------------------------------------------
       
   104 // CESMRView::ConstructL()
       
   105 // ---------------------------------------------------------------------------
       
   106 //
       
   107 void CESMRView::ConstructL( const TRect& aRect )
       
   108     {
       
   109     FUNC_LOG;
       
   110     CreateWindowL();
       
   111     SetRect( aRect );
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // CESMRView::~CESMRView()
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 CESMRView::~CESMRView()
       
   119     {
       
   120     FUNC_LOG;
       
   121     delete iListPane;
       
   122     delete iBgContext;
       
   123     delete iNaviArrowLeft;
       
   124     delete iNaviArrowRight;
       
   125     delete iScrollBar;
       
   126     delete iStorage;
       
   127     }
       
   128 
       
   129 // ---------------------------------------------------------------------------
       
   130 // CESMRView::ExternalizeL()
       
   131 // ---------------------------------------------------------------------------
       
   132 //
       
   133 void CESMRView::ExternalizeL( TBool aForceValidation )
       
   134     {
       
   135     FUNC_LOG;
       
   136     // externalize all fields:
       
   137     iListPane->ExternalizeL( *iEntry, aForceValidation );
       
   138     }
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // CESMRView::InternalizeL()
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 void CESMRView::InternalizeL()
       
   145     {
       
   146     FUNC_LOG;
       
   147     iListPane->DisableSizeChange( ETrue );
       
   148     // internalize all fields:
       
   149     iListPane->InternalizeL( *iEntry );
       
   150     iListPane->DisableSizeChange( EFalse );
       
   151     iListPane->SizeChanged();
       
   152     }
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // CESMRView::IsControlVisible()
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 TBool CESMRView::IsControlVisible( TESMREntryFieldId aFieldId ) const
       
   159     {
       
   160     FUNC_LOG;
       
   161     return iListPane->IsControlVisible( aFieldId );
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // CESMRView::ProcessCommandL
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 void CESMRView::ProcessEditorCommandL( TInt aCommand )
       
   169     {
       
   170     FUNC_LOG;
       
   171     switch ( aCommand )
       
   172         {
       
   173         case EESMRCmdPriorityHigh: // Fall through
       
   174         case EESMRCmdPriorityNormal: // Fall through
       
   175         case EESMRCmdPriorityLow:
       
   176            {
       
   177            CESMRField* field = iStorage->FieldById( EESMRFieldSubject );
       
   178            if ( field )
       
   179                {
       
   180                field->ExecuteGenericCommandL(
       
   181                        aCommand );
       
   182                iListPane->SizeChanged();
       
   183                }
       
   184            break;
       
   185            }
       
   186         case EESMRCmdAddOptAttendee:
       
   187         	{
       
   188             iListPane->ShowControl( EESMRFieldOptAttendee );
       
   189             SetControlFocusedL( EESMRFieldOptAttendee );
       
   190             break;
       
   191         	}
       
   192         case EAknCmdHelp:
       
   193         	{
       
   194         	break;
       
   195         	}
       
   196         case EMRCmdHideAttachmentIndicator:
       
   197             {
       
   198             if ( iAttachmentIndicator )
       
   199                 {
       
   200                 TInt pos = iControls.Find( iAttachmentIndicator );
       
   201                 if (KErrNotFound != pos )
       
   202                     {
       
   203                     iControls.Remove( pos );
       
   204                     }
       
   205                     
       
   206                 delete iAttachmentIndicator;
       
   207                 iAttachmentIndicator = NULL;
       
   208                 
       
   209                 SizeChanged();
       
   210                 }            
       
   211             }
       
   212             break;
       
   213         default://forward to fields
       
   214         	{
       
   215             iListPane->FocusedField()->ExecuteGenericCommandL( aCommand );
       
   216             break;
       
   217         	}
       
   218         }
       
   219     }
       
   220 
       
   221 // ---------------------------------------------------------------------------
       
   222 // CESMRView::LaunchEditorHelpL
       
   223 // ---------------------------------------------------------------------------
       
   224 //
       
   225 void CESMRView::LaunchEditorHelpL()
       
   226     {
       
   227     FUNC_LOG;
       
   228 
       
   229     switch ( iEntry->Type() )
       
   230         {
       
   231         case MESMRCalEntry::EESMRCalEntryTodo:
       
   232             {
       
   233             LaunchHelpL( KFSCA_HLP_TODO_EDITOR );
       
   234         	break;
       
   235             }
       
   236         case MESMRCalEntry::EESMRCalEntryMemo:
       
   237             {
       
   238             LaunchHelpL( KFSCA_HLP_MEMO_EDITOR );
       
   239             break;
       
   240             }
       
   241         case MESMRCalEntry::EESMRCalEntryAnniversary:
       
   242             {
       
   243             LaunchHelpL( KFSCA_HLP_ANNIVERSARY_EDITOR );
       
   244             break;
       
   245             }
       
   246         case MESMRCalEntry::EESMRCalEntryMeeting:
       
   247             {
       
   248             LaunchHelpL( KFSCA_HLP_CALE_MEETING_EDITOR );
       
   249             break;
       
   250             }
       
   251         case MESMRCalEntry::EESMRCalEntryMeetingRequest:
       
   252             {
       
   253             LaunchHelpL( KMEET_REQ_HLP_EDITOR );
       
   254             break;
       
   255             }
       
   256         case MESMRCalEntry::EESMRCalEntryReminder: // Fall through
       
   257         default:
       
   258             {
       
   259             break;
       
   260             }
       
   261         }
       
   262 
       
   263     }
       
   264 
       
   265 // ---------------------------------------------------------------------------
       
   266 // CESMRView::LaunchViewerHelpL
       
   267 // ---------------------------------------------------------------------------
       
   268 //
       
   269 void CESMRView::LaunchViewerHelpL()
       
   270     {
       
   271     FUNC_LOG;
       
   272 
       
   273 
       
   274     switch ( iEntry->Type() )
       
   275         {
       
   276     	case MESMRCalEntry::EESMRCalEntryTodo:
       
   277     	    {
       
   278             LaunchHelpL( KFSCA_HLP_TODO_VIEWER );
       
   279             break;
       
   280     	    }
       
   281         case MESMRCalEntry::EESMRCalEntryMemo:
       
   282             {
       
   283             LaunchHelpL( KFSCA_HLP_MEMO_VIEWER );
       
   284             break;
       
   285             }
       
   286         case MESMRCalEntry::EESMRCalEntryAnniversary:
       
   287             {
       
   288             LaunchHelpL( KFSCA_HLP_ANNI_VIEWER );
       
   289             break;
       
   290             }
       
   291         case MESMRCalEntry::EESMRCalEntryMeeting:
       
   292             {
       
   293             LaunchHelpL( KFSCA_HLP_CALE_MEETING_VIEWER );
       
   294             break;
       
   295             }
       
   296         case MESMRCalEntry::EESMRCalEntryMeetingRequest:
       
   297             {
       
   298             MESMRMeetingRequestEntry* mrEntry =
       
   299                static_cast<MESMRMeetingRequestEntry*>( iEntry );
       
   300             
       
   301             if ( mrEntry->IsOpenedFromMail() )
       
   302                 {
       
   303                 if ( CFeatureDiscovery::IsFeatureSupportedL(
       
   304                         TUid::Uid( KFeatureIdFfCalMeetingRequestUi ) ) )
       
   305                     {
       
   306                     // Full functionality
       
   307                     LaunchHelpL( KFS_VIEWER_HLP_MEETING_REQ_VIEW );
       
   308                     }
       
   309                 else
       
   310                     {
       
   311                     // Only viewer from Mail supported
       
   312                     LaunchHelpL( KFS_VIEWER_HLP_MR_RECEIVED );
       
   313                     }
       
   314                 }
       
   315             else if ( mrEntry->RoleL() == EESMRRoleOrganizer )
       
   316                 {
       
   317                 LaunchHelpL( KFSCA_HLP_VIEWER_ORGANIZER );
       
   318                 }
       
   319             else 
       
   320                 {
       
   321                 LaunchHelpL( KFSCA_HLP_VIEWER );
       
   322                 }
       
   323             break;
       
   324             }
       
   325         case MESMRCalEntry::EESMRCalEntryReminder: // Fall through
       
   326         default:
       
   327             {
       
   328             break;
       
   329             }
       
   330         }
       
   331 
       
   332     }
       
   333 
       
   334 // ---------------------------------------------------------------------------
       
   335 // CESMRView::IsComponentfocused
       
   336 // ---------------------------------------------------------------------------
       
   337 //
       
   338 TBool CESMRView::IsComponentFocused( TESMREntryFieldId aField ) const
       
   339 	{
       
   340     FUNC_LOG;
       
   341 	return 	FocusedField() == aField;
       
   342 	}
       
   343 
       
   344 // ---------------------------------------------------------------------------
       
   345 // CESMRView::FocusedField
       
   346 // ---------------------------------------------------------------------------
       
   347 //
       
   348 TESMREntryFieldId CESMRView::FocusedField() const
       
   349     {
       
   350     FUNC_LOG;
       
   351     TESMREntryFieldId fieldId( ( TESMREntryFieldId ) 0 );
       
   352 
       
   353 	CESMRField* field = iListPane->FocusedField();
       
   354 
       
   355     if ( field )
       
   356         {
       
   357         fieldId = field->FieldId();
       
   358         }
       
   359 
       
   360     return fieldId;
       
   361 	}
       
   362 
       
   363 // ---------------------------------------------------------------------------
       
   364 // CESMRView::ClickedOrFocusedField
       
   365 // ---------------------------------------------------------------------------
       
   366 //
       
   367 TESMREntryFieldId CESMRView::ClickedOrFocusedField() const
       
   368     {
       
   369     FUNC_LOG;
       
   370     TESMREntryFieldId fieldId( ( TESMREntryFieldId ) 0 );
       
   371 
       
   372     // Get clicked item if exists
       
   373     CESMRField* field = iListPane->ClickedField();
       
   374 
       
   375     if ( field )
       
   376         {
       
   377         fieldId = field->FieldId();
       
   378         }
       
   379     // If doesn't, try getting focused item
       
   380     else
       
   381         {
       
   382         field = iListPane->FocusedField();
       
   383         if( field )
       
   384             {
       
   385             fieldId = FocusedField();
       
   386             }
       
   387         }
       
   388 
       
   389     return fieldId;
       
   390     }
       
   391 
       
   392 // ---------------------------------------------------------------------------
       
   393 // CESMRView::AdjustViewL
       
   394 // ---------------------------------------------------------------------------
       
   395 //
       
   396 void CESMRView::AdjustViewL(
       
   397             MESMRCalEntry* aNewEntry,
       
   398             const CESMRPolicy& aNewPolicy )
       
   399     {
       
   400     iStorage->ChangePolicyL( aNewPolicy,*aNewEntry );
       
   401     iEntry = aNewEntry;
       
   402     iListPane->InitializeL();
       
   403     iListPane->ReActivateL();
       
   404     InternalizeL();
       
   405     SetControlFocusedL( EESMRFieldUnifiedEditor );
       
   406     SetTitlePaneObserver();
       
   407     DrawDeferred();
       
   408     }
       
   409 
       
   410 // ---------------------------------------------------------------------------
       
   411 // CESMRView::LaunchHelpL
       
   412 // ---------------------------------------------------------------------------
       
   413 //
       
   414 void CESMRView::LaunchHelpL( const TDesC& aContext )
       
   415     {
       
   416     FUNC_LOG;
       
   417 
       
   418     CArrayFix<TCoeHelpContext>* cntx =
       
   419 		new (ELeave) CArrayFixFlat<TCoeHelpContext>(1);
       
   420     CleanupStack::PushL(cntx);
       
   421     cntx->AppendL( TCoeHelpContext( KFSEmailUiUid, aContext ) );
       
   422     CleanupStack::Pop(cntx);
       
   423     HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), cntx );
       
   424     }
       
   425 
       
   426 
       
   427 // ---------------------------------------------------------------------------
       
   428 // CESMRView::SetTitlePaneObserver
       
   429 // ---------------------------------------------------------------------------
       
   430 //
       
   431 void CESMRView::SetTitlePaneObserver()
       
   432     {
       
   433     CESMRField* field = NULL;
       
   434     TInt fieldCount( iStorage->Count() );
       
   435     for ( TInt i(0); i < fieldCount; ++i )
       
   436         {
       
   437         field = iStorage->Field( i );
       
   438         TESMREntryFieldId fieldId( field->FieldId() );
       
   439 
       
   440         switch( fieldId )
       
   441             {
       
   442             case EESMRFieldSubject: //Fall through
       
   443             case EESMRFieldOccasion://Fall through
       
   444             case EESMRFieldPriority://Fall through
       
   445             case EESMRFieldDetailedSubject:
       
   446                 {
       
   447                 field->SetTitlePaneObserver( this );
       
   448                 break;
       
   449                 }
       
   450             default:
       
   451                 break;
       
   452             }
       
   453         }
       
   454     }
       
   455 
       
   456 // ---------------------------------------------------------------------------
       
   457 // CESMRView::UpdateTitlePaneTextL
       
   458 // ---------------------------------------------------------------------------
       
   459 //
       
   460 void CESMRView::UpdateTitlePaneTextL( const TDesC& aText )
       
   461     {
       
   462     FUNC_LOG;
       
   463     SetTitleL( aText );
       
   464     }
       
   465 
       
   466 // ---------------------------------------------------------------------------
       
   467 // CESMRView::HandleScrollEventL
       
   468 // ---------------------------------------------------------------------------
       
   469 //
       
   470 void CESMRView::HandleScrollEventL(
       
   471     CEikScrollBar* aScrollBar,
       
   472     TEikScrollEvent aEventType )
       
   473     {
       
   474     FUNC_LOG;
       
   475 
       
   476     if ( !aScrollBar )
       
   477        {
       
   478        return;
       
   479        }
       
   480 
       
   481     TInt newPosition = aScrollBar->ThumbPosition();
       
   482 
       
   483     switch( aEventType )
       
   484        {
       
   485        case EEikScrollThumbDragVert: // Drag started
       
   486        case EEikScrollThumbReleaseVert: // Drag released
       
   487            {
       
   488            if( newPosition < iScrollBarThumbPosition )
       
   489                {
       
   490                iListPane->ScrollFieldsDown(
       
   491                        iScrollBarThumbPosition - newPosition );
       
   492 
       
   493                iScrollBarThumbPosition = newPosition;
       
   494                }
       
   495 
       
   496            else if( newPosition > iScrollBarThumbPosition )
       
   497                {
       
   498                iListPane->ScrollFieldsUp(
       
   499                        newPosition - iScrollBarThumbPosition );
       
   500 
       
   501                iScrollBarThumbPosition = newPosition;
       
   502                }
       
   503            break;
       
   504            }
       
   505        case EEikScrollPageUp:
       
   506            {
       
   507            if( newPosition < iScrollBarThumbPosition )
       
   508                {
       
   509                iListPane->ScrollFieldsDown(
       
   510                        iScrollBarThumbPosition - newPosition );
       
   511 
       
   512                iScrollBarThumbPosition = newPosition;
       
   513                }
       
   514            break;
       
   515            }
       
   516        case EEikScrollPageDown:
       
   517            {
       
   518            if( newPosition > iScrollBarThumbPosition )
       
   519                {
       
   520                iListPane->ScrollFieldsUp(
       
   521                        newPosition - iScrollBarThumbPosition );
       
   522 
       
   523                iScrollBarThumbPosition = newPosition;
       
   524                }
       
   525            break;
       
   526            }
       
   527        default:
       
   528            {
       
   529            break;
       
   530            }
       
   531        }
       
   532 
       
   533     DrawNow();
       
   534     }
       
   535 
       
   536 // ---------------------------------------------------------------------------
       
   537 // CESMRView::ScrollBarPositionChanged()
       
   538 // ---------------------------------------------------------------------------
       
   539 //
       
   540 void CESMRView::ScrollBarPositionChanged( TInt aThumbPosition )
       
   541     {
       
   542     FUNC_LOG;
       
   543     iScrollBarThumbPosition = aThumbPosition;
       
   544     }
       
   545 
       
   546 // ---------------------------------------------------------------------------
       
   547 // CESMRView::SetContainerWindowL
       
   548 // ---------------------------------------------------------------------------
       
   549 //
       
   550 void CESMRView::SetContainerWindowL( const CCoeControl& aContainer )
       
   551     {
       
   552     FUNC_LOG;
       
   553     CCoeControl::SetContainerWindowL( aContainer );
       
   554 
       
   555     /**
       
   556      * Somehow if list is constructed before this SetContainerWindowL is called,
       
   557      * all redraws throws KERN-EXEC 3 (the CCoeControl's iWin variable is NULL)
       
   558      */
       
   559 
       
   560     iScrollBar = new (ELeave) CAknDoubleSpanScrollBar( this );
       
   561     iScrollBar->ConstructL( EFalse, this, this, CEikScrollBar::EVertical, 0 );
       
   562     iScrollBar->SetModel( &iScrollBarModel );
       
   563     iScrollBar->MakeVisible( ETrue );
       
   564 
       
   565     iControls.AppendL( iScrollBar );
       
   566     
       
   567     iListPane = CMRListPane::NewL(
       
   568             *this,
       
   569             *iStorage,
       
   570             iScrollBarModel,
       
   571             *iScrollBar,
       
   572             *this );
       
   573 
       
   574     iControls.AppendL( iListPane );
       
   575     
       
   576     iListPane->SetBackground( this );
       
   577 
       
   578     iBgContext = CAknsBasicBackgroundControlContext::NewL(
       
   579             KAknsIIDQsnBgAreaMain, Rect(), ETrue );
       
   580 
       
   581     if( iEntry )
       
   582         {
       
   583         MESMRCalDbMgr& dbMgr = iEntry->GetDBMgr();
       
   584         dbMgr.SetCurCalendarByEntryL( *iEntry );
       
   585         }
       
   586 
       
   587     // Physics: enable needed pointer events
       
   588     EnableDragEvents();
       
   589     ClaimPointerGrab();
       
   590 
       
   591     // Initialize the focus
       
   592     iFocusStrategy.InitializeFocus();
       
   593 
       
   594     if( iEntry->Type() == MESMRCalEntry::EESMRCalEntryMeetingRequest )
       
   595         {
       
   596         // Static cast is safe here. We know for sure that entry is MR
       
   597         MESMRMeetingRequestEntry* mrEntry =
       
   598                 static_cast<MESMRMeetingRequestEntry*>( iEntry );
       
   599         if ( mrEntry->IsOpenedFromMail() )
       
   600             {
       
   601             TAknLayoutRect naviArrowRightLayoutRect =
       
   602                         NMRLayoutManager::GetLayoutRect( Rect(),
       
   603                                 NMRLayoutManager::EMRLayoutMRNaviArrowRight );
       
   604             TRect naviArrowRect( naviArrowRightLayoutRect.Rect() );
       
   605             
       
   606             iNaviArrowLeft = CMRNaviArrow::NewL(
       
   607                     this, 
       
   608                     CMRNaviArrow::EMRArrowLeft, 
       
   609             		iObserver, 
       
   610             		naviArrowRect.Size()  );
       
   611             
       
   612             iNaviArrowRight = CMRNaviArrow::NewL( 
       
   613                     this, 
       
   614                     CMRNaviArrow::EMRArrowRight, 
       
   615             		iObserver, 
       
   616             		naviArrowRect.Size() );
       
   617             
       
   618             iControls.AppendL( iNaviArrowLeft );
       
   619             iControls.AppendL( iNaviArrowRight );
       
   620             }
       
   621         }
       
   622     }
       
   623 
       
   624 // ---------------------------------------------------------------------------
       
   625 // CESMRView::CountComponentControls
       
   626 // ---------------------------------------------------------------------------
       
   627 //
       
   628 TInt CESMRView::CountComponentControls() const
       
   629     {
       
   630     FUNC_LOG;
       
   631     return iControls.Count();
       
   632     }
       
   633 
       
   634 // ---------------------------------------------------------------------------
       
   635 // CESMRView::ComponentControl()
       
   636 // ---------------------------------------------------------------------------
       
   637 //
       
   638 CCoeControl* CESMRView::ComponentControl( TInt aInd ) const
       
   639     {
       
   640     FUNC_LOG;
       
   641     return iControls[aInd];
       
   642     }
       
   643 
       
   644 // ---------------------------------------------------------------------------
       
   645 // CESMRView::SizeChanged()
       
   646 // ---------------------------------------------------------------------------
       
   647 //
       
   648 void CESMRView::SizeChanged()
       
   649     {
       
   650     FUNC_LOG;
       
   651     
       
   652     // If list pane is not yet constructed, no point in layouting anything
       
   653     if( !iListPane )
       
   654         {
       
   655         return;
       
   656         }
       
   657     
       
   658     // Remove possible intersection with toolbar from container rect
       
   659     TRect containerRect( ContainerRect() );
       
   660     
       
   661     // Now toolbar does not intersect with view, so it must not be taken
       
   662     // into account when calculating other component layouts.
       
   663     containerRect.SetRect( TPoint( 0, 0 ), containerRect.Size() );
       
   664     
       
   665     // Get the rect of stripe.
       
   666     TAknLayoutRect stripeLayoutRect =
       
   667         NMRLayoutManager::GetLayoutRect( containerRect,
       
   668                 NMRLayoutManager::EMRLayoutStripe );
       
   669     iStripeRect = stripeLayoutRect.Rect();
       
   670     
       
   671     // Layouting listpane, scroll bar and navi arrows in landscape mode
       
   672     if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   673         {
       
   674         TAknLayoutRect listareaLayoutRect =
       
   675                 NMRLayoutManager::GetLayoutRect( containerRect,
       
   676                         NMRLayoutManager::EMRLayoutListArea );
       
   677         TRect listareaRect( listareaLayoutRect.Rect() );
       
   678 
       
   679         // List panes default rect needs to be modified due to
       
   680         // scrollbar and calendar indication stripe
       
   681         
       
   682         if ( AknLayoutUtils::LayoutMirrored() )
       
   683             {
       
   684             // Remove stripe width from list pane width when align is R to L
       
   685             listareaRect.iBr.iX -= iStripeRect.Width();
       
   686             }
       
   687         else
       
   688             {
       
   689             // Remove stripe width from list pane width when align is L to R
       
   690             listareaRect.iTl.iX += iStripeRect.Width();
       
   691             }
       
   692         
       
   693         if( iScrollBar )
       
   694            {
       
   695            TAknLayoutRect scrollareaLayoutRect =
       
   696                NMRLayoutManager::GetLayoutRect( containerRect,
       
   697                        NMRLayoutManager::EMRLayoutScrollBar );
       
   698            TRect scrollareaRect( scrollareaLayoutRect.Rect() );
       
   699            // Scroll bar's height is always the same as listpane's height
       
   700            scrollareaRect.SetHeight( listareaRect.Height() );
       
   701            
       
   702            iScrollBar->SetRect( scrollareaRect );
       
   703            }
       
   704 
       
   705         iListPane->SetRect( listareaRect );
       
   706         
       
   707         // Make sure, that stripe height is the list pane height
       
   708         iStripeRect.SetHeight( iListPane->Rect().Height() );
       
   709 
       
   710         if(iViewMode == EESMRViewMR)
       
   711             {
       
   712             if( iNaviArrowLeft )
       
   713                 {
       
   714                 TAknLayoutRect naviArrowLeftLayoutRect =
       
   715                     NMRLayoutManager::GetLayoutRect( containerRect,
       
   716                             NMRLayoutManager::EMRLayoutMRNaviArrowLeft );
       
   717                 TRect naviArrowLeftRect( naviArrowLeftLayoutRect.Rect() );
       
   718     
       
   719                 // Left arrow needs to be moved right the amount of
       
   720                 // stripe width in landscape
       
   721                 naviArrowLeftRect.Move( iStripeRect.Width(), 0 );
       
   722                 
       
   723                 iNaviArrowLeft->SetRect( naviArrowLeftRect );
       
   724                 }
       
   725     
       
   726             if( iNaviArrowRight )
       
   727                 {
       
   728                 TAknLayoutRect naviArrowRightLayoutRect =
       
   729                         NMRLayoutManager::GetLayoutRect( containerRect,
       
   730                                 NMRLayoutManager::EMRLayoutMRNaviArrowRight );
       
   731                 TRect naviArrowRightRect( naviArrowRightLayoutRect.Rect() );
       
   732     
       
   733                 // Right arrow needs to be moved left the amount of
       
   734                 // possible toolbar width in landscape
       
   735                 TInt scrollWidth( 0 );
       
   736                 if( iScrollBar )
       
   737                     {
       
   738                     scrollWidth = iScrollBar->Rect().Width();
       
   739                     }
       
   740                 
       
   741                 naviArrowRightRect.Move( scrollWidth, 0 );
       
   742     
       
   743                 iNaviArrowRight->SetRect( naviArrowRightRect );
       
   744                 }
       
   745             }
       
   746         else
       
   747             {
       
   748             SetNaviArrowStatus( EFalse, EFalse );
       
   749             }
       
   750         }
       
   751 
       
   752     // Layouting listpane, scroll bar and navi arrows in portrait mode
       
   753     else
       
   754         {
       
   755         TAknLayoutRect listareaLayoutRect =
       
   756                NMRLayoutManager::GetLayoutRect( containerRect,
       
   757                        NMRLayoutManager::EMRLayoutListArea );
       
   758         TRect listareaRect( listareaLayoutRect.Rect() );
       
   759         
       
   760         if ( AknLayoutUtils::LayoutMirrored() )
       
   761             {
       
   762             // Remove stripe width from list pane width when align is R to L
       
   763             listareaRect.iBr.iX -= iStripeRect.Width();
       
   764             }
       
   765         else
       
   766             {
       
   767             // Remove stripe width from list pane width when align is L to R
       
   768             listareaRect.iTl.iX += iStripeRect.Width();
       
   769             }
       
   770                 
       
   771         iListPane->SetRect( listareaRect );
       
   772         
       
   773         if( iScrollBar )
       
   774            {
       
   775            TAknLayoutRect scrollareaLayoutRect =
       
   776                NMRLayoutManager::GetLayoutRect( containerRect,
       
   777                        NMRLayoutManager::EMRLayoutScrollBar );
       
   778            TRect scrollareaRect( scrollareaLayoutRect.Rect() );
       
   779            // Scroll bar's height is always the same as listpane's height
       
   780            scrollareaRect.SetHeight( iListPane->Rect().Height() );
       
   781            iScrollBar->SetRect( scrollareaRect );
       
   782            }
       
   783         
       
   784         // Make sure, that stripe height is the list pane height
       
   785         iStripeRect.SetHeight( iListPane->Rect().Height() );
       
   786 
       
   787         if(iViewMode == EESMRViewMR)
       
   788             {
       
   789             if( iNaviArrowLeft )
       
   790                 {
       
   791                 TAknLayoutRect naviArrowLeftLayoutRect =
       
   792                     NMRLayoutManager::GetLayoutRect( containerRect,
       
   793                             NMRLayoutManager::EMRLayoutMRNaviArrowLeft );
       
   794                 TRect naviArrowLeftRect( naviArrowLeftLayoutRect.Rect() );
       
   795             
       
   796                 // Left arrow needs to be moved right the amount of
       
   797                 // stripe width in portrait
       
   798                 naviArrowLeftRect.Move( iStripeRect.Width(), 0 );
       
   799                 
       
   800                 iNaviArrowLeft->SetRect( naviArrowLeftRect );
       
   801                 }
       
   802             
       
   803             if( iNaviArrowRight )
       
   804                 {
       
   805                 TAknLayoutRect naviArrowRightLayoutRect =
       
   806                         NMRLayoutManager::GetLayoutRect( containerRect,
       
   807                                 NMRLayoutManager::EMRLayoutMRNaviArrowRight );
       
   808                 TRect naviArrowRightRect( naviArrowRightLayoutRect.Rect() );
       
   809             
       
   810                 // Right arrow needs to be moved right the amount of
       
   811                 // stripe width in portrait
       
   812                 naviArrowRightRect.Move( iStripeRect.Width(), 0 );
       
   813                 
       
   814                 iNaviArrowRight->SetRect( naviArrowRightRect );
       
   815                 }
       
   816             }
       
   817         else
       
   818             {
       
   819             SetNaviArrowStatus( EFalse, EFalse );
       
   820             }
       
   821         }
       
   822     
       
   823     if ( iAttachmentIndicator )
       
   824         {
       
   825         iAttachmentIndicator->SetRect( 
       
   826                 CalculateAttachmentIndicatorLayout() );
       
   827         }
       
   828     
       
   829     if( iBgContext )
       
   830         {
       
   831         iBgContext->SetRect( containerRect );
       
   832         if ( &Window() )
       
   833             {
       
   834             iBgContext->SetParentPos( PositionRelativeToScreen() );
       
   835             }
       
   836         }
       
   837     }
       
   838 
       
   839 // ---------------------------------------------------------------------------
       
   840 // CESMRView::MinimumSize()
       
   841 // Gets the main pane size needed by CEikDialog to layout itself correctly
       
   842 // ---------------------------------------------------------------------------
       
   843 //
       
   844 TSize CESMRView::MinimumSize()
       
   845     {
       
   846     FUNC_LOG;
       
   847     TRect rect;
       
   848     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
       
   849     return rect.Size();
       
   850     }
       
   851 
       
   852 // ---------------------------------------------------------------------------
       
   853 // CESMRView::OfferKeyEventL
       
   854 // ---------------------------------------------------------------------------
       
   855 //
       
   856 TKeyResponse CESMRView::OfferKeyEventL(
       
   857 		const TKeyEvent &aKeyEvent,
       
   858 		TEventCode aType)
       
   859     {
       
   860     FUNC_LOG;
       
   861     TKeyResponse response( EKeyWasNotConsumed );
       
   862     if ( iListPane )
       
   863         {
       
   864         // Use focus strategy
       
   865         iFocusStrategy.EventOccured( MMRFocusStrategy::EFocusKeyEvent );
       
   866 
       
   867         TBool forwardEvent( ETrue );
       
   868         // Remove Delete hw key command if the focus is not visible
       
   869         if ( !iFocusStrategy.IsFocusVisible() )
       
   870             {
       
   871             if ( aType == EEventKey && aKeyEvent.iCode == EKeyBackspace )
       
   872                 {
       
   873                 forwardEvent = EFalse;
       
   874                 }
       
   875             }
       
   876 
       
   877         if ( forwardEvent )
       
   878             {
       
   879             response = iListPane->OfferKeyEventL( aKeyEvent, aType );
       
   880             iListPane->DrawDeferred();
       
   881             }
       
   882         }
       
   883     return response;
       
   884     }
       
   885 
       
   886 
       
   887 // ---------------------------------------------------------------------------
       
   888 // CESMRView::Draw
       
   889 // This Draw is called when background for title pane (iTitle) is drawn
       
   890 // ---------------------------------------------------------------------------
       
   891 //
       
   892 void CESMRView::Draw( const TRect& aRect ) const
       
   893     {
       
   894     FUNC_LOG;
       
   895     CWindowGc& gc = SystemGc();
       
   896 
       
   897     // Draw the background for iTitle using the current skin
       
   898     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   899     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
   900     AknsDrawUtils::Background( skin, cc, this, gc, aRect );
       
   901 
       
   902     // Draw color stripe
       
   903     MESMRCalDbMgr& DbMgr = iEntry->GetDBMgr();
       
   904 
       
   905     TRgb stripeColor = DbMgr.GetCurCalendarColor();
       
   906     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   907     gc.SetBrushColor( stripeColor );
       
   908     gc.DrawRect( iStripeRect );
       
   909 
       
   910     gc.Reset();
       
   911     }
       
   912 
       
   913 // ---------------------------------------------------------------------------
       
   914 // CESMRView::Draw
       
   915 // This draw method draws the dialog area
       
   916 // ---------------------------------------------------------------------------
       
   917 //
       
   918 void CESMRView::Draw(
       
   919 		CWindowGc& /* aGc */,
       
   920 		const CCoeControl& aControl,
       
   921 		const TRect& /*aRect*/) const
       
   922     {
       
   923     FUNC_LOG;
       
   924     CWindowGc& gc = SystemGc();
       
   925 
       
   926     // Draw the background for aControl using the current skin
       
   927     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   928     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
   929     AknsDrawUtils::Background( skin, cc, &aControl, gc, aControl.Rect() );
       
   930     }
       
   931 
       
   932 // ---------------------------------------------------------------------------
       
   933 // CESMRView::GetTextDrawer
       
   934 // ---------------------------------------------------------------------------
       
   935 //
       
   936 void CESMRView::GetTextDrawer(
       
   937 		CCoeTextDrawerBase*& /*aText*/,
       
   938 		const CCoeControl* /*aControl*/) const
       
   939     {
       
   940     // Do nothing
       
   941     }
       
   942 
       
   943 // ---------------------------------------------------------------------------
       
   944 // CESMRView::SetTitleL()
       
   945 // ---------------------------------------------------------------------------
       
   946 //
       
   947 void CESMRView::SetTitleL( const TDesC& /*aTitle*/, TBool /*aDefault*/)
       
   948     {
       
   949     FUNC_LOG;
       
   950     }
       
   951 
       
   952 // ---------------------------------------------------------------------------
       
   953 // CESMRView::SetControlFocusedL()
       
   954 // ---------------------------------------------------------------------------
       
   955 //
       
   956 void CESMRView::SetControlFocusedL( TESMREntryFieldId aField )
       
   957     {
       
   958     FUNC_LOG;
       
   959     iListPane->SetControlFocusedL( aField );
       
   960     }
       
   961 
       
   962 // ---------------------------------------------------------------------------
       
   963 // CESMRView::HandleResourceChange()
       
   964 // ---------------------------------------------------------------------------
       
   965 //
       
   966 void CESMRView::HandleResourceChange( TInt aType )
       
   967     {
       
   968     FUNC_LOG;
       
   969     CCoeControl::HandleResourceChange( aType );
       
   970     TInt error = KErrNone;
       
   971     TBool record = ETrue;
       
   972     
       
   973     switch ( aType )
       
   974         {
       
   975         case  KAknsMessageSkinChange:
       
   976             {
       
   977             TRAP( error, iListPane->InitializeL() );
       
   978             break;
       
   979             }
       
   980         case KEikMessageColorSchemeChange:
       
   981             {
       
   982             TRAP( error, iListPane->InitializeL() );
       
   983             break;
       
   984             }
       
   985         case KEikDynamicLayoutVariantSwitch:
       
   986         case KAknLocalZoomLayoutSwitch:
       
   987             {
       
   988             SizeChanged();
       
   989             break;
       
   990             }
       
   991         default:
       
   992             {
       
   993             record = EFalse;
       
   994             break;
       
   995             }
       
   996         }
       
   997 
       
   998     if ( error != KErrNone )
       
   999         {
       
  1000         record = EFalse;
       
  1001         iCoeEnv->HandleError( error );
       
  1002         }
       
  1003     
       
  1004     if ( record )
       
  1005         {
       
  1006         iListPane->RecordFields();
       
  1007         }
       
  1008     }
       
  1009 
       
  1010 // ---------------------------------------------------------------------------
       
  1011 // CESMRView::MopSupplyObject()
       
  1012 // ---------------------------------------------------------------------------
       
  1013 //
       
  1014 TTypeUid::Ptr CESMRView::MopSupplyObject( TTypeUid aId )
       
  1015     {
       
  1016     FUNC_LOG;
       
  1017     if ( iBgContext )
       
  1018         {
       
  1019         return MAknsControlContext::SupplyMopObject( aId, iBgContext );
       
  1020         }
       
  1021     return CCoeControl::MopSupplyObject( aId );
       
  1022     }
       
  1023 
       
  1024 // -----------------------------------------------------------------------------
       
  1025  // CESMRView::HandlePointerEventL()
       
  1026  // -----------------------------------------------------------------------------
       
  1027  //
       
  1028  void CESMRView::HandlePointerEventL(
       
  1029      const TPointerEvent &aPointerEvent )
       
  1030      {
       
  1031      FUNC_LOG;
       
  1032      // Call focus strategy
       
  1033      iFocusStrategy.EventOccured( MMRFocusStrategy::EFocusPointerEvent );
       
  1034 
       
  1035      CCoeControl::HandlePointerEventL( aPointerEvent );
       
  1036      }
       
  1037 
       
  1038 // ---------------------------------------------------------------------------
       
  1039 // CESMRView::InitialScroll()
       
  1040 // ---------------------------------------------------------------------------
       
  1041 //
       
  1042 void CESMRView::InitialScrollL()
       
  1043     {
       
  1044     FUNC_LOG;
       
  1045     iListPane->InitialScrollL();
       
  1046     }
       
  1047 
       
  1048 // ---------------------------------------------------------------------------
       
  1049 // CESMRView::DynInitMenuPaneL
       
  1050 // ---------------------------------------------------------------------------
       
  1051 //
       
  1052 void CESMRView::DynInitMenuPaneL(
       
  1053         TMRMenuStyle aMenuStyle,
       
  1054         TInt aResourceId,
       
  1055         CEikMenuPane* aMenuPane )
       
  1056     {
       
  1057     FUNC_LOG;
       
  1058     // Initialize field specific options in context menu and options menu.
       
  1059     // Options menu has field specific options only when focus is visible.
       
  1060     if ( aMenuStyle != EMROptionsMenu
       
  1061          || ( aMenuStyle == EMROptionsMenu
       
  1062               && iFocusStrategy.IsFocusVisible() ) )
       
  1063         {
       
  1064         CESMRField* field = iStorage->FieldById( ClickedOrFocusedField() );
       
  1065         field->DynInitMenuPaneL( aResourceId, aMenuPane );
       
  1066         }
       
  1067     }
       
  1068 
       
  1069 // ---------------------------------------------------------------------------
       
  1070 // CESMRView::SetNaviArrowStatus
       
  1071 // ---------------------------------------------------------------------------
       
  1072 //
       
  1073 void CESMRView::SetNaviArrowStatus( 
       
  1074         TBool aLeftArrowVisible, 
       
  1075         TBool aRightArrowVisible )
       
  1076     {
       
  1077     FUNC_LOG;
       
  1078     if ( iNaviArrowLeft )
       
  1079         {
       
  1080         iNaviArrowLeft->SetNaviArrowStatus( aLeftArrowVisible );
       
  1081         }
       
  1082     if ( iNaviArrowRight )
       
  1083         {
       
  1084         iNaviArrowRight->SetNaviArrowStatus( aRightArrowVisible );
       
  1085         }
       
  1086     }
       
  1087 // ---------------------------------------------------------------------------
       
  1088 // CESMRView::SetViewMode
       
  1089 // ---------------------------------------------------------------------------
       
  1090 //
       
  1091 void CESMRView::SetViewMode(TESMRViewMode aMode)
       
  1092 	{
       
  1093     FUNC_LOG;
       
  1094 	iViewMode = aMode;
       
  1095 	}
       
  1096 // ---------------------------------------------------------------------------
       
  1097 // CESMRView::GetViewMode
       
  1098 // ---------------------------------------------------------------------------
       
  1099 //
       
  1100 TESMRViewMode CESMRView::GetViewMode()
       
  1101 	{
       
  1102     FUNC_LOG;
       
  1103 	return iViewMode;
       
  1104 	}
       
  1105 
       
  1106 // ---------------------------------------------------------------------------
       
  1107 // CESMRView::ProcessEventL
       
  1108 // ---------------------------------------------------------------------------
       
  1109 //
       
  1110 void CESMRView::ProcessEventL( const MESMRFieldEvent& aEvent )
       
  1111     {
       
  1112     FUNC_LOG;
       
  1113 
       
  1114     if ( MESMRFieldEvent::EESMRFieldChangeEvent ==  aEvent.Type() )
       
  1115         {
       
  1116         TInt* fieldId = static_cast< TInt* >( aEvent.Param( 0 ) );
       
  1117         
       
  1118         if ( EESMRFieldViewerAttachments == *fieldId )
       
  1119             {
       
  1120             if ( !iAttachmentIndicator )
       
  1121                 {
       
  1122                 TRect attachmentDownloadIndicatorRect( 
       
  1123                         CalculateAttachmentIndicatorLayout() );
       
  1124                 
       
  1125                 iAttachmentIndicator = CMRAttachmentIndicator::NewL( 
       
  1126                         attachmentDownloadIndicatorRect, 
       
  1127                         this );
       
  1128     
       
  1129                 CFbsBitmap* bitMap( NULL );
       
  1130                 CFbsBitmap* bitMapMask( NULL );
       
  1131                 TSize size( 0,0 );
       
  1132                 NMRBitmapManager::GetSkinBasedBitmapLC(
       
  1133                                 NMRBitmapManager::EMRBitmapDownloadAttachment,
       
  1134                                 bitMap, bitMapMask, size );
       
  1135                 
       
  1136                 CleanupStack::Pop( 2 ); // bitMap, bitMapMask
       
  1137                 
       
  1138                 
       
  1139                 
       
  1140                 iAttachmentIndicator->SetImage( bitMap, bitMapMask );
       
  1141                 iControls.AppendL( iAttachmentIndicator );
       
  1142                 }
       
  1143             
       
  1144             MESMRFieldEventValue* value =
       
  1145                     static_cast< MESMRFieldEventValue* >( aEvent.Param( 1 ) );
       
  1146             
       
  1147             iAttachmentIndicator->SetTextL( value->StringValue() );            
       
  1148             iAttachmentIndicator->MakeVisible( ETrue );
       
  1149             
       
  1150             SizeChanged();        
       
  1151             }
       
  1152         }
       
  1153     }
       
  1154 
       
  1155 // ---------------------------------------------------------------------------
       
  1156 // CESMRView::CalculateAttachmentIndicatorLayout
       
  1157 // ---------------------------------------------------------------------------
       
  1158 //
       
  1159 TRect CESMRView::CalculateAttachmentIndicatorLayout()
       
  1160     {
       
  1161     TRect containerRect( ContainerRect() );
       
  1162     
       
  1163 
       
  1164 	TAknLayoutRect naviArrowLeftLayoutRect =
       
  1165 			NMRLayoutManager::GetLayoutRect( containerRect,
       
  1166 					NMRLayoutManager::EMRLayoutMRNaviArrowLeft );    
       
  1167 	TRect naviArrowLeftRect = naviArrowLeftLayoutRect.Rect();
       
  1168 	
       
  1169 	TAknLayoutRect naviArrowRightLayoutRect =
       
  1170 			NMRLayoutManager::GetLayoutRect( containerRect,
       
  1171 					NMRLayoutManager::EMRLayoutMRNaviArrowRight );
       
  1172 	TRect naviArrowRightRect = naviArrowRightLayoutRect.Rect();
       
  1173 	//Exchange the narrows' rect when LayoutMirrored
       
  1174 	if ( AknLayoutUtils::LayoutMirrored() )
       
  1175 		{
       
  1176 		naviArrowLeftRect = naviArrowRightLayoutRect.Rect();
       
  1177 		naviArrowRightRect= naviArrowLeftLayoutRect.Rect();
       
  1178 		}
       
  1179 	
       
  1180     if( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1181         {                
       
  1182         naviArrowLeftRect.Move( iStripeRect.Width(), 0 );
       
  1183 
       
  1184         TInt scrollWidth( 0 );
       
  1185         if( iScrollBar )
       
  1186             {
       
  1187             scrollWidth = iScrollBar->Rect().Width();
       
  1188             }
       
  1189         
       
  1190         naviArrowRightRect.Move( scrollWidth, 0 );    
       
  1191         }
       
  1192     else
       
  1193         {
       
  1194         // Left arrow needs to be moved right the amount of
       
  1195         // stripe width in portrait
       
  1196         naviArrowLeftRect.Move( iStripeRect.Width(), 0 );
       
  1197         
       
  1198         TRect naviArrowRightRect = naviArrowRightLayoutRect.Rect();
       
  1199         
       
  1200         naviArrowRightRect.Move( iStripeRect.Width(), 0 );
       
  1201         }   
       
  1202 
       
  1203     // Get height for one row 
       
  1204     TAknLayoutRect rowLayout = 
       
  1205         NMRLayoutManager::GetLayoutRect( 
       
  1206                 containerRect, NMRLayoutManager::EMRLayoutTextEditorIcon );
       
  1207     TRect rowRect( rowLayout.Rect() );
       
  1208     
       
  1209     TRect attachmentIndicatorRect;
       
  1210     
       
  1211     attachmentIndicatorRect.iTl = 
       
  1212                 TPoint( naviArrowLeftRect.iBr.iX, 
       
  1213                         naviArrowLeftRect.iBr.iY - naviArrowLeftRect.Height() );    
       
  1214     
       
  1215     attachmentIndicatorRect.iBr = 
       
  1216             TPoint(  naviArrowRightRect.iTl.iX, 
       
  1217                     naviArrowLeftRect.iBr.iY );
       
  1218     
       
  1219     return attachmentIndicatorRect;
       
  1220     }
       
  1221 
       
  1222 // ---------------------------------------------------------------------------
       
  1223 // CESMRView::ContainerRect
       
  1224 // ---------------------------------------------------------------------------
       
  1225 //
       
  1226 TRect CESMRView::ContainerRect() const
       
  1227     {
       
  1228     // Remove possible intersection with toolbar from container rect
       
  1229     TRect containerRect( PositionRelativeToScreen(), Rect().Size() );
       
  1230     TRect toolbar( iToolbar.Rect() );
       
  1231     if ( containerRect.Intersects( toolbar ) )
       
  1232         {
       
  1233         toolbar.Intersection( containerRect );
       
  1234         if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1235             {
       
  1236             containerRect.SetWidth( containerRect.Width() - toolbar.Width() );
       
  1237             }
       
  1238         else
       
  1239             {
       
  1240             containerRect.SetHeight( containerRect.Height() - toolbar.Height() );
       
  1241             }
       
  1242         }
       
  1243     // Now toolbar does not intersect with view, so it must not be taken
       
  1244     // into account when calculating other component layouts.
       
  1245     containerRect.SetRect( TPoint( 0, 0 ), containerRect.Size() );
       
  1246     
       
  1247     return containerRect;
       
  1248     }
       
  1249 
       
  1250 // EOF