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 } |
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; |
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; |
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 |
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; |
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 { |
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 ) |