application/src/PodcastFeedView.cpp
changeset 153 1d3315159ef5
parent 137 eefed4bda2e2
child 163 f94dbd678dda
equal deleted inserted replaced
152:3402b2e2a66a 153:1d3315159ef5
   419 	}
   419 	}
   420 
   420 
   421 
   421 
   422 void CPodcastFeedView::UpdateListboxItemsL()
   422 void CPodcastFeedView::UpdateListboxItemsL()
   423 	{
   423 	{
       
   424 	DP("CPodcastFeedView::UpdateListboxItemsL BEGIN");
   424 	// No reason to do any work if it isn't going to show..
   425 	// No reason to do any work if it isn't going to show..
   425 	if(!iListContainer->IsVisible())
   426 	if(!iListContainer->IsVisible())
   426 		{
   427 		{
   427 		return;
   428 		return;
   428 		}
   429 		}
   464 		TListItemProperties itemProps;
   465 		TListItemProperties itemProps;
   465 		itemProps.SetDimmed(ETrue);
   466 		itemProps.SetDimmed(ETrue);
   466 		itemProps.SetHiddenSelection(ETrue);								
   467 		itemProps.SetHiddenSelection(ETrue);								
   467 		iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
   468 		iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
   468 		}
   469 		}
   469 	iListContainer->Listbox()->HandleItemAdditionL();		
   470 	iListContainer->Listbox()->HandleItemAdditionL();
       
   471 	DP("CPodcastFeedView::UpdateListboxItemsL END");
   470 	}
   472 	}
   471 
   473 
   472 /** 
   474 /** 
   473  * Command handling function intended for overriding by sub classes. 
   475  * Command handling function intended for overriding by sub classes. 
   474  * Default implementation is empty.  
   476  * Default implementation is empty.  
   475  * @param aCommand ID of the command to respond to. 
   477  * @param aCommand ID of the command to respond to. 
   476  */
   478  */
   477 void CPodcastFeedView::HandleCommandL(TInt aCommand)
   479 void CPodcastFeedView::HandleCommandL(TInt aCommand)
   478 	{
   480 	{
   479 	//CloseToolbarExtension();
   481 	DP("CPodcastFeedView::HandleCommandL BEGIN");
       
   482 
   480 	switch(aCommand)
   483 	switch(aCommand)
   481 		{
   484 		{
   482         case EPodcastHide:
   485         case EPodcastHide:
   483 			AppUi()->HandleCommandL(EEikCmdExit);
   486 			AppUi()->HandleCommandL(EEikCmdExit);
   484 			break;
   487 			break;
   546 			break;
   549 			break;
   547 		}
   550 		}
   548 	
   551 	
   549 	iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping
   552 	iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping
   550 	UpdateToolbar();
   553 	UpdateToolbar();
       
   554 	DP("CPodcastFeedView::HandleCommandL END");
   551 	}
   555 	}
   552 
   556 
   553 void CPodcastFeedView::UpdateToolbar(TBool aVisible)
   557 void CPodcastFeedView::UpdateToolbar(TBool aVisible)
   554 {
   558 {
       
   559 	DP("CPodcastFeedView::UpdateToolbar BEGIN");
   555 	CAknToolbar* toolbar = Toolbar();
   560 	CAknToolbar* toolbar = Toolbar();
   556 	
   561 	
   557 	if (toolbar)
   562 	if (toolbar)
   558 		{
   563 		{
   559 		if (iListContainer->IsVisible()) {
   564 		if (iListContainer->IsVisible()) {
   562 		toolbar->HideItem(EPodcastUpdateAllFeeds, iUpdatingAllRunning, ETrue);
   567 		toolbar->HideItem(EPodcastUpdateAllFeeds, iUpdatingAllRunning, ETrue);
   563 		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !iUpdatingAllRunning, ETrue );
   568 		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !iUpdatingAllRunning, ETrue );
   564 		toolbar->SetItemDimmed(EPodcastAddFeed, iUpdatingAllRunning, ETrue );
   569 		toolbar->SetItemDimmed(EPodcastAddFeed, iUpdatingAllRunning, ETrue );
   565 		toolbar->SetItemDimmed(EPodcastSettings, iUpdatingAllRunning, ETrue );
   570 		toolbar->SetItemDimmed(EPodcastSettings, iUpdatingAllRunning, ETrue );
   566 		}
   571 		}
       
   572 	DP("CPodcastFeedView::UpdateToolbar END");
   567 }
   573 }
   568 
   574 
   569 void CPodcastFeedView::HandleAddFeedL()
   575 void CPodcastFeedView::HandleAddFeedL()
   570 	{
   576 	{
   571 	TBuf<KFeedUrlLength> url;
   577 	TBuf<KFeedUrlLength> url;
   585 			HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_SEARCHING);
   591 			HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_SEARCHING);
   586 			ShowWaitDialogL(*waitText);
   592 			ShowWaitDialogL(*waitText);
   587 			CleanupStack::PopAndDestroy(waitText);	
   593 			CleanupStack::PopAndDestroy(waitText);	
   588 	
   594 	
   589 			iOpmlState = EOpmlSearching;
   595 			iOpmlState = EOpmlSearching;
   590 			iPodcastModel.FeedEngine().SearchForFeedL(url);
   596 			TRAPD(err, iPodcastModel.FeedEngine().SearchForFeedL(url));
       
   597 			
       
   598 			if (err != KErrNone)
       
   599 				{
       
   600 				delete iWaitDialog;
       
   601 				iOpmlState = EOpmlIdle;
       
   602 				}
   591 			}
   603 			}
   592 		else
   604 		else
   593 			{
   605 			{
   594 			PodcastUtils::FixProtocolsL(url);
   606 			PodcastUtils::FixProtocolsL(url);
   595 	
   607 	
   845 		{
   857 		{
   846 		case KErrCouldNotConnect:
   858 		case KErrCouldNotConnect:
   847 			{
   859 			{
   848 			TBuf<KMaxMessageLength> message;
   860 			TBuf<KMaxMessageLength> message;
   849 			iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
   861 			iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
       
   862 			delete iWaitDialog;
       
   863 			iOpmlState = EOpmlIdle;
   850 			ShowErrorMessageL(message);
   864 			ShowErrorMessageL(message);
   851 			}
   865 			}
   852 			break;
   866 			break;
   853 		case KErrNone: 
   867 		case KErrNone: 
   854 		default:			// we don't do more error handling here, just show 0 imported feeds
   868 		default:			// we don't do more error handling here, just show 0 imported feeds