meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrattendeefield.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 16 b5fbb9b25d57
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
    73 //
    73 //
    74 CESMRAttendeeField::CESMRAttendeeField( CCalAttendee::TCalRole aRole )
    74 CESMRAttendeeField::CESMRAttendeeField( CCalAttendee::TCalRole aRole )
    75 :iRole( aRole )
    75 :iRole( aRole )
    76     {
    76     {
    77     FUNC_LOG;
    77     FUNC_LOG;
    78     SetFocusType( EESMRHighlightFocus );    
    78     SetFocusType( EESMRHighlightFocus );
    79     SetFieldId ( (iRole == CCalAttendee::EReqParticipant) ? 
    79     SetFieldId ( (iRole == CCalAttendee::EReqParticipant) ?
    80             EESMRFieldAttendee : EESMRFieldOptAttendee );
    80             EESMRFieldAttendee : EESMRFieldOptAttendee );
    81     }
    81     }
    82 
    82 
    83 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    84 // CESMRAttendeeField::~CESMRAttendeeField
    84 // CESMRAttendeeField::~CESMRAttendeeField
   126     iFieldButton->SetParent( this );
   126     iFieldButton->SetParent( this );
   127     iFieldButton->SetObserver( this );
   127     iFieldButton->SetObserver( this );
   128 
   128 
   129     iTitle = CMRLabel::NewL();
   129     iTitle = CMRLabel::NewL();
   130     iTitle->SetParent( this );
   130     iTitle->SetParent( this );
   131     
   131 
   132     HBufC* buf = NULL;
   132     HBufC* buf = NULL;
   133     if( FieldId() == EESMRFieldAttendee )
   133     if( FieldId() == EESMRFieldAttendee )
   134         {
   134         {
   135         buf = StringLoader::LoadLC( R_QTN_MEET_REQ_LABEL_REQUIRED );
   135         buf = StringLoader::LoadLC( R_QTN_MEET_REQ_LABEL_REQUIRED );
   136         }
   136         }
   137     
   137 
   138     if( FieldId() == EESMRFieldOptAttendee )
   138     if( FieldId() == EESMRFieldOptAttendee )
   139         {
   139         {
   140         buf = StringLoader::LoadLC( R_QTN_MEET_REQ_LABEL_OPT );
   140         buf = StringLoader::LoadLC( R_QTN_MEET_REQ_LABEL_OPT );
   141         }
   141         }
   142     
   142 
   143     iTitle->SetTextL( *buf ); // ownership transferred
   143     iTitle->SetTextL( *buf ); // ownership transferred
   144     CleanupStack::Pop( buf );
   144     CleanupStack::Pop( buf );
   145 
   145 
   146     
   146 
   147     iEditor = 
   147     iEditor =
   148         new ( ELeave ) CESMRNcsAifEditor( *iContactHandler, iDefaultText );
   148         new ( ELeave ) CESMRNcsAifEditor( *iContactHandler, iDefaultText );
   149     CESMRField::ConstructL( iEditor );
   149     CESMRField::ConstructL( iEditor );
   150     iEditor->ConstructL (
   150     iEditor->ConstructL (
   151             this,
   151             this,
   152             KMaxAddressFieldLines,
   152             KMaxAddressFieldLines,
   153             0,
   153             0,
   154             CEikEdwin::EAvkonEditor | CEikEdwin::EResizable |
   154             CEikEdwin::EAvkonEditor | CEikEdwin::EResizable |
   155             CEikEdwin::ENoAutoSelection |CEikEdwin::EInclusiveSizeFixed |
   155             CEikEdwin::ENoAutoSelection |CEikEdwin::EInclusiveSizeFixed |
   156             CEikEdwin::ENoHorizScrolling
   156             CEikEdwin::ENoHorizScrolling
   157             );    
   157             );
   158     iEditor->SetEdwinSizeObserver( this );
   158     iEditor->SetEdwinSizeObserver( this );
   159     iEditor->SetParent( this );
   159     iEditor->SetParent( this );
   160     iEditor->SetPopupList( this );
   160     iEditor->SetPopupList( this );
   161     iEditor->SetAlignment ( EAknEditorAlignBidi | EAknEditorAlignCenter );
   161     iEditor->SetAlignment ( EAknEditorAlignBidi | EAknEditorAlignCenter );
   162     iEditor->SetAknEditorInputMode ( EAknEditorTextInputMode );
   162     iEditor->SetAknEditorInputMode ( EAknEditorTextInputMode );
   163     iEditor->SetAknEditorFlags ( 
   163     iEditor->SetAknEditorFlags (
   164             EAknEditorFlagNoT9| EAknEditorFlagUseSCTNumericCharmap );
   164             EAknEditorFlagNoT9| EAknEditorFlagUseSCTNumericCharmap );
   165     iEditor->SetAknEditorCurrentCase ( EAknEditorLowerCase );
   165     iEditor->SetAknEditorCurrentCase ( EAknEditorLowerCase );
   166 
   166 
   167     // Draw bg instead of using skin bg
   167     // Draw bg instead of using skin bg
   168     TRect tempRect( 0, 0, 0, 0 );
   168     TRect tempRect( 0, 0, 0, 0 );
   169     NMRBitmapManager::TMRBitmapStruct bitmapStruct;
   169     NMRBitmapManager::TMRBitmapStruct bitmapStruct;
   170     bitmapStruct = NMRBitmapManager::GetBitmapStruct( NMRBitmapManager::EMRBitmapInputCenter );
   170     bitmapStruct = NMRBitmapManager::GetBitmapStruct( NMRBitmapManager::EMRBitmapInputCenter );
   171     iBgCtrlContext = CAknsBasicBackgroundControlContext::NewL( 
   171     iBgCtrlContext = CAknsBasicBackgroundControlContext::NewL(
   172                 bitmapStruct.iItemId, 
   172                 bitmapStruct.iItemId,
   173                 tempRect, 
   173                 tempRect,
   174                 EFalse );        
   174                 EFalse );
   175     iEditor->SetSkinBackgroundControlContextL( iBgCtrlContext );
   175     iEditor->SetSkinBackgroundControlContextL( iBgCtrlContext );
   176     }
   176     }
   177 
   177 
   178 // ---------------------------------------------------------------------------
   178 // ---------------------------------------------------------------------------
   179 // CESMRAttendeeField::MinimumSize
   179 // CESMRAttendeeField::MinimumSize
   180 // ---------------------------------------------------------------------------
   180 // ---------------------------------------------------------------------------
   181 //
   181 //
   182 TSize CESMRAttendeeField::MinimumSize()
   182 TSize CESMRAttendeeField::MinimumSize()
   183     {
   183     {
   184     TRect parentRect( Parent()->Rect() );
   184     TRect parentRect( Parent()->Rect() );
   185     
   185 
   186     TRect richTextRect = 
   186     TRect richTextRect =
   187        NMRLayoutManager::GetFieldLayoutRect( parentRect, 1 ).Rect();
   187        NMRLayoutManager::GetFieldLayoutRect( parentRect, 1 ).Rect();
   188 
   188 
   189     TRect textRect( NMRLayoutManager::GetLayoutText( 
   189     TRect textRect( NMRLayoutManager::GetLayoutText(
   190             richTextRect, 
   190             richTextRect,
   191        NMRLayoutManager::EMRTextLayoutTextEditor ).TextRect() );
   191        NMRLayoutManager::EMRTextLayoutTextEditor ).TextRect() );
   192     
   192 
   193     // Adjust field size so that there's room for expandable editor.
   193     // Adjust field size so that there's room for expandable editor.
   194     richTextRect.Resize( 0, iSize.iHeight - textRect.Height() );
   194     richTextRect.Resize( 0, iSize.iHeight - textRect.Height() );
   195     
   195 
   196     // Add title area to the required size
   196     // Add title area to the required size
   197     TSize titleSize( CESMRField::MinimumSize() );
   197     TSize titleSize( CESMRField::MinimumSize() );
   198     
   198 
   199     TSize completeFieldSize( titleSize );
   199     TSize completeFieldSize( titleSize );
   200     completeFieldSize.iHeight += richTextRect.Height();
   200     completeFieldSize.iHeight += richTextRect.Height();
   201     
   201 
   202     return completeFieldSize;
   202     return completeFieldSize;
   203     }
   203     }
   204 
   204 
   205 // ---------------------------------------------------------------------------
   205 // ---------------------------------------------------------------------------
   206 // CESMRAttendeeField::InitializeL
   206 // CESMRAttendeeField::InitializeL
   217 // ---------------------------------------------------------------------------
   217 // ---------------------------------------------------------------------------
   218 //
   218 //
   219 void CESMRAttendeeField::InternalizeL( MESMRCalEntry& aEntry )
   219 void CESMRAttendeeField::InternalizeL( MESMRCalEntry& aEntry )
   220     {
   220     {
   221     FUNC_LOG;
   221     FUNC_LOG;
   222     iEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL ( 
   222     iEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL (
   223             CEikScrollBarFrame::EOff,
   223             CEikScrollBarFrame::EOff,
   224             CEikScrollBarFrame::EOff );
   224             CEikScrollBarFrame::EOff );
   225     
   225 
   226     TInt fieldAttendeeCount( 0 );
   226     TInt fieldAttendeeCount( 0 );
   227     
   227 
   228     CCalEntry& entry = aEntry.Entry ( );
   228     CCalEntry& entry = aEntry.Entry ( );
   229     RPointerArray< CCalAttendee > attendees = entry.AttendeesL ( );
   229     RPointerArray< CCalAttendee > attendees = entry.AttendeesL ( );
   230     RCPointerArray< CESMRNcsEmailAddressObject > addressList;
   230     RCPointerArray< CESMRNcsEmailAddressObject > addressList;
   231     CleanupClosePushL( addressList );    
   231     CleanupClosePushL( addressList );
   232 
   232 
   233     for (TInt i(0); i < attendees.Count(); i++ )
   233     for (TInt i(0); i < attendees.Count(); i++ )
   234         {
   234         {
   235         if ( attendees[i]->RoleL() == iRole )
   235         if ( attendees[i]->RoleL() == iRole )
   236             {
   236             {
   237             fieldAttendeeCount++;
   237             fieldAttendeeCount++;
   238             
   238 
   239             const TDesC& addr = attendees[i]->Address ( );
   239             const TDesC& addr = attendees[i]->Address ( );
   240             const TDesC& commonName = attendees[i]->CommonName ( );
   240             const TDesC& commonName = attendees[i]->CommonName ( );
   241 
   241 
   242             CESMRNcsEmailAddressObject* obj = 
   242             CESMRNcsEmailAddressObject* obj =
   243                 CESMRNcsEmailAddressObject::NewL ( commonName, addr );
   243                 CESMRNcsEmailAddressObject::NewL ( commonName, addr );
   244             CleanupStack::PushL (obj );
   244             CleanupStack::PushL (obj );
   245             addressList.AppendL( obj );
   245             addressList.AppendL( obj );
   246             CleanupStack::Pop( obj );
   246             CleanupStack::Pop( obj );
   247             }
   247             }
   273 
   273 
   274     CleanupStack::PopAndDestroy( &addressList );
   274     CleanupStack::PopAndDestroy( &addressList );
   275     // this is needed to be re-called here, otherwise the CEikEdwin
   275     // this is needed to be re-called here, otherwise the CEikEdwin
   276     // does not get correctly instantiated with default text
   276     // does not get correctly instantiated with default text
   277     iEditor->FocusChanged(EDrawNow);
   277     iEditor->FocusChanged(EDrawNow);
   278     
   278 
   279     UpdateSendOptionL();
   279     UpdateSendOptionL();
   280     }
   280     }
   281 
   281 
   282 // ---------------------------------------------------------------------------
   282 // ---------------------------------------------------------------------------
   283 // CESMRAttendeeField::ExternalizeL
   283 // CESMRAttendeeField::ExternalizeL
   301         }
   301         }
   302 
   302 
   303     UpdateAttendeesL( *mrEntry );
   303     UpdateAttendeesL( *mrEntry );
   304 
   304 
   305     HBufC* text = iEditor->GetTextInHBufL();
   305     HBufC* text = iEditor->GetTextInHBufL();
   306         
   306 
   307     //If there is no attendees, put back the default text
   307     //If there is no attendees, put back the default text
   308     if( !text )
   308     if( !text )
   309         {
   309         {
   310     	AppendDefaultTextL();
   310     	AppendDefaultTextL();
   311     	//during initialisation, SelectAllL() in setoutlinefocus gets overridden so this is needed
   311     	//during initialisation, SelectAllL() in setoutlinefocus gets overridden so this is needed
   324     TInt count( 0 );
   324     TInt count( 0 );
   325     if( iFieldButton )
   325     if( iFieldButton )
   326         {
   326         {
   327         ++count;
   327         ++count;
   328         }
   328         }
   329     
   329 
   330     if ( iTitle )
   330     if ( iTitle )
   331         {
   331         {
   332         ++count;
   332         ++count;
   333         }
   333         }
   334 
   334 
   366 //
   366 //
   367 void CESMRAttendeeField::SizeChanged( )
   367 void CESMRAttendeeField::SizeChanged( )
   368     {
   368     {
   369     FUNC_LOG;
   369     FUNC_LOG;
   370     TRect rect( Rect() );
   370     TRect rect( Rect() );
   371        
   371 
   372     TAknLayoutRect firstRowLayoutRect( 
   372     TAknLayoutRect firstRowLayoutRect(
   373            NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ) );
   373            NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ) );
   374     TRect firstRowRect( firstRowLayoutRect.Rect() );
   374     TRect firstRowRect( firstRowLayoutRect.Rect() );
   375     
   375 
   376     TRect secondRowRect( firstRowRect );
   376     TRect secondRowRect( firstRowRect );
   377     secondRowRect.Move( 0, firstRowRect.Height() );
   377     secondRowRect.Move( 0, firstRowRect.Height() );
   378     
   378 
   379     // Layout field button
   379     // Layout field button
   380     if( iFieldButton )
   380     if( iFieldButton )
   381        {
   381        {
   382        TAknWindowComponentLayout buttonLayout( 
   382        TAknWindowComponentLayout buttonLayout(
   383                NMRLayoutManager::GetWindowComponentLayout(
   383                NMRLayoutManager::GetWindowComponentLayout(
   384                    NMRLayoutManager::EMRLayoutTextEditorIcon ) );
   384                    NMRLayoutManager::EMRLayoutTextEditorIcon ) );
   385        AknLayoutUtils::LayoutControl( 
   385        AknLayoutUtils::LayoutControl(
   386                iFieldButton, firstRowRect, buttonLayout );
   386                iFieldButton, firstRowRect, buttonLayout );
   387        }
   387        }
   388     
   388 
   389     // Layout field title
   389     // Layout field title
   390     if( iTitle )
   390     if ( iTitle )
   391        {
   391         {
   392        TAknLayoutText labelLayout( 
   392         TAknTextComponentLayout editorLayout =
   393                NMRLayoutManager::GetLayoutText(
   393                 NMRLayoutManager::GetTextComponentLayout(
   394                        firstRowRect, 
   394                         NMRLayoutManager::EMRTextLayoutTextEditor );
   395                            NMRLayoutManager::EMRTextLayoutTextEditor ) );
   395 
   396     
   396         AknLayoutUtils::LayoutLabel( iTitle, rect, editorLayout );
   397        iTitle->SetRect( labelLayout.TextRect() );
   397         }
   398     
   398 
   399        // Setting font also for the label. Failures are ignored.
       
   400        iTitle->SetFont( labelLayout.Font() );
       
   401        }
       
   402     
       
   403     // Layout field editor
   399     // Layout field editor
   404     if( iEditor )
   400     if( iEditor )
   405         {
   401         {
   406         TAknLayoutText editorLayoutText = NMRLayoutManager::GetLayoutText( 
   402         TAknLayoutText editorLayoutText = NMRLayoutManager::GetLayoutText(
   407                   secondRowRect, 
   403                   secondRowRect,
   408                   NMRLayoutManager::EMRTextLayoutTextEditor );
   404                   NMRLayoutManager::EMRTextLayoutTextEditor );
   409 
   405 
   410         TRect editorRect = editorLayoutText.TextRect();
   406         TRect editorRect = editorLayoutText.TextRect();
   411 
   407 
   412         // Resize height according to actual height required by edwin.
   408         // Resize height according to actual height required by edwin.
   413         editorRect.Resize( 0, iSize.iHeight - editorRect.Height() );
   409         editorRect.Resize( 0, iSize.iHeight - editorRect.Height() );
   414         
   410 
   415         iEditor->SetRect( editorRect );
   411         iEditor->SetRect( editorRect );
   416         
   412 
   417         // Try setting font. Failures are ignored.
   413         // Try setting font. Failures are ignored.
   418         TRAP_IGNORE( iEditor->SetFontL( editorLayoutText.Font() ) );    
   414         TRAP_IGNORE( iEditor->SetFontL( editorLayoutText.Font() ) );
   419         }
   415         }
   420     
   416 
   421     // Layout field focus
   417     // Layout field focus
   422     if( iEditor )
   418     if( iEditor )
   423        {
   419        {
   424        // Layouting focus for rich text editor area
   420        // Layouting focus for rich text editor area
   425        TRect bgRect( iEditor->Rect() );
   421        TRect bgRect( iEditor->Rect() );
   426     
   422 
   427        // Move focus rect so that it's relative to field's position.
   423        // Move focus rect so that it's relative to field's position.
   428        bgRect.Move( -Position() );
   424        bgRect.Move( -Position() );
   429        SetFocusRect( bgRect );   
   425        SetFocusRect( bgRect );
   430        }
   426        }
   431 
   427 
   432     if ( iAacListBox && iAacListBox->IsVisible ( ) )
   428     if ( iAacListBox && iAacListBox->IsVisible ( ) )
   433         {
   429         {
   434         TRAPD( error, iAacListBox->SetPopupMaxRectL( ResolvePopupRectL()) )
   430         TRAPD( error, iAacListBox->SetPopupMaxRectL( ResolvePopupRectL()) )
   448     FUNC_LOG;
   444     FUNC_LOG;
   449     if ( !iAacListBox )
   445     if ( !iAacListBox )
   450         {
   446         {
   451         return TRect( 0, 0, 0, 0 );
   447         return TRect( 0, 0, 0, 0 );
   452         }
   448         }
   453     
   449 
   454     TRect popupRect( 0, 0, 0, 0 );
   450     TRect popupRect( 0, 0, 0, 0 );
   455     
   451 
   456     // Let's determine Popup's maximum height
   452     // Let's determine Popup's maximum height
   457     TInt requiredPopupHeight = iAacListBox->CalcHeightBasedOnNumOfItems( 
   453     TInt requiredPopupHeight = iAacListBox->CalcHeightBasedOnNumOfItems(
   458             iAacListBox->Model()->NumberOfItems() );
   454             iAacListBox->Model()->NumberOfItems() );
   459     TInt numberOfItemsInPopUp = iAacListBox->Model()->NumberOfItems();
   455     TInt numberOfItemsInPopUp = iAacListBox->Model()->NumberOfItems();
   460     
   456 
   461     if( numberOfItemsInPopUp > KMaxAmountOfItems )
   457     if( numberOfItemsInPopUp > KMaxAmountOfItems )
   462         {
   458         {
   463         // reducing popup item count shown at once to maximum value
   459         // reducing popup item count shown at once to maximum value
   464         requiredPopupHeight = iAacListBox->CalcHeightBasedOnNumOfItems( 
   460         requiredPopupHeight = iAacListBox->CalcHeightBasedOnNumOfItems(
   465                 KMaxAmountOfItems );
   461                 KMaxAmountOfItems );
   466         }
   462         }
   467     
   463 
   468     // Popup x-coords are always the same
   464     // Popup x-coords are always the same
   469     TInt topLeftX = iEditor->Rect().iTl.iX;
   465     TInt topLeftX = iEditor->Rect().iTl.iX;
   470     TInt bottomRightX = iEditor->Rect().iBr.iX;
   466     TInt bottomRightX = iEditor->Rect().iBr.iX;
   471     
   467 
   472     // Popup y-coords need to be calculated
   468     // Popup y-coords need to be calculated
   473     TInt topLeftY( 0 );
   469     TInt topLeftY( 0 );
   474     TInt bottomRightY( 0 );
   470     TInt bottomRightY( 0 );
   475            
   471 
   476     // Next we have to resolve if popup needs to be drawn below or 
   472     // Next we have to resolve if popup needs to be drawn below or
   477     // above the cursor (space requirement)
   473     // above the cursor (space requirement)
   478     
   474 
   479     TRect editorLineRect;
   475     TRect editorLineRect;
   480     iEditor->GetLineRectL( editorLineRect );
   476     iEditor->GetLineRectL( editorLineRect );
   481     TInt editorLineTopLeftY = editorLineRect.iTl.iY;
   477     TInt editorLineTopLeftY = editorLineRect.iTl.iY;
   482     TInt diff = iEditor->Rect().iTl.iY;
   478     TInt diff = iEditor->Rect().iTl.iY;
   483     TInt editorLineTopLeftYRelativeToParent = editorLineTopLeftY + diff;
   479     TInt editorLineTopLeftYRelativeToParent = editorLineTopLeftY + diff;
   484     
   480 
   485     TInt listPaneHeight = Parent()->Rect().Height();
   481     TInt listPaneHeight = Parent()->Rect().Height();
   486     
   482 
   487     // Popup will be drawn above the cursor
   483     // Popup will be drawn above the cursor
   488     if( editorLineTopLeftYRelativeToParent > TReal( listPaneHeight / 2 ) )
   484     if( editorLineTopLeftYRelativeToParent > TReal( listPaneHeight / 2 ) )
   489         {
   485         {
   490         topLeftY = editorLineTopLeftYRelativeToParent - requiredPopupHeight;
   486         topLeftY = editorLineTopLeftYRelativeToParent - requiredPopupHeight;
   491         bottomRightY = editorLineTopLeftYRelativeToParent;
   487         bottomRightY = editorLineTopLeftYRelativeToParent;
   496         topLeftY = editorLineTopLeftYRelativeToParent + iEditor->GetLineHeightL();
   492         topLeftY = editorLineTopLeftYRelativeToParent + iEditor->GetLineHeightL();
   497         bottomRightY = topLeftY + requiredPopupHeight;
   493         bottomRightY = topLeftY + requiredPopupHeight;
   498         }
   494         }
   499 
   495 
   500     popupRect.SetRect( topLeftX, topLeftY, bottomRightX, bottomRightY );
   496     popupRect.SetRect( topLeftX, topLeftY, bottomRightX, bottomRightY );
   501     
   497 
   502     return popupRect;
   498     return popupRect;
   503     }
   499     }
   504 
   500 
   505 // -----------------------------------------------------------------------------
   501 // -----------------------------------------------------------------------------
   506 // CNcsAddressInputField:::AppendDefaultTextL()
   502 // CNcsAddressInputField:::AppendDefaultTextL()
   526 
   522 
   527 // ---------------------------------------------------------------------------
   523 // ---------------------------------------------------------------------------
   528 // CESMRAttendeeField::OfferKeyEventL
   524 // CESMRAttendeeField::OfferKeyEventL
   529 // ---------------------------------------------------------------------------
   525 // ---------------------------------------------------------------------------
   530 //
   526 //
   531 TKeyResponse CESMRAttendeeField::OfferKeyEventL( 
   527 TKeyResponse CESMRAttendeeField::OfferKeyEventL(
   532         const TKeyEvent& aKeyEvent,
   528         const TKeyEvent& aKeyEvent,
   533         TEventCode aType )
   529         TEventCode aType )
   534     {
   530     {
   535     FUNC_LOG;
   531     FUNC_LOG;
   536 
   532 
   537     TKeyResponse ret( EKeyWasNotConsumed);
   533     TKeyResponse ret( EKeyWasNotConsumed);
   538 
   534 
   539     if ( aKeyEvent.iCode == EKeyEnter || 
   535     if ( aKeyEvent.iCode == EKeyEnter ||
   540          aKeyEvent.iScanCode == EStdKeyEnter ||
   536          aKeyEvent.iScanCode == EStdKeyEnter ||
   541          aKeyEvent.iCode == EKeyYes ||
   537          aKeyEvent.iCode == EKeyYes ||
   542          aKeyEvent.iScanCode == EStdKeyYes )
   538          aKeyEvent.iScanCode == EStdKeyYes )
   543         {//prevent these keys from being used in any attendee field editor
   539         {//prevent these keys from being used in any attendee field editor
   544         return EKeyWasConsumed;
   540         return EKeyWasConsumed;
   572         {
   568         {
   573         ret = iEditor->OfferKeyEventL (aKeyEvent, aType );
   569         ret = iEditor->OfferKeyEventL (aKeyEvent, aType );
   574         UpdateSendOptionL();
   570         UpdateSendOptionL();
   575         }
   571         }
   576 
   572 
   577     // Scroll editor visible, if for example cursor is out of the 
   573     // Scroll editor visible, if for example cursor is out of the
   578     // viewable area when user enters more text.
   574     // viewable area when user enters more text.
   579     if ( iObserver && aType == EEventKey )
   575     if ( iObserver && aType == EEventKey )
   580         {
   576         {
   581         CTextLayout* textLayout = iEditor->TextLayout();
   577         CTextLayout* textLayout = iEditor->TextLayout();
   582         TInt lineHeight = iEditor->GetLineHeightL();
   578         TInt lineHeight = iEditor->GetLineHeightL();
   584         TPoint cursorPos( 0,0 );
   580         TPoint cursorPos( 0,0 );
   585         textLayout->DocPosToXyPosL( iEditor->CursorPos(), cursorPos );
   581         textLayout->DocPosToXyPosL( iEditor->CursorPos(), cursorPos );
   586 
   582 
   587         TInt editorTlY = iEditor->Position().iY;
   583         TInt editorTlY = iEditor->Position().iY;
   588         TInt listHeight = iObserver->ViewableAreaRect().Height();
   584         TInt listHeight = iObserver->ViewableAreaRect().Height();
   589         
   585 
   590         TInt cursorTopY = cursorPos.iY - lineHeight + editorTlY;
   586         TInt cursorTopY = cursorPos.iY - lineHeight + editorTlY;
   591         TInt cursorBottomY = cursorPos.iY + lineHeight + editorTlY;
   587         TInt cursorBottomY = cursorPos.iY + lineHeight + editorTlY;
   592 
   588 
   593         // If cursor is below visible area
   589         // If cursor is below visible area
   594         if ( cursorBottomY > listHeight )
   590         if ( cursorBottomY > listHeight )
   614     FUNC_LOG;
   610     FUNC_LOG;
   615     CCoeControl::SetContainerWindowL( aControl );
   611     CCoeControl::SetContainerWindowL( aControl );
   616 
   612 
   617     iFieldButton->SetContainerWindowL( aControl );
   613     iFieldButton->SetContainerWindowL( aControl );
   618     iFieldButton->SetParent( this );
   614     iFieldButton->SetParent( this );
   619 	
   615 
   620     iTitle->SetContainerWindowL( aControl );
   616     iTitle->SetContainerWindowL( aControl );
   621     iTitle->SetParent( this );
   617     iTitle->SetParent( this );
   622     
   618 
   623     iEditor->SetContainerWindowL( aControl );
   619     iEditor->SetContainerWindowL( aControl );
   624     iEditor->SetParent( this );
   620     iEditor->SetParent( this );
   625         
   621 
   626     iAacListBox = CESMRNcsPopupListBox::NewL ( this, *iContactHandler );
   622     iAacListBox = CESMRNcsPopupListBox::NewL ( this, *iContactHandler );
   627     iAacListBox->MakeVisible ( EFalse );
   623     iAacListBox->MakeVisible ( EFalse );
   628     iAacListBox->SetListBoxObserver( this );
   624     iAacListBox->SetListBoxObserver( this );
   629     iAacListBox->SetObserver( this );
   625     iAacListBox->SetObserver( this );
   630     iAacListBox->ActivateL();
   626     iAacListBox->ActivateL();
   631     
   627 
   632     iButtonGroupContainer = CEikButtonGroupContainer::Current();
   628     iButtonGroupContainer = CEikButtonGroupContainer::Current();
   633 	}
   629 	}
   634 
   630 
   635 // ---------------------------------------------------------------------------
   631 // ---------------------------------------------------------------------------
   636 // CESMRAttendeeField::HandleEdwinSizeEventL
   632 // CESMRAttendeeField::HandleEdwinSizeEventL
   639 TBool CESMRAttendeeField::HandleEdwinSizeEventL( CEikEdwin* aEdwin,
   635 TBool CESMRAttendeeField::HandleEdwinSizeEventL( CEikEdwin* aEdwin,
   640         TEdwinSizeEvent /*aType*/, TSize aSize )
   636         TEdwinSizeEvent /*aType*/, TSize aSize )
   641     {
   637     {
   642     FUNC_LOG;
   638     FUNC_LOG;
   643     TBool reDraw( EFalse );
   639     TBool reDraw( EFalse );
   644     
   640 
   645     if( iSize != aSize )
   641     if( iSize != aSize )
   646         {
   642         {
   647         // Let's save the required size for the iEditor
   643         // Let's save the required size for the iEditor
   648         iSize = aSize;
   644         iSize = aSize;
   649     
   645 
   650         if ( iObserver && aEdwin == iEditor )
   646         if ( iObserver && aEdwin == iEditor )
   651             {
   647             {
   652             iObserver->ControlSizeChanged ( this );
   648             iObserver->ControlSizeChanged ( this );
   653             reDraw = ETrue;
   649             reDraw = ETrue;
   654             }
   650             }
   659 
   655 
   660 // ---------------------------------------------------------------------------
   656 // ---------------------------------------------------------------------------
   661 // CESMRAttendeeField::UpdatePopupContactListL
   657 // CESMRAttendeeField::UpdatePopupContactListL
   662 // ---------------------------------------------------------------------------
   658 // ---------------------------------------------------------------------------
   663 //
   659 //
   664 void CESMRAttendeeField::UpdatePopupContactListL( 
   660 void CESMRAttendeeField::UpdatePopupContactListL(
   665         const TDesC& aMatchString, 
   661         const TDesC& aMatchString,
   666         TBool /*iListAll*/)
   662         TBool /*iListAll*/)
   667     {
   663     {
   668     FUNC_LOG;
   664     FUNC_LOG;
   669     if ( aMatchString.CompareC( KNullDesC ) == 0 ||
   665     if ( aMatchString.CompareC( KNullDesC ) == 0 ||
   670             aMatchString.CompareC( *iDefaultText ) == 0 )
   666             aMatchString.CompareC( *iDefaultText ) == 0 )
   693 //
   689 //
   694 void CESMRAttendeeField::ShowPopupCbaL( TBool aShow )
   690 void CESMRAttendeeField::ShowPopupCbaL( TBool aShow )
   695     {
   691     {
   696     if( aShow )
   692     if( aShow )
   697         {
   693         {
   698         iButtonGroupContainer->SetCommandSetL( 
   694         iButtonGroupContainer->SetCommandSetL(
   699                 R_CONTACT_POPUP_SOFTKEYS_SELECT_CANCEL);
   695                 R_CONTACT_POPUP_SOFTKEYS_SELECT_CANCEL);
   700         }
   696         }
   701     else
   697     else
   702         {
   698         {
   703         iButtonGroupContainer->SetCommandSetL( 
   699         iButtonGroupContainer->SetCommandSetL(
   704                 R_CONTACT_EDITOR_SOFTKEYS_OPTIONS_DONE__ADD);       
   700                 R_CONTACT_EDITOR_SOFTKEYS_OPTIONS_DONE__ADD);
   705         }
   701         }
   706     
   702 
   707     iButtonGroupContainer->DrawDeferred();
   703     iButtonGroupContainer->DrawDeferred();
   708     }
   704     }
   709 
   705 
   710 // ---------------------------------------------------------------------------
   706 // ---------------------------------------------------------------------------
   711 // CESMRAttendeeField::ExecuteGenericCommandL
   707 // CESMRAttendeeField::ExecuteGenericCommandL
   739          case EESMRCmdLongtapDetected:
   735          case EESMRCmdLongtapDetected:
   740              {
   736              {
   741              if(iEditor->IsFocused())
   737              if(iEditor->IsFocused())
   742                  NotifyEventL(EESMRCmdLongtapDetected);
   738                  NotifyEventL(EESMRCmdLongtapDetected);
   743              isUsed = ETrue;
   739              isUsed = ETrue;
   744              
   740 
   745      		HandleTactileFeedbackL();
   741      		HandleTactileFeedbackL();
   746              break;
   742              break;
   747              }
   743              }
   748          default:
   744          default:
   749              break;
   745              break;
   758 void CESMRAttendeeField::SetOutlineFocusL( TBool aFocus )
   754 void CESMRAttendeeField::SetOutlineFocusL( TBool aFocus )
   759     {
   755     {
   760     FUNC_LOG;
   756     FUNC_LOG;
   761     CESMRField::SetOutlineFocusL( aFocus );
   757     CESMRField::SetOutlineFocusL( aFocus );
   762 
   758 
   763     
   759 
   764     if (aFocus) //Focus is gained on the field
   760     if (aFocus) //Focus is gained on the field
   765         {
   761         {
   766         if ( iEditor->HasDefaultText() )
   762         if ( iEditor->HasDefaultText() )
   767             {
   763             {
   768             iEditor->SelectAllL();
   764             iEditor->SelectAllL();
   782     FUNC_LOG;
   778     FUNC_LOG;
   783     if ( aContacts )
   779     if ( aContacts )
   784         {
   780         {
   785         if( aContacts->Count() > 0 )
   781         if( aContacts->Count() > 0 )
   786             {
   782             {
   787             RCPointerArray<CESMRNcsEmailAddressObject> ncsObjects;  // codescanner::resourcenotoncleanupstack        
   783             RCPointerArray<CESMRNcsEmailAddressObject> ncsObjects;  // codescanner::resourcenotoncleanupstack
   788             CleanupClosePushL( ncsObjects );
   784             CleanupClosePushL( ncsObjects );
   789             for ( int i = 0; i < aContacts->Count(); i++ )
   785             for ( int i = 0; i < aContacts->Count(); i++ )
   790                 {
   786                 {
   791                 CESMRNcsEmailAddressObject* object =
   787                 CESMRNcsEmailAddressObject* object =
   792                     CESMRNcsEmailAddressObject::NewL(
   788                     CESMRNcsEmailAddressObject::NewL(
   817 // ---------------------------------------------------------------------------
   813 // ---------------------------------------------------------------------------
   818 // CESMRAttendeeField::HandleControlEventL
   814 // CESMRAttendeeField::HandleControlEventL
   819 // ---------------------------------------------------------------------------
   815 // ---------------------------------------------------------------------------
   820 //
   816 //
   821 void CESMRAttendeeField::HandleControlEventL(
   817 void CESMRAttendeeField::HandleControlEventL(
   822         CCoeControl *aControl, 
   818         CCoeControl *aControl,
   823         TCoeEvent aEventType )
   819         TCoeEvent aEventType )
   824     {
   820     {
   825     FUNC_LOG;
   821     FUNC_LOG;
   826     if ( aControl == iAacListBox &&
   822     if ( aControl == iAacListBox &&
   827          aEventType == MCoeControlObserver::EEventStateChanged &&
   823          aEventType == MCoeControlObserver::EEventStateChanged &&
   867             }
   863             }
   868         CleanupStack::PopAndDestroy( lookupText );
   864         CleanupStack::PopAndDestroy( lookupText );
   869         }
   865         }
   870     else if( iAacListBox && !iAacListBox->IsPopupEmpty() )
   866     else if( iAacListBox && !iAacListBox->IsPopupEmpty() )
   871         {
   867         {
   872         CESMRNcsEmailAddressObject* emailAddress  = 
   868         CESMRNcsEmailAddressObject* emailAddress  =
   873                 iAacListBox->ReturnCurrentEmailAddressLC();
   869                 iAacListBox->ReturnCurrentEmailAddressLC();
   874         if( emailAddress )
   870         if( emailAddress )
   875             {
   871             {
   876             if ( emailAddress->EmailAddress().Compare( KNullDesC ))
   872             if ( emailAddress->EmailAddress().Compare( KNullDesC ))
   877                 {
   873                 {
   912     if ( iAacListBox && iAacListBox->IsVisible() )
   908     if ( iAacListBox && iAacListBox->IsVisible() )
   913         {
   909         {
   914         iAacListBox->MakeVisible( EFalse );
   910         iAacListBox->MakeVisible( EFalse );
   915         AknsUtils::SetAvkonSkinEnabledL( ETrue );
   911         AknsUtils::SetAvkonSkinEnabledL( ETrue );
   916         }
   912         }
   917     
   913 
   918     ShowPopupCbaL( EFalse );    
   914     ShowPopupCbaL( EFalse );
   919     UpdateSendOptionL();
   915     UpdateSendOptionL();
   920     }
   916     }
   921 
   917 
   922 // ---------------------------------------------------------------------------
   918 // ---------------------------------------------------------------------------
   923 // CESMRAttendeeField::ExecuteRemoteSearchL
   919 // CESMRAttendeeField::ExecuteRemoteSearchL
   932     displayname.CreateL( KMaxRemoteSearchResponseLength );
   928     displayname.CreateL( KMaxRemoteSearchResponseLength );
   933     displayname.CleanupClosePushL();
   929     displayname.CleanupClosePushL();
   934     RBuf emailAddress;  // codescanner::resourcenotoncleanupstack
   930     RBuf emailAddress;  // codescanner::resourcenotoncleanupstack
   935     emailAddress.CreateL( KMaxRemoteSearchResponseLength );
   931     emailAddress.CreateL( KMaxRemoteSearchResponseLength );
   936     emailAddress.CleanupClosePushL();
   932     emailAddress.CleanupClosePushL();
   937     
   933 
   938     // Pop-up needs to be closed before executing remote lookup with 
   934     // Pop-up needs to be closed before executing remote lookup with
   939     // query dialog, because combination of this pop-up and any query dialog
   935     // query dialog, because combination of this pop-up and any query dialog
   940     // causes background drawing problems with CEikMfne editors. 
   936     // causes background drawing problems with CEikMfne editors.
   941     // Reason unknown.
   937     // Reason unknown.
   942     ClosePopupContactListL();
   938     ClosePopupContactListL();
   943     
   939 
   944     TBool contactSelected = iContactHandler->LaunchRemoteLookupL( aSearchText,
   940     TBool contactSelected = iContactHandler->LaunchRemoteLookupL( aSearchText,
   945                                                                   displayname,
   941                                                                   displayname,
   946                                                                   emailAddress );
   942                                                                   emailAddress );
   947 
   943 
   948     CESMRNcsEmailAddressObject* address = NULL;
   944     CESMRNcsEmailAddressObject* address = NULL;
   975     HBufC *text = iEditor->GetTextInHBufL();
   971     HBufC *text = iEditor->GetTextInHBufL();
   976     TBool enable = text && text->Length() > 0 && text->Compare( *iDefaultText ) != 0;
   972     TBool enable = text && text->Length() > 0 && text->Compare( *iDefaultText ) != 0;
   977     if( enable )
   973     if( enable )
   978     	{
   974     	{
   979         TPtr ptr = text->Des();
   975         TPtr ptr = text->Des();
   980         ptr.Trim();        	
   976         ptr.Trim();
   981     	}
   977     	}
   982     enable = text && text->Length() > 0 && text->Compare( *iDefaultText ) != 0;
   978     enable = text && text->Length() > 0 && text->Compare( *iDefaultText ) != 0;
   983     delete text;
   979     delete text;
   984 
   980 
   985     // Send proper command to CESMREditorDialog::ProcessCommandL
   981     // Send proper command to CESMREditorDialog::ProcessCommandL
  1004         else
  1000         else
  1005             {
  1001             {
  1006             command = EESMRCmdAttendeeOptionalDisabled;
  1002             command = EESMRCmdAttendeeOptionalDisabled;
  1007             }
  1003             }
  1008         }
  1004         }
  1009     
  1005 
  1010     NotifyEventL( command );
  1006     NotifyEventL( command );
  1011     }
  1007     }
  1012 
  1008 
  1013 // ---------------------------------------------------------------------------
  1009 // ---------------------------------------------------------------------------
  1014 // CESMRAttendeeField::HandleListBoxEventL
  1010 // CESMRAttendeeField::HandleListBoxEventL
  1015 // ---------------------------------------------------------------------------
  1011 // ---------------------------------------------------------------------------
  1016 //
  1012 //
  1017 void CESMRAttendeeField::HandleListBoxEventL( CEikListBox* aListBox, 
  1013 void CESMRAttendeeField::HandleListBoxEventL( CEikListBox* aListBox,
  1018                                               TListBoxEvent aEventType )
  1014                                               TListBoxEvent aEventType )
  1019     {
  1015     {
  1020     if( aEventType == EEventEnterKeyPressed || aEventType == EEventItemClicked 
  1016     if( aEventType == EEventEnterKeyPressed || aEventType == EEventItemClicked
  1021             || aEventType == EEventItemDoubleClicked || aEventType == EEventItemSingleClicked )
  1017             || aEventType == EEventItemDoubleClicked || aEventType == EEventItemSingleClicked )
  1022         {
  1018         {
  1023         TInt newIndex = aListBox->CurrentItemIndex();
  1019         TInt newIndex = aListBox->CurrentItemIndex();
  1024         
  1020 
  1025         // if item is already highlighted and then clicked, 
  1021         // if item is already highlighted and then clicked,
  1026         // it is considered that it has been selected
  1022         // it is considered that it has been selected
  1027         if( newIndex == iPreviousIndex )
  1023         if( newIndex == iPreviousIndex )
  1028             {
  1024             {
  1029 			HandleTactileFeedbackL();
  1025 			HandleTactileFeedbackL();
  1030             DoPopupSelectL();
  1026             DoPopupSelectL();
  1031             
  1027 
  1032             // Item selected, index reseted
  1028             // Item selected, index reseted
  1033             iPreviousIndex = 0;
  1029             iPreviousIndex = 0;
  1034             }
  1030             }
  1035         else
  1031         else
  1036             {
  1032             {
  1071 //
  1067 //
  1072 TBool CESMRAttendeeField::HandleSingletapEventL( const TPoint& aPosition )
  1068 TBool CESMRAttendeeField::HandleSingletapEventL( const TPoint& aPosition )
  1073     {
  1069     {
  1074     FUNC_LOG;
  1070     FUNC_LOG;
  1075     TBool ret( EFalse );
  1071     TBool ret( EFalse );
  1076     
  1072 
  1077     if( iTitle->Rect().Contains( aPosition ) ||
  1073     if( iTitle->Rect().Contains( aPosition ) ||
  1078             iFieldButton->Rect().Contains( aPosition ) )
  1074             iFieldButton->Rect().Contains( aPosition ) )
  1079         {
  1075         {
  1080     	HandleTactileFeedbackL();
  1076     	HandleTactileFeedbackL();
  1081     	
  1077 
  1082         iContactHandler->GetAddressesFromPhonebookL( this );
  1078         iContactHandler->GetAddressesFromPhonebookL( this );
  1083         ret = ETrue;
  1079         ret = ETrue;
  1084         }
  1080         }
  1085 
  1081 
  1086     return ret;
  1082     return ret;
  1091 // ---------------------------------------------------------------------------
  1087 // ---------------------------------------------------------------------------
  1092 //
  1088 //
  1093 void CESMRAttendeeField::HandleLongtapEventL( const TPoint& aPosition )
  1089 void CESMRAttendeeField::HandleLongtapEventL( const TPoint& aPosition )
  1094     {
  1090     {
  1095     FUNC_LOG;
  1091     FUNC_LOG;
  1096            
  1092 
  1097     if( iTitle->Rect().Contains( aPosition ) ||
  1093     if( iTitle->Rect().Contains( aPosition ) ||
  1098             iFieldButton->Rect().Contains( aPosition ) )
  1094             iFieldButton->Rect().Contains( aPosition ) )
  1099         {
  1095         {
  1100         NotifyEventL( EAknSoftkeyContextOptions );
  1096         NotifyEventL( EAknSoftkeyContextOptions );
  1101         }
  1097         }
  1107 //
  1103 //
  1108 void CESMRAttendeeField::UpdateAttendeesL( MESMRMeetingRequestEntry& aMREntry )
  1104 void CESMRAttendeeField::UpdateAttendeesL( MESMRMeetingRequestEntry& aMREntry )
  1109     {
  1105     {
  1110     FUNC_LOG;
  1106     FUNC_LOG;
  1111 	/*
  1107 	/*
  1112 	 * Compare editor attendees to existing attendees and add / remove 
  1108 	 * Compare editor attendees to existing attendees and add / remove
  1113 	 * when necessary.
  1109 	 * when necessary.
  1114 	 */
  1110 	 */
  1115 	iEditor->CheckAddressWhenFocusLostL();
  1111 	iEditor->CheckAddressWhenFocusLostL();
  1116 	
  1112 
  1117 	CCalEntry& entry( aMREntry.Entry() );
  1113 	CCalEntry& entry( aMREntry.Entry() );
  1118 	
  1114 
  1119 	// Get editor's attendees
  1115 	// Get editor's attendees
  1120 	RPointerArray<CESMRNcsEmailAddressObject> editorAttendees = 
  1116 	RPointerArray<CESMRNcsEmailAddressObject> editorAttendees =
  1121 			iEditor->GetAddressesL();
  1117 			iEditor->GetAddressesL();
  1122 	TInt editorAttendeesCount( editorAttendees.Count() );
  1118 	TInt editorAttendeesCount( editorAttendees.Count() );
  1123 	
  1119 
  1124 	// Get existing attendees
  1120 	// Get existing attendees
  1125 	RPointerArray<CCalAttendee>& existingAttendees = entry.AttendeesL();
  1121 	RPointerArray<CCalAttendee>& existingAttendees = entry.AttendeesL();
  1126 	TInt existingAttendeesCount( existingAttendees.Count() );
  1122 	TInt existingAttendeesCount( existingAttendees.Count() );
  1127 	
  1123 
  1128 	// Remove removed attendees from entry
  1124 	// Remove removed attendees from entry
  1129 	for( TInt i( existingAttendeesCount - 1 ); i >= 0 ; --i )
  1125 	for( TInt i( existingAttendeesCount - 1 ); i >= 0 ; --i )
  1130 		{
  1126 		{
  1131 		// existing address and role
  1127 		// existing address and role
  1132 		const TDesC& address = existingAttendees[i]->Address();
  1128 		const TDesC& address = existingAttendees[i]->Address();
  1133 		CCalAttendee::TCalRole role = existingAttendees[i]->RoleL();
  1129 		CCalAttendee::TCalRole role = existingAttendees[i]->RoleL();
  1134 		
  1130 
  1135 		// Let's try to find them amongst editor attendees
  1131 		// Let's try to find them amongst editor attendees
  1136 		TBool matchFound( EFalse );
  1132 		TBool matchFound( EFalse );
  1137 		for( TInt j( 0 ); j < editorAttendeesCount ; ++j )
  1133 		for( TInt j( 0 ); j < editorAttendeesCount ; ++j )
  1138 			{
  1134 			{
  1139 			// if address match is found ...
  1135 			// if address match is found ...
  1156 				{
  1152 				{
  1157 				entry.DeleteAttendeeL( i );
  1153 				entry.DeleteAttendeeL( i );
  1158 				}
  1154 				}
  1159 			}
  1155 			}
  1160 		}
  1156 		}
  1161 	
  1157 
  1162 	// Update existing attendees count, because some attendees might
  1158 	// Update existing attendees count, because some attendees might
  1163 	// have been removed
  1159 	// have been removed
  1164 	existingAttendees.Reset();
  1160 	existingAttendees.Reset();
  1165 	existingAttendees = entry.AttendeesL();
  1161 	existingAttendees = entry.AttendeesL();
  1166 	existingAttendeesCount = existingAttendees.Count();
  1162 	existingAttendeesCount = existingAttendees.Count();
  1167 	
  1163 
  1168 	// Add new attendees to entry
  1164 	// Add new attendees to entry
  1169 	for( TInt i( 0 ); i < editorAttendeesCount ; ++i )
  1165 	for( TInt i( 0 ); i < editorAttendeesCount ; ++i )
  1170 		{
  1166 		{
  1171 		CESMRNcsEmailAddressObject* obj = editorAttendees[i];
  1167 		CESMRNcsEmailAddressObject* obj = editorAttendees[i];
  1172 		CCalAttendee* attendee = CCalAttendee::NewL( obj->EmailAddress() );
  1168 		CCalAttendee* attendee = CCalAttendee::NewL( obj->EmailAddress() );
  1173 		attendee->SetRoleL( iRole );
  1169 		attendee->SetRoleL( iRole );
  1174 		attendee->SetCommonNameL( obj->DisplayName() );
  1170 		attendee->SetCommonNameL( obj->DisplayName() );
  1175 	
  1171 
  1176 		if ( EESMRRoleOrganizer == aMREntry.RoleL() || 
  1172 		if ( EESMRRoleOrganizer == aMREntry.RoleL() ||
  1177 			 aMREntry.IsForwardedL() )
  1173 			 aMREntry.IsForwardedL() )
  1178 			{
  1174 			{
  1179 			attendee->SetResponseRequested( ETrue );
  1175 			attendee->SetResponseRequested( ETrue );
  1180 			}
  1176 			}
  1181 		
  1177 
  1182 		TBool isNewAttendee( ETrue );		
  1178 		TBool isNewAttendee( ETrue );
  1183 		for( TInt i( 0 ); i < existingAttendeesCount; ++i )
  1179 		for( TInt i( 0 ); i < existingAttendeesCount; ++i )
  1184 			{
  1180 			{
  1185 			if( existingAttendees[i]->Address().Compare( attendee->Address() ) == 0 )
  1181 			if( existingAttendees[i]->Address().Compare( attendee->Address() ) == 0 )
  1186 				{
  1182 				{
  1187 				if( existingAttendees[i]->RoleL() == iRole )
  1183 				if( existingAttendees[i]->RoleL() == iRole )
  1191 					break;
  1187 					break;
  1192 					}
  1188 					}
  1193 				}
  1189 				}
  1194 			}
  1190 			}
  1195 		// If this is new attendee, let's add it to entry
  1191 		// If this is new attendee, let's add it to entry
  1196 		if( isNewAttendee ) 
  1192 		if( isNewAttendee )
  1197 			{
  1193 			{
  1198 			entry.AddAttendeeL( attendee );
  1194 			entry.AddAttendeeL( attendee );
  1199 			}
  1195 			}
  1200 		}
  1196 		}
  1201     }
  1197     }