application/src/PodcastQueueView.cpp
branchsymbian1
changeset 356 697e27864f3a
parent 355 075b3a49cb55
child 359 16cc6373c043
equal deleted inserted replaced
346:a0eb6aaed052 356:697e27864f3a
    29 #include <podcast.mbg>
    29 #include <podcast.mbg>
    30 #include <gulicon.h>
    30 #include <gulicon.h>
    31 #include <barsread.h>
    31 #include <barsread.h>
    32 #include <aknnotedialog.h>
    32 #include <aknnotedialog.h>
    33 #include <aknmessagequerydialog.h>
    33 #include <aknmessagequerydialog.h>
       
    34 #include <akntitle.h>
    34 
    35 
    35 #define KMaxMessageLength 200
    36 #define KMaxMessageLength 200
    36 
    37 
    37 
    38 
    38 CPodcastQueueView* CPodcastQueueView::NewL(CPodcastModel& aPodcastModel)
    39 CPodcastQueueView* CPodcastQueueView::NewL(CPodcastModel& aPodcastModel)
   103 		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
   104 		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
   104 	}
   105 	}
   105 
   106 
   106 CPodcastQueueView::~CPodcastQueueView()
   107 CPodcastQueueView::~CPodcastQueueView()
   107 	{
   108 	{
       
   109 	DP("CPodcastQueueView::~CPodcastQueueView BEGIN");
   108 	iPodcastModel.ShowEngine().RemoveObserver(this);
   110 	iPodcastModel.ShowEngine().RemoveObserver(this);
   109 	iPodcastModel.FeedEngine().RemoveObserver(this);
   111 	iPodcastModel.FeedEngine().RemoveObserver(this);
   110 	
   112 	
   111     if(iStylusPopupMenu)
   113     if(iStylusPopupMenu)
   112         delete iStylusPopupMenu, iStylusPopupMenu = NULL;
   114         delete iStylusPopupMenu, iStylusPopupMenu = NULL;
       
   115 	DP("CPodcastQueueView::~CPodcastQueueView END");
   113 	}
   116 	}
   114 
   117 
   115 
   118 
   116 TUid CPodcastQueueView::Id() const
   119 TUid CPodcastQueueView::Id() const
   117 	{
   120 	{
   123 	{
   126 	{
   124 	DP("CPodcastQueueView::DoActivateL BEGIN");
   127 	DP("CPodcastQueueView::DoActivateL BEGIN");
   125 	
   128 	
   126 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   129 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   127 	iPreviousView = aPrevViewId;
   130 	iPreviousView = aPrevViewId;
   128 	
   131 	UpdateViewTitleL();
   129 	UpdateFeedUpdateStateL();
   132 	UpdateFeedUpdateStateL();
   130 	UpdateToolbar();
   133 	UpdateToolbar();
   131 	DP("CPodcastQueueView::DoActivateL END");
   134 	DP("CPodcastQueueView::DoActivateL END");
   132 	}
   135 	}
   133 
   136 
   334 			{
   337 			{
   335 			DisplayShowInfoDialogL();
   338 			DisplayShowInfoDialogL();
   336 			}
   339 			}
   337 			break;
   340 			break;
   338 		default:
   341 		default:
   339 			CPodcastListView::HandleCommandL(aCommand);
   342 			CPodcastShowsView::HandleCommandL(aCommand);
   340 			break;
   343 			break;
   341 		}
   344 		}
   342 	iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping
   345 	iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping
   343 	UpdateToolbar();
   346 	UpdateToolbar();
   344 	}
   347 	}
   382 			iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight;
   385 			iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight;
   383 
   386 
   384     if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
   387     if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
   385     {
   388     {
   386 		TBool dimDown = (iListContainer->Listbox()->CurrentItemIndex() >= iPodcastModel.ActiveShowList().Count() - 1 ?
   389 		TBool dimDown = (iListContainer->Listbox()->CurrentItemIndex() >= iPodcastModel.ActiveShowList().Count() - 1 ?
   387 				ETrue : EFalse);
   390 				(TBool)ETrue : (TBool)EFalse);
   388 		TBool dimUp = (iListContainer->Listbox()->CurrentItemIndex() <= 0 ?
   391 		TBool dimUp = (iListContainer->Listbox()->CurrentItemIndex() <= 0 ?
   389 				ETrue : EFalse);
   392 				(TBool)ETrue : (TBool)EFalse);
   390 		
   393 		
   391 		iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadDown, dimDown);
   394 		iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadDown, dimDown);
   392 		iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadUp, dimUp);
   395 		iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadUp, dimUp);
   393 		
   396 
       
   397 		TInt index = iListContainer->Listbox()->CurrentItemIndex();
       
   398 		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
       
   399 
       
   400 		iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, info->PlayState() != ENeverPlayed);
       
   401 		iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, info->PlayState() == ENeverPlayed);
       
   402 	
   394 		iStylusPopupMenu->ShowMenu();
   403 		iStylusPopupMenu->ShowMenu();
   395 		iStylusPopupMenu->SetPosition(aPenEventLocation);
   404 		iStylusPopupMenu->SetPosition(aPenEventLocation);
   396     }
   405     }
   397     
   406     
   398 	DP("CPodcastQueueView::HandleLongTapEventL END");
   407 	DP("CPodcastQueueView::HandleLongTapEventL END");
   399 }
   408 }
       
   409 
       
   410 void CPodcastQueueView::UpdateViewTitleL()
       
   411 	{
       
   412 	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
   413 		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   414 		 
       
   415 	HBufC *title = iEikonEnv->AllocReadResourceLC(R_DOWNLOAD_QUEUE);
       
   416 	titlePane->SetTextL(*title);
       
   417 	CleanupStack::PopAndDestroy(title);
       
   418 	}