application/src/PodcastFeedView.cpp
branchRCL_3
changeset 311 606f4f6babf6
parent 306 a36dc474cae2
child 312 2faae209e72b
equal deleted inserted replaced
310:2e0299e13cbf 311:606f4f6babf6
   161 		
   161 		
   162 void CPodcastFeedView::DoActivateL(const TVwsViewId& aPrevViewId,
   162 void CPodcastFeedView::DoActivateL(const TVwsViewId& aPrevViewId,
   163 	                                  TUid aCustomMessageId,
   163 	                                  TUid aCustomMessageId,
   164 	                                  const TDesC8& aCustomMessage)
   164 	                                  const TDesC8& aCustomMessage)
   165 	{
   165 	{
       
   166 	DP("CPodcastFeedView::DoActivateL BEGIN");
   166 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   167 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   167 	
   168 	
   168 	if (aPrevViewId.iViewUid == KUidPodcastShowsViewID)
   169 	if (aPrevViewId.iViewUid == KUidPodcastShowsViewID)
   169 		{
   170 		{
   170 		// back key from shows view
   171 		// back key from shows view
   175 		UpdateToolbar();
   176 		UpdateToolbar();
   176 
   177 
   177 	if (iFirstActivateAfterLaunch)
   178 	if (iFirstActivateAfterLaunch)
   178 		{
   179 		{
   179 		iFirstActivateAfterLaunch = EFalse;
   180 		iFirstActivateAfterLaunch = EFalse;
   180 		iListContainer->Listbox()->ScrollToMakeItemVisible(0);
   181 		}
   181 		}
   182 
       
   183 	DP("CPodcastFeedView::DoActivateL END");
   182 	}
   184 	}
   183 
   185 
   184 void CPodcastFeedView::DoDeactivate()
   186 void CPodcastFeedView::DoDeactivate()
   185 	{
   187 	{
   186 	iUpdater->StopUpdate();
   188 	iUpdater->StopUpdate();
   363 		// Hopefully temporary haxx to prevent double delete. I would prefer if
   365 		// Hopefully temporary haxx to prevent double delete. I would prefer if
   364 		// this could be solved with a little better design.
   366 		// this could be solved with a little better design.
   365 		CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap;
   367 		CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap;
   366 		CleanupStack::PushL(bmpCopy);
   368 		CleanupStack::PushL(bmpCopy);
   367 		bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle());
   369 		bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle());
   368 		icons->AppendL( CGulIcon::NewL(bmpCopy, NULL));
   370 		icons->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL));
       
   371 		
   369 		iFeedIdForIconArray.Append(aFeedInfo.Uid());
   372 		iFeedIdForIconArray.Append(aFeedInfo.Uid());
   370 		CleanupStack::Pop(bmpCopy);			
   373 		CleanupStack::Pop(bmpCopy);			
   371 		iconIndex = icons->Count()-1;
   374 		iconIndex = icons->Count()-1;
   372 		}	
   375 		}	
   373 	else 
   376 	else 
   565 			}	
   568 			}	
   566 		}
   569 		}
   567 	CleanupStack::PopAndDestroy( array );		
   570 	CleanupStack::PopAndDestroy( array );		
   568 	}
   571 	}
   569 
   572 
       
   573 void CPodcastFeedView::ShowItem(TUint aUid)
       
   574 	{
       
   575 	TInt listIndex = -1;
       
   576 	for (TUint i=0;i<iItemIdArray.Count();i++)
       
   577 		{
       
   578 		if (iItemIdArray[i] == aUid)
       
   579 			{
       
   580 			listIndex = i;
       
   581 			}
       
   582 		}
       
   583 		
       
   584 	if (listIndex != -1)
       
   585 		iListContainer->Listbox()->ScrollToMakeItemVisible(listIndex);
       
   586 
       
   587 	}
       
   588 
   570 void CPodcastFeedView::HandleAddFeedUrlL()
   589 void CPodcastFeedView::HandleAddFeedUrlL()
   571 	{
   590 	{
   572 	TBuf<KFeedUrlLength> url;
   591 	TBuf<KFeedUrlLength> url;
   573 	url.Copy(_L("http://"));
   592 	url.Copy(_L("http://"));
   574 	
   593 	
   597 			// ask if users wants to update it now
   616 			// ask if users wants to update it now
   598 			TBuf<KMaxMessageLength> message;
   617 			TBuf<KMaxMessageLength> message;
   599 			iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
   618 			iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
   600 			if(ShowQueryMessageL(message))
   619 			if(ShowQueryMessageL(message))
   601 				{
   620 				{
   602 				CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(newFeedInfo->Uid());
   621 				ShowItem(newFeedInfo->Uid());
   603 				
       
   604 				iPodcastModel.SetActiveFeedInfo(info);			
       
   605 				AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID,  TUid::Uid(0), KNullDesC8());
       
   606 				iPodcastModel.FeedEngine().UpdateFeedL(newFeedInfo->Uid());
   622 				iPodcastModel.FeedEngine().UpdateFeedL(newFeedInfo->Uid());
   607 				}
   623 				}
   608 			}
   624 			}
   609 		else
   625 		else
   610 			{
   626 			{