application/src/PodcastFeedView.cpp
branchsymbian1
changeset 164 000f9fc147b2
parent 154 fd105a5a9dad
child 171 cc1be3797632
child 175 cd124c4eb6b9
child 210 e82411ba1646
equal deleted inserted replaced
161:ce4f70a6d1d2 164:000f9fc147b2
    35 #include "Podcatcher.pan"
    35 #include "Podcatcher.pan"
    36 
    36 
    37 const TInt KMaxFeedNameLength = 100;
    37 const TInt KMaxFeedNameLength = 100;
    38 const TInt KMaxUnplayedFeedsLength =64;
    38 const TInt KMaxUnplayedFeedsLength =64;
    39 const TInt KADayInHours = 24;
    39 const TInt KADayInHours = 24;
    40 const TInt KDefaultGran = 5;
       
    41 const TInt KNumberOfFilesMaxLength = 4;
       
    42 #define KMaxMessageLength 200
    40 #define KMaxMessageLength 200
    43 #define KMaxTitleLength 100
    41 #define KMaxTitleLength 100
    44 const TInt KMimeBufLength = 100;
       
    45 
    42 
    46 _LIT(KFeedFormat, "%d\t%S\t%S%S");
    43 _LIT(KFeedFormat, "%d\t%S\t%S%S");
    47 enum 
    44 enum 
    48 {
    45 {
    49  EFeedIcon
    46  EFeedIcon
   225 	DP("CPodcastFeedView::HandleListBoxEventL END");
   222 	DP("CPodcastFeedView::HandleListBoxEventL END");
   226 	}
   223 	}
   227 
   224 
   228 void CPodcastFeedView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
   225 void CPodcastFeedView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
   229 	{
   226 	{
   230 	iUpdatingAllRunning = EFalse;
   227 	iUpdatingRunning = EFalse;
   231 	UpdateToolbar();
   228 	UpdateToolbar();
   232 	}
   229 	}
   233 
   230 
   234 void CPodcastFeedView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
   231 void CPodcastFeedView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
   235 	{
   232 	{
   236 	// Update status text
   233 	// Update status text
       
   234 	iUpdatingRunning = ETrue;
   237 	UpdateFeedInfoStatusL(aFeedUid, ETrue);
   235 	UpdateFeedInfoStatusL(aFeedUid, ETrue);
   238 	
   236 	
   239 	UpdateToolbar();
   237 	UpdateToolbar();
   240 	}
   238 	}
   241 
   239 
   418 	}
   416 	}
   419 
   417 
   420 
   418 
   421 void CPodcastFeedView::UpdateListboxItemsL()
   419 void CPodcastFeedView::UpdateListboxItemsL()
   422 	{
   420 	{
       
   421 	DP("CPodcastFeedView::UpdateListboxItemsL BEGIN");
   423 	// No reason to do any work if it isn't going to show..
   422 	// No reason to do any work if it isn't going to show..
   424 	if(!iListContainer->IsVisible())
   423 	if(!iListContainer->IsVisible())
   425 		{
   424 		{
   426 		return;
   425 		return;
   427 		}
   426 		}
   463 		TListItemProperties itemProps;
   462 		TListItemProperties itemProps;
   464 		itemProps.SetDimmed(ETrue);
   463 		itemProps.SetDimmed(ETrue);
   465 		itemProps.SetHiddenSelection(ETrue);								
   464 		itemProps.SetHiddenSelection(ETrue);								
   466 		iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
   465 		iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
   467 		}
   466 		}
   468 	iListContainer->Listbox()->HandleItemAdditionL();		
   467 	iListContainer->Listbox()->HandleItemAdditionL();
       
   468 	DP("CPodcastFeedView::UpdateListboxItemsL END");
   469 	}
   469 	}
   470 
   470 
   471 /** 
   471 /** 
   472  * Command handling function intended for overriding by sub classes. 
   472  * Command handling function intended for overriding by sub classes. 
   473  * Default implementation is empty.  
   473  * Default implementation is empty.  
   474  * @param aCommand ID of the command to respond to. 
   474  * @param aCommand ID of the command to respond to. 
   475  */
   475  */
   476 void CPodcastFeedView::HandleCommandL(TInt aCommand)
   476 void CPodcastFeedView::HandleCommandL(TInt aCommand)
   477 	{
   477 	{
   478 	//CloseToolbarExtension();
   478 	DP("CPodcastFeedView::HandleCommandL BEGIN");
       
   479 
   479 	switch(aCommand)
   480 	switch(aCommand)
   480 		{
   481 		{
   481         case EPodcastHide:
   482         case EPodcastHide:
   482 			AppUi()->HandleCommandL(EEikCmdExit);
   483 			AppUi()->HandleCommandL(EEikCmdExit);
   483 			break;
   484 			break;
   497 		case EPodcastDeleteFeed:
   498 		case EPodcastDeleteFeed:
   498 			HandleRemoveFeedL();
   499 			HandleRemoveFeedL();
   499 			break;
   500 			break;
   500 		case EPodcastUpdateAllFeeds:
   501 		case EPodcastUpdateAllFeeds:
   501 			{
   502 			{
   502 			iUpdatingAllRunning = ETrue;			
       
   503 			iPodcastModel.FeedEngine().UpdateAllFeedsL();
   503 			iPodcastModel.FeedEngine().UpdateAllFeedsL();
   504 			UpdateToolbar();
   504 			UpdateToolbar();
   505 			}break;
   505 			}break;
   506 		case EPodcastUpdateFeed:
   506 		case EPodcastUpdateFeed:
   507 			{
   507 			{
   508 			HandleUpdateFeedL();
   508 			HandleUpdateFeedL();
   509 			}break;
   509 			}break;
   510 		case EPodcastCancelUpdateAllFeeds:
   510 		case EPodcastCancelUpdateAllFeeds:
   511 			{
   511 			{
   512 			if(iUpdatingAllRunning)
   512 			if(iUpdatingRunning)
   513 				{
   513 				{
   514 				iUpdatingAllRunning = EFalse;
       
   515 				iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
   514 				iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
   516 				}
   515 				}
   517 			}break;
   516 			}break;
   518 		case EAknSoftkeyExit:
   517 		case EAknSoftkeyExit:
   519 			{
   518 			{
   545 			break;
   544 			break;
   546 		}
   545 		}
   547 	
   546 	
   548 	iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping
   547 	iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping
   549 	UpdateToolbar();
   548 	UpdateToolbar();
       
   549 	DP("CPodcastFeedView::HandleCommandL END");
   550 	}
   550 	}
   551 
   551 
   552 void CPodcastFeedView::UpdateToolbar(TBool aVisible)
   552 void CPodcastFeedView::UpdateToolbar(TBool aVisible)
   553 {
   553 {
       
   554 	DP("CPodcastFeedView::UpdateToolbar BEGIN");
   554 	CAknToolbar* toolbar = Toolbar();
   555 	CAknToolbar* toolbar = Toolbar();
   555 	
   556 	
   556 	if (toolbar)
   557 	if (toolbar)
   557 		{
   558 		{
   558 		if (iListContainer->IsVisible()) {
   559 		if (iListContainer->IsVisible()) {
   559 			toolbar->SetToolbarVisibility(aVisible);
   560 			toolbar->SetToolbarVisibility(aVisible);
   560 		}
   561 		}
   561 		toolbar->HideItem(EPodcastUpdateAllFeeds, iUpdatingAllRunning, ETrue);
   562 		toolbar->HideItem(EPodcastUpdateAllFeeds, iUpdatingRunning, ETrue);
   562 		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !iUpdatingAllRunning, ETrue );
   563 		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !iUpdatingRunning, ETrue );
   563 		toolbar->SetItemDimmed(EPodcastAddFeed, iUpdatingAllRunning, ETrue );
   564 		toolbar->SetItemDimmed(EPodcastAddFeed, iUpdatingRunning, ETrue );
   564 		toolbar->SetItemDimmed(EPodcastSettings, iUpdatingAllRunning, ETrue );
   565 		toolbar->SetItemDimmed(EPodcastSettings, iUpdatingRunning, ETrue );
   565 		}
   566 		}
       
   567 	DP("CPodcastFeedView::UpdateToolbar END");
   566 }
   568 }
   567 
   569 
   568 void CPodcastFeedView::HandleAddFeedL()
   570 void CPodcastFeedView::HandleAddFeedL()
   569 	{
   571 	{
   570 	TBuf<KFeedUrlLength> url;
   572 	TBuf<KFeedUrlLength> url;