application/src/PodcastShowsView.cpp
branch3rded
changeset 177 269e3f3e544a
parent 175 cd124c4eb6b9
child 343 9c56bf585696
equal deleted inserted replaced
176:1c8b56cb6409 177:269e3f3e544a
   103 	{
   103 	{
   104 	}
   104 	}
   105 
   105 
   106 void CPodcastShowsView::ConstructL()
   106 void CPodcastShowsView::ConstructL()
   107 	{
   107 	{
       
   108 	DP("CPodcastShowsView::ConstructL BEGIN");
   108 	BaseConstructL(R_PODCAST_SHOWSVIEW);
   109 	BaseConstructL(R_PODCAST_SHOWSVIEW);
   109 	CPodcastListView::ConstructL();
   110 	CPodcastListView::ConstructL();
   110 	
   111 	
   111 	CreateIconsL();
   112 	CreateIconsL();
   112 	
   113 	
   113 	iListContainer->Listbox()->SetListBoxObserver(this);
   114 	iListContainer->Listbox()->SetListBoxObserver(this);
   114 	
   115 	
   115 	iPodcastModel.FeedEngine().AddObserver(this);
   116 	iPodcastModel.FeedEngine().AddObserver(this);
   116 	iPodcastModel.ShowEngine().AddObserver(this);
   117 	iPodcastModel.ShowEngine().AddObserver(this);
   117 	
   118 	
   118 	CleanupStack::PopAndDestroy();	
   119 	DP("CPodcastShowsView::ConstructL END");
   119 	}
   120 	}
   120 
   121 
   121 void CPodcastShowsView::CreateIconsL()
   122 void CPodcastShowsView::CreateIconsL()
   122 	{
   123 	{
   123 	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
   124 	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
   170 					HandleCommandL(EPodcastMarkAsPlayed);
   171 					HandleCommandL(EPodcastMarkAsPlayed);
   171 				}
   172 				}
   172 				break;
   173 				break;
   173 			case 106:
   174 			case 106:
   174 			case '#':
   175 			case '#':
   175 				if (activeShow->DownloadState() == ENotDownloaded) {
   176 				HandleCommandL(EPodcastShowInfo);
   176 					HandleCommandL(EPodcastDownloadShow);
       
   177 				}
       
   178 				break;
   177 				break;
   179 			case EKeyBackspace:
   178 			case EKeyBackspace:
   180 			case EKeyDelete:
   179 			case EKeyDelete:
   181 					HandleCommandL(EPodcastDeleteShow);
   180 					HandleCommandL(EPodcastDeleteShow);
   182 				break;
   181 				break;
   634 		}
   633 		}
   635 	}
   634 	}
   636 	
   635 	
   637 void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
   636 void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
   638 {
   637 {
       
   638 	TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() && 
       
   639 				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
       
   640 
   639 	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
   641 	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
   640 		{
   642 		{	
   641 		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
   643 		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState || iPodcastModel.ActiveShowList().Count() == 0);
   642 		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState);
   644 		aMenuPane->SetItemDimmed(EPodcastUpdateFeed, updatingState); 
       
   645 		aMenuPane->SetItemDimmed(EPodcastCancelUpdateAllFeeds, !updatingState);
       
   646 		aMenuPane->SetItemDimmed(EPodcastShowsShowMenu, updatingState || iPodcastModel.ActiveShowList().Count() == 0);
       
   647 		}
       
   648 	else if (aResourceId == R_SHOWS_SHOW_MENU)
       
   649 		{
       
   650 		TInt index = iListContainer->Listbox()->CurrentItemIndex();
       
   651 		if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
       
   652 			{
       
   653 			CShowInfo *info = iPodcastModel.ActiveShowList()[index];
       
   654 			TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
       
   655 			TBool hideMarkOld = info->PlayState() == EPlayed;
       
   656 			
       
   657 			aMenuPane->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
       
   658 			aMenuPane->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);			
       
   659 			aMenuPane->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
       
   660 			}
   643 		}
   661 		}
   644 }
   662 }
   645 	
   663 	
   646 void CPodcastShowsView::DisplayShowInfoDialogL()
   664 void CPodcastShowsView::DisplayShowInfoDialogL()
   647 	{
   665 	{