application/src/PodcastQueueView.cpp
changeset 66 41d00e97e2f7
parent 62 c06c2a75bb57
child 68 867fc277ffea
equal deleted inserted replaced
65:523e04129df6 66:41d00e97e2f7
    23 #include "PodcastApp.h"
    23 #include "PodcastApp.h"
    24 #include "Constants.h"
    24 #include "Constants.h"
    25 #include "imagehandler.h"
    25 #include "imagehandler.h"
    26 #include "PodcastShowsView.h"
    26 #include "PodcastShowsView.h"
    27 
    27 
    28 #include <akntitle.h>
       
    29 #include <podcast.rsg>
    28 #include <podcast.rsg>
    30 #include <podcast.mbg>
    29 #include <podcast.mbg>
    31 #include <gulicon.h>
    30 #include <gulicon.h>
    32 #include <barsread.h>
    31 #include <barsread.h>
    33 #include <aknnotedialog.h>
    32 #include <aknnotedialog.h>
   125 	CleanupStack::Pop(icons); // icons
   124 	CleanupStack::Pop(icons); // icons
   126 	iListContainer->Listbox()->SetListBoxObserver(this);
   125 	iListContainer->Listbox()->SetListBoxObserver(this);
   127 	
   126 	
   128 	iPodcastModel.FeedEngine().AddObserver(this);
   127 	iPodcastModel.FeedEngine().AddObserver(this);
   129 	iPodcastModel.ShowEngine().AddObserver(this);
   128 	iPodcastModel.ShowEngine().AddObserver(this);
   130 	
   129 
       
   130 	// no popup options apply to S^1
       
   131 #ifndef SYMBIAN1_UI
   131 	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
   132 	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
   132 	TResourceReader reader;
   133 	TResourceReader reader;
   133 	iCoeEnv->CreateResourceReaderLC(reader,R_QUEUEVIEW_POPUP_MENU);
   134 	iCoeEnv->CreateResourceReaderLC(reader,R_QUEUEVIEW_POPUP_MENU);
   134 	iStylusPopupMenu->ConstructFromResourceL(reader);
   135 	iStylusPopupMenu->ConstructFromResourceL(reader);
   135 	CleanupStack::PopAndDestroy();
   136 	CleanupStack::PopAndDestroy();
       
   137 #endif
   136 	SetEmptyTextL(R_PODCAST_EMPTY_QUEUE);
   138 	SetEmptyTextL(R_PODCAST_EMPTY_QUEUE);
   137 	}
   139 	}
   138 
   140 
   139 TKeyResponse CPodcastQueueView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
   141 TKeyResponse CPodcastQueueView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
   140 	{
   142 	{
   198 		TUid aCustomMessageId, const TDesC8& aCustomMessage)
   200 		TUid aCustomMessageId, const TDesC8& aCustomMessage)
   199 	{
   201 	{
   200 	DP("CPodcastQueueView::DoActivateL BEGIN");
   202 	DP("CPodcastQueueView::DoActivateL BEGIN");
   201 	
   203 	
   202 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   204 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   203 	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
   205 	iPreviousView = aPrevViewId;
   204 	
   206 	
   205 	UpdateFeedUpdateStateL();
   207 	UpdateFeedUpdateStateL();
   206 	UpdateToolbar();
   208 	UpdateToolbar();
   207 	DP("CPodcastQueueView::DoActivateL END");
   209 	DP("CPodcastQueueView::DoActivateL END");
   208 	}
   210 	}
   247 			{
   249 			{
   248 			case KErrCouldNotConnect:
   250 			case KErrCouldNotConnect:
   249 				{
   251 				{
   250 				TBuf<KMaxMessageLength> message;
   252 				TBuf<KMaxMessageLength> message;
   251 				iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
   253 				iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
   252 				ShowErrorMessage(message);
   254 				ShowErrorMessageL(message);
   253 				}
   255 				}
   254 				break;
   256 				break;
   255 			default: // Do nothing
   257 			default: // Do nothing
   256 				break;
   258 				break;
   257 			}
   259 			}
   386 	else
   388 	else
   387 		{
   389 		{
   388 		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
   390 		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
   389 		}
   391 		}
   390 
   392 
   391 	if(aShowInfo.LastError() != KErrNone)
   393 	if (infoSize.Length() > 0) {
   392 		{
   394 		infoSize.Insert(0,_L(", "));
   393 		TBuf<KSizeBufLen> errorBuffer;
   395 	}
   394 		iEikonEnv->GetErrorText(errorBuffer, aShowInfo.LastError());
   396 	
   395 		iListboxFormatbuffer.Format(KShowErrorFormat(), iconIndex, &aShowInfo.Title(), &errorBuffer);
   397 	iListboxFormatbuffer.Format(KShowQueueFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
   396 		}
       
   397 	else	
       
   398 		{
       
   399 		if (infoSize.Length() > 0) {
       
   400 			infoSize.Insert(0,_L(", "));
       
   401 		}
       
   402 		
       
   403 		iListboxFormatbuffer.Format(KShowQueueFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
       
   404 		}
       
   405 	}
   398 	}
   406 
   399 
   407 void CPodcastQueueView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   400 void CPodcastQueueView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   408 {
   401 {
   409 	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
   402 	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
   515 		case EPodcastRemoveAllDownloads:
   508 		case EPodcastRemoveAllDownloads:
   516 			{
   509 			{
   517 			TBuf<KMaxMessageLength> msg;
   510 			TBuf<KMaxMessageLength> msg;
   518 			iEikonEnv->ReadResourceL(msg, R_CLEAR_QUERY);
   511 			iEikonEnv->ReadResourceL(msg, R_CLEAR_QUERY);
   519 												
   512 												
   520 			if(ShowQueryMessage(msg))
   513 			if(ShowQueryMessageL(msg))
   521 				{
   514 				{
   522 				iPodcastModel.ShowEngine().RemoveAllDownloads();
   515 				iPodcastModel.ShowEngine().RemoveAllDownloadsL();
   523 				UpdateListboxItemsL();
   516 				UpdateListboxItemsL();
   524 				}
   517 				}
   525 			}
   518 			}
   526 			break;
   519 			break;
   527 		case EPodcastRemoveDownload:
   520 		case EPodcastRemoveDownload:
   557 			break;
   550 			break;
   558 		default:
   551 		default:
   559 			CPodcastListView::HandleCommandL(aCommand);
   552 			CPodcastListView::HandleCommandL(aCommand);
   560 			break;
   553 			break;
   561 		}
   554 		}
       
   555 	iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping
   562 	UpdateToolbar();
   556 	UpdateToolbar();
   563 	}
   557 	}
   564 	
   558 	
   565 void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
   559 void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
   566 {
   560 {