emailuis/emailui/src/FreestyleEmailUiDownloadManagerVisualiser.cpp
branchRCL_3
changeset 8 e1b6206813b4
parent 0 8466d47a6819
equal deleted inserted replaced
4:e7aa27f58ae1 8:e1b6206813b4
    17 
    17 
    18 
    18 
    19 
    19 
    20 // SYSTEM INCLUDES
    20 // SYSTEM INCLUDES
    21 #include "emailtrace.h"
    21 #include "emailtrace.h"
    22 #include <FreestyleEmailUi.mbg>
    22 #include <freestyleemailui.mbg>
    23 #include <aknutils.h>
    23 #include <AknUtils.h>
    24 #include <gulicon.h>
    24 #include <gulicon.h>
    25 #include <StringLoader.h>
    25 #include <StringLoader.h>
    26 #include <FreestyleEmailUi.rsg>
    26 #include <FreestyleEmailUi.rsg>
    27 // <cmail> SF
    27 // <cmail> SF
    28 #include <alf/alfframebrush.h>
    28 #include <alf/alfframebrush.h>
    35 #include "fstreeplainonelinenodedata.h"
    35 #include "fstreeplainonelinenodedata.h"
    36 #include "fstreeplainonelinenodevisualizer.h"
    36 #include "fstreeplainonelinenodevisualizer.h"
    37 #include "fstreeplaintwolineitemdata.h"
    37 #include "fstreeplaintwolineitemdata.h"
    38 #include "fstreeplaintwolineitemvisualizer.h"
    38 #include "fstreeplaintwolineitemvisualizer.h"
    39 // </cmail>
    39 // </cmail>
    40 #include <AknListQueryDialog.h>
    40 #include <aknlistquerydialog.h>
    41 #include <caknfileselectiondialog.h>
    41 #include <CAknFileSelectionDialog.h>
    42 #include <caknmemoryselectiondialog.h>
    42 #include <CAknMemorySelectionDialog.h>
    43 #include <pathinfo.h>
    43 #include <pathinfo.h>
    44 #include <aknnotewrappers.h>
    44 #include <aknnotewrappers.h>
    45 // <cmail> SF
    45 // <cmail> SF
    46 #include <alf/alfdecklayout.h>
    46 #include <alf/alfdecklayout.h>
    47 #include <alf/alfevent.h>
    47 #include <alf/alfevent.h>
    48 #include <alf/alfcontrolgroup.h>
    48 #include <alf/alfcontrolgroup.h>
    49 #include <csxhelp/cmail.hlp.hrh>
    49 #include <csxhelp/cmail.hlp.hrh>
    50 #include "mfsmailbrandmanager.h"
    50 #include "mfsmailbrandmanager.h"
    51 #include "cfsmailclient.h"
    51 #include "cfsmailclient.h"
    52 //</cmail>
    52 //</cmail>
    53 #include <FeatMgr.h>
    53 #include <featmgr.h>
    54 //</cmail>
    54 //</cmail>
    55 
    55 
    56 // INTERNAL INCLUDES
    56 // INTERNAL INCLUDES
    57 #include "FreestyleEmailUiAttachmentsListVisualiser.h"
    57 #include "FreestyleEmailUiAttachmentsListVisualiser.h"
    58 #include "FreestyleEmailUiLayoutHandler.h"
    58 #include "FreestyleEmailUiLayoutHandler.h"
    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 //
   185 void CFSEmailUiDownloadManagerVisualiser::ChildDoActivateL( 
   185 void CFSEmailUiDownloadManagerVisualiser::ChildDoActivateL( 
   186         const TVwsViewId& /*aPrevViewId*/,
   186         const TVwsViewId& /*aPrevViewId*/,
   187         TUid /*aCustomMessageId*/,
   187         TUid /*aCustomMessageId*/,
   188         const TDesC8& /*aCustomMessage*/ )
   188         const TDesC8& /*aCustomMessage*/ )
   189 // <cmail> Toolbar
   189 // <cmail> Toolbar
   190 	{
   190     {
   191     FUNC_LOG;
   191     FUNC_LOG;
   192 	RefreshL();
   192     RefreshL();
   193 	iDownloadManagerList->ShowListL();
   193     iDownloadManagerList->ShowListL();
   194 	
   194     
   195 	SetMailboxNameToStatusPaneL();
   195     SetMailboxNameToStatusPaneL();
   196 	}
   196     }
   197 
   197 
   198 void CFSEmailUiDownloadManagerVisualiser::SetMailboxNameToStatusPaneL()
   198 void CFSEmailUiDownloadManagerVisualiser::SetMailboxNameToStatusPaneL()
   199 	{
   199     {
   200     FUNC_LOG;
   200     FUNC_LOG;
   201 	iAppUi.SetActiveMailboxNameToStatusPaneL();
   201     iAppUi.SetActiveMailboxNameToStatusPaneL();
   202 	}
   202     }
   203 
   203 
   204 // ---------------------------------------------------------------------------
   204 // ---------------------------------------------------------------------------
   205 // CFSEmailUiDownloadManagerVisualiser::ChildDoDeactivate
   205 // CFSEmailUiDownloadManagerVisualiser::ChildDoDeactivate
   206 // ---------------------------------------------------------------------------
   206 // ---------------------------------------------------------------------------
   207 //
   207 //
   208 void CFSEmailUiDownloadManagerVisualiser::ChildDoDeactivate()
   208 void CFSEmailUiDownloadManagerVisualiser::ChildDoDeactivate()
   209 	{
   209     {
   210     FUNC_LOG;
   210     FUNC_LOG;
   211     if ( !iAppUi.AppUiExitOngoing() )
   211     if ( !iAppUi.AppUiExitOngoing() )
   212         {
   212         {
   213         iDownloadManagerTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
   213         iDownloadManagerTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
   214         }
   214         }
   215     }	
   215     }   
   216 	
   216     
   217 CFSEmailUiDownloadManagerModel* CFSEmailUiDownloadManagerVisualiser::Model()
   217 CFSEmailUiDownloadManagerModel* CFSEmailUiDownloadManagerVisualiser::Model()
   218 	{
   218     {
   219     FUNC_LOG;
   219     FUNC_LOG;
   220 	return iModel;	
   220     return iModel;  
   221 	}
   221     }
   222 
   222 
   223 void CFSEmailUiDownloadManagerVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
   223 void CFSEmailUiDownloadManagerVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
   224     {
   224     {
   225     FUNC_LOG;
   225     FUNC_LOG;
   226     TAttachmentData* selectedItem = iModel->GetItem( iDownloadManagerList->FocusedItem() );      
   226     TAttachmentData* selectedItem = iModel->GetItem( iDownloadManagerList->FocusedItem() );      
   255                 !IsCommandAvailableOnItem(EFsEmailUiCmdRemoveAttachment, selectedItem) );
   255                 !IsCommandAvailableOnItem(EFsEmailUiCmdRemoveAttachment, selectedItem) );
   256         }
   256         }
   257     else if ( aResourceId == R_FSEMAILUI_DOWNLOADMANAGER_MENUPANE )
   257     else if ( aResourceId == R_FSEMAILUI_DOWNLOADMANAGER_MENUPANE )
   258         {
   258         {
   259         if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
   259         if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
   260     	   {
   260            {
   261     	   // remove help support in pf5250
   261            // remove help support in pf5250
   262     	   aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);      
   262            aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);      
   263     	   }        
   263            }        
   264         
   264         
   265         aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions,
   265         aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions,
   266                 !IsCommandAvailableOnItem(EFsEmailUiCmdMailActions, selectedItem) );
   266                 !IsCommandAvailableOnItem(EFsEmailUiCmdMailActions, selectedItem) );
   267 
   267 
   268         // Hide message related commands if no message in focus.
   268         // Hide message related commands if no message in focus.
   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(),
   683                 result = ETrue;
   683                 result = ETrue;
   684                 }
   684                 }
   685             }
   685             }
   686         }
   686         }
   687 
   687 
   688 	/*
   688     /*
   689     if (!result)
   689     if (!result)
   690         {
   690         {
   691         result = iDownloadManagerList->TreeControl()->OfferEventL(aEvent);
   691         result = iDownloadManagerList->TreeControl()->OfferEventL(aEvent);
   692         }
   692         }
   693 	*/
   693     */
   694     return result;
   694     return result;
   695     }
   695     }
   696 
   696 
   697 void CFSEmailUiDownloadManagerVisualiser::ReScaleUiL()
   697 void CFSEmailUiDownloadManagerVisualiser::ReScaleUiL()
   698 	{
   698     {
   699     FUNC_LOG;
   699     FUNC_LOG;
   700     TInt fontHeight = iAppUi.LayoutHandler()->ListItemFontHeightInTwips();
   700     TInt fontHeight = iAppUi.LayoutHandler()->ListItemFontHeightInTwips();
   701     
   701     
   702     // Header item
   702     // Header item
   703     TFsTreeItemId headerId = iDownloadManagerList->Child( KFsTreeRootID, 0 );
   703     TFsTreeItemId headerId = iDownloadManagerList->Child( KFsTreeRootID, 0 );
   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;
   782         // <cmail> Disabled until plugins support this.
   782         // <cmail> Disabled until plugins support this.
   783         //case EFsEmailUiCmdClearFetchedAttachment:
   783         //case EFsEmailUiCmdClearFetchedAttachment:
   784         //case FsEActionAttachmentClearFetchedContent:
   784         //case FsEActionAttachmentClearFetchedContent:
   785         // </cmail>
   785         // </cmail>
   786             {
   786             {
   787     		if ( aFocusedItem && aFocusedItem->downloadProgress == KComplete )
   787             if ( aFocusedItem && aFocusedItem->downloadProgress == KComplete )
   788     			{
   788                 {
   789     			available = ETrue;
   789                 available = ETrue;
   790     			}
   790                 }
   791             }
   791             }
   792             break;
   792             break;
   793 
   793 
   794         // <cmail>
   794         // <cmail>
   795         case FsEActionAttachmentClearFetchedContent:
   795         case FsEActionAttachmentClearFetchedContent:
   801         case EFsEmailUiCmdDownload:
   801         case EFsEmailUiCmdDownload:
   802         case FsEActionAttachmentDownload:
   802         case FsEActionAttachmentDownload:
   803         case EFsEmailUiCmdRemoveAttachment:
   803         case EFsEmailUiCmdRemoveAttachment:
   804         case FsEActionAttachmentRemoveUnfetchedAttachment:
   804         case FsEActionAttachmentRemoveUnfetchedAttachment:
   805             {
   805             {
   806     		if ( iAppUi.DownloadInfoMediator() && aFocusedItem && aFocusedItem->downloadProgress == KNone && 
   806             if ( iAppUi.DownloadInfoMediator() && aFocusedItem && aFocusedItem->downloadProgress == KNone && 
   807     		     !iAppUi.DownloadInfoMediator()->IsDownloading( aFocusedItem->partData.iMessagePartId ) )
   807                  !iAppUi.DownloadInfoMediator()->IsDownloading( aFocusedItem->partData.iMessagePartId ) )
   808     			{
   808                 {
   809     			available = ETrue;
   809                 available = ETrue;
   810     			}
   810                 }
   811             }
   811             }
   812             break;
   812             break;
   813 
   813 
   814         case EFsEmailUiCmdCancelDownload:
   814         case EFsEmailUiCmdCancelDownload:
   815         case FsEActionAttachmentCancelDownload:
   815         case FsEActionAttachmentCancelDownload:
   816             {
   816             {
   817     		if ( iAppUi.DownloadInfoMediator() && aFocusedItem && 
   817             if ( iAppUi.DownloadInfoMediator() && aFocusedItem && 
   818     			 iAppUi.DownloadInfoMediator()->IsDownloading( aFocusedItem->partData.iMessagePartId ) )
   818                  iAppUi.DownloadInfoMediator()->IsDownloading( aFocusedItem->partData.iMessagePartId ) )
   819     			{
   819                 {
   820     			available = ETrue;
   820                 available = ETrue;
   821     			}
   821                 }
   822             }
   822             }
   823             break;
   823             break;
   824 
   824 
   825         case EFsEmailUiCmdSave:
   825         case EFsEmailUiCmdSave:
   826         case FsEActionAttachmentSave:
   826         case FsEActionAttachmentSave:
   827             {
   827             {
   828     		if ( iAppUi.DownloadInfoMediator() && aFocusedItem && 
   828             if ( iAppUi.DownloadInfoMediator() && aFocusedItem && 
   829     			 !iAppUi.DownloadInfoMediator()->IsDownloading( aFocusedItem->partData.iMessagePartId ) )
   829                  !iAppUi.DownloadInfoMediator()->IsDownloading( aFocusedItem->partData.iMessagePartId ) )
   830     			{
   830                 {
   831     			available = ETrue;
   831                 available = ETrue;
   832     			}
   832                 }
   833             }
   833             }
   834             break;
   834             break;
   835 
   835 
   836         case EFsEmailUiCmdSaveAll:
   836         case EFsEmailUiCmdSaveAll:
   837         case FsEActionAttachmentSaveAll:
   837         case FsEActionAttachmentSaveAll:
   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             {
   932 
   932 
   933 HBufC* CFSEmailUiDownloadManagerVisualiser::CreateSecondLineTextLC( const TAttachmentData& aAttachment ) const
   933 HBufC* CFSEmailUiDownloadManagerVisualiser::CreateSecondLineTextLC( const TAttachmentData& aAttachment ) const
   934     {
   934     {
   935     FUNC_LOG;
   935     FUNC_LOG;
   936     // File extension
   936     // File extension
   937 	TPtrC extString = TParsePtrC( aAttachment.fileName ).Ext();
   937     TPtrC extString = TParsePtrC( aAttachment.fileName ).Ext();
   938 	// It seems to vary if preceeding dot is included in the file extension. Remove it if present.
   938     // It seems to vary if preceeding dot is included in the file extension. Remove it if present.
   939 	if ( extString.Length() && extString[0] == '.' )
   939     if ( extString.Length() && extString[0] == '.' )
   940 	    {
   940         {
   941 	    extString.Set( extString.Mid(1) );
   941         extString.Set( extString.Mid(1) );
   942 	    }
   942         }
   943 
   943 
   944     // File size	
   944     // File size    
   945 	HBufC* sizeString = iModel->CreateSizeDescLC( aAttachment.fileSize );
   945     HBufC* sizeString = iModel->CreateSizeDescLC( aAttachment.fileSize );
   946 
   946 
   947     // Download progress
   947     // Download progress
   948     HBufC* progressString = NULL;
   948     HBufC* progressString = NULL;
   949 	if ( iAppUi.DownloadInfoMediator() && iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
   949     if ( iAppUi.DownloadInfoMediator() && iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
   950 		{
   950         {
   951 		progressString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_LIST_DOWNLOADING, aAttachment.downloadProgress  );
   951         progressString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_LIST_DOWNLOADING, aAttachment.downloadProgress  );
   952 		}
   952         }
   953 	else if ( aAttachment.downloadProgress == KComplete )
   953     else if ( aAttachment.downloadProgress == KComplete )
   954 	    {
   954         {
   955 		progressString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_LIST_DOWNLOADED_100 );
   955         progressString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_LIST_DOWNLOADED_100 );
   956 	    }
   956         }
   957 	else
   957     else
   958 	    {
   958         {
   959 	    progressString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_LIST_DOWNLOADING_CANCELLED );
   959         progressString = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_LIST_DOWNLOADING_CANCELLED );
   960 	    }
   960         }
   961 
   961 
   962     // Combine the accumulated data to one buffer
   962     // Combine the accumulated data to one buffer
   963     HBufC* result = HBufC::NewL( extString.Length() + 
   963     HBufC* result = HBufC::NewL( extString.Length() + 
   964                                  KSpace().Length() + 
   964                                  KSpace().Length() + 
   965                                  sizeString->Length() + 
   965                                  sizeString->Length() + 
   969     resultPtr.Append( extString );
   969     resultPtr.Append( extString );
   970     resultPtr.Append( KSpace );
   970     resultPtr.Append( KSpace );
   971     resultPtr.Append( *sizeString );
   971     resultPtr.Append( *sizeString );
   972     resultPtr.Append( KSpace );
   972     resultPtr.Append( KSpace );
   973     resultPtr.Append( *progressString );
   973     resultPtr.Append( *progressString );
   974     	
   974         
   975 	CleanupStack::PopAndDestroy( progressString );
   975     CleanupStack::PopAndDestroy( progressString );
   976 	CleanupStack::PopAndDestroy( sizeString );
   976     CleanupStack::PopAndDestroy( sizeString );
   977 	
   977     
   978 	CleanupStack::PushL( result );
   978     CleanupStack::PushL( result );
   979 	return result;
   979     return result;
   980     }
   980     }
   981 
   981 
   982 // ---------------------------------------------------------------------------
   982 // ---------------------------------------------------------------------------
   983 // Attempt to open the focused item. Start downloading if the item is not
   983 // Attempt to open the focused item. Start downloading if the item is not
   984 // downloaded or show note if it's currently being downloaded.
   984 // downloaded or show note if it's currently being downloaded.
   990     TAttachmentData* attachment = NULL;
   990     TAttachmentData* attachment = NULL;
   991     
   991     
   992     TRAPD( err, attachment = &iModel->GetItemL( aId ) );
   992     TRAPD( err, attachment = &iModel->GetItemL( aId ) );
   993     
   993     
   994     if( !err )
   994     if( !err )
   995     	{
   995         {
   996 	    if ( attachment )
   996         if ( attachment )
   997 	        {
   997             {
   998 	        if ( iModel->IsDownloading( *attachment ) )
   998             if ( iModel->IsDownloading( *attachment ) )
   999 	            {
   999                 {
  1000 	            TFsEmailUiUtility::ShowInfoNoteL( R_FSE_VIEWER_NOTE_ATTACHMENT_DOWNLOADING_PROGRESS );
  1000                 TFsEmailUiUtility::ShowInfoNoteL( R_FSE_VIEWER_NOTE_ATTACHMENT_DOWNLOADING_PROGRESS );
  1001 	            }
  1001                 }
  1002 	        else if ( attachment->downloadProgress != KComplete )
  1002             else if ( attachment->downloadProgress != KComplete )
  1003 	            {
  1003                 {
  1004 	            TInt restartDownload = 
  1004                 TInt restartDownload = 
  1005 	                TFsEmailUiUtility::ShowConfirmationQueryL( R_FSE_VIEWER_NOTE_ATTACHMENT_RESTART_DOWNLOADING );
  1005                     TFsEmailUiUtility::ShowConfirmationQueryL( R_FSE_VIEWER_NOTE_ATTACHMENT_RESTART_DOWNLOADING );
  1006 	            if ( restartDownload )
  1006                 if ( restartDownload )
  1007 	                {
  1007                     {
  1008 	                HandleCommandL( EFsEmailUiCmdDownload );
  1008                     HandleCommandL( EFsEmailUiCmdDownload );
  1009 	                }
  1009                     }
  1010 	            }
  1010                 }
  1011 	        else
  1011             else
  1012 	            {
  1012                 {
  1013 	            TFsEmailUiUtility::OpenAttachmentL( attachment->partData );
  1013                 TFsEmailUiUtility::OpenAttachmentL( attachment->partData );
  1014 	            }
  1014                 }
  1015 	        }
  1015             }
  1016 	    }
  1016         }
  1017     }
  1017     }
  1018 
  1018 
  1019 // ---------------------------------------------------------------------------
  1019 // ---------------------------------------------------------------------------
  1020 // Show confirmation note and remove contents of given attachment item
  1020 // Show confirmation note and remove contents of given attachment item
  1021 // if user accepts. Does nothing if given ID doesn't match an attachment item.
  1021 // if user accepts. Does nothing if given ID doesn't match an attachment item.
  1069             }
  1069             }
  1070         }
  1070         }
  1071     }
  1071     }
  1072 
  1072 
  1073 void CFSEmailUiDownloadManagerVisualiser::DownloadStatusChangedL( TInt aIndex )
  1073 void CFSEmailUiDownloadManagerVisualiser::DownloadStatusChangedL( TInt aIndex )
  1074 	{
  1074     {
  1075     FUNC_LOG;
  1075     FUNC_LOG;
  1076 	if ( iAppUi.CurrentActiveView() == this &&
  1076     if ( iAppUi.CurrentActiveView() == this &&
  1077 	     aIndex < iModel->GetModel().Count() &&
  1077          aIndex < iModel->GetModel().Count() &&
  1078 	     !iAppUi.AppUiExitOngoing() )
  1078          !iAppUi.AppUiExitOngoing() )
  1079 	    {
  1079         {
  1080       	TRect screenRect;
  1080         TRect screenRect;
  1081      	AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );	
  1081         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );   
  1082     
  1082     
  1083        	TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
  1083         TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
  1084        	TRgb normalItemColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
  1084         TRgb normalItemColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
  1085        	TRgb normalNodeColor = iAppUi.LayoutHandler()->ListNodeTextColor();
  1085         TRgb normalNodeColor = iAppUi.LayoutHandler()->ListNodeTextColor();
  1086     
  1086     
  1087     	const RArray<TMessageData>& modelData = iModel->GetModel();
  1087         const RArray<TMessageData>& modelData = iModel->GetModel();
  1088     	const TMessageData& message = modelData[ aIndex ];
  1088         const TMessageData& message = modelData[ aIndex ];
  1089     	
  1089         
  1090         // Insert the message node if it's not yet present
  1090         // Insert the message node if it's not yet present
  1091         if ( message.treeId == KFsTreeNoneID )
  1091         if ( message.treeId == KFsTreeNoneID )
  1092             {
  1092             {
  1093             CFsTreePlainOneLineNodeData* separatorData = CFsTreePlainOneLineNodeData::NewL();
  1093             CFsTreePlainOneLineNodeData* separatorData = CFsTreePlainOneLineNodeData::NewL();
  1094             CleanupStack::PushL( separatorData );
  1094             CleanupStack::PushL( separatorData );
  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 
  1252         if ( IsCommandAvailableOnItem( FsEActionAttachmentRemoveUnfetchedAttachment, selectedItem ) )
  1252         if ( IsCommandAvailableOnItem( FsEActionAttachmentRemoveUnfetchedAttachment, selectedItem ) )
  1253             {
  1253             {
  1254             itemList.AppendL( FsEActionAttachmentRemoveUnfetchedAttachment );
  1254             itemList.AppendL( FsEActionAttachmentRemoveUnfetchedAttachment );
  1255             }
  1255             }
  1256         
  1256         
  1257 		// Execute action list and handle the menu command
  1257         // Execute action list and handle the menu command
  1258 	   	TActionMenuCustomItemId itemId = CFSEmailUiActionMenu::ExecuteL( itemList );
  1258         TActionMenuCustomItemId itemId = CFSEmailUiActionMenu::ExecuteL( itemList );
  1259 	   	
  1259         
  1260 	   	CleanupStack::PopAndDestroy( &itemList );
  1260         CleanupStack::PopAndDestroy( &itemList );
  1261 	   	
  1261         
  1262 	  	switch( itemId )
  1262         switch( itemId )
  1263 	  		{
  1263             {
  1264 			case FsEActionAttachmentOpen:
  1264             case FsEActionAttachmentOpen:
  1265 			    HandleCommandL( EFsEmailUiCmdOpen );
  1265                 HandleCommandL( EFsEmailUiCmdOpen );
  1266 			    break;
  1266                 break;
  1267 			case FsEActionAttachmentDownload:
  1267             case FsEActionAttachmentDownload:
  1268 			    HandleCommandL( EFsEmailUiCmdDownload );
  1268                 HandleCommandL( EFsEmailUiCmdDownload );
  1269 			    break;
  1269                 break;
  1270 			case FsEActionAttachmentCancelDownload:
  1270             case FsEActionAttachmentCancelDownload:
  1271                 HandleCommandL( EFsEmailUiCmdCancelDownload );
  1271                 HandleCommandL( EFsEmailUiCmdCancelDownload );
  1272 				break;
  1272                 break;
  1273 			case FsEActionAttachmentSave:
  1273             case FsEActionAttachmentSave:
  1274 			    HandleCommandL( EFsEmailUiCmdSave );
  1274                 HandleCommandL( EFsEmailUiCmdSave );
  1275 			    break;
  1275                 break;
  1276             case FsEActionAttachmentDownloadAll:
  1276             case FsEActionAttachmentDownloadAll:
  1277                 HandleCommandL( EFsEmailUiCmdDownloadAll );
  1277                 HandleCommandL( EFsEmailUiCmdDownloadAll );
  1278                 break;
  1278                 break;
  1279             case FsEActionAttachmentCancelAllDownloads:
  1279             case FsEActionAttachmentCancelAllDownloads:
  1280                 HandleCommandL( EFsEmailUiCmdCancelAllDownloads );
  1280                 HandleCommandL( EFsEmailUiCmdCancelAllDownloads );
  1286                 HandleCommandL( EFsEmailUiCmdClearFetchedAttachment );
  1286                 HandleCommandL( EFsEmailUiCmdClearFetchedAttachment );
  1287                 break;
  1287                 break;
  1288             case FsEActionAttachmentRemoveUnfetchedAttachment:
  1288             case FsEActionAttachmentRemoveUnfetchedAttachment:
  1289                 HandleCommandL( EFsEmailUiCmdRemoveAttachment );
  1289                 HandleCommandL( EFsEmailUiCmdRemoveAttachment );
  1290                 break;
  1290                 break;
  1291 			default:
  1291             default:
  1292 				break;
  1292                 break;
  1293 	  		}
  1293             }
  1294   		}
  1294         }
  1295 	}
  1295     }
  1296 
  1296 
  1297 // ---------------------------------------------------------------------------
  1297 // ---------------------------------------------------------------------------
  1298 // If there is one or more expanded nodes, collapses all nodes.
  1298 // If there is one or more expanded nodes, collapses all nodes.
  1299 // Otherwise expands all nodes.
  1299 // Otherwise expands all nodes.
  1300 // ---------------------------------------------------------------------------
  1300 // ---------------------------------------------------------------------------
  1310         if ( iDownloadManagerList->IsNode( curId ) &&
  1310         if ( iDownloadManagerList->IsNode( curId ) &&
  1311              iDownloadManagerList->IsExpanded( curId ) )
  1311              iDownloadManagerList->IsExpanded( curId ) )
  1312             {
  1312             {
  1313             collapseAllNodes = ETrue;
  1313             collapseAllNodes = ETrue;
  1314             break;
  1314             break;
  1315             }	
  1315             }   
  1316         }
  1316         }
  1317 
  1317 
  1318     if ( collapseAllNodes )
  1318     if ( collapseAllNodes )
  1319         {
  1319         {
  1320         iDownloadManagerTreeListVisualizer->CollapseAllL();        
  1320         iDownloadManagerTreeListVisualizer->CollapseAllL();        
  1321         }
  1321         }
  1322     else
  1322     else
  1323         {
  1323         {
  1324        	TFsTreeItemId prevId = iDownloadManagerList->FocusedItem(); // the focus may fall out of the screen unless manually reset
  1324         TFsTreeItemId prevId = iDownloadManagerList->FocusedItem(); // the focus may fall out of the screen unless manually reset
  1325         iDownloadManagerTreeListVisualizer->ExpandAllL();
  1325         iDownloadManagerTreeListVisualizer->ExpandAllL();
  1326     	iDownloadManagerTreeListVisualizer->SetFocusedItemL( prevId );    
  1326         iDownloadManagerTreeListVisualizer->SetFocusedItemL( prevId );    
  1327         }
  1327         }
  1328     }
  1328     }
  1329 
  1329 
  1330 // ---------------------------------------------------------------------------
  1330 // ---------------------------------------------------------------------------
  1331 // Moves the focus to the topmost item
  1331 // Moves the focus to the topmost item
  1365             }
  1365             }
  1366         iDownloadManagerTreeListVisualizer->SetFocusedItemL( bottomId );            
  1366         iDownloadManagerTreeListVisualizer->SetFocusedItemL( bottomId );            
  1367         }
  1367         }
  1368     }
  1368     }
  1369 
  1369 
  1370 	
  1370