application/src/PodcastQueueView.cpp
branch3rded
changeset 390 d7abecc9d189
parent 343 9c56bf585696
equal deleted inserted replaced
345:702ba9ffe210 390:d7abecc9d189
    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)
    90 			default:
    91 			default:
    91 				break;
    92 				break;
    92 			}
    93 			}
    93 		}
    94 		}
    94 	}
    95 	}
    95 		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
    96 		return CPodcastShowsView::OfferKeyEventL(aKeyEvent, aType);
    96 	}
    97 	}
    97 
    98 
    98 CPodcastQueueView::~CPodcastQueueView()
    99 CPodcastQueueView::~CPodcastQueueView()
    99 	{
   100 	{
       
   101 	DP("CPodcastQueueView::~CPodcastQueueView BEGIN");
   100 	iPodcastModel.ShowEngine().RemoveObserver(this);
   102 	iPodcastModel.ShowEngine().RemoveObserver(this);
   101 	iPodcastModel.FeedEngine().RemoveObserver(this);
   103 	iPodcastModel.FeedEngine().RemoveObserver(this);
   102 	}
   104 	}
   103 
   105 
   104 
   106 
   112 	{
   114 	{
   113 	DP("CPodcastQueueView::DoActivateL BEGIN");
   115 	DP("CPodcastQueueView::DoActivateL BEGIN");
   114 	
   116 	
   115 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   117 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   116 	iPreviousView = aPrevViewId;
   118 	iPreviousView = aPrevViewId;
   117 	
   119 	UpdateViewTitleL();
   118 	UpdateFeedUpdateStateL();
   120 	UpdateFeedUpdateStateL();
   119 	DP("CPodcastQueueView::DoActivateL END");
   121 	DP("CPodcastQueueView::DoActivateL END");
   120 	}
   122 	}
   121 
   123 
   122 void CPodcastQueueView::DoDeactivate()
   124 void CPodcastQueueView::DoDeactivate()
   318 			{
   320 			{
   319 			DisplayShowInfoDialogL();
   321 			DisplayShowInfoDialogL();
   320 			}
   322 			}
   321 			break;
   323 			break;
   322 		default:
   324 		default:
   323 			CPodcastListView::HandleCommandL(aCommand);
   325 			CPodcastShowsView::HandleCommandL(aCommand);
   324 			break;
   326 			break;
   325 		}
   327 		}
   326 	}
   328 	}
   327 	
   329 	
   328 void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
   330 void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
   334 		TBool dimUp = (iListContainer->Listbox()->CurrentItemIndex() <= 0 ?
   336 		TBool dimUp = (iListContainer->Listbox()->CurrentItemIndex() <= 0 ?
   335 				ETrue : EFalse);
   337 				ETrue : EFalse);
   336 		
   338 		
   337 		aMenuPane->SetItemDimmed(EPodcastMoveDownloadDown, dimDown);
   339 		aMenuPane->SetItemDimmed(EPodcastMoveDownloadDown, dimDown);
   338 		aMenuPane->SetItemDimmed(EPodcastMoveDownloadUp, dimUp);
   340 		aMenuPane->SetItemDimmed(EPodcastMoveDownloadUp, dimUp);
       
   341 		
       
   342 		TInt index = iListContainer->Listbox()->CurrentItemIndex();
       
   343 		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
       
   344 
       
   345 		aMenuPane->SetItemDimmed(EPodcastMarkAsPlayed, info->PlayState() != ENeverPlayed);
       
   346 		aMenuPane->SetItemDimmed(EPodcastMarkAsUnplayed, info->PlayState() == ENeverPlayed);
   339 		}
   347 		}
   340 	else if (aResourceId == R_PODCAST_QUEUEVIEW_MENU)
   348 	else if (aResourceId == R_PODCAST_QUEUEVIEW_MENU)
   341 		{
   349 		{
   342 		aMenuPane->SetItemDimmed(EPodcastQueueShowMenu, iPodcastModel.ActiveShowList().Count() == 0);
   350 		aMenuPane->SetItemDimmed(EPodcastQueueShowMenu, iPodcastModel.ActiveShowList().Count() == 0);
   343 		aMenuPane->SetItemDimmed(EPodcastRemoveAllDownloads, iPodcastModel.ActiveShowList().Count() == 0);
   351 		aMenuPane->SetItemDimmed(EPodcastRemoveAllDownloads, iPodcastModel.ActiveShowList().Count() == 0);
   344 		aMenuPane->SetItemDimmed(EPodcastSuspendDownloads, iPodcastModel.SettingsEngine().DownloadSuspended());
   352 		aMenuPane->SetItemDimmed(EPodcastSuspendDownloads, iPodcastModel.SettingsEngine().DownloadSuspended());
   345 		aMenuPane->SetItemDimmed(EPodcastResumeDownloads, !iPodcastModel.SettingsEngine().DownloadSuspended());				
   353 		aMenuPane->SetItemDimmed(EPodcastResumeDownloads, !iPodcastModel.SettingsEngine().DownloadSuspended());				
   346 		}
   354 		}
   347 	}
   355 	}
       
   356 
       
   357 
       
   358 void CPodcastQueueView::UpdateViewTitleL()
       
   359 	{
       
   360 	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
   361 		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   362 		 
       
   363 	HBufC *title = iEikonEnv->AllocReadResourceLC(R_DOWNLOAD_QUEUE);
       
   364 	titlePane->SetTextL(*title);
       
   365 	CleanupStack::PopAndDestroy(title);
       
   366 	}