|
1 /* |
|
2 * Copyright (c) 2007 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 : FreestyleEmailUi message details view implementation |
|
15 * Version : %version: 44 % |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // SYSTEM INCLUDES |
|
22 #include "emailtrace.h" |
|
23 #include <AknUtils.h> |
|
24 #include <gulicon.h> |
|
25 #include <freestyleemailui.mbg> |
|
26 #include <FreestyleEmailUi.rsg> |
|
27 #include <StringLoader.h> |
|
28 #include <AknBidiTextUtils.h> |
|
29 #include <akntitle.h> |
|
30 // <cmail> SF |
|
31 #include <alf/alfdecklayout.h> |
|
32 #include <alf/alfcontrolgroup.h> |
|
33 #include <alf/alfframebrush.h> |
|
34 #include <alf/alfevent.h> |
|
35 // </cmail> |
|
36 #include <featmgr.h> |
|
37 //</cmail> |
|
38 |
|
39 //<cmail> |
|
40 #include "CFSMailMessage.h" |
|
41 #include "CFSMailClient.h" |
|
42 //</cmail> |
|
43 |
|
44 #include "FSEmailBuildFlags.h" |
|
45 //<cmail> |
|
46 #include "cfsccontactactionmenu.h" |
|
47 #include "mfsccontactactionmenumodel.h" |
|
48 //</cmail> |
|
49 |
|
50 //<cmail> |
|
51 #include "fstreelist.h" |
|
52 #include "fstreevisualizerbase.h" |
|
53 #include "fstreeplainonelinenodedata.h" |
|
54 #include "fstreeplainonelinenodevisualizer.h" |
|
55 #include "fstreeplainonelineitemdata.h" |
|
56 #include "fstreeplainonelineitemvisualizer.h" |
|
57 #include "fstreeplaintwolineitemdata.h" |
|
58 #include "fstreeplaintwolineitemvisualizer.h" |
|
59 #include <csxhelp/cmail.hlp.hrh> |
|
60 // </cmail> |
|
61 |
|
62 // INTERNAL INCLUDES |
|
63 #include "FreestyleEmailUiAppui.h" |
|
64 #include "FreestyleEmailUiMsgDetailsControl.h" |
|
65 #include "FreestyleEmailUiMsgDetailsModel.h" |
|
66 #include "FreestyleEmailUiMsgDetailsVisualiser.h" |
|
67 #include "FreestyleEmailUi.hrh" |
|
68 #include "FreestyleEmailUiLayoutHandler.h" |
|
69 #include "FreestyleEmailUiTextureManager.h" |
|
70 #include "FreestyleEmailUiUtilities.h" |
|
71 #include "FreestyleEmailUiShortcutBinding.h" |
|
72 #include "FreestyleEmailUiContactHandler.h" |
|
73 #include "FSDelayedLoader.h" |
|
74 |
|
75 |
|
76 CFSEmailUiMsgDetailsVisualiser* CFSEmailUiMsgDetailsVisualiser::NewL( CAlfEnv& aEnv, |
|
77 CAlfControlGroup& aControlGroup, |
|
78 CFreestyleEmailUiAppUi& aAppUi ) |
|
79 { |
|
80 FUNC_LOG; |
|
81 CFSEmailUiMsgDetailsVisualiser* self = CFSEmailUiMsgDetailsVisualiser::NewLC(aEnv, aControlGroup, aAppUi ); |
|
82 CleanupStack::Pop(self); |
|
83 return self; |
|
84 } |
|
85 |
|
86 CFSEmailUiMsgDetailsVisualiser* CFSEmailUiMsgDetailsVisualiser::NewLC( CAlfEnv& aEnv, |
|
87 CAlfControlGroup& aControlGroup, |
|
88 CFreestyleEmailUiAppUi& aAppUi ) |
|
89 { |
|
90 FUNC_LOG; |
|
91 CFSEmailUiMsgDetailsVisualiser* self = new (ELeave) CFSEmailUiMsgDetailsVisualiser( aEnv, aAppUi, aControlGroup ); |
|
92 CleanupStack::PushL(self); |
|
93 self->ConstructL(); |
|
94 return self; |
|
95 } |
|
96 |
|
97 void CFSEmailUiMsgDetailsVisualiser::ConstructL() |
|
98 { |
|
99 FUNC_LOG; |
|
100 |
|
101 BaseConstructL( R_FSEMAILUI_MAIL_DETAILS_VIEW ); |
|
102 |
|
103 iFirstStartCompleted = EFalse; |
|
104 |
|
105 } |
|
106 |
|
107 // CFSEmailUiMsgDetailsVisualiser::DoFirstStartL() |
|
108 // Purpose of this function is to do first start only when msg details is |
|
109 // really needed to be shown. Implemented to make app startuo faster. |
|
110 void CFSEmailUiMsgDetailsVisualiser::DoFirstStartL() |
|
111 { |
|
112 FUNC_LOG; |
|
113 iControl = CFSEmailUiMsgDetailsControl::NewL( iEnv, *this ); |
|
114 iModel = new (ELeave) CFSEmailUiMsgDetailsModel(); |
|
115 |
|
116 UpdateListSizeAttributes(); |
|
117 |
|
118 iParentLayout = CAlfDeckLayout::AddNewL( *iControl ); |
|
119 iParentLayout->SetFlags( EAlfVisualFlagLayoutUpdateNotification ); |
|
120 iParentLayout->SetRect( iScreenRect ); |
|
121 |
|
122 iTreeVisualizer = CFsTreeVisualizerBase::NewL(iControl, *iParentLayout); |
|
123 iTreeVisualizer->SetItemExpansionDelay( iAppUi.LayoutHandler()->ListItemExpansionDelay() ); |
|
124 iTreeVisualizer->SetScrollTime( iAppUi.LayoutHandler()->ListScrollingTime() ); |
|
125 iTreeVisualizer->SetFadeInEffectTime( iAppUi.LayoutHandler()->ListFadeInEffectTime() ); |
|
126 iTreeVisualizer->SetFadeOutEffectTime( iAppUi.LayoutHandler()->ListFadeOutEffectTime() ); |
|
127 |
|
128 iTreeList = CFsTreeList::NewL( *iTreeVisualizer, iEnv ); |
|
129 iTreeList->HideListL(); |
|
130 iTreeList->SetLoopingType( EFsTreeListLoopingJumpToFirstLast ); |
|
131 iTreeList->SetScrollbarVisibilityL( EFsScrollbarAuto ); |
|
132 iTreeList->SetIndentationL( 0 ); |
|
133 |
|
134 //<cmail> Compared to S60 3.2.3 in S60 5.0 Alf offers the key events in |
|
135 // opposite order. |
|
136 ControlGroup().AppendL( iControl ); |
|
137 ControlGroup().AppendL( iTreeList->TreeControl() ); |
|
138 //</cmail> |
|
139 |
|
140 // <cmail> Touch |
|
141 iTreeList->AddObserverL(*this); |
|
142 //</cmail> |
|
143 |
|
144 // Set page up and page down keys |
|
145 iTreeVisualizer->AddCustomPageUpKey( EStdKeyPageUp ); |
|
146 iTreeVisualizer->AddCustomPageDownKey( EStdKeyPageDown ); |
|
147 iTreeVisualizer->SetItemsAlwaysExtendedL( ETrue ); |
|
148 |
|
149 iAppUi.LayoutHandler()->SetListMarqueeBehaviour( iTreeList ); |
|
150 |
|
151 iFirstStartCompleted = ETrue; |
|
152 } |
|
153 |
|
154 CFSEmailUiMsgDetailsVisualiser::CFSEmailUiMsgDetailsVisualiser( CAlfEnv& aEnv, CFreestyleEmailUiAppUi& aAppUi, CAlfControlGroup& aControlGroup ) |
|
155 : CFsEmailUiViewBase(aControlGroup, aAppUi), |
|
156 iEnv(aEnv), |
|
157 iFirstViewActivation( ETrue ), |
|
158 iExpandCollapseMode( EExpandAll ), |
|
159 // <cmail> video call |
|
160 iVideoCall( EFalse ) |
|
161 // </cmail> |
|
162 { |
|
163 FUNC_LOG; |
|
164 } |
|
165 |
|
166 CFSEmailUiMsgDetailsVisualiser::~CFSEmailUiMsgDetailsVisualiser() |
|
167 { |
|
168 FUNC_LOG; |
|
169 delete iModel; |
|
170 iModel = NULL; |
|
171 |
|
172 delete iPreviousTitleText; |
|
173 iPreviousTitleText = NULL; |
|
174 |
|
175 delete iViewedMsg; |
|
176 iViewedMsg = NULL; |
|
177 |
|
178 delete iNoDisplayNameAvailableText; |
|
179 iNoDisplayNameAvailableText = NULL; |
|
180 |
|
181 delete iNoEmailAddressAvailableText; |
|
182 iNoEmailAddressAvailableText = NULL; |
|
183 |
|
184 delete iTreeList; |
|
185 iTreeList = NULL; |
|
186 |
|
187 iNodeIds.Close(); |
|
188 } |
|
189 |
|
190 TUid CFSEmailUiMsgDetailsVisualiser::Id() const |
|
191 { |
|
192 FUNC_LOG; |
|
193 return MsgDetailsViewId; |
|
194 } |
|
195 |
|
196 // <cmail> Toolbar |
|
197 /*void CFSEmailUiMsgDetailsVisualiser::DoActivateL(const TVwsViewId& aPrevViewId, |
|
198 TUid aCustomMessageId, |
|
199 const TDesC8& aCustomMessage)*/ |
|
200 void CFSEmailUiMsgDetailsVisualiser::ChildDoActivateL( |
|
201 const TVwsViewId& aPrevViewId, TUid aCustomMessageId, |
|
202 const TDesC8& aCustomMessage) |
|
203 // </cmail> Toolbar |
|
204 { |
|
205 FUNC_LOG; |
|
206 if ( !iFirstStartCompleted ) |
|
207 { |
|
208 DoFirstStartL(); |
|
209 } |
|
210 |
|
211 UpdateListSizeAttributes(); |
|
212 iParentLayout->SetRect( iScreenRect ); |
|
213 |
|
214 if ( aCustomMessageId == KStartMsgDetailsReturnToPrevious ) |
|
215 { |
|
216 // Fisrt handle special case where we are returning to msg details view, |
|
217 // so we don't need to recreate list contents, just refresh the view |
|
218 if ( iViewedMsg ) // Safety check |
|
219 { |
|
220 // Set title bar text to "Message/Meeting details" |
|
221 ChangeTitleBarTextL( ETrue ); |
|
222 |
|
223 // Hide list and switch this view as active |
|
224 iTreeList->HideListL(); |
|
225 |
|
226 // Then just refresh the list as in dynamic variant switch, |
|
227 // because screen orientation might have changed |
|
228 HandleDynamicVariantSwitchL( EScreenLayoutChanged ); |
|
229 } |
|
230 } |
|
231 else |
|
232 { |
|
233 // This is the "normal" case, so we need to recreate the list contents |
|
234 |
|
235 // Store previous view ID |
|
236 iPreviousViewUid = aPrevViewId.iViewUid; |
|
237 |
|
238 TMsgDetailsActivationData subView; |
|
239 TPckgBuf<TMsgDetailsActivationData> viewData( subView ); |
|
240 viewData.Copy( aCustomMessage ); |
|
241 subView = viewData(); |
|
242 |
|
243 delete iViewedMsg; |
|
244 iViewedMsg = NULL; |
|
245 |
|
246 iViewedMsg = iAppUi.GetMailClient()->GetMessageByUidL( subView.iMailBoxId, subView.iFolderId, subView.iMessageId, EFSMsgDataEnvelope ); |
|
247 CFSMailBox* mailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( subView.iMailBoxId ); |
|
248 CleanupStack::PushL( mailBox ); |
|
249 if ( mailBox && TFsEmailUiUtility::IsRemoteLookupSupported( *mailBox ) ) |
|
250 { |
|
251 iRCLSupported = ETrue; |
|
252 } |
|
253 else |
|
254 { |
|
255 iRCLSupported = EFalse; |
|
256 } |
|
257 CleanupStack::PopAndDestroy( mailBox ); |
|
258 |
|
259 if( iFirstViewActivation ) |
|
260 { |
|
261 iTreeVisualizer->SetMenuIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMenuIcon ) ); |
|
262 //<cmail> S60 skin support |
|
263 //iTreeVisualizer->SetBackgroundTextureL( iAppUi.FsTextureManager()->TextureByIndex( EBackgroundTextureMailList ) ); |
|
264 //</cmail> |
|
265 |
|
266 CAlfBrush* selectorBrush = iAppUi.FsTextureManager()->ListSelectorBrushL(); |
|
267 iTreeVisualizer->SetSelectorPropertiesL( selectorBrush, 1.0, CFsTreeVisualizerBase::EFsSelectorMoveSmoothly ); |
|
268 |
|
269 iFirstViewActivation = EFalse; |
|
270 } |
|
271 |
|
272 if ( iViewedMsg ) // Safety check |
|
273 { |
|
274 // Set title bar text to "Message/Meeting details" |
|
275 ChangeTitleBarTextL( ETrue ); |
|
276 |
|
277 iTreeList->HideListL(); |
|
278 |
|
279 // By default we expand all nodes, if parameters doesn't state |
|
280 // something else |
|
281 iExpandCollapseMode = EExpandAll; |
|
282 if ( aCustomMessageId == KStartMsgDetailsToTo ) |
|
283 { |
|
284 iExpandCollapseMode = ECollapseAllExceptTo; |
|
285 } |
|
286 else if ( aCustomMessageId == KStartMsgDetailsToCc ) |
|
287 { |
|
288 iExpandCollapseMode = ECollapseAllExceptCc; |
|
289 } |
|
290 else if ( aCustomMessageId == KStartMsgDetailsToBcc ) |
|
291 { |
|
292 iExpandCollapseMode = ECollapseAllExceptBcc; |
|
293 } |
|
294 |
|
295 iParentLayout->SetRect( iScreenRect ); |
|
296 ClearMsgDetailsModelL(); |
|
297 |
|
298 UpdateMsgDetailsModelL(); |
|
299 iTreeList->ShowListL(); |
|
300 } |
|
301 } |
|
302 // <cmail> Touch |
|
303 iTreeList->SetFocusedL(ETrue); |
|
304 // </cmail> |
|
305 } |
|
306 |
|
307 void CFSEmailUiMsgDetailsVisualiser::ChildDoDeactivate() |
|
308 { |
|
309 FUNC_LOG; |
|
310 if ( !iAppUi.AppUiExitOngoing() ) |
|
311 { |
|
312 if ( iTreeList->IsFocused() ) |
|
313 { |
|
314 TRAP_IGNORE( { |
|
315 iTreeList->SetFocusedL(EFalse); |
|
316 iTreeList->SetFocusedItemL(KFsTreeNoneID); |
|
317 } ); |
|
318 } |
|
319 iTreeVisualizer->NotifyControlVisibilityChange( EFalse ); |
|
320 } |
|
321 } |
|
322 |
|
323 void CFSEmailUiMsgDetailsVisualiser::PrepareForExit() |
|
324 { |
|
325 delete iViewedMsg; |
|
326 iViewedMsg = NULL; |
|
327 } |
|
328 |
|
329 |
|
330 void CFSEmailUiMsgDetailsVisualiser::ChangeTitleBarTextL( TBool aViewStarted ) |
|
331 { |
|
332 FUNC_LOG; |
|
333 if ( iFirstStartCompleted ) // Safety |
|
334 { |
|
335 if ( aViewStarted ) |
|
336 { |
|
337 // Store previous application title text |
|
338 delete iPreviousTitleText; |
|
339 iPreviousTitleText = NULL; |
|
340 iPreviousTitleText = iAppUi.TitlePaneTextL().AllocL(); |
|
341 |
|
342 HBufC* titleText = NULL; |
|
343 if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
344 { |
|
345 titleText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_MEETING_HEADING ); |
|
346 } |
|
347 else |
|
348 { |
|
349 titleText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_HEADING ); |
|
350 } |
|
351 |
|
352 iAppUi.SetTitlePaneTextL( *titleText ); |
|
353 |
|
354 CleanupStack::PopAndDestroy( titleText ); |
|
355 } |
|
356 else |
|
357 { |
|
358 if ( iPreviousTitleText ) |
|
359 { |
|
360 iAppUi.SetTitlePaneTextL( *iPreviousTitleText ); // Set application title text back |
|
361 } |
|
362 } |
|
363 } |
|
364 } |
|
365 |
|
366 void CFSEmailUiMsgDetailsVisualiser::LaunchActionMenuL() |
|
367 { |
|
368 FUNC_LOG; |
|
369 CFSEmailUiActionMenu::RemoveAllL(); |
|
370 |
|
371 RFsEActionMenuIdList itemList; |
|
372 itemList.AppendL(FsEActionMenuCall); |
|
373 // <cmail> video call |
|
374 itemList.AppendL( FsEActionMenuCallVideo ); |
|
375 // </cmail> |
|
376 itemList.AppendL(FsEActionMenuCreateMessage); |
|
377 itemList.AppendL(FsEActionMenuContactDetails); |
|
378 itemList.AppendL(FsEActionMenuAddToContacts); |
|
379 if ( iRCLSupported ) |
|
380 { |
|
381 itemList.AppendL(FsEActionMenuRemoteLookup); |
|
382 } |
|
383 CFSEmailUiActionMenu::AddCustomItemsL( itemList ); |
|
384 itemList.Close(); |
|
385 |
|
386 // <cmail> Touch |
|
387 TActionMenuCustomItemId itemId = CFSEmailUiActionMenu::ExecuteL( EFscCustom, 0, this ); |
|
388 // </cmail> |
|
389 |
|
390 HandleActionMenuCommandL( itemId ); |
|
391 } |
|
392 |
|
393 void CFSEmailUiMsgDetailsVisualiser::HandleActionMenuCommandL( TActionMenuCustomItemId itemId ) |
|
394 { |
|
395 FUNC_LOG; |
|
396 switch( itemId ) |
|
397 { |
|
398 case FsEActionMenuCall: |
|
399 { |
|
400 CallToFocusedItemL(); |
|
401 } |
|
402 break; |
|
403 // <cmail> video call |
|
404 case FsEActionMenuCallVideo: // Video Call |
|
405 { |
|
406 iVideoCall = ETrue; |
|
407 CallToFocusedItemL(); |
|
408 } |
|
409 break; |
|
410 // </cmail> |
|
411 case FsEActionMenuCreateMessage: |
|
412 { |
|
413 CreateMessageToFocusedItemL(); |
|
414 } |
|
415 break; |
|
416 |
|
417 case FsEActionMenuContactDetails: |
|
418 { |
|
419 ShowContactDetailsForFocusedItemL(); |
|
420 } |
|
421 break; |
|
422 |
|
423 case FsEActionMenuAddToContacts: |
|
424 { |
|
425 AddFocusedItemToContactsL(); |
|
426 } |
|
427 break; |
|
428 |
|
429 case FsEActionMenuRemoteLookup: |
|
430 { |
|
431 LaunchRemoteLookupForFocusedItemL(); |
|
432 } |
|
433 break; |
|
434 } |
|
435 } |
|
436 |
|
437 |
|
438 // ----------------------------------------------------------------------------- |
|
439 // CFSEmailUiMsgDetailsVisualiser::GetEmailAddressForFocusedItem |
|
440 // Returns email address of the focused list item. NULL returned if not found. |
|
441 // ----------------------------------------------------------------------------- |
|
442 CFSMailAddress* CFSEmailUiMsgDetailsVisualiser::GetEmailAddressForFocusedItem() const |
|
443 { |
|
444 FUNC_LOG; |
|
445 CFSMailAddress* foundEmailAddress = NULL; |
|
446 CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() ); |
|
447 if( item ) |
|
448 { |
|
449 foundEmailAddress = item->iMailAddress; |
|
450 } |
|
451 return foundEmailAddress; |
|
452 } |
|
453 |
|
454 // ----------------------------------------------------------------------------- |
|
455 // CFSEmailUiMsgDetailsVisualiser::GetEmailAddressForFocusedItem |
|
456 // Returns email address of the focused list item. NULL returned if not found. |
|
457 // ----------------------------------------------------------------------------- |
|
458 TDesC* CFSEmailUiMsgDetailsVisualiser::GetEmailAddressForFocusedItemAsTDes() const |
|
459 { |
|
460 FUNC_LOG; |
|
461 TDesC* foundEmailAddress = NULL; |
|
462 CFSMailAddress* address = GetEmailAddressForFocusedItem(); |
|
463 if( address ) |
|
464 { |
|
465 foundEmailAddress = &address->GetEmailAddress(); |
|
466 } |
|
467 return foundEmailAddress; |
|
468 } |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // CFSEmailUiMsgDetailsVisualiser::SendEmailToFocusedItemL |
|
472 // |
|
473 // Open composer and set the focused item as recipient, if valid email address |
|
474 // is available. Return ETrue if valid email address was found, EFalse if not. |
|
475 // ----------------------------------------------------------------------------- |
|
476 TBool CFSEmailUiMsgDetailsVisualiser::SendEmailToFocusedItemL() const |
|
477 { |
|
478 FUNC_LOG; |
|
479 TBool addrFound = EFalse; |
|
480 CFSMailAddress* address = GetEmailAddressForFocusedItem(); |
|
481 if( address ) |
|
482 { |
|
483 iAppUi.LaunchEditorL( address ); |
|
484 addrFound = ETrue; |
|
485 } |
|
486 return addrFound; |
|
487 } |
|
488 |
|
489 // ----------------------------------------------------------------------------- |
|
490 // CFSEmailUiMsgDetailsVisualiser::CallToFocusedItemL |
|
491 // ----------------------------------------------------------------------------- |
|
492 void CFSEmailUiMsgDetailsVisualiser::CallToFocusedItemL() |
|
493 { |
|
494 FUNC_LOG; |
|
495 TDesC* email = GetEmailAddressForFocusedItemAsTDes(); |
|
496 if( email ) |
|
497 { |
|
498 CFSMailClient* mailClient = iAppUi.GetMailClient(); |
|
499 CFSMailBox* mailBox = mailClient->GetMailBoxByUidL( iViewedMsg->GetMailBoxId() ); |
|
500 CleanupStack::PushL( mailBox ); |
|
501 |
|
502 // <cmail> video call |
|
503 if ( iVideoCall ) |
|
504 { |
|
505 iVideoCall = EFalse; |
|
506 CFsDelayedLoader::InstanceL()->GetContactHandlerL()->SetVideoCall( ETrue ); |
|
507 } |
|
508 // </cmail> |
|
509 |
|
510 CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCallToContactByEmailL( *email, |
|
511 iAppUi.GetActiveMailbox(), this, EFalse ); |
|
512 |
|
513 CleanupStack::PopAndDestroy( mailBox ); |
|
514 } |
|
515 } |
|
516 |
|
517 // ----------------------------------------------------------------------------- |
|
518 // CFSEmailUiMsgDetailsVisualiser::CreateMessageToFocusedItemL |
|
519 // ----------------------------------------------------------------------------- |
|
520 void CFSEmailUiMsgDetailsVisualiser::CreateMessageToFocusedItemL() const |
|
521 { |
|
522 FUNC_LOG; |
|
523 TDesC* email = GetEmailAddressForFocusedItemAsTDes(); |
|
524 if( email ) |
|
525 { |
|
526 CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCreateMsgToContactByEmailL( *email, iAppUi.GetActiveMailbox() ); |
|
527 } |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CFSEmailUiMsgDetailsVisualiser::LaunchRemoteLookupForFocusedItemL |
|
532 // ----------------------------------------------------------------------------- |
|
533 void CFSEmailUiMsgDetailsVisualiser::LaunchRemoteLookupForFocusedItemL() const |
|
534 { |
|
535 FUNC_LOG; |
|
536 CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() ); |
|
537 if( !item ) |
|
538 { |
|
539 return; |
|
540 } |
|
541 CFSMailAddress* address = item->iMailAddress; |
|
542 if( !address ) |
|
543 { |
|
544 return; |
|
545 } |
|
546 TDesC* queryString = &address->GetEmailAddress(); |
|
547 if( !queryString ) |
|
548 { |
|
549 queryString = &address->GetDisplayName(); |
|
550 if( !queryString ) |
|
551 { |
|
552 return; |
|
553 } |
|
554 } |
|
555 |
|
556 // this method assumes that remote lookup is available with current plugin. |
|
557 CFSMailClient* mailClient = iAppUi.GetMailClient(); |
|
558 CFSMailBox* mailBox = mailClient->GetMailBoxByUidL( iViewedMsg->GetMailBoxId() ); |
|
559 CleanupStack::PushL( mailBox ); |
|
560 |
|
561 CFsDelayedLoader::InstanceL()->GetContactHandlerL()->LaunchRemoteLookupWithQueryL( *mailBox, *queryString ); |
|
562 |
|
563 CleanupStack::PopAndDestroy( mailBox ); |
|
564 } |
|
565 |
|
566 // ----------------------------------------------------------------------------- |
|
567 // CFSEmailUiMsgDetailsVisualiser::AddFocusedItemToContactsL |
|
568 // ----------------------------------------------------------------------------- |
|
569 void CFSEmailUiMsgDetailsVisualiser::AddFocusedItemToContactsL() const |
|
570 { |
|
571 FUNC_LOG; |
|
572 TDesC* email = GetEmailAddressForFocusedItemAsTDes(); |
|
573 if( email ) |
|
574 { |
|
575 TAddToContactsType aType; |
|
576 //Query to "update existing" or "Create new" --> EFALSE = user choosed "cancel" |
|
577 if ( CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddtoContactsQueryL( aType ) ) |
|
578 { |
|
579 CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddToContactL( |
|
580 *email, EContactUpdateEmail, aType ); |
|
581 } |
|
582 } |
|
583 } |
|
584 |
|
585 // ----------------------------------------------------------------------------- |
|
586 // CFSEmailUiMsgDetailsVisualiser::ShowContactDetailsForFocusedItemL |
|
587 // ----------------------------------------------------------------------------- |
|
588 void CFSEmailUiMsgDetailsVisualiser::ShowContactDetailsForFocusedItemL() const |
|
589 { |
|
590 FUNC_LOG; |
|
591 TDesC* email = GetEmailAddressForFocusedItemAsTDes(); |
|
592 if( email ) |
|
593 { |
|
594 CFsDelayedLoader::InstanceL()->GetContactHandlerL()->ShowContactDetailsL( |
|
595 *email, EContactUpdateEmail, NULL ); |
|
596 } |
|
597 } |
|
598 |
|
599 // ----------------------------------------------------------------------------- |
|
600 // CFSEmailUiMsgDetailsVisualiser::CopyFocusedItemToClipboardL |
|
601 // ----------------------------------------------------------------------------- |
|
602 void CFSEmailUiMsgDetailsVisualiser::CopyFocusedItemToClipboardL() const |
|
603 { |
|
604 FUNC_LOG; |
|
605 CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() ); |
|
606 if (item) |
|
607 { |
|
608 CFSMailAddress* address = item->iMailAddress; |
|
609 TDesC* text = item->iText; |
|
610 if ( address ) |
|
611 { |
|
612 TDesC* clipBoardText = &address->GetEmailAddress(); |
|
613 if( !clipBoardText || |
|
614 (clipBoardText && clipBoardText->Length() == 0) ) |
|
615 { |
|
616 clipBoardText = &address->GetDisplayName(); |
|
617 if( !clipBoardText ) |
|
618 { |
|
619 return; |
|
620 } |
|
621 } |
|
622 TFsEmailUiUtility::CopyToClipboardL( *clipBoardText ); |
|
623 } |
|
624 else if( text ) |
|
625 { |
|
626 TFsEmailUiUtility::CopyToClipboardL( *text ); |
|
627 } |
|
628 } |
|
629 } |
|
630 |
|
631 // ----------------------------------------------------------------------------- |
|
632 // Action menu is available for items that has iMailAddress set in model. |
|
633 // ----------------------------------------------------------------------------- |
|
634 TBool CFSEmailUiMsgDetailsVisualiser::HasFocusedItemActionMenu() const |
|
635 { |
|
636 FUNC_LOG; |
|
637 CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() ); |
|
638 if( item && item->iMailAddress ) |
|
639 { |
|
640 const TDesC* displayName = &item->iMailAddress->GetDisplayName(); |
|
641 const TDesC* emailAddress = &item->iMailAddress->GetEmailAddress(); |
|
642 |
|
643 if ( (displayName && displayName->Length()) || |
|
644 (emailAddress && emailAddress->Length()) ) |
|
645 { |
|
646 return ETrue; |
|
647 } |
|
648 } |
|
649 return EFalse; |
|
650 } |
|
651 |
|
652 void CFSEmailUiMsgDetailsVisualiser::SetMskL() |
|
653 { |
|
654 FUNC_LOG; |
|
655 if ( iFirstStartCompleted ) // Safety |
|
656 { |
|
657 TFsTreeItemId curId = iTreeList->FocusedItem(); |
|
658 |
|
659 if ( iTreeList->IsNode( curId ) ) |
|
660 { |
|
661 if ( iTreeList->IsExpanded( curId ) ) |
|
662 { |
|
663 ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE ); |
|
664 } |
|
665 else |
|
666 { |
|
667 ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND ); |
|
668 } |
|
669 } |
|
670 else // non-node item |
|
671 { |
|
672 if( GetEmailAddressForFocusedItem() ) |
|
673 { |
|
674 ChangeMskCommandL( R_FSE_QTN_MSK_COMPOSE ); |
|
675 } |
|
676 else |
|
677 { |
|
678 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
|
679 } |
|
680 } |
|
681 } |
|
682 } |
|
683 |
|
684 TBool CFSEmailUiMsgDetailsVisualiser::OfferEventL(const TAlfEvent& aEvent) |
|
685 { |
|
686 FUNC_LOG; |
|
687 TBool result = EFalse; |
|
688 SetMskL(); |
|
689 if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey ) |
|
690 { |
|
691 TInt scanCode = aEvent.KeyEvent().iScanCode; |
|
692 // Swap right and left controls in mirrored layout |
|
693 if ( AknLayoutUtils::LayoutMirrored() ) |
|
694 { |
|
695 if (scanCode == EStdKeyRightArrow) scanCode = EStdKeyLeftArrow; |
|
696 else if (scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow; |
|
697 } |
|
698 |
|
699 switch ( scanCode ) |
|
700 { |
|
701 case EStdKeyDevice3: // CENTER CLICK |
|
702 case EStdKeyEnter: // ENTER |
|
703 { |
|
704 // Send email to focused item. Set the event as consumed if |
|
705 // valid email address was found and composer was opened with |
|
706 // that email address as recipent. If email address was not |
|
707 // found, offer the event to list by not consuming it. |
|
708 result = SendEmailToFocusedItemL(); |
|
709 } |
|
710 break; |
|
711 |
|
712 case EStdKeyYes: |
|
713 { |
|
714 CallToFocusedItemL(); |
|
715 result = ETrue; |
|
716 } |
|
717 break; |
|
718 |
|
719 case EStdKeyRightArrow: |
|
720 { |
|
721 // Show action toolbar if the item has action menu. |
|
722 if( HasFocusedItemActionMenu() ) |
|
723 { |
|
724 LaunchActionMenuL(); |
|
725 result = ETrue; |
|
726 } |
|
727 else |
|
728 { |
|
729 result = EFalse; |
|
730 } |
|
731 } |
|
732 break; |
|
733 |
|
734 default: |
|
735 // Check keyboard shortcuts. |
|
736 TInt shortcutCommand = |
|
737 iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(), |
|
738 CFSEmailUiShortcutBinding::EContextMailDetails ); |
|
739 if ( shortcutCommand != KErrNotFound ) |
|
740 { |
|
741 HandleCommandL( shortcutCommand ); |
|
742 result = ETrue; |
|
743 } |
|
744 break; |
|
745 } |
|
746 } |
|
747 else if (aEvent.IsPointerEvent()) |
|
748 { |
|
749 result = iTreeList->TreeControl()->OfferEventL(aEvent); |
|
750 } |
|
751 |
|
752 return result; |
|
753 } |
|
754 |
|
755 // --------------------------------------------------------------------------- |
|
756 // From MFSEmailUiContactHandlerObserver |
|
757 // The ownership of the CLS items in the contacts array is transferred to the |
|
758 // observer, and they must be deleted by the observer. |
|
759 // --------------------------------------------------------------------------- |
|
760 // |
|
761 void CFSEmailUiMsgDetailsVisualiser::OperationCompleteL( |
|
762 TContactHandlerCmd /*aCmd*/, const RPointerArray<CFSEmailUiClsItem>& /*aContacts*/ ) |
|
763 { |
|
764 FUNC_LOG; |
|
765 } |
|
766 |
|
767 // --------------------------------------------------------------------------- |
|
768 // From MFSEmailUiContactHandlerObserver |
|
769 // Handles error in contact handler operation. |
|
770 // --------------------------------------------------------------------------- |
|
771 // |
|
772 void CFSEmailUiMsgDetailsVisualiser::OperationErrorL( TContactHandlerCmd /*aCmd*/, |
|
773 TInt /*aError*/ ) |
|
774 { |
|
775 FUNC_LOG; |
|
776 } |
|
777 |
|
778 void CFSEmailUiMsgDetailsVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
779 { |
|
780 FUNC_LOG; |
|
781 |
|
782 if ( aResourceId == R_FSEMAILUI_MAILDETAILS_MENUPANE ) |
|
783 { |
|
784 if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) ) |
|
785 { |
|
786 // remove help support in pf5250 |
|
787 aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
|
788 } |
|
789 |
|
790 // Hide "actions" option if currently focused item doesn't have action menu |
|
791 aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, !HasFocusedItemActionMenu() ); |
|
792 // Hide "copy to clipboard" option if there is nothing to copy on the focused row |
|
793 CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() ); |
|
794 if ( !item ) |
|
795 { |
|
796 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCopyToClipboard, ETrue ); |
|
797 } |
|
798 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCollapseAll, AllNodesCollapsed() ); |
|
799 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsExpandAll, AllNodesExpanded() ); |
|
800 } |
|
801 |
|
802 if ( aResourceId == R_FSEMAILUI_MAILDETAILS_SUBMENU_ACTIONS ) |
|
803 { |
|
804 TInt pos( 0 ); |
|
805 if ( !iRCLSupported && aMenuPane->MenuItemExists( EFsEmailUiCmdActionsRemoteLookup ,pos) ) |
|
806 { |
|
807 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsRemoteLookup, ETrue ); |
|
808 } |
|
809 } |
|
810 |
|
811 // Add shortcut hints |
|
812 iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, |
|
813 CFSEmailUiShortcutBinding::EContextMailDetails ); |
|
814 } |
|
815 |
|
816 void CFSEmailUiMsgDetailsVisualiser::HandleCommandL( TInt aCommand ) |
|
817 { |
|
818 FUNC_LOG; |
|
819 switch(aCommand) |
|
820 { |
|
821 case EAknSoftkeyBack: |
|
822 { |
|
823 if ( !iAppUi.ViewSwitchingOngoing() ) |
|
824 { |
|
825 ChangeTitleBarTextL( EFalse ); |
|
826 iAppUi.ReturnToPreviousViewL(); |
|
827 } |
|
828 } |
|
829 break; |
|
830 |
|
831 case EFsEmailUiCmdActionsCopyToClipboard: |
|
832 { |
|
833 CopyFocusedItemToClipboardL(); |
|
834 } |
|
835 break; |
|
836 case EFsEmailUiCmdCollapse: |
|
837 { |
|
838 TFsTreeItemId focId1 = iTreeList->FocusedItem(); |
|
839 iTreeList->CollapseNodeL(focId1); |
|
840 ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND); |
|
841 } |
|
842 break; |
|
843 |
|
844 case EFsEmailUiCmdExpand: |
|
845 { |
|
846 TFsTreeItemId focId2 = iTreeList->FocusedItem(); |
|
847 iTreeList->ExpandNodeL(focId2); |
|
848 ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE); |
|
849 } |
|
850 break; |
|
851 // Options menu commands |
|
852 case EFsEmailUiCmdActionsCollapseAll: |
|
853 { |
|
854 TFsTreeItemId prevId = iTreeList->FocusedItem(); |
|
855 prevId = GetRootParent( prevId ); |
|
856 iTreeVisualizer->CollapseAllL(); |
|
857 if ( prevId != KFsTreeRootID && prevId != KFsTreeNoneID ) |
|
858 { |
|
859 iTreeVisualizer->SetFocusedItemL( prevId ); |
|
860 } |
|
861 } |
|
862 break; |
|
863 |
|
864 case EFsEmailUiCmdActionsExpandAll: |
|
865 { |
|
866 TFsTreeItemId prevId = iTreeList->FocusedItem(); |
|
867 iTreeVisualizer->ExpandAllL(); |
|
868 if ( prevId != KFsTreeRootID && prevId != KFsTreeNoneID ) |
|
869 { |
|
870 iTreeVisualizer->SetFocusedItemL( prevId ); |
|
871 } |
|
872 } |
|
873 break; |
|
874 |
|
875 case EFsEmailUiCmdActionsCall: |
|
876 { |
|
877 CallToFocusedItemL(); |
|
878 } |
|
879 break; |
|
880 // <cmail> video call |
|
881 case EFsEmailUiCmdActionsCallVideo: |
|
882 { |
|
883 iVideoCall = ETrue; |
|
884 CallToFocusedItemL(); |
|
885 } |
|
886 break; |
|
887 // </cmail> |
|
888 case EFsEmailUiCmdActionsCreateMessage: |
|
889 { |
|
890 CreateMessageToFocusedItemL(); |
|
891 } |
|
892 break; |
|
893 |
|
894 case EFsEmailUiCmdComposeTo: |
|
895 { |
|
896 SendEmailToFocusedItemL(); |
|
897 } |
|
898 break; |
|
899 |
|
900 case EFsEmailUiCmdActionsContactDetails: |
|
901 { |
|
902 ShowContactDetailsForFocusedItemL(); |
|
903 } |
|
904 break; |
|
905 |
|
906 case EFsEmailUiCmdActionsAddContact: |
|
907 { |
|
908 AddFocusedItemToContactsL(); |
|
909 } |
|
910 break; |
|
911 |
|
912 case EFsEmailUiCmdActionsRemoteLookup: |
|
913 { |
|
914 LaunchRemoteLookupForFocusedItemL(); |
|
915 } |
|
916 break; |
|
917 |
|
918 case EFsEmailUiCmdHelp: |
|
919 { |
|
920 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
|
921 } |
|
922 break; |
|
923 |
|
924 case EFsEmailUiCmdExit: |
|
925 { |
|
926 //<cmail> |
|
927 iTreeList->SetFocusedL(EFalse); |
|
928 //</cmail> |
|
929 iAppUi.Exit(); |
|
930 } |
|
931 break; |
|
932 |
|
933 case EFsEmailUiCmdActionsCollapseExpandAllToggle: |
|
934 { |
|
935 ShortcutCollapseExpandAllToggleL(); |
|
936 } |
|
937 break; |
|
938 |
|
939 case EFsEmailUiCmdGoToTop: |
|
940 { |
|
941 GoToTopL(); |
|
942 } |
|
943 break; |
|
944 |
|
945 case EFsEmailUiCmdGoToBottom: |
|
946 { |
|
947 GoToBottomL(); |
|
948 } |
|
949 break; |
|
950 |
|
951 case EFsEmailUiCmdPageUp: |
|
952 { |
|
953 TKeyEvent simEvent = { EKeyPageUp, EStdKeyPageUp, 0, 0 }; |
|
954 iCoeEnv->SimulateKeyEventL( simEvent, EEventKey ); |
|
955 } |
|
956 break; |
|
957 |
|
958 case EFsEmailUiCmdPageDown: |
|
959 { |
|
960 TKeyEvent simEvent = { EKeyPageDown, EStdKeyPageDown, 0, 0 }; |
|
961 iCoeEnv->SimulateKeyEventL( simEvent, EEventKey ); |
|
962 } |
|
963 break; |
|
964 |
|
965 default: |
|
966 break; |
|
967 } |
|
968 } |
|
969 |
|
970 |
|
971 void CFSEmailUiMsgDetailsVisualiser::ClearMsgDetailsModelL() |
|
972 { |
|
973 FUNC_LOG; |
|
974 iTreeList->RemoveAllL(); |
|
975 iModel->RemoveAll(); |
|
976 |
|
977 iNodeIds.Reset(); |
|
978 iToNodeId = iCcNodeId = iBccNodeId = KFsTreeNoneID; |
|
979 } |
|
980 |
|
981 void CFSEmailUiMsgDetailsVisualiser::UpdateMsgDetailsModelL() |
|
982 { |
|
983 FUNC_LOG; |
|
984 // If there are lots of items under some node, then the list drawing |
|
985 // might become very slow because of scroll bar updating. So we deny |
|
986 // the list refresh during the construction. List refresh is still |
|
987 // allowed in case of node insert, as there aren't that many nodes, |
|
988 // and it will keep the scroll bar roughly in the map. |
|
989 iAllowListRefreshInInsert = ETrue; |
|
990 iExpandAndHighlightNextNode = EFalse; |
|
991 |
|
992 // Append lines to the model |
|
993 AppendFromLinesL(); |
|
994 AppendSubjectLinesL(); |
|
995 |
|
996 if( iExpandCollapseMode == ECollapseAllExceptTo ) |
|
997 { |
|
998 iExpandAndHighlightNextNode = ETrue; |
|
999 } |
|
1000 AppendToLinesL(); |
|
1001 |
|
1002 if( iExpandCollapseMode == ECollapseAllExceptCc ) |
|
1003 { |
|
1004 iExpandAndHighlightNextNode = ETrue; |
|
1005 } |
|
1006 AppendCcLinesL(); |
|
1007 |
|
1008 if( iExpandCollapseMode == ECollapseAllExceptBcc ) |
|
1009 { |
|
1010 iExpandAndHighlightNextNode = ETrue; |
|
1011 } |
|
1012 AppendBccLinesL(); |
|
1013 AppendSizeLinesL(); |
|
1014 AppendSentLinesL(); |
|
1015 AppendPriorityLinesL(); |
|
1016 // Allow list (scroll bar) refresh for last item(s) |
|
1017 //iAllowListRefreshInInsert = ETrue; |
|
1018 AppendMessageTypeLinesL(); |
|
1019 } |
|
1020 |
|
1021 void CFSEmailUiMsgDetailsVisualiser::CreateOneLinePlainItemLC2( const TDesC& aItemDataBuff, |
|
1022 CFsTreePlainOneLineItemData* &aItemData, |
|
1023 CFsTreePlainOneLineItemVisualizer* &aItemVisualizer ) |
|
1024 { |
|
1025 FUNC_LOG; |
|
1026 aItemData = CFsTreePlainOneLineItemData::NewL(); |
|
1027 CleanupStack::PushL( aItemData ); |
|
1028 aItemData->SetDataL( aItemDataBuff ); |
|
1029 |
|
1030 aItemVisualizer = CFsTreePlainOneLineItemVisualizer::NewL(*iTreeList->TreeControl()); |
|
1031 CleanupStack::PushL( aItemVisualizer ); |
|
1032 aItemVisualizer->SetExtendable( EFalse ); // One line items are obviously not extendable |
|
1033 |
|
1034 SetItemVisualizerCommonProperties( *aItemVisualizer ); |
|
1035 } |
|
1036 |
|
1037 void CFSEmailUiMsgDetailsVisualiser::CreateTwoLinePlainItemLC2( const TDesC& aPrimaryDataBuff, |
|
1038 const TDesC& aSecondaryDataBuff, |
|
1039 CFsTreePlainTwoLineItemData* &aItemData, |
|
1040 CFsTreePlainTwoLineItemVisualizer* &aItemVisualizer ) |
|
1041 { |
|
1042 FUNC_LOG; |
|
1043 aItemData = CFsTreePlainTwoLineItemData::NewL(); |
|
1044 CleanupStack::PushL( aItemData ); |
|
1045 aItemData->SetDataL( aPrimaryDataBuff ); |
|
1046 aItemData->SetSecondaryDataL( aSecondaryDataBuff ); |
|
1047 |
|
1048 aItemVisualizer = CFsTreePlainTwoLineItemVisualizer::NewL(*iTreeList->TreeControl()); |
|
1049 CleanupStack::PushL( aItemVisualizer ); |
|
1050 aItemVisualizer->SetExtendable( ETrue ); // All two line items are extendable |
|
1051 aItemVisualizer->SetMenu( NULL ); |
|
1052 |
|
1053 SetItemVisualizerCommonProperties( *aItemVisualizer ); |
|
1054 } |
|
1055 |
|
1056 void CFSEmailUiMsgDetailsVisualiser::SetItemVisualizerCommonProperties( MFsTreeItemVisualizer& aItemVisualizer ) |
|
1057 { |
|
1058 FUNC_LOG; |
|
1059 aItemVisualizer.SetSize(TSize(iScreenRect.Width(), iListItemHeight)); |
|
1060 aItemVisualizer.SetExtendedSize(TSize(iScreenRect.Width(), 2*iListItemHeight)); |
|
1061 |
|
1062 // Set correct skin text colors for the list items |
|
1063 TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
|
1064 TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
|
1065 aItemVisualizer.SetFocusedStateTextColor( focusedColor ); |
|
1066 aItemVisualizer.SetNormalStateTextColor( normalColor ); |
|
1067 |
|
1068 // Set font size |
|
1069 aItemVisualizer.SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
|
1070 } |
|
1071 |
|
1072 void CFSEmailUiMsgDetailsVisualiser::CreatePlainNodeLC2( const TDesC& aItemDataBuff, |
|
1073 CFsTreePlainOneLineNodeData* &aItemData, |
|
1074 CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) |
|
1075 { |
|
1076 FUNC_LOG; |
|
1077 aItemData = CFsTreePlainOneLineNodeData::NewL(); |
|
1078 CleanupStack::PushL( aItemData ); |
|
1079 |
|
1080 aItemData->SetDataL( aItemDataBuff ); |
|
1081 aItemData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeExpanded ) ); |
|
1082 aItemData->SetIconCollapsed( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeCollapsed ) ); |
|
1083 |
|
1084 aNodeVisualizer = CFsTreePlainOneLineNodeVisualizer::NewL(*iTreeList->TreeControl()); |
|
1085 CleanupStack::PushL( aNodeVisualizer ); |
|
1086 |
|
1087 SetNodeVisualizerProperties( *aNodeVisualizer ); |
|
1088 |
|
1089 // Gradient background for headings |
|
1090 CAlfBrush *titleDividerBgBrush = iAppUi.FsTextureManager()->TitleDividerBgBrushL(); |
|
1091 aNodeVisualizer->SetBackgroundBrush( titleDividerBgBrush ); |
|
1092 } |
|
1093 |
|
1094 void CFSEmailUiMsgDetailsVisualiser::SetNodeVisualizerProperties( MFsTreeItemVisualizer& aNodeVisualizer ) |
|
1095 { |
|
1096 FUNC_LOG; |
|
1097 aNodeVisualizer.SetSize(TSize(iScreenRect.Width(), iListNodeHeight)); |
|
1098 |
|
1099 // Set correct skin text colors for the list items |
|
1100 TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
|
1101 TRgb normalColor = iAppUi.LayoutHandler()->ListNodeTextColor(); |
|
1102 aNodeVisualizer.SetFocusedStateTextColor( focusedColor ); |
|
1103 aNodeVisualizer.SetNormalStateTextColor( normalColor ); |
|
1104 |
|
1105 // Set font size |
|
1106 aNodeVisualizer.SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
|
1107 // Set node bolded |
|
1108 aNodeVisualizer.SetTextBold( ETrue ); |
|
1109 |
|
1110 // Temporary fix for EASV-7GJFVD |
|
1111 //aNodeVisualizer.SetBackgroundColorL( iAppUi.LayoutHandler()->ListNodeBackgroundColor() ); |
|
1112 |
|
1113 } |
|
1114 |
|
1115 TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::AppendHeadingToListL( TInt aResourceId ) |
|
1116 { |
|
1117 FUNC_LOG; |
|
1118 CFsTreePlainOneLineNodeData* plainNodeData; |
|
1119 CFsTreePlainOneLineNodeVisualizer* plainNodeVisualizer; |
|
1120 |
|
1121 HBufC* headingText = StringLoader::LoadLC( aResourceId ); |
|
1122 |
|
1123 CreatePlainNodeLC2( *headingText, plainNodeData, plainNodeVisualizer ); |
|
1124 |
|
1125 TFsTreeItemId nodeId = iTreeList->InsertNodeL( *plainNodeData, *plainNodeVisualizer, KFsTreeRootID); |
|
1126 CleanupStack::Pop( 2 ); // plainNodeData & plainNodeVisualizer |
|
1127 |
|
1128 // Set the node expanded/collapsed according to the member variables |
|
1129 if( nodeId != KFsTreeNoneID ) // Safety check |
|
1130 { |
|
1131 if( iExpandCollapseMode == EExpandAll ) |
|
1132 { |
|
1133 // The "normal" case, expand all and keep the first one highlighted |
|
1134 iTreeList->ExpandNodeL( nodeId ); |
|
1135 } |
|
1136 else if( iExpandAndHighlightNextNode ) |
|
1137 { |
|
1138 // View opened to To, Cc or Bcc field and we just added the |
|
1139 // corresponding node, so expand and focus it |
|
1140 iTreeList->ExpandNodeL( nodeId ); |
|
1141 iTreeVisualizer->SetFocusedItemL( nodeId ); |
|
1142 } |
|
1143 else |
|
1144 { |
|
1145 // View opened to To, Cc or Bcc field but we added some other |
|
1146 // node, so collapse it |
|
1147 iTreeList->CollapseNodeL( nodeId ); |
|
1148 } |
|
1149 } |
|
1150 // Reset the node expanding and highlighting flag |
|
1151 iExpandAndHighlightNextNode = EFalse; |
|
1152 |
|
1153 CleanupStack::PopAndDestroy(headingText); |
|
1154 |
|
1155 return nodeId; |
|
1156 } |
|
1157 |
|
1158 TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::AppendOneLineItemToListL( const TDesC& aItemData, TFsTreeItemId aParentNode ) |
|
1159 { |
|
1160 FUNC_LOG; |
|
1161 CFsTreePlainOneLineItemData* plainItemData; |
|
1162 CFsTreePlainOneLineItemVisualizer* plainItemVisualizer; |
|
1163 |
|
1164 CreateOneLinePlainItemLC2( aItemData, plainItemData, plainItemVisualizer ); |
|
1165 |
|
1166 TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, iAllowListRefreshInInsert ); |
|
1167 CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer |
|
1168 |
|
1169 return itemId; |
|
1170 } |
|
1171 |
|
1172 TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::AppendTwoLineItemToListL( const TDesC& aPrimaryDataBuff, |
|
1173 const TDesC& aSecondaryDataBuff, |
|
1174 TFsTreeItemId aParentNode, |
|
1175 TBool aItemHasActionMenu /*= EFalse*/ ) |
|
1176 { |
|
1177 FUNC_LOG; |
|
1178 CFsTreePlainTwoLineItemData* plainItemData; |
|
1179 CFsTreePlainTwoLineItemVisualizer* plainItemVisualizer; |
|
1180 |
|
1181 CreateTwoLinePlainItemLC2( aPrimaryDataBuff, aSecondaryDataBuff, plainItemData, plainItemVisualizer ); |
|
1182 |
|
1183 if ( aItemHasActionMenu ) |
|
1184 { |
|
1185 plainItemVisualizer->SetFlags( plainItemVisualizer->Flags() | KFsTreeListItemHasMenu ); |
|
1186 } |
|
1187 |
|
1188 plainItemVisualizer->SetFlags(plainItemVisualizer->Flags() & ~KFsTreeListItemManagedLayout); |
|
1189 |
|
1190 TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, iAllowListRefreshInInsert ); |
|
1191 CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer |
|
1192 |
|
1193 return itemId; |
|
1194 } |
|
1195 |
|
1196 TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::AppendDateTimeItemToListL( const TDesC& aPrimaryDataBuff, |
|
1197 const TDesC& aSecondaryDataBuff, |
|
1198 const TDesC& aDateTimeDataBuff, |
|
1199 TFsTreeItemId aParentNode ) |
|
1200 { |
|
1201 FUNC_LOG; |
|
1202 CFsTreePlainTwoLineItemData* plainItemData; |
|
1203 CFsTreePlainTwoLineItemVisualizer* plainItemVisualizer; |
|
1204 |
|
1205 CreateTwoLinePlainItemLC2( aPrimaryDataBuff, aSecondaryDataBuff, plainItemData, plainItemVisualizer ); |
|
1206 |
|
1207 plainItemData->SetDateTimeDataL( aDateTimeDataBuff ); |
|
1208 plainItemVisualizer->SetExtendable( EFalse ); |
|
1209 |
|
1210 TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, iAllowListRefreshInInsert ); |
|
1211 CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer |
|
1212 |
|
1213 return itemId; |
|
1214 } |
|
1215 |
|
1216 TBool CFSEmailUiMsgDetailsVisualiser::GetDisplayNameAndEmailAddressL( CFSMailAddress* aAddressData, TDesC* &aDisplayName, TDesC* &aEmailAddress ) |
|
1217 { |
|
1218 FUNC_LOG; |
|
1219 aDisplayName = &aAddressData->GetDisplayName(); |
|
1220 aEmailAddress = &aAddressData->GetEmailAddress(); |
|
1221 TInt notFoundCount(0); |
|
1222 |
|
1223 // If display name is not set, then the plugins seem to set it to be same |
|
1224 // as email address. So there's no safe way to know wheter the display name |
|
1225 // is set or not. Best quess is that if display name is the same as email |
|
1226 // address, then there are no display name available. |
|
1227 if ( !aDisplayName || ( aDisplayName->Length() == 0 ) || ( *aDisplayName == *aEmailAddress ) ) |
|
1228 { |
|
1229 // Internal variable used to store the text to avoid problems with ownership handling |
|
1230 if( !iNoDisplayNameAvailableText ) |
|
1231 { |
|
1232 iNoDisplayNameAvailableText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_DISPLAY_NAME ); |
|
1233 } |
|
1234 |
|
1235 aDisplayName = iNoDisplayNameAvailableText; |
|
1236 notFoundCount++; |
|
1237 } |
|
1238 if ( !aEmailAddress || ( aEmailAddress->Length() == 0 ) ) |
|
1239 { |
|
1240 // Internal variable used to store the text to avoid problems with ownership handling |
|
1241 if( !iNoEmailAddressAvailableText ) |
|
1242 { |
|
1243 iNoEmailAddressAvailableText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_EMAIL_ADDRESS ); |
|
1244 } |
|
1245 |
|
1246 aEmailAddress = iNoEmailAddressAvailableText; |
|
1247 notFoundCount++; |
|
1248 } |
|
1249 |
|
1250 // If both display name and email address are empty, return EFalse |
|
1251 if( notFoundCount > 1 ) |
|
1252 { |
|
1253 return EFalse; |
|
1254 } |
|
1255 else |
|
1256 { |
|
1257 return ETrue; |
|
1258 } |
|
1259 } |
|
1260 |
|
1261 void CFSEmailUiMsgDetailsVisualiser::AppendFromLinesL() |
|
1262 { |
|
1263 FUNC_LOG; |
|
1264 TFsTreeItemId nodeId; |
|
1265 if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
1266 { |
|
1267 nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_ORGANIZER ); |
|
1268 } |
|
1269 else |
|
1270 { |
|
1271 nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_FROM ); |
|
1272 } |
|
1273 iNodeIds.Append( nodeId ); |
|
1274 |
|
1275 CFSMailAddress* fromAddress = iViewedMsg->GetSender(); |
|
1276 // If CFSMailAddress not available, show "No sender info available" |
|
1277 if( fromAddress == NULL ) |
|
1278 { |
|
1279 HBufC* noSender = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_SENDER_INFO_AVAILABLE ); |
|
1280 AppendOneLineItemToListL( *noSender, nodeId ); |
|
1281 CleanupStack::PopAndDestroy( noSender ); |
|
1282 } |
|
1283 else |
|
1284 { |
|
1285 TDesC* displayName( NULL ); |
|
1286 TDesC* emailAddress( NULL ); |
|
1287 if( GetDisplayNameAndEmailAddressL( fromAddress, displayName, emailAddress ) ) |
|
1288 { |
|
1289 TFsTreeItemId itemId = AppendTwoLineItemToListL( *displayName, *emailAddress, nodeId, ETrue ); |
|
1290 iModel->AppendL( itemId, fromAddress ); |
|
1291 } |
|
1292 else |
|
1293 { |
|
1294 HBufC* noSender = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_SENDER_INFO_AVAILABLE ); |
|
1295 AppendOneLineItemToListL( *noSender, nodeId ); |
|
1296 CleanupStack::PopAndDestroy( noSender ); |
|
1297 } |
|
1298 } |
|
1299 } |
|
1300 |
|
1301 void CFSEmailUiMsgDetailsVisualiser::AppendSubjectLinesL() |
|
1302 { |
|
1303 FUNC_LOG; |
|
1304 TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_SUBJECT ); |
|
1305 iNodeIds.Append( nodeId ); |
|
1306 |
|
1307 TDesC* subject = &iViewedMsg->GetSubject(); |
|
1308 if ( subject == NULL || subject->Length() <= 0 ) |
|
1309 { |
|
1310 HBufC* noSubject = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_SUBJECT ); |
|
1311 AppendOneLineItemToListL( *noSubject, nodeId ); |
|
1312 CleanupStack::PopAndDestroy( noSubject ); |
|
1313 } |
|
1314 else |
|
1315 { |
|
1316 HBufC* subjectText = TFsEmailUiUtility::CreateSubjectTextLC( iViewedMsg ); |
|
1317 TFsTreeItemId itemId = AppendOneLineItemToListL( *subjectText, nodeId ); |
|
1318 CleanupStack::PopAndDestroy( subjectText ); |
|
1319 iModel->AppendL( itemId, subject ); |
|
1320 } |
|
1321 } |
|
1322 |
|
1323 // Duplicate code in AppendToLinesL/AppendCcLinesL/AppendBccLinesL, create |
|
1324 // one generic function that can be used from all of these functions |
|
1325 void CFSEmailUiMsgDetailsVisualiser::AppendToLinesL() |
|
1326 { |
|
1327 FUNC_LOG; |
|
1328 if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
1329 { |
|
1330 iToNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_REQUIRED ); |
|
1331 } |
|
1332 else |
|
1333 { |
|
1334 iToNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_TO ); |
|
1335 } |
|
1336 iNodeIds.Append( iToNodeId ); |
|
1337 |
|
1338 RPointerArray<CFSMailAddress>& toArray = iViewedMsg->GetToRecipients(); |
|
1339 TInt toArrayCount = toArray.Count(); |
|
1340 if ( toArrayCount ) |
|
1341 { |
|
1342 for ( TInt i=0 ; i<toArrayCount ; i++ ) |
|
1343 { |
|
1344 CFSMailAddress* toAddress = toArray[i]; |
|
1345 if( toAddress ) |
|
1346 { |
|
1347 TDesC* displayName( NULL ); |
|
1348 TDesC* emailAddress( NULL ); |
|
1349 TBool toNameFound = GetDisplayNameAndEmailAddressL( toAddress, displayName, emailAddress ); |
|
1350 |
|
1351 TFsTreeItemId itemId = AppendTwoLineItemToListL( *displayName, *emailAddress, iToNodeId, toNameFound ); |
|
1352 iModel->AppendL( itemId, toAddress ); |
|
1353 } |
|
1354 } |
|
1355 } |
|
1356 else |
|
1357 { |
|
1358 //Laske To- ja Cc-vastaanottajat yhteensä ja näytä tämä vain jos kumpiakaan ei ole yhtään |
|
1359 HBufC* noToText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_VISIBLE_RECIPIENTS ); |
|
1360 AppendOneLineItemToListL( *noToText, iToNodeId ); |
|
1361 CleanupStack::PopAndDestroy( noToText ); |
|
1362 } |
|
1363 } |
|
1364 |
|
1365 void CFSEmailUiMsgDetailsVisualiser::AppendCcLinesL() |
|
1366 { |
|
1367 FUNC_LOG; |
|
1368 RPointerArray<CFSMailAddress>& ccArray = iViewedMsg->GetCCRecipients(); |
|
1369 TInt ccArrayCount = ccArray.Count(); |
|
1370 |
|
1371 if ( ccArrayCount ) |
|
1372 { |
|
1373 if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
1374 { |
|
1375 iCcNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_OPTIONAL ); |
|
1376 } |
|
1377 else |
|
1378 { |
|
1379 iCcNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_CC ); |
|
1380 } |
|
1381 iNodeIds.Append( iCcNodeId ); |
|
1382 |
|
1383 for ( TInt i=0 ; i<ccArrayCount ; i++ ) |
|
1384 { |
|
1385 CFSMailAddress* ccAddress = ccArray[i]; |
|
1386 if( ccAddress ) |
|
1387 { |
|
1388 TDesC* displayName( NULL ); |
|
1389 TDesC* emailAddress( NULL ); |
|
1390 TBool ccNameFound = GetDisplayNameAndEmailAddressL( ccAddress, displayName, emailAddress ); |
|
1391 |
|
1392 TFsTreeItemId itemId = AppendTwoLineItemToListL( *displayName, *emailAddress, iCcNodeId, ccNameFound ); |
|
1393 iModel->AppendL( itemId, ccAddress ); |
|
1394 } |
|
1395 } |
|
1396 } |
|
1397 } |
|
1398 |
|
1399 void CFSEmailUiMsgDetailsVisualiser::AppendBccLinesL() |
|
1400 { |
|
1401 FUNC_LOG; |
|
1402 // Get message's parent folder |
|
1403 TFSMailMsgId folderId = iViewedMsg->GetFolderId(); |
|
1404 TFSMailMsgId mailboxId = iViewedMsg->GetMailBoxId(); |
|
1405 CFSMailFolder* folder = iAppUi.GetMailClient()->GetFolderByUidL( mailboxId, folderId ); |
|
1406 |
|
1407 // Show bcc field only if message's parent folder is some outgoing folder, |
|
1408 // so basically outbox, drafts or sent items. |
|
1409 TBool showBcc( EFalse ); |
|
1410 if( folder ) |
|
1411 { |
|
1412 TInt folderType = folder->GetFolderType(); |
|
1413 |
|
1414 switch( folderType ) |
|
1415 { |
|
1416 case EFSOutbox: |
|
1417 case EFSDraftsFolder: |
|
1418 case EFSSentFolder: |
|
1419 { |
|
1420 showBcc = ETrue; |
|
1421 } |
|
1422 break; |
|
1423 |
|
1424 case EFSInbox: |
|
1425 case EFSDeleted: |
|
1426 default: |
|
1427 break; |
|
1428 } |
|
1429 } |
|
1430 delete folder; |
|
1431 |
|
1432 if( showBcc ) |
|
1433 { |
|
1434 RPointerArray<CFSMailAddress>& bccArray = iViewedMsg->GetBCCRecipients(); |
|
1435 TInt bccArrayCount = bccArray.Count(); |
|
1436 |
|
1437 if ( bccArrayCount ) |
|
1438 { |
|
1439 iBccNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_BCC ); |
|
1440 iNodeIds.Append( iBccNodeId ); |
|
1441 |
|
1442 for ( TInt i=0 ; i<bccArrayCount ; i++ ) |
|
1443 { |
|
1444 CFSMailAddress* bccAddress = bccArray[i]; |
|
1445 if( bccAddress ) |
|
1446 { |
|
1447 TDesC* displayName( NULL ); |
|
1448 TDesC* emailAddress( NULL ); |
|
1449 TBool bccNameFound = GetDisplayNameAndEmailAddressL( bccAddress, displayName, emailAddress ); |
|
1450 |
|
1451 TFsTreeItemId itemId = AppendTwoLineItemToListL( *displayName, *emailAddress, iBccNodeId, bccNameFound ); |
|
1452 iModel->AppendL( itemId, bccAddress ); |
|
1453 } |
|
1454 } |
|
1455 } |
|
1456 } |
|
1457 } |
|
1458 |
|
1459 void CFSEmailUiMsgDetailsVisualiser::AppendSizeLinesL() |
|
1460 { |
|
1461 FUNC_LOG; |
|
1462 TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_SIZE_HEADER ); |
|
1463 iNodeIds.Append( nodeId ); |
|
1464 |
|
1465 // Gets the full content size (in bytes) |
|
1466 TUint msgSize = iViewedMsg->ContentSize(); |
|
1467 |
|
1468 HBufC* sizeText = TFsEmailUiUtility::CreateSizeDescLC( msgSize, ETrue ); |
|
1469 |
|
1470 AppendOneLineItemToListL( *sizeText, nodeId ); |
|
1471 CleanupStack::PopAndDestroy( sizeText ); |
|
1472 } |
|
1473 |
|
1474 void CFSEmailUiMsgDetailsVisualiser::AppendSentLinesL() |
|
1475 { |
|
1476 FUNC_LOG; |
|
1477 TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_SENT ); |
|
1478 iNodeIds.Append( nodeId ); |
|
1479 |
|
1480 HBufC* dateFromMsg = TFsEmailUiUtility::DateTextFromMsgLC( iViewedMsg ); |
|
1481 HBufC* dateText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_DATE_U, *dateFromMsg ); |
|
1482 |
|
1483 AppendOneLineItemToListL( *dateText, nodeId ); |
|
1484 |
|
1485 CleanupStack::PopAndDestroy( dateText ); |
|
1486 CleanupStack::PopAndDestroy( dateFromMsg ); |
|
1487 |
|
1488 ////////////////////////// |
|
1489 HBufC* timeFromMsg = TFsEmailUiUtility::TimeTextFromMsgLC( iViewedMsg ); |
|
1490 HBufC* timeText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_TIME_U, *timeFromMsg ); |
|
1491 |
|
1492 AppendOneLineItemToListL( *timeText, nodeId ); |
|
1493 |
|
1494 CleanupStack::PopAndDestroy( timeText ); |
|
1495 CleanupStack::PopAndDestroy( timeFromMsg ); |
|
1496 } |
|
1497 |
|
1498 void CFSEmailUiMsgDetailsVisualiser::AppendPriorityLinesL() |
|
1499 { |
|
1500 FUNC_LOG; |
|
1501 TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_PRIORITY ); |
|
1502 iNodeIds.Append( nodeId ); |
|
1503 |
|
1504 HBufC* priorityText( NULL ); |
|
1505 if ( iViewedMsg->IsFlagSet( EFSMsgFlag_Important ) ) |
|
1506 { |
|
1507 priorityText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_PRIORITY_HIGH ); |
|
1508 } |
|
1509 else if ( iViewedMsg->IsFlagSet( EFSMsgFlag_Low ) ) |
|
1510 { |
|
1511 priorityText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_PRIORITY_LOW ); |
|
1512 } |
|
1513 else |
|
1514 { |
|
1515 priorityText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_PRIORITY_NORMAL ); |
|
1516 } |
|
1517 |
|
1518 CleanupStack::PushL( priorityText ); |
|
1519 AppendOneLineItemToListL( *priorityText, nodeId ); |
|
1520 CleanupStack::PopAndDestroy( priorityText ); |
|
1521 } |
|
1522 |
|
1523 void CFSEmailUiMsgDetailsVisualiser::AppendMessageTypeLinesL() |
|
1524 { |
|
1525 FUNC_LOG; |
|
1526 TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_MSG_TYPE ); |
|
1527 iNodeIds.Append( nodeId ); |
|
1528 |
|
1529 HBufC* msgType; |
|
1530 if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
1531 { |
|
1532 msgType = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_MSG_TYPE_MEETING ); |
|
1533 } |
|
1534 else |
|
1535 { |
|
1536 msgType = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_MSG_TYPE_EMAIL ); |
|
1537 } |
|
1538 |
|
1539 AppendOneLineItemToListL( *msgType, nodeId ); |
|
1540 CleanupStack::PopAndDestroy( msgType ); |
|
1541 } |
|
1542 |
|
1543 void CFSEmailUiMsgDetailsVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType /*aType*/ ) |
|
1544 { |
|
1545 FUNC_LOG; |
|
1546 if ( iFirstStartCompleted ) // Safety |
|
1547 { |
|
1548 iTreeList->HideListL(); |
|
1549 UpdateListSizeAttributes(); |
|
1550 iParentLayout->SetRect( iScreenRect ); |
|
1551 for ( TInt i = 0; i < iNodeIds.Count(); i++ ) |
|
1552 { |
|
1553 MFsTreeItemVisualizer& vis = iTreeList->ItemVisualizer( iNodeIds[i] ); |
|
1554 SetNodeVisualizerProperties( vis ); |
|
1555 SetChildVisualizersProperties( iNodeIds[i] ); |
|
1556 } |
|
1557 iTreeList->ShowListL(); |
|
1558 } |
|
1559 } |
|
1560 |
|
1561 // --------------------------------------------------------------------------- |
|
1562 // Sets tree item visualizer properties for all the childs of the given node |
|
1563 // --------------------------------------------------------------------------- |
|
1564 // |
|
1565 void CFSEmailUiMsgDetailsVisualiser::SetChildVisualizersProperties( TFsTreeItemId aNodeId ) |
|
1566 { |
|
1567 FUNC_LOG; |
|
1568 TUint childrenCount = iTreeList->CountChildren( aNodeId ); |
|
1569 for( TInt i = 0; i < childrenCount; ++i ) |
|
1570 { |
|
1571 TFsTreeItemId childId = iTreeList->Child( aNodeId, i ); |
|
1572 MFsTreeItemVisualizer& vis = iTreeList->ItemVisualizer( childId ); |
|
1573 SetItemVisualizerCommonProperties( vis ); |
|
1574 } |
|
1575 } |
|
1576 |
|
1577 // --------------------------------------------------------------------------- |
|
1578 // Update list size members variables |
|
1579 // --------------------------------------------------------------------------- |
|
1580 // |
|
1581 void CFSEmailUiMsgDetailsVisualiser::UpdateListSizeAttributes() |
|
1582 { |
|
1583 FUNC_LOG; |
|
1584 if ( iFirstStartCompleted ) // Safety |
|
1585 { |
|
1586 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, iScreenRect ); |
|
1587 iScreenRect.SetRect( 0, 0, iScreenRect.Width(), iScreenRect.Height() ); |
|
1588 |
|
1589 iListItemHeight = iAppUi.LayoutHandler()->OneLineListItemHeight(); |
|
1590 iListNodeHeight = iAppUi.LayoutHandler()->OneLineListNodeHeight(); |
|
1591 } |
|
1592 } |
|
1593 |
|
1594 // --------------------------------------------------------------------------- |
|
1595 // Collapse nodes except the specified one (used when starting the list in |
|
1596 // specific loaction) |
|
1597 // --------------------------------------------------------------------------- |
|
1598 // |
|
1599 void CFSEmailUiMsgDetailsVisualiser::CollapseNodesExceptL( TFsTreeItemId aExcludedNode ) |
|
1600 { |
|
1601 FUNC_LOG; |
|
1602 for( TInt i = 0; i < iNodeIds.Count(); i++ ) |
|
1603 { |
|
1604 if( iNodeIds[i] != aExcludedNode ) |
|
1605 { |
|
1606 iTreeList->CollapseNodeL( iNodeIds[i] ); |
|
1607 } |
|
1608 } |
|
1609 } |
|
1610 |
|
1611 // --------------------------------------------------------------------------- |
|
1612 // If there is one or more expanded nodes, collapses all nodes. |
|
1613 // Otherwise expands all nodes. |
|
1614 // --------------------------------------------------------------------------- |
|
1615 // |
|
1616 void CFSEmailUiMsgDetailsVisualiser::ShortcutCollapseExpandAllToggleL() |
|
1617 { |
|
1618 FUNC_LOG; |
|
1619 TBool collapseAllNodes( EFalse ); |
|
1620 for( TInt i=0 ; i<iNodeIds.Count() ; i++ ) |
|
1621 { |
|
1622 if( iTreeList->IsExpanded( iNodeIds[i] ) ) |
|
1623 { |
|
1624 collapseAllNodes = ETrue; |
|
1625 break; |
|
1626 } |
|
1627 } |
|
1628 |
|
1629 if( collapseAllNodes ) |
|
1630 { |
|
1631 HandleCommandL( EFsEmailUiCmdActionsCollapseAll ); |
|
1632 } |
|
1633 else |
|
1634 { |
|
1635 HandleCommandL( EFsEmailUiCmdActionsExpandAll ); |
|
1636 } |
|
1637 } |
|
1638 |
|
1639 // --------------------------------------------------------------------------- |
|
1640 // Moves the focus to the topmost item |
|
1641 // --------------------------------------------------------------------------- |
|
1642 // |
|
1643 void CFSEmailUiMsgDetailsVisualiser::GoToTopL() |
|
1644 { |
|
1645 FUNC_LOG; |
|
1646 if ( iNodeIds.Count() ) |
|
1647 { |
|
1648 TFsTreeItemId topId = iNodeIds[0]; |
|
1649 iTreeVisualizer->SetFocusedItemL( topId ); |
|
1650 } |
|
1651 } |
|
1652 |
|
1653 // --------------------------------------------------------------------------- |
|
1654 // Moves the focus to the bottommost item |
|
1655 // --------------------------------------------------------------------------- |
|
1656 // |
|
1657 void CFSEmailUiMsgDetailsVisualiser::GoToBottomL() |
|
1658 { |
|
1659 FUNC_LOG; |
|
1660 if ( iNodeIds.Count() ) |
|
1661 { |
|
1662 TFsTreeItemId bottomId = iNodeIds[ iNodeIds.Count()-1 ]; |
|
1663 TInt childCount = iTreeList->CountChildren(bottomId); |
|
1664 if ( childCount && iTreeList->IsExpanded(bottomId) ) |
|
1665 { |
|
1666 // Focus the last child of the bottom node if the node is expanded. |
|
1667 bottomId = iTreeList->Child( bottomId, childCount-1 ); |
|
1668 } |
|
1669 iTreeVisualizer->SetFocusedItemL( bottomId ); |
|
1670 } |
|
1671 } |
|
1672 |
|
1673 |
|
1674 // --------------------------------------------------------------------------- |
|
1675 // Recursive function to get the root parent of given item |
|
1676 // --------------------------------------------------------------------------- |
|
1677 // |
|
1678 TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::GetRootParent( const TFsTreeItemId aItemId ) const |
|
1679 { |
|
1680 FUNC_LOG; |
|
1681 TFsTreeItemId parentId = iTreeList->Parent( aItemId ); |
|
1682 // If current item's parent is KFsTreeRootID, return its id |
|
1683 if( parentId == KFsTreeRootID || parentId == KFsTreeNoneID ) |
|
1684 { |
|
1685 return aItemId; |
|
1686 } |
|
1687 else |
|
1688 { |
|
1689 // Get the root parent recursively |
|
1690 return GetRootParent( parentId ); |
|
1691 } |
|
1692 } |
|
1693 |
|
1694 |
|
1695 // --------------------------------------------------------------------------- |
|
1696 // Tells if all expandable nodes are collapsed |
|
1697 // --------------------------------------------------------------------------- |
|
1698 // |
|
1699 TBool CFSEmailUiMsgDetailsVisualiser::AllNodesCollapsed() const |
|
1700 { |
|
1701 FUNC_LOG; |
|
1702 TFsTreeItemId itemId = KFsTreeNoneID; |
|
1703 TInt count = iTreeList->CountChildren(KFsTreeRootID); |
|
1704 |
|
1705 // If top level is collapsed, then everything is collapsed. There's no need |
|
1706 // to crawl any deeper in the tree hierarchy. |
|
1707 for ( TInt i=0 ; i<count ; ++i ) |
|
1708 { |
|
1709 itemId = iTreeList->Child( KFsTreeRootID, i ); |
|
1710 if ( iTreeList->IsNode(itemId) && |
|
1711 iTreeList->IsExpanded(itemId) ) |
|
1712 { |
|
1713 return EFalse; |
|
1714 } |
|
1715 } |
|
1716 |
|
1717 return ETrue; |
|
1718 } |
|
1719 |
|
1720 // --------------------------------------------------------------------------- |
|
1721 // Tells if all expandable nodes are expanded |
|
1722 // --------------------------------------------------------------------------- |
|
1723 // |
|
1724 TBool CFSEmailUiMsgDetailsVisualiser::AllNodesExpanded( TFsTreeItemId aParentNodeId ) const |
|
1725 { |
|
1726 FUNC_LOG; |
|
1727 // We must crawl through the whole tree to see, if there are any collapsed nodes |
|
1728 // at any level. We do this with recursive depth-first-search. |
|
1729 |
|
1730 TFsTreeItemId itemId = KFsTreeNoneID; |
|
1731 TInt count = iTreeList->CountChildren(aParentNodeId); |
|
1732 |
|
1733 for ( TInt i=0 ; i<count ; ++i ) |
|
1734 { |
|
1735 itemId = iTreeList->Child( aParentNodeId, i ); |
|
1736 if ( iTreeList->IsNode(itemId) ) |
|
1737 { |
|
1738 if ( !iTreeList->IsExpanded(itemId) || |
|
1739 !AllNodesExpanded(itemId) ) |
|
1740 { |
|
1741 return EFalse; |
|
1742 } |
|
1743 } |
|
1744 } |
|
1745 |
|
1746 return ETrue; |
|
1747 } |
|
1748 |
|
1749 // <cmail> Touch |
|
1750 // --------------------------------------------------------------------------- |
|
1751 // Process a treelist event |
|
1752 // --------------------------------------------------------------------------- |
|
1753 // |
|
1754 void CFSEmailUiMsgDetailsVisualiser::TreeListEventL( const TFsTreeListEvent aEvent, |
|
1755 const TFsTreeItemId /*aId*/ ) |
|
1756 { |
|
1757 switch (aEvent) |
|
1758 { |
|
1759 case EFsTreeListItemTouchAction: |
|
1760 { |
|
1761 if (TFsTreeItemId focId1 = iTreeList->FocusedItem()) |
|
1762 { |
|
1763 if (iTreeList->IsNode(focId1)) |
|
1764 { |
|
1765 if (iTreeList->IsExpanded(focId1)) |
|
1766 { |
|
1767 HandleCommandL(EFsEmailUiCmdCollapse); |
|
1768 } |
|
1769 else |
|
1770 { |
|
1771 HandleCommandL(EFsEmailUiCmdExpand); |
|
1772 } |
|
1773 } |
|
1774 else |
|
1775 { |
|
1776 SendEmailToFocusedItemL(); |
|
1777 } |
|
1778 } |
|
1779 break; |
|
1780 } |
|
1781 case EFsTreeListItemTouchLongTap: |
|
1782 { |
|
1783 // Show action toolbar if the item has action menu. |
|
1784 if( HasFocusedItemActionMenu() ) |
|
1785 { |
|
1786 LaunchActionMenuL(); |
|
1787 } |
|
1788 break; |
|
1789 } |
|
1790 case EFsTreeListItemWillGetFocused: |
|
1791 { |
|
1792 SetMskL(); |
|
1793 break; |
|
1794 } |
|
1795 } |
|
1796 } |
|
1797 |
|
1798 |
|
1799 TPoint CFSEmailUiMsgDetailsVisualiser::ActionMenuPosition() |
|
1800 { |
|
1801 TAlfRealRect focusRect; |
|
1802 TFsTreeItemId listItemId = iTreeList->FocusedItem(); |
|
1803 iTreeList->GetItemDisplayRectTarget(listItemId, focusRect); |
|
1804 return focusRect.iTl; |
|
1805 } |
|
1806 // </cmail> |
|
1807 |
|
1808 void CFSEmailUiMsgDetailsVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const |
|
1809 { |
|
1810 aLayoutArray.AppendL( iParentLayout ); |
|
1811 } |
|
1812 |