|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ESMR UI Container class |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cesmrviewerattendeesfield.h" |
|
19 |
|
20 #include "mesmrlistobserver.h" |
|
21 #include "cesmrborderlayer.h" |
|
22 #include "cesmrrichtextlink.h" |
|
23 #include "esmrfieldbuilderdef.h" |
|
24 #include "cesmrlayoutmgr.h" |
|
25 #include "cmrlabel.h" |
|
26 #include "nmrlayoutmanager.h" |
|
27 |
|
28 #include <caluser.h> |
|
29 #include <calentry.h> |
|
30 #include <StringLoader.h> |
|
31 #include <esmrgui.rsg> |
|
32 #include <CPbkContactEngine.h> |
|
33 #include <AknBidiTextUtils.h> |
|
34 #include "cmrlistpane.h" |
|
35 |
|
36 // DEBUG |
|
37 #include "emailtrace.h" |
|
38 |
|
39 using namespace ESMRLayout; |
|
40 |
|
41 // CONSTANTS |
|
42 /// Unnamed namespace for local definitions |
|
43 namespace { // codescanner::namespace |
|
44 |
|
45 _LIT( KNewLine, "\f" ); |
|
46 const TInt KMaxLineCount = 4; |
|
47 const TInt KNumberOfComponents = 2; |
|
48 const TInt KMargin = 5; |
|
49 |
|
50 static void RPointerArrayResetAndDestroy( TAny* aPtr ) |
|
51 { |
|
52 static_cast<RPointerArray<CESMRRichTextLink>*>( aPtr )->ResetAndDestroy(); |
|
53 } |
|
54 |
|
55 } // namespace |
|
56 |
|
57 |
|
58 // ======== MEMBER FUNCTIONS ======== |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CESMRViewerAttendeesField::NewL |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 CESMRViewerAttendeesField* CESMRViewerAttendeesField::NewL( |
|
65 CCalAttendee::TCalRole aRole ) |
|
66 { |
|
67 FUNC_LOG; |
|
68 CESMRViewerAttendeesField* self = |
|
69 new (ELeave) CESMRViewerAttendeesField( aRole ); |
|
70 CleanupStack::PushL ( self ); |
|
71 self->ConstructL ( ); |
|
72 CleanupStack::Pop ( self ); |
|
73 return self; |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CESMRViewerAttendeesField::ConstructL |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CESMRViewerAttendeesField::ConstructL( ) |
|
81 { |
|
82 FUNC_LOG; |
|
83 |
|
84 SetFieldId ( (iRole == CCalAttendee::EReqParticipant) ? EESMRFieldAttendee |
|
85 : EESMRFieldOptAttendee ); |
|
86 |
|
87 iTitle = CMRLabel::NewL(); |
|
88 iTitle->SetParent( this ); |
|
89 |
|
90 iRichTextViewer = CESMRRichTextViewer::NewL (this ); |
|
91 iRichTextViewer->SetEdwinSizeObserver ( this ); |
|
92 iRichTextViewer->SetLinkObserver (this ); |
|
93 iRichTextViewer->SetParent( this ); |
|
94 |
|
95 HBufC* label = StringLoader::LoadLC (iRole == CCalAttendee::EReqParticipant ? |
|
96 R_QTN_MEET_REQ_LABEL_REQUIRED : R_QTN_MEET_REQ_LABEL_OPT ); |
|
97 iTitle->SetTextL ( *label ); |
|
98 |
|
99 CleanupStack::PopAndDestroy( label ); |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CESMRViewerAttendeesField::InitializeL |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CESMRViewerAttendeesField::InitializeL() |
|
107 { |
|
108 FUNC_LOG; |
|
109 TAknLayoutText layoutText = |
|
110 NMRLayoutManager::GetLayoutText( Rect(), |
|
111 NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ); |
|
112 iRichTextViewer->SetFontL( layoutText.Font(), iLayout ); |
|
113 UpdateAttendeesListL(); |
|
114 //wake up current contact menu selection by calling this |
|
115 iRichTextViewer->FocusChanged( ENoDrawNow ); |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CESMRViewerAttendeesField::SetOutlineFocusL |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CESMRViewerAttendeesField::SetOutlineFocusL( TBool aFocus ) |
|
123 { |
|
124 FUNC_LOG; |
|
125 CESMRField::SetOutlineFocusL( aFocus ); |
|
126 iRichTextViewer->SetFocus( aFocus ); |
|
127 |
|
128 if ( aFocus ) |
|
129 { |
|
130 SetMiddleSoftKeyVisible( ETrue ); |
|
131 } |
|
132 else |
|
133 { |
|
134 TInt oldShowAttendees = iShowAllAttendees; |
|
135 iShowAllAttendees = EFalse; |
|
136 if (oldShowAttendees != iShowAllAttendees) |
|
137 { |
|
138 UpdateAttendeesListL(); |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CESMRViewerAttendeesField::InternalizeL |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void CESMRViewerAttendeesField::InternalizeL( MESMRCalEntry& aEntry ) |
|
148 { |
|
149 FUNC_LOG; |
|
150 CCalEntry& entry = aEntry.Entry(); |
|
151 RPointerArray<CCalAttendee>& attendees = entry.AttendeesL(); |
|
152 iCalAttendees.ReserveL(attendees.Count()); |
|
153 for (TInt i=0; i<attendees.Count ( ); ++i ) |
|
154 { |
|
155 CCalAttendee* attendee = attendees[i]; |
|
156 if ( attendee->RoleL() == iRole ) |
|
157 { |
|
158 iCalAttendees.AppendL( attendee ); |
|
159 } |
|
160 } |
|
161 |
|
162 UpdateAttendeesListL(); |
|
163 |
|
164 if ( iRichTextViewer->TextLength() > 0 ) |
|
165 { |
|
166 //wake up current contact menu selection by calling this |
|
167 iRichTextViewer->FocusChanged( ENoDrawNow ); |
|
168 } |
|
169 else |
|
170 { |
|
171 iObserver->RemoveControl( iFieldId ); |
|
172 } |
|
173 iDisableRedraw = ETrue; |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CESMRViewerAttendeesField::GetMinimumVisibleVerticalArea |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 void CESMRViewerAttendeesField::GetMinimumVisibleVerticalArea( |
|
181 TInt& aUpper, TInt& aLower) |
|
182 { |
|
183 FUNC_LOG; |
|
184 aLower = iRichTextViewer->CurrentLineNumber() * iRichTextViewer->RowHeight() + iTitle->Size().iHeight; |
|
185 aUpper = aLower - iRichTextViewer->RowHeight() - iTitle->Size().iHeight; |
|
186 } |
|
187 |
|
188 // ----------------------------------------------------------------------------- |
|
189 // CESMRViewerAttendeesField::ListObserverSet |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 void CESMRViewerAttendeesField::ListObserverSet( ) |
|
193 { |
|
194 FUNC_LOG; |
|
195 iRichTextViewer->SetListObserver( iObserver ); |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CESMRViewerAttendeesField::SizeChanged |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 void CESMRViewerAttendeesField::SizeChanged( ) |
|
203 { |
|
204 FUNC_LOG; |
|
205 // Store iRichTextViewer original width. |
|
206 TInt richTextViewerWidth = iRichTextViewer->Size().iWidth; |
|
207 |
|
208 // Get field's rect |
|
209 TRect rect( Rect() ); |
|
210 |
|
211 // First row for title |
|
212 TAknLayoutRect rowLayoutRect = |
|
213 NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 ); |
|
214 TRect rowRect = rowLayoutRect.Rect(); |
|
215 |
|
216 // Layout title to first row's rect |
|
217 TAknTextComponentLayout titleLayout = |
|
218 NMRLayoutManager::GetTextComponentLayout( |
|
219 NMRLayoutManager::EMRTextLayoutText ); |
|
220 AknLayoutUtils::LayoutLabel( iTitle, rect, titleLayout ); |
|
221 // Color should be overrided after layouting |
|
222 // If this function leaves we'll have to use default color |
|
223 TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( |
|
224 *iTitle, |
|
225 EColorLabelText, |
|
226 KRgbBlack )); |
|
227 |
|
228 // Move upper left corner below first line and get second row's rect. |
|
229 rect.iTl.iY += rowRect.Height(); |
|
230 rowLayoutRect = |
|
231 NMRLayoutManager::GetFieldRowLayoutRect( rect, 2 ); |
|
232 rowRect = rowLayoutRect.Rect(); |
|
233 |
|
234 // Get default 1 row editor rect. |
|
235 TAknLayoutText viewerLayoutText = |
|
236 NMRLayoutManager::GetLayoutText( rowRect, |
|
237 NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ); |
|
238 TRect viewerRect = viewerLayoutText.TextRect(); |
|
239 // Resize resize it's height according to actual height required by edwin. |
|
240 viewerRect.Resize( 0, iExpandedSize.iHeight - viewerRect.Height() ); |
|
241 iRichTextViewer->SetRect( viewerRect ); |
|
242 |
|
243 // Update AttendeesList only if iRichTextViewer width was changed. |
|
244 // This happens when screen orientation changes e.g. This check |
|
245 // also prevents recursive calls to UpdateAttendeesListL since |
|
246 // it causes edwin size changed event. |
|
247 if ( iRichTextViewer->Size().iWidth != richTextViewerWidth ) |
|
248 { |
|
249 // Ignore leave, there's nothing we can do if leave occurs. |
|
250 TRAP_IGNORE( UpdateAttendeesListL() ); |
|
251 //wake up current contact menu selection by calling this |
|
252 iRichTextViewer->FocusChanged(ENoDrawNow); |
|
253 } |
|
254 |
|
255 DrawDeferred(); |
|
256 } |
|
257 |
|
258 // ----------------------------------------------------------------------------- |
|
259 // CESMRViewerAttendeesField::OfferKeyEventL |
|
260 // ----------------------------------------------------------------------------- |
|
261 // |
|
262 TKeyResponse CESMRViewerAttendeesField::OfferKeyEventL( const TKeyEvent& aEvent, |
|
263 TEventCode aType ) |
|
264 { |
|
265 FUNC_LOG; |
|
266 TKeyResponse response = EKeyWasNotConsumed; |
|
267 response = iRichTextViewer->OfferKeyEventL ( aEvent, aType ); |
|
268 |
|
269 //track up and down events to change MSK |
|
270 if ( aType == EEventKey ) |
|
271 { |
|
272 if ( aEvent.iScanCode == EStdKeyUpArrow |
|
273 || aEvent.iScanCode == EStdKeyDownArrow ) |
|
274 { |
|
275 const CESMRRichTextLink* link = |
|
276 iRichTextViewer->GetSelectedLink ( ); |
|
277 if( link ) |
|
278 { |
|
279 if (link->Type() == CESMRRichTextLink::ETypeShowAll ) |
|
280 { |
|
281 ChangeMiddleSoftKeyL( |
|
282 EESMRCmdShowAllAttendees, R_QTN_MEET_REQ_SHOW_ALL); |
|
283 } |
|
284 else |
|
285 { |
|
286 RestoreMiddleSoftKeyL(); |
|
287 SetMiddleSoftKeyVisible( ETrue ); |
|
288 } |
|
289 } |
|
290 } |
|
291 } |
|
292 |
|
293 return response; |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------------------------- |
|
297 // CESMRViewerAttendeesField::SetContainerWindowL() |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 void CESMRViewerAttendeesField::SetContainerWindowL( |
|
301 const CCoeControl& aContainer ) |
|
302 { |
|
303 CESMRField::SetContainerWindowL( aContainer ); |
|
304 iRichTextViewer->SetContainerWindowL( aContainer ); |
|
305 } |
|
306 |
|
307 // --------------------------------------------------------------------------- |
|
308 // CESMRViewerAttendeesField::MinimumSize() |
|
309 // --------------------------------------------------------------------------- |
|
310 // |
|
311 TSize CESMRViewerAttendeesField::MinimumSize() |
|
312 { |
|
313 // Parent rect will be list area later --> no need to calculate it manually. |
|
314 TRect parentRect = Parent()->Rect(); |
|
315 TRect contentRect = NMRLayoutManager::GetLayoutRect( |
|
316 parentRect, NMRLayoutManager::EMRLayoutListArea ).Rect(); |
|
317 // We have two lines; title and richtextviewer. |
|
318 TRect fieldRect = |
|
319 NMRLayoutManager::GetFieldLayoutRect( contentRect, 2 ).Rect(); |
|
320 // Get row size for second row (richtext viewer). |
|
321 TRect rowRect = |
|
322 NMRLayoutManager::GetFieldRowLayoutRect( fieldRect, 2 ).Rect(); |
|
323 // Get size for default 1 line editor. |
|
324 TRect viewerRect = NMRLayoutManager::GetLayoutText( |
|
325 rowRect, |
|
326 NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ).TextRect(); |
|
327 // Adjust field size so that there's room for expandable editor. |
|
328 fieldRect.Resize( 0, iExpandedSize.iHeight - viewerRect.Height() ); |
|
329 return fieldRect.Size(); |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------------------------- |
|
333 // CESMRViewerAttendeesField::ExecuteGenericCommandL() |
|
334 // --------------------------------------------------------------------------- |
|
335 // |
|
336 void CESMRViewerAttendeesField::ExecuteGenericCommandL( TInt aCommand ) |
|
337 { |
|
338 FUNC_LOG; |
|
339 switch ( aCommand ) |
|
340 { |
|
341 case EESMRCmdClipboardCopy: |
|
342 { |
|
343 iRichTextViewer->CopyCurrentLinkValueToClipBoardL(); |
|
344 break; |
|
345 } |
|
346 case EESMRCmdShowAllAttendees: |
|
347 { |
|
348 iShowAllAttendees = ETrue; |
|
349 UpdateAttendeesListL(); |
|
350 |
|
351 RestoreMiddleSoftKeyL(); |
|
352 //wake up current contact menu selection by calling this |
|
353 iRichTextViewer->FocusChanged(ENoDrawNow); |
|
354 break; |
|
355 } |
|
356 case EAknSoftkeySelect: |
|
357 { |
|
358 iRichTextViewer->LinkSelectedL(); |
|
359 break; |
|
360 } |
|
361 default: |
|
362 // do nothing for now.. |
|
363 break; |
|
364 } |
|
365 } |
|
366 |
|
367 // ----------------------------------------------------------------------------- |
|
368 // CESMRViewerAttendeesField::HandleEdwinSizeEventL |
|
369 // ----------------------------------------------------------------------------- |
|
370 // |
|
371 TBool CESMRViewerAttendeesField::HandleEdwinSizeEventL(CEikEdwin* /*aEdwin*/, |
|
372 TEdwinSizeEvent /*aType*/, TSize aSize ) |
|
373 { |
|
374 FUNC_LOG; |
|
375 iExpandedSize = aSize; |
|
376 if ( iObserver && iDisableRedraw ) |
|
377 { |
|
378 iObserver->ControlSizeChanged ( this ); |
|
379 } |
|
380 return iDisableRedraw; |
|
381 } |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // CESMRViewerAttendeesField::HandleRichTextLinkSelection |
|
385 // ----------------------------------------------------------------------------- |
|
386 // |
|
387 TBool CESMRViewerAttendeesField::HandleRichTextLinkSelection( |
|
388 const CESMRRichTextLink* aLink ) |
|
389 { |
|
390 FUNC_LOG; |
|
391 if ( aLink->Type() == CESMRRichTextLink::ETypeShowAll ) |
|
392 { |
|
393 iShowAllAttendees = ETrue; |
|
394 TRAPD( err, UpdateAttendeesListL() ); |
|
395 |
|
396 if ( err == KErrNone ) |
|
397 { |
|
398 return ETrue; |
|
399 } |
|
400 } |
|
401 return EFalse; |
|
402 } |
|
403 |
|
404 // ----------------------------------------------------------------------------- |
|
405 // CESMRViewerAttendeesField::CountComponentControls |
|
406 // ----------------------------------------------------------------------------- |
|
407 // |
|
408 TInt CESMRViewerAttendeesField::CountComponentControls( ) const |
|
409 { |
|
410 FUNC_LOG; |
|
411 TInt count = KNumberOfComponents; |
|
412 return count; |
|
413 } |
|
414 |
|
415 // ----------------------------------------------------------------------------- |
|
416 // CESMRViewerAttendeesField::ComponentControl |
|
417 // ----------------------------------------------------------------------------- |
|
418 // |
|
419 CCoeControl* CESMRViewerAttendeesField::ComponentControl( TInt aInd ) const |
|
420 { |
|
421 FUNC_LOG; |
|
422 switch ( aInd ) |
|
423 { |
|
424 case 0: |
|
425 { |
|
426 return iTitle; |
|
427 } |
|
428 case 1: |
|
429 { |
|
430 return iRichTextViewer; |
|
431 } |
|
432 default: |
|
433 { |
|
434 return NULL; |
|
435 } |
|
436 } |
|
437 } |
|
438 |
|
439 // ----------------------------------------------------------------------------- |
|
440 // CESMRViewerAttendeesField::~CESMRViewerAttendeesField |
|
441 // ----------------------------------------------------------------------------- |
|
442 // |
|
443 CESMRViewerAttendeesField::~CESMRViewerAttendeesField( ) |
|
444 { |
|
445 FUNC_LOG; |
|
446 delete iTitle; |
|
447 delete iRichTextViewer; |
|
448 iCalAttendees.Reset(); |
|
449 } |
|
450 |
|
451 // ----------------------------------------------------------------------------- |
|
452 // CESMRViewerAttendeesField::CESMRViewerAttendeesField |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 CESMRViewerAttendeesField::CESMRViewerAttendeesField( |
|
456 CCalAttendee::TCalRole aRole ) : |
|
457 iRole( aRole) |
|
458 { |
|
459 FUNC_LOG; |
|
460 //do nothing |
|
461 } |
|
462 |
|
463 // ----------------------------------------------------------------------------- |
|
464 // CESMRViewerAttendeesField::ClipTextLC |
|
465 // ----------------------------------------------------------------------------- |
|
466 // |
|
467 HBufC* CESMRViewerAttendeesField::ClipTextLC( |
|
468 const TDesC& aText, const CFont& aFont, TInt aWidth ) |
|
469 { |
|
470 FUNC_LOG; |
|
471 HBufC* text = HBufC::NewLC( aText.Length() + KAknBidiExtraSpacePerLine ); |
|
472 TPtr textPtr = text->Des(); |
|
473 AknBidiTextUtils::ConvertToVisualAndClip( |
|
474 aText, textPtr, aFont, aWidth, aWidth ); |
|
475 return text; |
|
476 } |
|
477 |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // CESMRViewerAttendeesField::UpdateAttendeesListL |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 void CESMRViewerAttendeesField::UpdateAttendeesListL() |
|
484 { |
|
485 FUNC_LOG; |
|
486 RBuf buffer; // codescanner::resourcenotoncleanupstack |
|
487 buffer.CleanupClosePushL(); |
|
488 |
|
489 iRichTextViewer->SetMargins( KMargin ); |
|
490 |
|
491 TSize oldSize = Size(); |
|
492 |
|
493 TRect rect( Rect() ); |
|
494 TAknLayoutText layoutText = |
|
495 NMRLayoutManager::GetLayoutText( rect, |
|
496 NMRLayoutManager::EMRTextLayoutMultiRowTextEditor ); |
|
497 TRect viewerRect = layoutText.TextRect(); |
|
498 TInt maxLineWidth = viewerRect.Size().iWidth; |
|
499 const CFont* font = layoutText.Font(); |
|
500 |
|
501 if ( maxLineWidth > 0 ) // control size is set |
|
502 { |
|
503 TInt linkCount = iCalAttendees.Count(); |
|
504 TBool notAllShown(EFalse); |
|
505 if ( !iShowAllAttendees ) |
|
506 { |
|
507 linkCount = Min(KMaxLineCount, iCalAttendees.Count() ); |
|
508 notAllShown = ( linkCount != iCalAttendees.Count() ); |
|
509 } |
|
510 |
|
511 RPointerArray<CESMRRichTextLink> attendeeLinks; // codescanner::resourcenotoncleanupstack |
|
512 TCleanupItem arrayCleanup( RPointerArrayResetAndDestroy, &attendeeLinks ); |
|
513 CleanupStack::PushL( arrayCleanup ); |
|
514 attendeeLinks.ReserveL( linkCount ); |
|
515 |
|
516 for ( TInt i = 0; i < linkCount; ++i ) |
|
517 { |
|
518 CCalAttendee* attendee = iCalAttendees[i]; |
|
519 |
|
520 // Attendee email address. |
|
521 TPtrC addr = attendee->Address(); |
|
522 // Attendee common name. |
|
523 TPtrC name = attendee->CommonName(); |
|
524 // Actual text to be added to attendee field (email or common name). |
|
525 TPtrC text = addr; |
|
526 |
|
527 // If attendee has common name, use it instead. |
|
528 if ( name.Length() > 0 ) |
|
529 { |
|
530 text.Set( name ); |
|
531 } |
|
532 |
|
533 HBufC* clippedTextHBufC = ClipTextLC( text, *font, maxLineWidth ); |
|
534 TPtr clippedText = clippedTextHBufC->Des(); |
|
535 clippedText.Trim(); |
|
536 |
|
537 if ( clippedText.Length() > 0 ) |
|
538 { |
|
539 CESMRRichTextLink* link = CESMRRichTextLink::NewL( |
|
540 buffer.Length(), |
|
541 clippedText.Length() + |
|
542 KAddressDelimeterSemiColon().Length(), |
|
543 addr, |
|
544 CESMRRichTextLink::ETypeEmail, |
|
545 CESMRRichTextLink::ETriggerKeyRight ); |
|
546 CleanupStack::PushL( link ); |
|
547 attendeeLinks.AppendL( link ); |
|
548 CleanupStack::Pop( link ); |
|
549 |
|
550 // Append text and semicolon to buffer. |
|
551 buffer.ReAllocL( buffer.Length() + |
|
552 clippedText.Length() + |
|
553 KAddressDelimeterSemiColon().Length() + |
|
554 KNewLine().Length() ); |
|
555 buffer.Append( clippedText ); |
|
556 buffer.Append( KAddressDelimeterSemiColon ); |
|
557 buffer.Append( KNewLine ); |
|
558 } |
|
559 |
|
560 CleanupStack::PopAndDestroy( clippedTextHBufC ); |
|
561 } |
|
562 |
|
563 // If there are more lines in use than KMaxLineCount and |
|
564 // we don't want to show all attendees, leave only |
|
565 // KMaxLineCount-1 attendees and add 'show all' |
|
566 // link to the end. |
|
567 if ( notAllShown ) |
|
568 { |
|
569 // Create and append 'show all' link. |
|
570 CESMRRichTextLink* showAllLink; |
|
571 HBufC* showAllBuf = StringLoader::LoadLC( R_QTN_MEET_REQ_SHOW_ALL ); |
|
572 buffer.ReAllocL( buffer.Length() + |
|
573 showAllBuf->Length() ); |
|
574 showAllLink = CESMRRichTextLink::NewL( buffer.Length ( ), |
|
575 showAllBuf->Length(), KNullDesC, |
|
576 CESMRRichTextLink::ETypeShowAll, |
|
577 CESMRRichTextLink::ETriggerKeyOk ); |
|
578 buffer.Append( *showAllBuf ); |
|
579 CleanupStack::PopAndDestroy( showAllBuf ); |
|
580 CleanupStack::PushL( showAllLink ); |
|
581 attendeeLinks.AppendL( showAllLink ); |
|
582 CleanupStack::Pop( showAllLink ); |
|
583 } |
|
584 |
|
585 // Remove unnecessary new line from the end of buffer. |
|
586 else if ( buffer.Length() >= KNewLine().Length() ) |
|
587 { |
|
588 buffer.SetLength( buffer.Length() - KNewLine().Length() ); |
|
589 } |
|
590 |
|
591 if ( buffer.Length() > 0 ) |
|
592 { |
|
593 iRichTextViewer->SetTextL( &buffer ); |
|
594 |
|
595 // Add all links to iRichTextViewer. |
|
596 while ( attendeeLinks.Count() > 0 ) |
|
597 { |
|
598 CESMRRichTextLink* link = attendeeLinks[0]; |
|
599 CleanupStack::PushL( link ); |
|
600 attendeeLinks.Remove( 0 ); |
|
601 iRichTextViewer->AddLinkL( link ); |
|
602 CleanupStack::Pop( link ); |
|
603 } |
|
604 } |
|
605 |
|
606 CleanupStack::PopAndDestroy( &attendeeLinks ); |
|
607 |
|
608 TSize newSize = Size(); |
|
609 if (oldSize != newSize) |
|
610 { |
|
611 CMRListPane* parent = static_cast<CMRListPane*>(Parent()); |
|
612 parent->SizeChanged(); |
|
613 } |
|
614 } |
|
615 CleanupStack::PopAndDestroy( &buffer ); |
|
616 } |
|
617 |
|
618 |
|
619 // ----------------------------------------------------------------------------- |
|
620 // CESMRViewerAttendeesField::HandlePointerEventL |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 void CESMRViewerAttendeesField::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
624 { |
|
625 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
626 } |
|
627 // End of file |
|
628 |