application/src/PodcastQueueView.cpp
author Brendan Donegan <brendand@symbian.org>
Sat, 06 Mar 2010 10:22:09 +0000
changeset 35 66c5303f3610
parent 23 cf4b850bbffb
child 36 e010fc411ddc
permissions -rw-r--r--
A ton of CodeScanner fixes (high issues) - but not all
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
* All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
* This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
* under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
* which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
* Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
* EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
* Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
* Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#include "PodcastQueueView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#include "PodcastAppUi.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
#include "ShowEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include "SettingsEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include "PodcastApp.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include "Constants.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include "imagehandler.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include "PodcastShowsView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include <akntitle.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include <podcast.rsg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include <podcast.mbg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include <gulicon.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#include <barsread.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
#include <aknnotedialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
#include <aknmessagequerydialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
#include "Podcast.hrh"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
#define KMaxMessageLength 200
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
#define KPodcastImageWidth 160
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
#define KPodcastImageHeight 120
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
#define KPodcastDialogOffset 2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
#define KOneHundredPercent 100
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
const TInt KSizeBufLen = 64;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
const TInt KDefaultGran = 5;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
_LIT(KShowsSizeFormatS60, "%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
_LIT(KShowFormat, "%d\t%S\t%S %S\t");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
_LIT(KShowErrorFormat, "%d\t%S\t%S\t");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
_LIT(KShowQueueFormat, "%d\t%S\t%S%S\t");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
// these must correspond with TShowsIconIndex
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
const TUint KShowIconArrayIds[] =
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
			EMbmPodcastAudio,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
			EMbmPodcastAudio_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
			EMbmPodcastAudio_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
			EMbmPodcastAudio_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
			EMbmPodcastAudio_queued,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
			EMbmPodcastAudio_queued_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
			EMbmPodcastAudio_downloading,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
			EMbmPodcastAudio_downloading_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
			EMbmPodcastAudio_downloaded,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
			EMbmPodcastAudio_downloaded_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
			EMbmPodcastAudio_downloaded_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
			EMbmPodcastAudio_downloaded_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
			EMbmPodcastAudio_failed,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
			EMbmPodcastAudio_failed_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
			EMbmPodcastAudio_suspended,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
			EMbmPodcastAudio_suspended_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
			0,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
			0
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
CPodcastQueueView* CPodcastQueueView::NewL(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	CPodcastQueueView* self = CPodcastQueueView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
CPodcastQueueView* CPodcastQueueView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	CPodcastQueueView* self = new ( ELeave ) CPodcastQueueView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
CPodcastQueueView::CPodcastQueueView(CPodcastModel& aPodcastModel) :
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
	iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
void CPodcastQueueView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
	BaseConstructL(R_PODCAST_QUEUEVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
		// Load the bitmap for play icon	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
		CFbsBitmap* bitmap= NULL;//iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
		CFbsBitmap* mask=  NULL;////iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos+1] );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
		CleanupStack::PushL(bitmap);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
		// Load the mask for play icon			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
		// Append the play icon to icon array
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
		pos+=2;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
	CleanupStack::Pop(icons); // icons
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
	iListContainer->Listbox()->SetListBoxObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
	iPodcastModel.ShowEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
	TResourceReader reader;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
	iCoeEnv->CreateResourceReaderLC(reader,R_QUEUEVIEW_POPUP_MENU);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
	iStylusPopupMenu->ConstructFromResourceL(reader);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
	CleanupStack::PopAndDestroy();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
	SetEmptyTextL(R_PODCAST_EMPTY_QUEUE);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
TKeyResponse CPodcastQueueView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
	if (aType == EEventKey)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
		CShowInfo *activeShow = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
			activeShow = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
					HandleCommandL(EPodcastMarkAsPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
			case '#':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
				if (activeShow->DownloadState() == ENotDownloaded) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
				HandleCommandL(EPodcastRemoveDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
			UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
CPodcastQueueView::~CPodcastQueueView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
	iPodcastModel.FeedEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
    if(iStylusPopupMenu)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
        delete iStylusPopupMenu, iStylusPopupMenu = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
TUid CPodcastQueueView::Id() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
	return KUidPodcastQueueViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
void CPodcastQueueView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
	DP("CPodcastQueueView::DoActivateL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
	DP("CPodcastQueueView::DoActivateL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
void CPodcastQueueView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
	CPodcastListView::DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
void CPodcastQueueView::ShowListUpdatedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
void CPodcastQueueView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
	if (!iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
		return;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
	if (info) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   234
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
void CPodcastQueueView::ShowDownloadFinishedL(TUint /*aShowUid*/, TInt aError)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
	iProgressAdded = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 4
diff changeset
   239
	iPodcastModel.GetShowsDownloadingL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   243
	switch(aError)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   244
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   245
		case KErrCouldNotConnect:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   248
			iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 23
diff changeset
   249
			ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   250
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   251
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   252
		default: // Do nothing
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   253
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   254
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   255
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   256
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   257
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   258
void CPodcastQueueView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   259
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   260
	// TODO make use of the fact that we know that the feed download is
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   261
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   262
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   263
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   264
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 4
diff changeset
   265
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   266
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
		}	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   268
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   269
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
void CPodcastQueueView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   271
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   272
	DP("CPodcastQueueView::FeedDownloadFinishedL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   273
	// TODO make use of the fact that we know that the feed download is
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   274
	// finished instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   275
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 4
diff changeset
   278
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
	DP("CPodcastQueueView::FeedDownloadFinishedL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   282
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   283
void CPodcastQueueView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   284
		TListBoxEvent aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   285
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   286
	switch (aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
		{
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   288
#ifndef SYMBIAN1_UI
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   289
		case EEventItemClicked:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   290
#endif
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   291
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   292
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   293
		case EEventItemDoubleClicked:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   294
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   296
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   298
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   299
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   300
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   301
void CPodcastQueueView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   302
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   303
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
	TUint showDownloadingUid = iPodcastModel.ShowEngine().ShowDownloading() ? iPodcastModel.ShowEngine().ShowDownloading()->Uid() : 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   305
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   306
	if (showDownloadingUid == aShowInfo->Uid())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   307
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   308
		aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   310
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   311
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   312
		switch (aShowInfo->DownloadState())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   313
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   314
			case EQueued:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   315
				aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   316
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   317
			case EDownloading:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   318
				aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   319
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   320
			case EFailedDownload:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
				aIconIndex = EFailedShowIcon;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   322
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   323
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
				DP("Wrong download state for queue view!");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   326
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   327
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   328
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   329
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   330
void CPodcastQueueView::UpdateFeedUpdateStateL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   332
	TBool listboxDimmed = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   333
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
	if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   335
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
		listboxDimmed = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   339
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   342
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   345
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   347
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   348
void CPodcastQueueView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   349
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   351
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   352
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   353
	GetShowIcons(&aShowInfo, iconIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   354
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
	if(aSizeDownloaded > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   356
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   357
		if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   358
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   359
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
						((float)aShowInfo.ShowSize() / (float)KSizeMb));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   362
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   365
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   366
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   367
	else if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   368
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   369
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   370
		} 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   371
	else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   372
		infoSize = KNullDesC();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   373
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   374
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   375
	if (aShowInfo.PubDate().Int64() == 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   376
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   377
		showDate = KNullDesC();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   378
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   379
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   380
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   381
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   382
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   383
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   384
	if(aShowInfo.LastError() != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   385
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   386
		TBuf<KSizeBufLen> errorBuffer;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   387
		iEikonEnv->GetErrorText(errorBuffer, aShowInfo.LastError());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   388
		iListboxFormatbuffer.Format(KShowErrorFormat(), iconIndex, &aShowInfo.Title(), &errorBuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   389
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   390
	else	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   391
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   392
		if (infoSize.Length() > 0) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
			infoSize.Insert(0,_L(", "));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   394
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   395
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   396
		iListboxFormatbuffer.Format(KShowQueueFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   397
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   398
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   399
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   400
void CPodcastQueueView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   401
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   402
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
	iItemArray->Delete(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
	if(aIndex>= iItemArray->MdcaCount())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   405
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
		iItemArray->AppendL(iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   407
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   408
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   409
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   410
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   411
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   412
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   414
void CPodcastQueueView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   415
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   418
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   419
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   420
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   421
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   422
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   423
					iListContainer->Listbox()->DrawItem(i);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   424
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   425
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   426
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   428
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   429
void CPodcastQueueView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   430
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   431
	if (iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   432
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   433
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   434
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 4
diff changeset
   436
		iPodcastModel.GetShowsDownloadingL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   437
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   438
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   439
		len = fItems.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
		if (iListContainer->Listbox() != NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   442
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
			TBool allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   444
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   445
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   446
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   447
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   449
				for (TInt loop = 0; loop< len; loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   450
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   451
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   452
					if (fItems[loop]->Uid() != itemId)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   453
						{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   455
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   456
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   457
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   459
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   460
			if (allUidsMatch && len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   461
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
				for (TInt loop = 0; loop< len; loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   463
					{					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   464
					UpdateShowItemDataL(fItems[loop], loop);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
					iListContainer->Listbox()->DrawItem(loop);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   467
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   468
			else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   469
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   470
				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   471
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   472
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   473
				iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   474
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
				if (len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   476
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
					for (TInt i=0; i<len; i++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
						{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   481
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
						iItemArray->AppendL(iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   483
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   484
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   485
				else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   486
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   487
					iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
					iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   490
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   491
					itemProps.SetHiddenSelection(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   492
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
				iListContainer->Listbox()->HandleItemAdditionL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   494
				}				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   495
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   496
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   497
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   498
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   499
/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   500
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   501
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   502
 * @param aCommand ID of the command to respond to. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   503
 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   504
void CPodcastQueueView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   505
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   506
	switch (aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
		case EPodcastRemoveAllDownloads:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   509
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   510
			TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
			iEikonEnv->ReadResourceL(msg, R_CLEAR_QUERY);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   512
												
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 23
diff changeset
   513
			if(ShowQueryMessageL(msg))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
				{
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 23
diff changeset
   515
				iPodcastModel.ShowEngine().RemoveAllDownloadsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   516
				UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   517
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   518
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   519
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
		case EPodcastRemoveDownload:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   521
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   523
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   524
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   525
				if (iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid()))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   526
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   527
						iItemArray->Delete(index);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   528
						iItemIdArray.Remove(index);						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   529
						iListContainer->Listbox()->HandleItemRemovalL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   530
						iListContainer->Listbox()->SetCurrentItemIndex(index - 1 > 0 ? index - 1 : 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   531
						iListContainer->Listbox()->DrawNow();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   532
						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   533
						delete iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
						iPodcastModel.ActiveShowList().Remove(index);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   535
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   536
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   537
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   538
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   539
		case EPodcastSuspendDownloads:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   540
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   541
			iPodcastModel.ShowEngine().SuspendDownloads();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   542
			UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   543
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   544
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   545
		case EPodcastResumeDownloads:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   546
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   547
			iPodcastModel.ShowEngine().ResumeDownloadsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   548
			UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   549
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   550
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   551
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   552
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   553
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   554
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   555
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   556
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   557
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   558
void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   559
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   560
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   561
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   562
		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   563
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   564
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   565
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   566
void CPodcastQueueView::UpdateToolbar(TBool aVisible)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   567
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   568
	CAknToolbar* toolbar = Toolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   569
	
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   570
	if (toolbar) {
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   571
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   572
		TInt itemCnt = fItems.Count();
14
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   573
		if (iListContainer->IsVisible()) {
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   574
			toolbar->SetToolbarVisibility(aVisible);
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   575
		}
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   576
		toolbar->HideItem(EPodcastRemoveAllDownloads, EFalse, ETrue);
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   577
		toolbar->SetItemDimmed(EPodcastRemoveAllDownloads, itemCnt == 0, ETrue);
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   578
		toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue);
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   579
		toolbar->HideItem(EPodcastResumeDownloads,!iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue);	
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   580
#ifdef SYMBIAN1_UI
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   581
		toolbar->HideItem(EPodcastRemoveDownload, EFalse, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   582
		toolbar->SetItemDimmed(EPodcastRemoveDownload, itemCnt == 0, ETrue);		
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   583
#endif
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   584
	}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   585
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   586
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   587
void CPodcastQueueView::DownloadQueueUpdatedL(TInt /*aDownloadingShows*/, TInt /*aQueuedShows*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   588
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   589
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   590
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   591
void CPodcastQueueView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   592
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   593
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   594
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
	}