87 CFSEmailUiDownloadManagerVisualiser* self = |
87 CFSEmailUiDownloadManagerVisualiser* self = |
88 new (ELeave) CFSEmailUiDownloadManagerVisualiser( aEnv, aAppUi, aControlGroup ); |
88 new (ELeave) CFSEmailUiDownloadManagerVisualiser( aEnv, aAppUi, aControlGroup ); |
89 CleanupStack::PushL( self ); |
89 CleanupStack::PushL( self ); |
90 self->ConstructL(); |
90 self->ConstructL(); |
91 return self; |
91 return self; |
92 } |
92 } |
93 |
93 |
94 void CFSEmailUiDownloadManagerVisualiser::ConstructL() |
94 void CFSEmailUiDownloadManagerVisualiser::ConstructL() |
95 { |
95 { |
96 FUNC_LOG; |
96 FUNC_LOG; |
97 |
97 |
98 BaseConstructL( R_FSEMAILUI_DOWNLOADMANAGER_VIEW ); |
98 BaseConstructL( R_FSEMAILUI_DOWNLOADMANAGER_VIEW ); |
99 |
99 |
100 // Create list screen (list) control |
100 // Create list screen (list) control |
101 iScreenControl = CFreestyleEmailUiDownloadManagerControl::NewL( iEnv, this ); |
101 iScreenControl = CFreestyleEmailUiDownloadManagerControl::NewL( iEnv, this ); |
102 |
102 |
103 // Create attachments list layout and set it to fill the main pane |
103 // Create attachments list layout and set it to fill the main pane |
104 TRect screenRect; |
104 TRect screenRect; |
105 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, screenRect ); |
105 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, screenRect ); |
106 iListLayout = CAlfDeckLayout::AddNewL( *iScreenControl ); |
106 iListLayout = CAlfDeckLayout::AddNewL( *iScreenControl ); |
107 screenRect.Move(0,0); |
107 screenRect.Move(0,0); |
108 iListLayout->SetRect( screenRect ); |
108 iListLayout->SetRect( screenRect ); |
109 |
109 |
110 // Create attachments list tree list component |
110 // Create attachments list tree list component |
111 iDownloadManagerTreeListVisualizer = CFsTreeVisualizerBase::NewL(iScreenControl, *iListLayout); |
111 iDownloadManagerTreeListVisualizer = CFsTreeVisualizerBase::NewL(iScreenControl, *iListLayout); |
112 iDownloadManagerTreeListVisualizer->SetItemExpansionDelay( iAppUi.LayoutHandler()->ListItemExpansionDelay() ); |
112 iDownloadManagerTreeListVisualizer->SetItemExpansionDelay( iAppUi.LayoutHandler()->ListItemExpansionDelay() ); |
113 |
113 |
114 iDownloadManagerList = CFsTreeList::NewL(*iDownloadManagerTreeListVisualizer, iEnv); |
114 iDownloadManagerList = CFsTreeList::NewL(*iDownloadManagerTreeListVisualizer, iEnv); |
115 iDownloadManagerList->SetScrollbarVisibilityL( EFsScrollbarAuto ); |
115 iDownloadManagerList->SetScrollbarVisibilityL( EFsScrollbarAuto ); |
116 iDownloadManagerList->SetMarkTypeL( CFsTreeList::EFsTreeListMultiMarkable ); |
116 iDownloadManagerList->SetMarkTypeL( CFsTreeList::EFsTreeListMultiMarkable ); |
117 iDownloadManagerList->SetIndentationL( 0 ); |
117 iDownloadManagerList->SetIndentationL( 0 ); |
118 |
118 |
119 //<cmail> Compared to S60 3.2.3 in S60 5.0 Alf offers the key events in |
119 //<cmail> Compared to S60 3.2.3 in S60 5.0 Alf offers the key events in |
120 // opposite order. |
120 // opposite order. |
121 ControlGroup().AppendL( iScreenControl ); |
121 ControlGroup().AppendL( iScreenControl ); |
122 ControlGroup().AppendL( iDownloadManagerList->TreeControl() ); |
122 ControlGroup().AppendL( iDownloadManagerList->TreeControl() ); |
123 //</cmail> |
123 //</cmail> |
124 |
124 |
125 iModel = CFSEmailUiDownloadManagerModel::NewL( iAppUi, *this ); |
125 iModel = CFSEmailUiDownloadManagerModel::NewL( iAppUi, *this ); |
126 //<cmail> S60 skin support |
126 //<cmail> S60 skin support |
127 //iDownloadManagerTreeListVisualizer->SetBackgroundTextureL( iAppUi.FsTextureManager()->TextureByIndex( EBackgroundTextureMailList ) ); |
127 //iDownloadManagerTreeListVisualizer->SetBackgroundTextureL( iAppUi.FsTextureManager()->TextureByIndex( EBackgroundTextureMailList ) ); |
128 //</cmail> |
128 //</cmail> |
129 iDownloadManagerTreeListVisualizer->SetMenuIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMenuIcon ) ); |
129 iDownloadManagerTreeListVisualizer->SetMenuIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMenuIcon ) ); |
130 iDownloadManagerTreeListVisualizer->SetItemsAlwaysExtendedL( ETrue ); |
130 iDownloadManagerTreeListVisualizer->SetItemsAlwaysExtendedL( ETrue ); |
131 iDownloadManagerList->AddObserverL( *this ); |
131 iDownloadManagerList->AddObserverL( *this ); |
132 |
132 |
133 iAppUi.LayoutHandler()->SetListMarqueeBehaviour( iDownloadManagerList ); |
133 iAppUi.LayoutHandler()->SetListMarqueeBehaviour( iDownloadManagerList ); |
134 |
134 |
135 // Set page up and page down keys |
135 // Set page up and page down keys |
136 iDownloadManagerTreeListVisualizer->AddCustomPageUpKey( EStdKeyPageUp ); |
136 iDownloadManagerTreeListVisualizer->AddCustomPageUpKey( EStdKeyPageUp ); |
137 iDownloadManagerTreeListVisualizer->AddCustomPageDownKey( EStdKeyPageDown ); |
137 iDownloadManagerTreeListVisualizer->AddCustomPageDownKey( EStdKeyPageDown ); |
138 |
138 |
139 CAlfBrush* selectorBrush = iAppUi.FsTextureManager()->ListSelectorBrushL(); |
139 CAlfBrush* selectorBrush = iAppUi.FsTextureManager()->ListSelectorBrushL(); |
140 iDownloadManagerTreeListVisualizer->SetSelectorPropertiesL( selectorBrush, 1.0, CFsTreeVisualizerBase::EFsSelectorMoveSmoothly ); |
140 iDownloadManagerTreeListVisualizer->SetSelectorPropertiesL( selectorBrush, 1.0, CFsTreeVisualizerBase::EFsSelectorMoveSmoothly ); |
141 |
141 |
142 } |
142 } |
143 |
143 |
144 |
144 |
145 CFSEmailUiDownloadManagerVisualiser::CFSEmailUiDownloadManagerVisualiser( |
145 CFSEmailUiDownloadManagerVisualiser::CFSEmailUiDownloadManagerVisualiser( |
146 CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi, CAlfControlGroup& aControlGroup ) |
146 CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi, CAlfControlGroup& aControlGroup ) |
147 : CFsEmailUiViewBase( aControlGroup, *aAppUi ), iEnv( aEnv ) |
147 : CFsEmailUiViewBase( aControlGroup, *aAppUi ), iEnv( aEnv ) |
148 { |
148 { |
149 FUNC_LOG; |
149 FUNC_LOG; |
150 } |
150 } |
151 |
151 |
152 CFSEmailUiDownloadManagerVisualiser::~CFSEmailUiDownloadManagerVisualiser() |
152 CFSEmailUiDownloadManagerVisualiser::~CFSEmailUiDownloadManagerVisualiser() |
153 { |
153 { |
154 FUNC_LOG; |
154 FUNC_LOG; |
155 delete iModel; |
155 delete iModel; |
156 if ( iDownloadManagerList ) |
156 if ( iDownloadManagerList ) |
157 { |
157 { |
158 iDownloadManagerList->RemoveObserver( *this ); |
158 iDownloadManagerList->RemoveObserver( *this ); |
159 } |
159 } |
160 delete iDownloadManagerList; |
160 delete iDownloadManagerList; |
161 } |
161 } |
162 |
162 |
163 |
163 |
164 TInt CFSEmailUiDownloadManagerVisualiser::HighlightedIndex() |
164 TInt CFSEmailUiDownloadManagerVisualiser::HighlightedIndex() |
165 { |
165 { |
166 FUNC_LOG; |
166 FUNC_LOG; |
167 return 0; |
167 return 0; |
168 } |
168 } |
169 |
169 |
170 TUid CFSEmailUiDownloadManagerVisualiser::Id() const |
170 TUid CFSEmailUiDownloadManagerVisualiser::Id() const |
171 { |
171 { |
172 FUNC_LOG; |
172 FUNC_LOG; |
173 return DownloadManagerViewId; |
173 return DownloadManagerViewId; |
174 } |
174 } |
175 |
175 |
176 // --------------------------------------------------------------------------- |
176 // --------------------------------------------------------------------------- |
177 // CFSEmailUiDownloadManagerVisualiser::ChildDoActivateL |
177 // CFSEmailUiDownloadManagerVisualiser::ChildDoActivateL |
178 // --------------------------------------------------------------------------- |
178 // --------------------------------------------------------------------------- |
179 // |
179 // |
276 } |
276 } |
277 } |
277 } |
278 |
278 |
279 // Add shortcut hints |
279 // Add shortcut hints |
280 iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, |
280 iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, |
281 CFSEmailUiShortcutBinding::EContextDownloadManager ); |
281 CFSEmailUiShortcutBinding::EContextDownloadManager ); |
282 } |
282 } |
283 |
283 |
284 |
284 |
285 // --------------------------------------------------------------------------- |
285 // --------------------------------------------------------------------------- |
286 // HandleMailBoxEventL |
286 // HandleMailBoxEventL |
287 // Mailbox event handler, responds to events sent by the plugin. |
287 // Mailbox event handler, responds to events sent by the plugin. |
288 // --------------------------------------------------------------------------- |
288 // --------------------------------------------------------------------------- |
289 // |
289 // |
290 void CFSEmailUiDownloadManagerVisualiser::HandleMailBoxEventL( TFSMailEvent aEvent, |
290 void CFSEmailUiDownloadManagerVisualiser::HandleMailBoxEventL( TFSMailEvent aEvent, |
291 TFSMailMsgId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
291 TFSMailMsgId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ ) |
292 { |
292 { |
293 FUNC_LOG; |
293 FUNC_LOG; |
294 // Safety, refresh only if this view is active, has model and mail deleted event has been received. |
294 // Safety, refresh only if this view is active, has model and mail deleted event has been received. |
295 if ( aEvent == TFSEventMailDeleted && iModel ) |
295 if ( aEvent == TFSEventMailDeleted && iModel ) |
296 { |
296 { |
297 // Remove deleted items from list. Refresh list if this view is active |
297 // Remove deleted items from list. Refresh list if this view is active |
298 // and some item was removed. |
298 // and some item was removed. |
299 if ( iModel->ClearInvalidItemsL() && |
299 if ( iModel->ClearInvalidItemsL() && |
300 iAppUi.CurrentActiveView() == this ) |
300 iAppUi.CurrentActiveView() == this ) |
301 { |
301 { |
302 RefreshL(); |
302 RefreshL(); |
303 SetMskL(); |
303 SetMskL(); |
304 } |
304 } |
305 } |
305 } |
306 } |
306 } |
307 |
307 |
308 |
308 |
309 void CFSEmailUiDownloadManagerVisualiser::RefreshL() |
309 void CFSEmailUiDownloadManagerVisualiser::RefreshL() |
310 { |
310 { |
311 FUNC_LOG; |
311 FUNC_LOG; |
312 TRect screenRect; |
312 TRect screenRect; |
313 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
313 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
314 iListLayout->SetRect( screenRect ); |
314 iListLayout->SetRect( screenRect ); |
315 |
315 |
316 iDownloadManagerList->RemoveAllL(); |
316 iDownloadManagerList->RemoveAllL(); |
317 |
317 |
318 CFsTreePlainTwoLineItemData* twoLineItemData = CFsTreePlainTwoLineItemData::NewL(); |
318 CFsTreePlainTwoLineItemData* twoLineItemData = CFsTreePlainTwoLineItemData::NewL(); |
319 CleanupStack::PushL( twoLineItemData ); |
319 CleanupStack::PushL( twoLineItemData ); |
320 CFsTreePlainTwoLineItemVisualizer* twoLineItemVisualizer = |
320 CFsTreePlainTwoLineItemVisualizer* twoLineItemVisualizer = |
321 CFsTreePlainTwoLineItemVisualizer::NewL( *iDownloadManagerList->TreeControl() ); |
321 CFsTreePlainTwoLineItemVisualizer::NewL( *iDownloadManagerList->TreeControl() ); |
322 CleanupStack::PushL( twoLineItemVisualizer ); |
322 CleanupStack::PushL( twoLineItemVisualizer ); |
323 // Set font height |
323 // Set font height |
324 twoLineItemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
324 twoLineItemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
325 // Set font bolding |
325 // Set font bolding |
326 twoLineItemVisualizer->SetTextBold( ETrue ); |
326 twoLineItemVisualizer->SetTextBold( ETrue ); |
327 // Set manual layout and make item non-focusable |
327 // Set manual layout and make item non-focusable |
328 twoLineItemVisualizer->SetFlags( twoLineItemVisualizer->Flags() & ~KFsTreeListItemFocusable ); |
328 twoLineItemVisualizer->SetFlags( twoLineItemVisualizer->Flags() & ~KFsTreeListItemFocusable ); |
329 |
329 |
330 // Set correct skin text colors for the list items |
330 // Set correct skin text colors for the list items |
331 TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
331 TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
332 TRgb normalItemColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
332 TRgb normalItemColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
333 TRgb normalNodeColor = iAppUi.LayoutHandler()->ListNodeTextColor(); |
333 TRgb normalNodeColor = iAppUi.LayoutHandler()->ListNodeTextColor(); |
334 TRgb headerBgColor = iAppUi.LayoutHandler()->ListHeaderBackgroundColor(); |
334 TRgb headerBgColor = iAppUi.LayoutHandler()->ListHeaderBackgroundColor(); |
335 |
335 |
336 twoLineItemVisualizer->SetFocusedStateTextColor( focusedColor ); |
336 twoLineItemVisualizer->SetFocusedStateTextColor( focusedColor ); |
337 twoLineItemVisualizer->SetNormalStateTextColor( normalItemColor ); |
337 twoLineItemVisualizer->SetNormalStateTextColor( normalItemColor ); |
338 twoLineItemVisualizer->SetBackgroundColor( headerBgColor ); |
338 twoLineItemVisualizer->SetBackgroundColor( headerBgColor ); |
339 |
339 |
340 const RArray<TMessageData>& modelData = iModel->GetModel(); |
340 const RArray<TMessageData>& modelData = iModel->GetModel(); |
341 HBufC* resourceString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_HEADER_DOWNLOAD_MANAGER ); |
341 HBufC* resourceString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_HEADER_DOWNLOAD_MANAGER ); |
342 twoLineItemData->SetDataL( *resourceString ); |
342 twoLineItemData->SetDataL( *resourceString ); |
343 CleanupStack::PopAndDestroy( resourceString ); |
343 CleanupStack::PopAndDestroy( resourceString ); |
344 |
344 |
345 resourceString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_HEADER_TOTAL, iModel->AttachmentCount() ); |
345 resourceString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_HEADER_TOTAL, iModel->AttachmentCount() ); |
346 twoLineItemData->SetSecondaryDataL( *resourceString ); |
346 twoLineItemData->SetSecondaryDataL( *resourceString ); |
347 CleanupStack::PopAndDestroy( resourceString ); |
347 CleanupStack::PopAndDestroy( resourceString ); |
348 twoLineItemData->SetIcon ( iAppUi.FsTextureManager()->TextureByIndex( EAttachmentIcon ) ); |
348 twoLineItemData->SetIcon ( iAppUi.FsTextureManager()->TextureByIndex( EAttachmentIcon ) ); |
349 CleanupStack::Pop( twoLineItemVisualizer ); |
349 CleanupStack::Pop( twoLineItemVisualizer ); |
350 CleanupStack::Pop( twoLineItemData ); |
350 CleanupStack::Pop( twoLineItemData ); |
351 iHeaderItemId = iDownloadManagerList->InsertItemL( *twoLineItemData, *twoLineItemVisualizer, KFsTreeRootID ); |
351 iHeaderItemId = iDownloadManagerList->InsertItemL( *twoLineItemData, *twoLineItemVisualizer, KFsTreeRootID ); |
352 |
352 |
353 TFsTreeItemId parentNode; |
353 TFsTreeItemId parentNode; |
354 for ( TInt i=0 ; i<modelData.Count() ; i++ ) |
354 for ( TInt i=0 ; i<modelData.Count() ; i++ ) |
355 { |
355 { |
356 CFsTreePlainOneLineNodeData* separatorData = CFsTreePlainOneLineNodeData::NewL(); |
356 CFsTreePlainOneLineNodeData* separatorData = CFsTreePlainOneLineNodeData::NewL(); |
357 CleanupStack::PushL( separatorData ); |
357 CleanupStack::PushL( separatorData ); |
358 CFsTreePlainOneLineNodeVisualizer* separatorVisualiser = |
358 CFsTreePlainOneLineNodeVisualizer* separatorVisualiser = |
359 CFsTreePlainOneLineNodeVisualizer::NewL( *iDownloadManagerList->TreeControl() ); |
359 CFsTreePlainOneLineNodeVisualizer::NewL( *iDownloadManagerList->TreeControl() ); |
360 CleanupStack::PushL( separatorVisualiser ); |
360 CleanupStack::PushL( separatorVisualiser ); |
361 separatorData->SetDataL( *modelData[i].mailSubject ); |
361 separatorData->SetDataL( *modelData[i].mailSubject ); |
362 // Set font height |
362 // Set font height |
363 separatorVisualiser->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
363 separatorVisualiser->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
364 // Set font bolding |
364 // Set font bolding |
365 separatorVisualiser->SetTextBold( ETrue ); |
365 separatorVisualiser->SetTextBold( ETrue ); |
366 // Set correct skin text colors for the list items |
366 // Set correct skin text colors for the list items |
367 separatorVisualiser->SetFocusedStateTextColor( focusedColor ); |
367 separatorVisualiser->SetFocusedStateTextColor( focusedColor ); |
368 separatorVisualiser->SetNormalStateTextColor( normalNodeColor ); |
368 separatorVisualiser->SetNormalStateTextColor( normalNodeColor ); |
369 separatorVisualiser->SetBackgroundColor( iAppUi.LayoutHandler()->ListNodeBackgroundColor() ); |
369 separatorVisualiser->SetBackgroundColor( iAppUi.LayoutHandler()->ListNodeBackgroundColor() ); |
370 |
370 |
371 separatorVisualiser->SetExtendable( EFalse ); |
371 separatorVisualiser->SetExtendable( EFalse ); |
372 separatorData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeExpanded ) ); |
372 separatorData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeExpanded ) ); |
373 separatorData->SetIconCollapsed( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeCollapsed ) ); |
373 separatorData->SetIconCollapsed( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeCollapsed ) ); |
374 CleanupStack::Pop( separatorVisualiser ); |
374 CleanupStack::Pop( separatorVisualiser ); |
375 CleanupStack::Pop( separatorData ); |
375 CleanupStack::Pop( separatorData ); |
376 parentNode = iDownloadManagerList->InsertNodeL(*separatorData, *separatorVisualiser, KFsTreeRootID); |
376 parentNode = iDownloadManagerList->InsertNodeL(*separatorData, *separatorVisualiser, KFsTreeRootID); |
377 iModel->SetNodeIdL( i, parentNode ); |
377 iModel->SetNodeIdL( i, parentNode ); |
378 for (TInt j=0; j<modelData[i].mailAttachments.Count(); j++) |
378 for (TInt j=0; j<modelData[i].mailAttachments.Count(); j++) |
379 { |
379 { |
380 twoLineItemData = CFsTreePlainTwoLineItemData::NewL(); |
380 twoLineItemData = CFsTreePlainTwoLineItemData::NewL(); |
381 CleanupStack::PushL( twoLineItemData ); |
381 CleanupStack::PushL( twoLineItemData ); |
382 twoLineItemData->SetDataL( modelData[i].mailAttachments[j].fileName ); |
382 twoLineItemData->SetDataL( modelData[i].mailAttachments[j].fileName ); |
383 |
383 |
384 HBufC* secondLine = CreateSecondLineTextLC( modelData[i].mailAttachments[j] ); |
384 HBufC* secondLine = CreateSecondLineTextLC( modelData[i].mailAttachments[j] ); |
385 twoLineItemData->SetSecondaryDataL( *secondLine ); |
385 twoLineItemData->SetSecondaryDataL( *secondLine ); |
386 CleanupStack::PopAndDestroy( secondLine ); |
386 CleanupStack::PopAndDestroy( secondLine ); |
387 |
387 |
388 CAlfTexture& itemTexture = TFsEmailUiUtility::GetAttachmentIcon( modelData[i].mailAttachments[j].fileType, |
388 CAlfTexture& itemTexture = TFsEmailUiUtility::GetAttachmentIcon( modelData[i].mailAttachments[j].fileType, |
389 *iAppUi.FsTextureManager() ); |
389 *iAppUi.FsTextureManager() ); |
390 twoLineItemData->SetIcon( itemTexture ); |
390 twoLineItemData->SetIcon( itemTexture ); |
391 |
391 |
392 |
392 |
393 twoLineItemVisualizer = CFsTreePlainTwoLineItemVisualizer::NewL( *iDownloadManagerList->TreeControl()); |
393 twoLineItemVisualizer = CFsTreePlainTwoLineItemVisualizer::NewL( *iDownloadManagerList->TreeControl()); |
394 CleanupStack::PushL( twoLineItemVisualizer ); |
394 CleanupStack::PushL( twoLineItemVisualizer ); |
395 twoLineItemVisualizer->SetExtendable(ETrue); |
395 twoLineItemVisualizer->SetExtendable(ETrue); |
396 twoLineItemVisualizer->SetFlags( twoLineItemVisualizer->Flags() | KFsTreeListItemHasMenu ); |
396 twoLineItemVisualizer->SetFlags( twoLineItemVisualizer->Flags() | KFsTreeListItemHasMenu ); |
397 |
397 |
398 CAlfTextStyle* textStyle = iAppUi.LayoutHandler()->FSTextStyleFromIdL( EFSFontTypeSmall ); |
398 CAlfTextStyle* textStyle = iAppUi.LayoutHandler()->FSTextStyleFromIdL( EFSFontTypeSmall ); |
399 twoLineItemVisualizer->SetTextStyleId( textStyle->Id() ); |
399 twoLineItemVisualizer->SetTextStyleId( textStyle->Id() ); |
400 |
400 |
401 // Set font height |
401 // Set font height |
402 twoLineItemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
402 twoLineItemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
403 // Set font bolding |
403 // Set font bolding |
404 twoLineItemVisualizer->SetTextBold( EFalse ); |
404 twoLineItemVisualizer->SetTextBold( EFalse ); |
405 // Set correct skin text colors for the list items |
405 // Set correct skin text colors for the list items |
406 twoLineItemVisualizer->SetFocusedStateTextColor( focusedColor ); |
406 twoLineItemVisualizer->SetFocusedStateTextColor( focusedColor ); |
407 twoLineItemVisualizer->SetNormalStateTextColor( normalItemColor ); |
407 twoLineItemVisualizer->SetNormalStateTextColor( normalItemColor ); |
408 |
408 |
409 |
409 |
410 TFsTreeItemId treeItemId = iDownloadManagerList->InsertItemL( *twoLineItemData, *twoLineItemVisualizer, parentNode); |
410 TFsTreeItemId treeItemId = iDownloadManagerList->InsertItemL( *twoLineItemData, *twoLineItemVisualizer, parentNode); |
411 CleanupStack::Pop( twoLineItemVisualizer ); |
411 CleanupStack::Pop( twoLineItemVisualizer ); |
412 CleanupStack::Pop( twoLineItemData ); |
412 CleanupStack::Pop( twoLineItemData ); |
413 |
413 |
414 iModel->SetItemIdL( i, j, treeItemId ); |
414 iModel->SetItemIdL( i, j, treeItemId ); |
415 } |
415 } |
416 } |
416 } |
417 } |
417 } |
418 |
418 |
419 |
419 |
420 void CFSEmailUiDownloadManagerVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType ) |
420 void CFSEmailUiDownloadManagerVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType ) |
421 { |
421 { |
422 FUNC_LOG; |
422 FUNC_LOG; |
423 iDownloadManagerList->HideListL(); |
423 iDownloadManagerList->HideListL(); |
424 if ( aType == CFsEmailUiViewBase::ESkinChanged ) |
424 if ( aType == CFsEmailUiViewBase::ESkinChanged ) |
425 { |
425 { |
426 ResetColorsL(); |
426 ResetColorsL(); |
427 iDownloadManagerList->ShowListL(); |
427 iDownloadManagerList->ShowListL(); |
428 } |
428 } |
429 else if ( aType == CFsEmailUiViewBase::EScreenLayoutChanged ) |
429 else if ( aType == CFsEmailUiViewBase::EScreenLayoutChanged ) |
430 { |
430 { |
431 ReScaleUiL(); |
431 ReScaleUiL(); |
432 iDownloadManagerList->ShowListL(); |
432 iDownloadManagerList->ShowListL(); |
433 } |
433 } |
434 } |
434 } |
435 |
435 |
436 void CFSEmailUiDownloadManagerVisualiser::HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType ) |
436 void CFSEmailUiDownloadManagerVisualiser::HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType ) |
437 { |
437 { |
438 FUNC_LOG; |
438 FUNC_LOG; |
439 if ( aType == CFsEmailUiViewBase::ESkinChanged ) |
439 if ( aType == CFsEmailUiViewBase::ESkinChanged ) |
451 { |
451 { |
452 FUNC_LOG; |
452 FUNC_LOG; |
453 TFsTreeItemId focusedId = iDownloadManagerList->FocusedItem(); |
453 TFsTreeItemId focusedId = iDownloadManagerList->FocusedItem(); |
454 |
454 |
455 switch(aCommand) |
455 switch(aCommand) |
456 { |
456 { |
457 case EFsEmailUiCmdEmpty: // used when focused item is being downloaded |
457 case EFsEmailUiCmdEmpty: // used when focused item is being downloaded |
458 case EAknSoftkeyOpen: |
458 case EAknSoftkeyOpen: |
459 case EFsEmailUiCmdOpen: |
459 case EFsEmailUiCmdOpen: |
460 { |
460 { |
461 TryToOpenItemL( focusedId ); |
461 TryToOpenItemL( focusedId ); |
462 } |
462 } |
463 break; |
463 break; |
464 case EFsEmailUiCmdDownload: |
464 case EFsEmailUiCmdDownload: |
465 { |
465 { |
466 iModel->StartDownloadL(focusedId); |
466 iModel->StartDownloadL(focusedId); |
467 } |
467 } |
468 break; |
468 break; |
469 case EFsEmailUiCmdDownloadAll: |
469 case EFsEmailUiCmdDownloadAll: |
470 { |
470 { |
471 iModel->DownloadAllAttachmentsL(); |
471 iModel->DownloadAllAttachmentsL(); |
472 } |
472 } |
473 break; |
473 break; |
474 case EFsEmailUiCmdCancelDownload: |
474 case EFsEmailUiCmdCancelDownload: |
475 { |
475 { |
476 TInt reallyCancel = |
476 TInt reallyCancel = |
477 TFsEmailUiUtility::ShowConfirmationQueryL( R_FSE_VIEWER_CANCEL_DOWNLOAD_QUERY ); |
477 TFsEmailUiUtility::ShowConfirmationQueryL( R_FSE_VIEWER_CANCEL_DOWNLOAD_QUERY ); |
478 if ( reallyCancel ) |
478 if ( reallyCancel ) |
479 { |
479 { |
480 iModel->CancelDownloadL( focusedId ); |
480 iModel->CancelDownloadL( focusedId ); |
481 } |
481 } |
482 } |
482 } |
483 break; |
483 break; |
484 case EFsEmailUiCmdCancelAllDownloads: |
484 case EFsEmailUiCmdCancelAllDownloads: |
485 { |
485 { |
486 TInt reallyCancel = |
486 TInt reallyCancel = |
487 TFsEmailUiUtility::ShowConfirmationQueryL( R_FSE_VIEWER_CANCEL_DOWNLOADS_QUERY ); |
487 TFsEmailUiUtility::ShowConfirmationQueryL( R_FSE_VIEWER_CANCEL_DOWNLOADS_QUERY ); |
488 if ( reallyCancel ) |
488 if ( reallyCancel ) |
489 { |
489 { |
490 iModel->CancelAllDownloadsL(); |
490 iModel->CancelAllDownloadsL(); |
491 } |
491 } |
492 } |
492 } |
493 break; |
493 break; |
494 case EFsEmailUiCmdSave: |
494 case EFsEmailUiCmdSave: |
495 { |
495 { |
496 TFileName fileName; |
496 TFileName fileName; |
497 TInt savedCount( 0 ); |
497 TInt savedCount( 0 ); |
498 if ( TFsEmailUiUtility::ShowSaveFolderDialogL( fileName ) ) |
498 if ( TFsEmailUiUtility::ShowSaveFolderDialogL( fileName ) ) |
499 { |
499 { |
500 iModel->SaveAttachmentL( focusedId, fileName, savedCount ); |
500 iModel->SaveAttachmentL( focusedId, fileName, savedCount ); |
501 } |
501 } |
502 if ( savedCount ) |
502 if ( savedCount ) |
503 { |
503 { |
504 TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( savedCount ); |
504 TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( savedCount ); |
505 } |
505 } |
506 } |
506 } |
507 break; |
507 break; |
508 case EFsEmailUiCmdSaveAll: |
508 case EFsEmailUiCmdSaveAll: |
509 { |
509 { |
510 TFileName fileName; |
510 TFileName fileName; |
511 if ( TFsEmailUiUtility::ShowSaveFolderDialogL( fileName ) ) |
511 if ( TFsEmailUiUtility::ShowSaveFolderDialogL( fileName ) ) |
512 { |
512 { |
513 iModel->SaveAllAttachmentsL( fileName ); |
513 iModel->SaveAllAttachmentsL( fileName ); |
514 } |
514 } |
515 } |
515 } |
516 break; |
516 break; |
517 case EFsEmailUiCmdClearFetchedAttachment: |
517 case EFsEmailUiCmdClearFetchedAttachment: |
518 case EFsEmailUiCmdRemoveAttachment: |
518 case EFsEmailUiCmdRemoveAttachment: |
519 case EFsEmailUiCmdActionsDelete: // from shortcut key |
519 case EFsEmailUiCmdActionsDelete: // from shortcut key |
520 { |
520 { |
521 RemoveAttachmentL( focusedId ); |
521 RemoveAttachmentL( focusedId ); |
522 } |
522 } |
523 break; |
523 break; |
524 case EFsEmailUiCmdMsgDetails: |
524 case EFsEmailUiCmdMsgDetails: |
525 { |
525 { |
526 TPartData messageData = iModel->GetMessageL( focusedId ); |
526 TPartData messageData = iModel->GetMessageL( focusedId ); |
527 |
527 |
528 TMsgDetailsActivationData msgDetailsData; |
528 TMsgDetailsActivationData msgDetailsData; |
529 msgDetailsData.iMailBoxId = messageData.iMailBoxId; |
529 msgDetailsData.iMailBoxId = messageData.iMailBoxId; |
530 msgDetailsData.iFolderId = messageData.iFolderId; |
530 msgDetailsData.iFolderId = messageData.iFolderId; |
531 msgDetailsData.iMessageId = messageData.iMessageId; |
531 msgDetailsData.iMessageId = messageData.iMessageId; |
532 |
532 |
533 const TPckgBuf<TMsgDetailsActivationData> pkgOut( msgDetailsData ); |
533 const TPckgBuf<TMsgDetailsActivationData> pkgOut( msgDetailsData ); |
534 iAppUi.EnterFsEmailViewL( MsgDetailsViewId, KStartMsgDetailsToBeginning, pkgOut ); |
534 iAppUi.EnterFsEmailViewL( MsgDetailsViewId, KStartMsgDetailsToBeginning, pkgOut ); |
535 } |
535 } |
536 break; |
536 break; |
537 case EFSEmailUICmdViewMessage: |
537 case EFSEmailUICmdViewMessage: |
538 { |
538 { |
539 TPartData messageData = iModel->GetMessageL( focusedId ); |
539 TPartData messageData = iModel->GetMessageL( focusedId ); |
540 |
540 |
541 TMsgViewerActivationData msgViewerData; |
541 TMsgViewerActivationData msgViewerData; |
542 msgViewerData.iMailBoxId = messageData.iMailBoxId; |
542 msgViewerData.iMailBoxId = messageData.iMailBoxId; |
543 msgViewerData.iFolderId = messageData.iFolderId; |
543 msgViewerData.iFolderId = messageData.iFolderId; |
544 msgViewerData.iMessageId = messageData.iMessageId; |
544 msgViewerData.iMessageId = messageData.iMessageId; |
545 msgViewerData.iDetails = EFSMsgDataStructure; |
545 msgViewerData.iDetails = EFSMsgDataStructure; |
546 const TPckgBuf<TMsgViewerActivationData> pkgOut( msgViewerData ); |
546 const TPckgBuf<TMsgViewerActivationData> pkgOut( msgViewerData ); |
547 iAppUi.EnterFsEmailViewL( MailViewerId, KStartViewerWithMsgId, pkgOut ); |
547 iAppUi.EnterFsEmailViewL( MailViewerId, KStartViewerWithMsgId, pkgOut ); |
548 } |
548 } |
549 break; |
549 break; |
550 case EFsEmailUiCmdExit: |
550 case EFsEmailUiCmdExit: |
551 { |
551 { |
552 iAppUi.Exit(); |
552 iAppUi.Exit(); |
553 } |
553 } |
554 break; |
554 break; |
555 case EAknSoftkeyBack: |
555 case EAknSoftkeyBack: |
556 { |
556 { |
557 if ( !iAppUi.ViewSwitchingOngoing() ) |
557 if ( !iAppUi.ViewSwitchingOngoing() ) |
558 { |
558 { |
559 iAppUi.ReturnToPreviousViewL(); |
559 iAppUi.ReturnToPreviousViewL(); |
560 } |
560 } |
561 } |
561 } |
562 break; |
562 break; |
563 |
563 |
564 case EFsEmailUiCmdCollapse: |
564 case EFsEmailUiCmdCollapse: |
565 { |
565 { |
566 iDownloadManagerList->CollapseNodeL( focusedId ); |
566 iDownloadManagerList->CollapseNodeL( focusedId ); |
567 ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND ); |
567 ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND ); |
568 } |
568 } |
599 { |
599 { |
600 TKeyEvent simEvent = { EKeyPageDown, EStdKeyPageDown, 0, 0 }; |
600 TKeyEvent simEvent = { EKeyPageDown, EStdKeyPageDown, 0, 0 }; |
601 iCoeEnv->SimulateKeyEventL( simEvent, EEventKey ); |
601 iCoeEnv->SimulateKeyEventL( simEvent, EEventKey ); |
602 } |
602 } |
603 break; |
603 break; |
604 case EFsEmailUiCmdHelp: |
604 case EFsEmailUiCmdHelp: |
605 { |
605 { |
606 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
606 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
607 } |
607 } |
608 break; |
608 break; |
609 default: |
609 default: |
610 break; |
610 break; |
611 } |
611 } |
612 } |
612 } |
613 |
613 |
614 void CFSEmailUiDownloadManagerVisualiser::SetMskL() |
614 void CFSEmailUiDownloadManagerVisualiser::SetMskL() |
615 { |
615 { |
616 FUNC_LOG; |
616 FUNC_LOG; |
617 TFsTreeItemId curId = iDownloadManagerList->FocusedItem(); |
617 TFsTreeItemId curId = iDownloadManagerList->FocusedItem(); |
618 if ( curId ) |
618 if ( curId ) |
619 { |
619 { |
620 if( iDownloadManagerList->IsNode( curId ) ) |
620 if( iDownloadManagerList->IsNode( curId ) ) |
621 { |
621 { |
622 if (iDownloadManagerList->IsExpanded( curId ) ) |
622 if (iDownloadManagerList->IsExpanded( curId ) ) |
623 { |
623 { |
624 ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE ); |
624 ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE ); |
625 } |
625 } |
626 else |
626 else |
627 { |
627 { |
628 ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND ); |
628 ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND ); |
629 } |
629 } |
630 } |
630 } |
631 else // non-node item |
631 else // non-node item |
632 { |
632 { |
633 TAttachmentData* selectedItem = iModel->GetItem( iDownloadManagerList->FocusedItem()); |
633 TAttachmentData* selectedItem = iModel->GetItem( iDownloadManagerList->FocusedItem()); |
634 if ( selectedItem && IsCommandAvailableOnItem( EFsEmailUiCmdDownload, selectedItem ) ) |
634 if ( selectedItem && IsCommandAvailableOnItem( EFsEmailUiCmdDownload, selectedItem ) ) |
635 { |
635 { |
636 ChangeMskCommandL( R_FSE_QTN_MSK_DOWNLOAD ); |
636 ChangeMskCommandL( R_FSE_QTN_MSK_DOWNLOAD ); |
637 } |
637 } |
638 else if ( selectedItem && IsCommandAvailableOnItem( EFsEmailUiCmdOpen, selectedItem ) ) |
638 else if ( selectedItem && IsCommandAvailableOnItem( EFsEmailUiCmdOpen, selectedItem ) ) |
639 { |
639 { |
640 ChangeMskCommandL( R_FSE_QTN_MSK_OPEN ); |
640 ChangeMskCommandL( R_FSE_QTN_MSK_OPEN ); |
641 } |
641 } |
642 else |
642 else |
643 { |
643 { |
644 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
644 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
645 } |
645 } |
646 } |
646 } |
647 } |
647 } |
648 else |
648 else |
649 { |
649 { |
650 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
650 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
651 } |
651 } |
652 } |
652 } |
653 |
653 |
654 TBool CFSEmailUiDownloadManagerVisualiser::OfferEventL(const TAlfEvent& aEvent) |
654 TBool CFSEmailUiDownloadManagerVisualiser::OfferEventL(const TAlfEvent& aEvent) |
655 { |
655 { |
656 FUNC_LOG; |
656 FUNC_LOG; |
657 TBool result( EFalse ); |
657 TBool result( EFalse ); |
658 SetMskL(); |
658 SetMskL(); |
659 if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey ) |
659 if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey ) |
660 { |
660 { |
661 TInt scanCode = aEvent.KeyEvent().iScanCode; |
661 TInt scanCode = aEvent.KeyEvent().iScanCode; |
662 // Swap right and left controls in mirrored layout |
662 // Swap right and left controls in mirrored layout |
663 if ( AknLayoutUtils::LayoutMirrored() ) |
663 if ( AknLayoutUtils::LayoutMirrored() ) |
664 { |
664 { |
665 if (scanCode == EStdKeyRightArrow) scanCode = EStdKeyLeftArrow; |
665 if (scanCode == EStdKeyRightArrow) scanCode = EStdKeyLeftArrow; |
666 else if (scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow; |
666 else if (scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow; |
667 } |
667 } |
668 |
668 |
669 if ( scanCode == EStdKeyRightArrow ) |
669 if ( scanCode == EStdKeyRightArrow ) |
670 { |
670 { |
671 LaunchActionMenuL(); |
671 LaunchActionMenuL(); |
672 result = ETrue; |
672 result = ETrue; |
673 } |
673 } |
674 else |
674 else |
675 { |
675 { |
676 // Check keyboard shortcuts. |
676 // Check keyboard shortcuts. |
677 TInt shortcutCommand = |
677 TInt shortcutCommand = |
678 iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(), |
678 iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(), |
718 const TAttachmentData& attachment = message.mailAttachments[j]; |
718 const TAttachmentData& attachment = message.mailAttachments[j]; |
719 |
719 |
720 MFsTreeItemVisualizer& attachmentVis = iDownloadManagerList->ItemVisualizer( attachment.treeId ); |
720 MFsTreeItemVisualizer& attachmentVis = iDownloadManagerList->ItemVisualizer( attachment.treeId ); |
721 attachmentVis.SetFontHeight( fontHeight ); |
721 attachmentVis.SetFontHeight( fontHeight ); |
722 } |
722 } |
723 } |
723 } |
724 } |
724 } |
725 |
725 |
726 void CFSEmailUiDownloadManagerVisualiser::ResetColorsL() |
726 void CFSEmailUiDownloadManagerVisualiser::ResetColorsL() |
727 { |
727 { |
728 FUNC_LOG; |
728 FUNC_LOG; |
729 TRgb normalTextColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
729 TRgb normalTextColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
730 TRgb focusedTextColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
730 TRgb focusedTextColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
731 TRgb nodeTextColor = iAppUi.LayoutHandler()->ListNodeTextColor(); |
731 TRgb nodeTextColor = iAppUi.LayoutHandler()->ListNodeTextColor(); |
732 TRgb nodeBgColor = iAppUi.LayoutHandler()->ListNodeBackgroundColor(); |
732 TRgb nodeBgColor = iAppUi.LayoutHandler()->ListNodeBackgroundColor(); |
733 TRgb headerBgColor = iAppUi.LayoutHandler()->ListHeaderBackgroundColor(); |
733 TRgb headerBgColor = iAppUi.LayoutHandler()->ListHeaderBackgroundColor(); |
734 |
734 |
735 // Header item |
735 // Header item |
736 TFsTreeItemId headerId = iDownloadManagerList->Child( KFsTreeRootID, 0 ); |
736 TFsTreeItemId headerId = iDownloadManagerList->Child( KFsTreeRootID, 0 ); |
737 MFsTreeItemVisualizer& headerVis = iDownloadManagerList->ItemVisualizer( headerId ); |
737 MFsTreeItemVisualizer& headerVis = iDownloadManagerList->ItemVisualizer( headerId ); |
738 headerVis.SetNormalStateTextColor( normalTextColor ); |
738 headerVis.SetNormalStateTextColor( normalTextColor ); |
739 headerVis.SetFocusedStateTextColor( focusedTextColor ); |
739 headerVis.SetFocusedStateTextColor( focusedTextColor ); |
740 headerVis.SetBackgroundColor( headerBgColor ); |
740 headerVis.SetBackgroundColor( headerBgColor ); |
741 |
741 |
742 // Mail nodes and attachment items |
742 // Mail nodes and attachment items |
743 const RArray<TMessageData>& modelData = iModel->GetModel(); |
743 const RArray<TMessageData>& modelData = iModel->GetModel(); |
744 for ( TInt i=0 ; i<modelData.Count() ; ++i ) |
744 for ( TInt i=0 ; i<modelData.Count() ; ++i ) |
745 { |
745 { |
746 const TMessageData& message = modelData[ i ]; |
746 const TMessageData& message = modelData[ i ]; |
747 |
747 |
748 MFsTreeItemVisualizer& messageVis = iDownloadManagerList->ItemVisualizer( message.treeId ); |
748 MFsTreeItemVisualizer& messageVis = iDownloadManagerList->ItemVisualizer( message.treeId ); |
749 messageVis.SetNormalStateTextColor( nodeTextColor ); |
749 messageVis.SetNormalStateTextColor( nodeTextColor ); |
750 messageVis.SetFocusedStateTextColor( focusedTextColor ); |
750 messageVis.SetFocusedStateTextColor( focusedTextColor ); |
751 messageVis.SetBackgroundColor( nodeBgColor ); |
751 messageVis.SetBackgroundColor( nodeBgColor ); |
752 |
752 |
753 for ( TInt j=0 ; j<message.mailAttachments.Count() ; j++ ) |
753 for ( TInt j=0 ; j<message.mailAttachments.Count() ; j++ ) |
754 { |
754 { |
755 const TAttachmentData& attachment = message.mailAttachments[j]; |
755 const TAttachmentData& attachment = message.mailAttachments[j]; |
756 |
756 |
757 MFsTreeItemVisualizer& attachmentVis = iDownloadManagerList->ItemVisualizer( attachment.treeId ); |
757 MFsTreeItemVisualizer& attachmentVis = iDownloadManagerList->ItemVisualizer( attachment.treeId ); |
758 attachmentVis.SetNormalStateTextColor( normalTextColor ); |
758 attachmentVis.SetNormalStateTextColor( normalTextColor ); |
759 attachmentVis.SetFocusedStateTextColor( focusedTextColor ); |
759 attachmentVis.SetFocusedStateTextColor( focusedTextColor ); |
760 } |
760 } |
761 } |
761 } |
762 } |
762 } |
763 |
763 |
764 CAlfControl* CFSEmailUiDownloadManagerVisualiser::ViewerControl() |
764 CAlfControl* CFSEmailUiDownloadManagerVisualiser::ViewerControl() |
765 { |
765 { |
766 FUNC_LOG; |
766 FUNC_LOG; |
767 return iScreenControl; |
767 return iScreenControl; |
768 } |
768 } |
769 |
769 |
770 TBool CFSEmailUiDownloadManagerVisualiser::IsCommandAvailableOnItem( TInt aCommandId, |
770 TBool CFSEmailUiDownloadManagerVisualiser::IsCommandAvailableOnItem( TInt aCommandId, |
771 const TAttachmentData* aFocusedItem ) const |
771 const TAttachmentData* aFocusedItem ) const |
772 { |
772 { |
773 FUNC_LOG; |
773 FUNC_LOG; |
839 // Save all is available if there is more than one attachment |
839 // Save all is available if there is more than one attachment |
840 // and none of them are currently being downloaded |
840 // and none of them are currently being downloaded |
841 if ( iModel->AttachmentCount() > 1 ) |
841 if ( iModel->AttachmentCount() > 1 ) |
842 { |
842 { |
843 available = ETrue; |
843 available = ETrue; |
844 for ( TInt i=0; i<model.Count(); i++) |
844 for ( TInt i=0; i<model.Count(); i++) |
845 { |
845 { |
846 const RArray<TAttachmentData>& attachments = model[i].mailAttachments; |
846 const RArray<TAttachmentData>& attachments = model[i].mailAttachments; |
847 for ( TInt j=0 ; j<attachments.Count() ; ++j ) |
847 for ( TInt j=0 ; j<attachments.Count() ; ++j ) |
848 { |
848 { |
849 if ( iAppUi.DownloadInfoMediator() && |
849 if ( iAppUi.DownloadInfoMediator() && |
850 iAppUi.DownloadInfoMediator()->IsDownloading( attachments[j].partData.iMessagePartId ) ) |
850 iAppUi.DownloadInfoMediator()->IsDownloading( attachments[j].partData.iMessagePartId ) ) |
851 { |
851 { |
852 available = EFalse; |
852 available = EFalse; |
853 break; |
853 break; |
854 } |
854 } |
855 } |
855 } |
856 } |
856 } |
857 } |
857 } |
858 } |
858 } |
859 break; |
859 break; |
860 |
860 |
861 case EFsEmailUiCmdCancelAllDownloads: |
861 case EFsEmailUiCmdCancelAllDownloads: |
862 case FsEActionAttachmentCancelAllDownloads: |
862 case FsEActionAttachmentCancelAllDownloads: |
863 { |
863 { |
864 // Cancel all is available if there is more than one ongoing download |
864 // Cancel all is available if there is more than one ongoing download |
865 TInt downloads = 0; |
865 TInt downloads = 0; |
866 for ( TInt i=0; i<model.Count(); i++) |
866 for ( TInt i=0; i<model.Count(); i++) |
867 { |
867 { |
868 const RArray<TAttachmentData>& attachments = model[i].mailAttachments; |
868 const RArray<TAttachmentData>& attachments = model[i].mailAttachments; |
869 for ( TInt j=0 ; j<attachments.Count() ; ++j ) |
869 for ( TInt j=0 ; j<attachments.Count() ; ++j ) |
870 { |
870 { |
871 if ( iAppUi.DownloadInfoMediator() && |
871 if ( iAppUi.DownloadInfoMediator() && |
872 iAppUi.DownloadInfoMediator()->IsDownloading( attachments[j].partData.iMessagePartId ) ) |
872 iAppUi.DownloadInfoMediator()->IsDownloading( attachments[j].partData.iMessagePartId ) ) |
873 { |
873 { |
874 downloads++; |
874 downloads++; |
875 } |
875 } |
876 } |
876 } |
877 } |
877 } |
878 if ( downloads > 1 ) |
878 if ( downloads > 1 ) |
879 { |
879 { |
880 available = ETrue; |
880 available = ETrue; |
881 } |
881 } |
882 } |
882 } |
883 break; |
883 break; |
884 |
884 |
885 case EFsEmailUiCmdDownloadAll: |
885 case EFsEmailUiCmdDownloadAll: |
886 case FsEActionAttachmentDownloadAll: |
886 case FsEActionAttachmentDownloadAll: |
887 { |
887 { |
888 // Download all is available there is more than one attachments for which |
888 // Download all is available there is more than one attachments for which |
889 // "Download" command is available. |
889 // "Download" command is available. |
890 TInt downloadableFiles = 0; |
890 TInt downloadableFiles = 0; |
891 for ( TInt i=0; i<model.Count(); i++) |
891 for ( TInt i=0; i<model.Count(); i++) |
892 { |
892 { |
893 const RArray<TAttachmentData>& attachments = model[i].mailAttachments; |
893 const RArray<TAttachmentData>& attachments = model[i].mailAttachments; |
894 for ( TInt j=0 ; j<attachments.Count() ; ++j ) |
894 for ( TInt j=0 ; j<attachments.Count() ; ++j ) |
895 { |
895 { |
896 if ( IsCommandAvailableOnItem( EFsEmailUiCmdDownload, &attachments[j] ) ) |
896 if ( IsCommandAvailableOnItem( EFsEmailUiCmdDownload, &attachments[j] ) ) |
897 { |
897 { |
898 downloadableFiles++; |
898 downloadableFiles++; |
899 } |
899 } |
900 } |
900 } |
901 } |
901 } |
902 if ( downloadableFiles > 1 ) |
902 if ( downloadableFiles > 1 ) |
903 { |
903 { |
904 available = ETrue; |
904 available = ETrue; |
905 } |
905 } |
906 } |
906 } |
907 break; |
907 break; |
908 |
908 |
909 case EFsEmailUiCmdMailActions: |
909 case EFsEmailUiCmdMailActions: |
910 { |
910 { |
1112 iModel->SetNodeIdL( aIndex, parentNode ); |
1112 iModel->SetNodeIdL( aIndex, parentNode ); |
1113 } |
1113 } |
1114 |
1114 |
1115 // Insert or update the attachment items |
1115 // Insert or update the attachment items |
1116 for ( TInt j = 0 ; j < message.mailAttachments.Count() ; j++ ) |
1116 for ( TInt j = 0 ; j < message.mailAttachments.Count() ; j++ ) |
1117 { |
1117 { |
1118 HBufC* secondLine = CreateSecondLineTextLC( message.mailAttachments[j] ); |
1118 HBufC* secondLine = CreateSecondLineTextLC( message.mailAttachments[j] ); |
1119 |
1119 |
1120 //is the item already drawn |
1120 //is the item already drawn |
1121 TFsTreeItemId itemId = message.mailAttachments[j].treeId; |
1121 TFsTreeItemId itemId = message.mailAttachments[j].treeId; |
1122 if ( itemId != KFsTreeNoneID ) |
1122 if ( itemId != KFsTreeNoneID ) |
1123 { |
1123 { |
1124 // Item is already present. Update the existing item but only if the second line data |
1124 // Item is already present. Update the existing item but only if the second line data |
1125 // is actually changed. |
1125 // is actually changed. |
1126 CFsTreePlainTwoLineItemData& itemData = |
1126 CFsTreePlainTwoLineItemData& itemData = |
1127 static_cast<CFsTreePlainTwoLineItemData&>( iDownloadManagerList->ItemData( itemId ) ); |
1127 static_cast<CFsTreePlainTwoLineItemData&>( iDownloadManagerList->ItemData( itemId ) ); |
1128 |
1128 |
1129 if ( itemData.SecondaryData() != *secondLine ) |
1129 if ( itemData.SecondaryData() != *secondLine ) |
1130 { |
1130 { |
1131 itemData.SetSecondaryDataL( *secondLine ); |
1131 itemData.SetSecondaryDataL( *secondLine ); |
1132 iDownloadManagerTreeListVisualizer->UpdateItemL( itemId ); |
1132 iDownloadManagerTreeListVisualizer->UpdateItemL( itemId ); |
1133 |
1133 |
1134 // Update the MSK label if the updated item happens to be the focused item |
1134 // Update the MSK label if the updated item happens to be the focused item |
1135 if ( itemId == iDownloadManagerList->FocusedItem() ) |
1135 if ( itemId == iDownloadManagerList->FocusedItem() ) |
1136 { |
1136 { |
1137 SetMskL(); |
1137 SetMskL(); |
1138 } |
1138 } |
1139 } |
1139 } |
1140 } |
1140 } |
1141 else |
1141 else |
1142 { |
1142 { |
1143 //create and draw new item |
1143 //create and draw new item |
1144 CFsTreePlainTwoLineItemData* twoLineItemData = CFsTreePlainTwoLineItemData::NewL(); |
1144 CFsTreePlainTwoLineItemData* twoLineItemData = CFsTreePlainTwoLineItemData::NewL(); |
1145 CleanupStack::PushL( twoLineItemData ); |
1145 CleanupStack::PushL( twoLineItemData ); |
1146 |
1146 |
1147 twoLineItemData->SetDataL( message.mailAttachments[j].fileName ); |
1147 twoLineItemData->SetDataL( message.mailAttachments[j].fileName ); |
1148 twoLineItemData->SetSecondaryDataL( *secondLine ); |
1148 twoLineItemData->SetSecondaryDataL( *secondLine ); |
1149 |
1149 |
1150 CAlfTexture& itemTexture = TFsEmailUiUtility::GetAttachmentIcon( message.mailAttachments[j].fileType, |
1150 CAlfTexture& itemTexture = TFsEmailUiUtility::GetAttachmentIcon( message.mailAttachments[j].fileType, |
1151 *iAppUi.FsTextureManager() ); |
1151 *iAppUi.FsTextureManager() ); |
1152 twoLineItemData->SetIcon( itemTexture ); |
1152 twoLineItemData->SetIcon( itemTexture ); |
1153 |
1153 |
1154 CFsTreePlainTwoLineItemVisualizer* twoLineItemVisualizer = |
1154 CFsTreePlainTwoLineItemVisualizer* twoLineItemVisualizer = |
1155 CFsTreePlainTwoLineItemVisualizer::NewL( *iDownloadManagerList->TreeControl() ); |
1155 CFsTreePlainTwoLineItemVisualizer::NewL( *iDownloadManagerList->TreeControl() ); |
1156 CleanupStack::PushL( twoLineItemVisualizer ); |
1156 CleanupStack::PushL( twoLineItemVisualizer ); |
1157 twoLineItemVisualizer->SetFlags( twoLineItemVisualizer->Flags() | KFsTreeListItemHasMenu ); |
1157 twoLineItemVisualizer->SetFlags( twoLineItemVisualizer->Flags() | KFsTreeListItemHasMenu ); |
1158 twoLineItemVisualizer->SetExtendable( ETrue ); |
1158 twoLineItemVisualizer->SetExtendable( ETrue ); |
1159 CAlfTextStyle* textStyle = iAppUi.LayoutHandler()->FSTextStyleFromIdL( EFSFontTypeSmall ); |
1159 CAlfTextStyle* textStyle = iAppUi.LayoutHandler()->FSTextStyleFromIdL( EFSFontTypeSmall ); |
1160 twoLineItemVisualizer->SetTextStyleId( textStyle->Id() ); |
1160 twoLineItemVisualizer->SetTextStyleId( textStyle->Id() ); |
1161 // Set font height |
1161 // Set font height |
1162 twoLineItemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
1162 twoLineItemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
1163 // Set font bolding |
1163 // Set font bolding |
1164 twoLineItemVisualizer->SetTextBold( EFalse ); |
1164 twoLineItemVisualizer->SetTextBold( EFalse ); |
1165 // Set correct skin text colors for the list items |
1165 // Set correct skin text colors for the list items |
1166 twoLineItemVisualizer->SetFocusedStateTextColor( focusedColor ); |
1166 twoLineItemVisualizer->SetFocusedStateTextColor( focusedColor ); |
1167 twoLineItemVisualizer->SetNormalStateTextColor( normalItemColor ); |
1167 twoLineItemVisualizer->SetNormalStateTextColor( normalItemColor ); |
1168 TFsTreeItemId treeItemId = |
1168 TFsTreeItemId treeItemId = |
1169 iDownloadManagerList->InsertItemL( *twoLineItemData, *twoLineItemVisualizer, message.treeId, j ); |
1169 iDownloadManagerList->InsertItemL( *twoLineItemData, *twoLineItemVisualizer, message.treeId, j ); |
1170 CleanupStack::Pop( twoLineItemVisualizer ); // ownership transferred to TreeList |
1170 CleanupStack::Pop( twoLineItemVisualizer ); // ownership transferred to TreeList |
1171 CleanupStack::Pop( twoLineItemData ); // ownership transferred to TreeList |
1171 CleanupStack::Pop( twoLineItemData ); // ownership transferred to TreeList |
1172 iModel->SetItemIdL( aIndex, j, treeItemId ); |
1172 iModel->SetItemIdL( aIndex, j, treeItemId ); |
1173 } |
1173 } |
1174 |
1174 |
1175 CleanupStack::PopAndDestroy( secondLine ); |
1175 CleanupStack::PopAndDestroy( secondLine ); |
1176 } |
1176 } |
1177 } |
1177 } |
1178 } |
1178 } |
1179 |
1179 |
1180 // <cmail> Touch |
1180 // <cmail> Touch |
1181 void CFSEmailUiDownloadManagerVisualiser::TreeListEventL( |
1181 void CFSEmailUiDownloadManagerVisualiser::TreeListEventL( |
1182 const TFsTreeListEvent aEvent, const TFsTreeItemId aId ) |
1182 const TFsTreeListEvent aEvent, const TFsTreeItemId aId ) |
1183 // </cmail> |
1183 // </cmail> |
1184 { |
1184 { |
1185 FUNC_LOG; |
1185 FUNC_LOG; |
1186 if ( aEvent == EFsTreeItemSelected ) |
1186 if ( aEvent == EFsTreeItemSelected ) |
1187 { |
1187 { |
1188 TRAPD( err, TryToOpenItemL( aId ) ); |
1188 TRAPD( err, TryToOpenItemL( aId ) ); |
1189 if ( err != KErrNone ) |
1189 if ( err != KErrNone ) |
1190 { |
1190 { |
1191 } |
1191 } |
1192 } |
1192 } |
1193 } |
1193 } |
1194 |
1194 |
1195 void CFSEmailUiDownloadManagerVisualiser::LaunchActionMenuL() |
1195 void CFSEmailUiDownloadManagerVisualiser::LaunchActionMenuL() |
1196 { |
1196 { |
1197 FUNC_LOG; |
1197 FUNC_LOG; |
1198 |
1198 |
1199 TAttachmentData* selectedItem = NULL; |
1199 TAttachmentData* selectedItem = NULL; |
1200 |
1200 |
1201 TRAPD( err, selectedItem = &iModel->GetItemL( iDownloadManagerList->FocusedItem() ) ); |
1201 TRAPD( err, selectedItem = &iModel->GetItemL( iDownloadManagerList->FocusedItem() ) ); |
1202 |
1202 |
1203 if ( !err ) |
1203 if ( !err ) |
1204 { |
1204 { |
1205 // Remove old items from action menu |
1205 // Remove old items from action menu |
1206 CFSEmailUiActionMenu::RemoveAllL(); |
1206 CFSEmailUiActionMenu::RemoveAllL(); |
1207 |
1207 |
1208 // Construct item list |
1208 // Construct item list |
1209 RFsEActionMenuIdList itemList; |
1209 RFsEActionMenuIdList itemList; |
1210 CleanupClosePushL( itemList ); |
1210 CleanupClosePushL( itemList ); |
1211 |
1211 |
1212 if ( IsCommandAvailableOnItem( FsEActionAttachmentOpen, selectedItem ) ) |
1212 if ( IsCommandAvailableOnItem( FsEActionAttachmentOpen, selectedItem ) ) |
1213 { |
1213 { |
1214 itemList.AppendL( FsEActionAttachmentOpen ); |
1214 itemList.AppendL( FsEActionAttachmentOpen ); |
1215 } |
1215 } |
1216 |
1216 |
1217 if ( IsCommandAvailableOnItem( FsEActionAttachmentDownload, selectedItem ) ) |
1217 if ( IsCommandAvailableOnItem( FsEActionAttachmentDownload, selectedItem ) ) |
1218 { |
1218 { |
1219 itemList.AppendL( FsEActionAttachmentDownload ); |
1219 itemList.AppendL( FsEActionAttachmentDownload ); |
1220 } |
1220 } |
1221 |
1221 |
1222 if ( IsCommandAvailableOnItem( FsEActionAttachmentDownloadAll, selectedItem ) ) |
1222 if ( IsCommandAvailableOnItem( FsEActionAttachmentDownloadAll, selectedItem ) ) |
1223 { |
1223 { |
1224 itemList.AppendL( FsEActionAttachmentDownloadAll ); |
1224 itemList.AppendL( FsEActionAttachmentDownloadAll ); |
1225 } |
1225 } |
1226 |
1226 |
1227 if ( IsCommandAvailableOnItem( FsEActionAttachmentCancelDownload, selectedItem ) ) |
1227 if ( IsCommandAvailableOnItem( FsEActionAttachmentCancelDownload, selectedItem ) ) |
1228 { |
1228 { |
1229 itemList.AppendL( FsEActionAttachmentCancelDownload ); |
1229 itemList.AppendL( FsEActionAttachmentCancelDownload ); |
1230 } |
1230 } |
1231 |
1231 |
1232 if ( IsCommandAvailableOnItem( FsEActionAttachmentCancelAllDownloads, selectedItem ) ) |
1232 if ( IsCommandAvailableOnItem( FsEActionAttachmentCancelAllDownloads, selectedItem ) ) |
1233 { |
1233 { |
1234 itemList.AppendL( FsEActionAttachmentCancelAllDownloads ); |
1234 itemList.AppendL( FsEActionAttachmentCancelAllDownloads ); |
1235 } |
1235 } |
1236 |
1236 |
1237 if ( IsCommandAvailableOnItem( FsEActionAttachmentSave, selectedItem ) ) |
1237 if ( IsCommandAvailableOnItem( FsEActionAttachmentSave, selectedItem ) ) |
1238 { |
1238 { |
1239 itemList.AppendL( FsEActionAttachmentSave ); |
1239 itemList.AppendL( FsEActionAttachmentSave ); |
1240 } |
1240 } |
1241 |
1241 |
1242 if ( IsCommandAvailableOnItem( FsEActionAttachmentSaveAll, selectedItem ) ) |
1242 if ( IsCommandAvailableOnItem( FsEActionAttachmentSaveAll, selectedItem ) ) |
1243 { |
1243 { |
1244 itemList.AppendL( FsEActionAttachmentSaveAll ); |
1244 itemList.AppendL( FsEActionAttachmentSaveAll ); |
1245 } |
1245 } |
1246 |
1246 |