meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponsefield.cpp
changeset 0 8466d47a6819
child 8 e1b6206813b4
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:  Meeting Request viewer response field implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cesmrresponsefield.h"
       
    19 #include "cesmrresponseitem.h"
       
    20 #include "mesmrresponseobserver.h"
       
    21 #include "mesmrmeetingrequestentry.h"
       
    22 #include "cesmrconflictpopup.h"
       
    23 #include "cesmrlayoutmgr.h"
       
    24 #include "nmrlayoutmanager.h"
       
    25 #include "esmrhelper.h"
       
    26 #include "CFSMailBox.h"
       
    27 
       
    28 #include <esmrgui.rsg>
       
    29 #include <StringLoader.h>
       
    30 #include <calentry.h>
       
    31 #include <caluser.h>
       
    32 
       
    33 // DEBUG
       
    34 #include "emailtrace.h"
       
    35 
       
    36 /// Unnamed namespace for local definitions
       
    37 namespace // codescanner::namespace 
       
    38     { 
       
    39     const TInt KSelectionTopic(0);
       
    40     const TInt KOnlyTwoLines( 2 );
       
    41     const TInt KFirstCheckboxRow( 2 );
       
    42     const TInt KFirstControlItemIndex( 1 );
       
    43     const TInt KTopicFieldCount( 1 );
       
    44     const TInt KFirstSelectedItem( 1 );
       
    45     }  // namespace
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // -----------------------------------------------------------------------------
       
    49 //                       CESMRResponseField
       
    50 // -----------------------------------------------------------------------------
       
    51 // -----------------------------------------------------------------------------
       
    52 
       
    53 // ======== MEMBER FUNCTIONS ========
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CESMRResponseField::NewL
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 CESMRResponseField* CESMRResponseField::NewL(
       
    60         MESMRResponseObserver* aResponseObserver )
       
    61     {
       
    62     FUNC_LOG;
       
    63     CESMRResponseField* self = new (ELeave) CESMRResponseField(aResponseObserver);
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL();
       
    66     CleanupStack::Pop( self );
       
    67     return self;
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CESMRResponseField::~CESMRResponseField
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CESMRResponseField::~CESMRResponseField()
       
    75     {
       
    76     FUNC_LOG;
       
    77     iResponseItemArray.ResetAndDestroy();
       
    78     delete iConfPopup;
       
    79     
       
    80     if( iESMRStaticAccessed ) 
       
    81         {
       
    82         iESMRStatic.Close();
       
    83         }
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CESMRResponseField::CESMRResponseField
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 CESMRResponseField::CESMRResponseField(MESMRResponseObserver* aResponseObserver)
       
    91 : iResponseObserver(aResponseObserver), iSelectionIndex( KFirstSelectedItem ),
       
    92   iESMRStaticAccessed(EFalse)
       
    93     {
       
    94     FUNC_LOG;
       
    95     SetFieldId( EESMRFieldResponseArea );
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CESMRResponseField::ConstructL
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 void CESMRResponseField::ConstructL()
       
   103     {
       
   104     FUNC_LOG;
       
   105     // Construct the topic for response area
       
   106     // Topic line is without icon and text. Text is set later
       
   107     CESMRResponseItem* responseItem =
       
   108         CESMRResponseItem::NewLC( EESMRCmdUndefined, KNullDesC, EFalse );
       
   109     iResponseItemArray.AppendL( responseItem );
       
   110     CleanupStack::Pop( responseItem );
       
   111 
       
   112     // Create tick boxes only in non touch environment
       
   113     if ( !AknLayoutUtils::PenEnabled() )
       
   114     	{
       
   115 		// Constuct the first item (Accept)
       
   116 		HBufC* stringholder = StringLoader::LoadLC( R_QTN_MEET_REQ_RESPONSE_ACCEPT ,
       
   117 													iEikonEnv );
       
   118 		responseItem = CESMRResponseItem::NewLC( EESMRCmdAcceptMR, *stringholder, ETrue );
       
   119 		iResponseItemArray.AppendL( responseItem );
       
   120 		CleanupStack::Pop( responseItem );
       
   121 		CleanupStack::PopAndDestroy( stringholder );
       
   122 			
       
   123 		// Constuct the second item (Tentative)
       
   124 		stringholder = StringLoader::LoadLC( R_QTN_MEET_REQ_RESPONSE_TENTATIVE , iEikonEnv );
       
   125 		responseItem = CESMRResponseItem::NewLC( EESMRCmdTentativeMR, *stringholder, ETrue );
       
   126 		iResponseItemArray.AppendL( responseItem );
       
   127 		CleanupStack::Pop( responseItem );
       
   128 		CleanupStack::PopAndDestroy( stringholder );
       
   129 	
       
   130 		// Constuct the third item (Decline)
       
   131 		stringholder = StringLoader::LoadLC( R_QTN_MEET_REQ_RESPONSE_DECLINE , iEikonEnv );
       
   132 		responseItem = CESMRResponseItem::NewLC( EESMRCmdDeclineMR, *stringholder, ETrue );
       
   133 		iResponseItemArray.AppendL( responseItem );
       
   134 		CleanupStack::Pop( responseItem );
       
   135 		CleanupStack::PopAndDestroy( stringholder );
       
   136     	}
       
   137     }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CESMRResponseField::InitializeL
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 void CESMRResponseField::InitializeL()
       
   144     {
       
   145     FUNC_LOG;
       
   146     TAknLayoutText layout = 
       
   147     NMRLayoutManager::GetLayoutText( 
       
   148             Rect(), NMRLayoutManager::EMRTextLayoutCheckboxEditor );    
       
   149     SetFont( layout.Font() );
       
   150     if( iSelectionIndex < iResponseItemArray.Count() )
       
   151         {
       
   152         iResponseItemArray[iSelectionIndex]->SetHighlight();
       
   153         }
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CESMRResponseField::CountComponentControls
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 TInt CESMRResponseField::CountComponentControls() const
       
   161     {
       
   162     FUNC_LOG;
       
   163     return iResponseItemArray.Count();
       
   164     }
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 // CESMRResponseField::ComponentControl
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 CCoeControl* CESMRResponseField::ComponentControl( TInt aInd ) const
       
   171     {
       
   172     FUNC_LOG;
       
   173     return iResponseItemArray[aInd];
       
   174     }
       
   175 
       
   176 // -----------------------------------------------------------------------------
       
   177 // CESMRResponseField::Draw
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 void CESMRResponseField::Draw(
       
   181     const TRect& /*aRect*/ ) const
       
   182     {
       
   183     FUNC_LOG;
       
   184     }
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CESMRResponseField::SizeChanged
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 void CESMRResponseField::SizeChanged()
       
   191     {
       
   192     FUNC_LOG;
       
   193     TRect rect( Rect() );
       
   194 
       
   195     // Topic field
       
   196     TAknLayoutRect topicLayoutRect =
       
   197         NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );  
       
   198     AknLayoutUtils::LayoutControl(
       
   199             ControlItem( KSelectionTopic ),
       
   200             rect,
       
   201             topicLayoutRect.Color().Value(), 
       
   202             topicLayoutRect.Rect().iTl.iX, 
       
   203             topicLayoutRect.Rect().iTl.iY, 
       
   204             topicLayoutRect.Rect().iBr.iX, 
       
   205             topicLayoutRect.Rect().iBr.iY,
       
   206             topicLayoutRect.Rect().Width(), 
       
   207             topicLayoutRect.Rect().Height());    
       
   208 
       
   209     // Items
       
   210     // Remove one for the topic field
       
   211     TInt count( iResponseItemArray.Count() - KTopicFieldCount );
       
   212     TInt row( KFirstCheckboxRow );
       
   213     TInt controlIndex( KFirstControlItemIndex );
       
   214     TRect parentRect( Rect() );
       
   215     for( TInt i = 0; i < count; ++i )
       
   216         {        
       
   217         TAknLayoutRect choiceLayoutRect =
       
   218             NMRLayoutManager::GetFieldRowLayoutRect( parentRect, row + i );
       
   219         rect = parentRect;
       
   220         // Move the row down then it will be drawn to correct position.
       
   221         // controlIndex+1 tells the fields index.
       
   222         TInt movement = choiceLayoutRect.Rect().Height();
       
   223         rect.Move( 0, movement * ( controlIndex + i ) );
       
   224         
       
   225         AknLayoutUtils::LayoutControl(
       
   226                 ControlItem( controlIndex + i ),
       
   227                 rect,
       
   228                 choiceLayoutRect.Color().Value(), 
       
   229                 choiceLayoutRect.Rect().iTl.iX, 
       
   230                 choiceLayoutRect.Rect().iTl.iY, 
       
   231                 choiceLayoutRect.Rect().iBr.iX, 
       
   232                 choiceLayoutRect.Rect().iBr.iY,
       
   233                 choiceLayoutRect.Rect().Width(), 
       
   234                 choiceLayoutRect.Rect().Height() );          
       
   235         }
       
   236     }
       
   237 
       
   238 // -----------------------------------------------------------------------------
       
   239 // CESMRResponseField::MinimumSize
       
   240 // -----------------------------------------------------------------------------
       
   241 //
       
   242 TSize CESMRResponseField::MinimumSize()
       
   243     {
       
   244     TRect rect( Rect() );
       
   245 
       
   246     // Topic field
       
   247     TAknLayoutRect row1LayoutRect(
       
   248         NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ) );
       
   249     rect = row1LayoutRect.Rect();
       
   250     
       
   251     TInt rowCount( iResponseItemArray.Count() );
       
   252     TInt height( rect.Height() * rowCount );
       
   253     return TSize( Parent()->Size().iWidth, height );
       
   254     }
       
   255 
       
   256 // -----------------------------------------------------------------------------
       
   257 // CESMRResponseField::OfferKeyEventL
       
   258 // -----------------------------------------------------------------------------
       
   259 //
       
   260 TKeyResponse CESMRResponseField::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   261                                                 TEventCode aType )
       
   262     {
       
   263     FUNC_LOG;
       
   264     TKeyResponse consumed( EKeyWasNotConsumed );    
       
   265 
       
   266     if ( aType == EEventKey && iSelectionIndex < iResponseItemArray.Count() )
       
   267         {
       
   268         if ( aKeyEvent.iScanCode == EStdKeyUpArrow  && iSelectionIndex > 1)
       
   269             {
       
   270             iResponseItemArray[iSelectionIndex]->RemoveHighlight();
       
   271             iSelectionIndex--;
       
   272             iResponseItemArray[iSelectionIndex]->SetHighlight();
       
   273             consumed = EKeyWasConsumed;
       
   274             }
       
   275          if ( aKeyEvent.iScanCode == EStdKeyDownArrow  &&
       
   276               iSelectionIndex < iResponseItemArray.Count() - 1 )
       
   277             {
       
   278             iResponseItemArray[iSelectionIndex]->RemoveHighlight();
       
   279             iSelectionIndex++;
       
   280             iResponseItemArray[iSelectionIndex]->SetHighlight();
       
   281             consumed = EKeyWasConsumed;
       
   282             }
       
   283          // If ok button is pressed and highlight is not in the topic item
       
   284          if ( aKeyEvent.iScanCode == EStdKeyDevice3
       
   285               && ItemSelectedL() )
       
   286             {
       
   287             consumed = EKeyWasConsumed;
       
   288             }
       
   289         }
       
   290 
       
   291     if ( consumed == EKeyWasConsumed )
       
   292         {
       
   293         DrawDeferred();
       
   294         }
       
   295 
       
   296     return consumed;
       
   297     }
       
   298 
       
   299 // -----------------------------------------------------------------------------
       
   300 // CESMRResponseField::FocusChanged
       
   301 // -----------------------------------------------------------------------------
       
   302 //
       
   303 void CESMRResponseField::FocusChanged( TDrawNow /*aDrawNow*/ )
       
   304     {
       
   305     FUNC_LOG;
       
   306     // Focus received
       
   307     if ( IsFocused() && iSelectionIndex < iResponseItemArray.Count() )
       
   308         {
       
   309         // By default, highlight the first item
       
   310         iResponseItemArray[iSelectionIndex]->SetHighlight();
       
   311         DrawDeferred();
       
   312         if (iConfPopup)
       
   313             {
       
   314             iConfPopup->ShowPopup();
       
   315             }
       
   316         }
       
   317     else // Focus lost remove highlight
       
   318         {
       
   319         for( TInt i = 0; i < iResponseItemArray.Count() ; i++ )
       
   320             {
       
   321             iResponseItemArray[i]->RemoveHighlight();
       
   322             }
       
   323         }
       
   324     }
       
   325 
       
   326 // -----------------------------------------------------------------------------
       
   327 // CESMRResponseField::InternalizeL
       
   328 // -----------------------------------------------------------------------------
       
   329 //
       
   330 void CESMRResponseField::InternalizeL( MESMRCalEntry& aEntry )
       
   331     {
       
   332     FUNC_LOG;
       
   333 
       
   334     MESMRMeetingRequestEntry* entry = NULL;
       
   335     if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == aEntry.Type() )
       
   336         {
       
   337         entry = static_cast<MESMRMeetingRequestEntry*>(&aEntry);
       
   338         }
       
   339     else
       
   340         {
       
   341         User::Leave( KErrNotSupported );
       
   342         }
       
   343 
       
   344     MESMRMeetingRequestEntry::TESMREntryInfo attendeeInfo = entry->EntryAttendeeInfoL();
       
   345     HBufC* stringholder;
       
   346     switch( attendeeInfo )
       
   347         {
       
   348         case MESMRMeetingRequestEntry::EESMREntryInfoOutOfDate:
       
   349             {
       
   350             stringholder = StringLoader::LoadLC(
       
   351                            R_QTN_MEET_REQ_RESPONSE_OUT_OF_DATE , iEikonEnv );
       
   352             break;
       
   353             }
       
   354 
       
   355         case MESMRMeetingRequestEntry::EESMREntryInfoCancelled:
       
   356             {
       
   357             stringholder = StringLoader::LoadLC(
       
   358                            R_QTN_MEET_REQ_RESPONSE_CANCELLED , iEikonEnv );
       
   359             HandleCancelledEventItemsL( aEntry );
       
   360             break;
       
   361             }
       
   362 
       
   363         case MESMRMeetingRequestEntry::EESMREntryInfoAccepted:
       
   364             {
       
   365             stringholder = StringLoader::LoadLC(
       
   366                            R_QTN_MEET_REQ_RESPOND_ACCEPTED , iEikonEnv );
       
   367             break;
       
   368             }
       
   369 
       
   370         case MESMRMeetingRequestEntry::EESMREntryInfoTentativelyAccepted:
       
   371             {
       
   372             stringholder = StringLoader::LoadLC(
       
   373                            R_QTN_MEET_REQ_RESPOND_TENTATIVE , iEikonEnv );
       
   374             break;
       
   375             }
       
   376 
       
   377         case MESMRMeetingRequestEntry::EESMREntryInfoDeclined:
       
   378             {
       
   379             stringholder = StringLoader::LoadLC(
       
   380                            R_QTN_MEET_REQ_RESPOND_DECLINED , iEikonEnv );
       
   381             break;
       
   382             }
       
   383 
       
   384        case MESMRMeetingRequestEntry::EESMREntryInfoOccursInPast:
       
   385             {
       
   386             stringholder = StringLoader::LoadLC(
       
   387                            R_QTN_MEET_REQ_RESPONSE_OCCURS_PAST , iEikonEnv );
       
   388             break;
       
   389             }
       
   390 
       
   391         case MESMRMeetingRequestEntry::EESMREntryInfoConflicts:
       
   392             {
       
   393             stringholder = StringLoader::LoadLC(
       
   394                            R_QTN_MEET_REQ_RESPONSE_CONFLICT , iEikonEnv );
       
   395             iConfPopup = CESMRConflictPopup::NewL(aEntry);
       
   396             iConfPopup->ShowPopup();
       
   397             break;
       
   398             }
       
   399 
       
   400         case MESMRMeetingRequestEntry::EESMREntryInfoNormal:
       
   401             {
       
   402             stringholder = StringLoader::LoadLC(
       
   403                            R_QTN_MEET_REQ_RESPONSE_PLEASE_RESPOND , iEikonEnv );
       
   404             break;
       
   405             }
       
   406 
       
   407         default:
       
   408         stringholder = StringLoader::LoadLC(
       
   409                        R_QTN_MEET_REQ_RESPONSE_PLEASE_RESPOND , iEikonEnv );
       
   410         break;
       
   411         }
       
   412 
       
   413     iResponseItemArray[0]->SetTextL( stringholder->Des() );
       
   414     // Check do we need to expand because of the long topic text ( two lines max )
       
   415     if ( iResponseItemArray[0]->ItemTextLineCount() > 1  ||
       
   416             iResponseItemArray.Count() == KOnlyTwoLines )
       
   417         {
       
   418         SizeChanged();
       
   419         }
       
   420     CleanupStack::PopAndDestroy( stringholder );
       
   421     }
       
   422 
       
   423 // -----------------------------------------------------------------------------
       
   424 // CESMRResponseField::AddObserver
       
   425 // -----------------------------------------------------------------------------
       
   426 //
       
   427 void CESMRResponseField::AddObserver( MESMRResponseObserver* aResponseObserver )
       
   428     {
       
   429     FUNC_LOG;
       
   430     iResponseObserver = aResponseObserver;
       
   431     }
       
   432 
       
   433 // -----------------------------------------------------------------------------
       
   434 // CESMRResponseField::SetFont
       
   435 // -----------------------------------------------------------------------------
       
   436 //
       
   437 void CESMRResponseField::SetFont( const CFont* aFont )
       
   438     {
       
   439     FUNC_LOG;
       
   440     iFont = aFont;
       
   441     // Set font for the response items (Tpoic, Accept, Tentative, Decline )
       
   442     TInt itemCount = iResponseItemArray.Count();
       
   443     for( TInt i = 0; i < itemCount; i++ )
       
   444         {
       
   445         iResponseItemArray[i]->SetFont( aFont );
       
   446         }
       
   447     }
       
   448 
       
   449 // -----------------------------------------------------------------------------
       
   450 // CESMRResponseField::SetLayoutManager
       
   451 // -----------------------------------------------------------------------------
       
   452 //
       
   453 void CESMRResponseField::SetLayoutManager( CESMRLayoutManager* aLayout )
       
   454     {
       
   455     FUNC_LOG;
       
   456     iLayout = aLayout;
       
   457 
       
   458     // Set layoutmanager for the response items
       
   459     TInt itemCount = iResponseItemArray.Count();
       
   460     for( TInt i = 0; i < itemCount; i++ )
       
   461         {
       
   462         iResponseItemArray[i]->SetLayoutManager( aLayout );
       
   463         }
       
   464     }
       
   465 
       
   466 // -----------------------------------------------------------------------------
       
   467 // CESMRResponseField::ItemSelectedL
       
   468 // -----------------------------------------------------------------------------
       
   469 //
       
   470 TBool CESMRResponseField::ItemSelectedL()
       
   471     {
       
   472     FUNC_LOG;
       
   473     TBool selected( EFalse );
       
   474     
       
   475     if ( iSelectionIndex > KSelectionTopic )
       
   476         {
       
   477         if( iSelectionIndex < iResponseItemArray.Count() )
       
   478             {
       
   479             iResponseItemArray[iSelectionIndex]->ChangeIconL( ETrue );
       
   480             }
       
   481         // Redraw to enable new checked icon in the screen
       
   482         DrawDeferred();
       
   483                 
       
   484         TBool response( EFalse );
       
   485         
       
   486         TInt cmd( 0 );
       
   487         if( iSelectionIndex < iResponseItemArray.Count() )
       
   488             {
       
   489             cmd = static_cast< TInt >( iResponseItemArray[iSelectionIndex]->CommandId() );
       
   490             }
       
   491         response = iResponseObserver->Response( cmd );
       
   492         
       
   493         if ( !response )
       
   494             {
       
   495             // Cancel was selected, update the icon
       
   496             if( iSelectionIndex < iResponseItemArray.Count() )
       
   497                 {
       
   498                 iResponseItemArray[iSelectionIndex]->ChangeIconL( EFalse );
       
   499                 }
       
   500             }
       
   501         
       
   502         selected = ETrue;
       
   503         }
       
   504     
       
   505     return selected;
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // CESMRResponseField::HandleCancelledEventItemsL
       
   510 // -----------------------------------------------------------------------------
       
   511 //
       
   512 void CESMRResponseField::HandleCancelledEventItemsL( MESMRCalEntry& aEntry )
       
   513     {
       
   514     FUNC_LOG;
       
   515     // Remove all other but title items from response array. Only 'Remove from Cal'
       
   516     // should be shown.
       
   517     TInt count = iResponseItemArray.Count();
       
   518     for ( TInt i = count - 1; i > 0; --i )
       
   519         {
       
   520         CESMRResponseItem* item = iResponseItemArray[i];
       
   521         iResponseItemArray.Remove( i );
       
   522         delete item;
       
   523         item = NULL;
       
   524         }
       
   525 
       
   526     CCalEntry& entry = aEntry.Entry();
       
   527     CCalUser* calUser = entry.PhoneOwnerL();
       
   528     TPtrC addr = ESMRHelper::AddressWithoutMailtoPrefix( calUser->Address() );
       
   529     
       
   530     iESMRStatic.ConnectL();
       
   531     iESMRStaticAccessed = ETrue;
       
   532     
       
   533     if( iESMRStatic.MailBoxL( addr ).HasCapability( 
       
   534             EFSMBoxCapaRemoveFromCalendar ) &&
       
   535             aEntry.IsStoredL() )
       
   536         {
       
   537         // Construct the 'Remove from Calendar' item
       
   538         HBufC* stringholder = StringLoader::LoadLC(
       
   539                 R_QTN_MEET_REQ_RESPONSE_REMOVE_CALENDAR_EVENT, iEikonEnv );
       
   540         CESMRResponseItem* responseItem =
       
   541             CESMRResponseItem::NewL( EESMRCmdRemoveFromCalendar, *stringholder, ETrue );
       
   542         CleanupStack::PopAndDestroy( stringholder );
       
   543         CleanupStack::PushL( responseItem );
       
   544         // Set layout manager and font for the item
       
   545         responseItem->SetLayoutManager( iLayout );
       
   546         responseItem->SetFont( iFont );
       
   547         responseItem->SetHighlight();
       
   548         User::LeaveIfError( iResponseItemArray.Append( responseItem ) );
       
   549         CleanupStack::Pop( responseItem );
       
   550         }
       
   551     }
       
   552 
       
   553 // -----------------------------------------------------------------------------
       
   554 // CESMRResponseField::ExecuteGenericCommandL
       
   555 // -----------------------------------------------------------------------------
       
   556 //
       
   557 void CESMRResponseField::ExecuteGenericCommandL( TInt aCommand )
       
   558     {
       
   559     FUNC_LOG;
       
   560     if ( aCommand == EAknSoftkeySelect )
       
   561         {
       
   562         ItemSelectedL();
       
   563         }
       
   564     else
       
   565         {
       
   566         CESMRField::ExecuteGenericCommandL( aCommand );
       
   567         }
       
   568     }
       
   569 
       
   570 // -----------------------------------------------------------------------------
       
   571 // CESMRResponseField::SetOutlineFocusL
       
   572 // -----------------------------------------------------------------------------
       
   573 //
       
   574 void CESMRResponseField::SetOutlineFocusL( TBool aFocus )
       
   575     {
       
   576     FUNC_LOG;
       
   577     CESMRField::SetOutlineFocusL( aFocus );
       
   578     
       
   579     if ( aFocus )
       
   580         {
       
   581         SetMiddleSoftKeyVisible( ETrue );
       
   582         }
       
   583     }
       
   584 
       
   585 // -----------------------------------------------------------------------------
       
   586 // CESMRResponseField::ControlItem
       
   587 // -----------------------------------------------------------------------------
       
   588 //
       
   589 CCoeControl* CESMRResponseField::ControlItem( TInt aIndex )
       
   590     {
       
   591     CCoeControl* control = NULL;
       
   592     if( aIndex < iResponseItemArray.Count() )
       
   593         {
       
   594         control = static_cast<CCoeControl*>( iResponseItemArray[aIndex] );
       
   595         }
       
   596         
       
   597     return control;
       
   598     }
       
   599 
       
   600 // EOF
       
   601