application/src/PodcastQueueView.cpp
author teknolog
Fri, 12 Mar 2010 00:20:10 +0000
changeset 49 43e204e6ae2e
parent 46 094bbe96dde0
child 50 e7b10d6d7ba3
permissions -rw-r--r--
Fix for accidental merge regressions. Text fixes for tool tip and settings.
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 <podcast.rsg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include <podcast.mbg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include <gulicon.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include <barsread.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#include <aknnotedialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
#include <aknmessagequerydialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
#include "Podcast.hrh"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
#define KMaxMessageLength 200
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
#define KPodcastImageWidth 160
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
#define KPodcastImageHeight 120
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
#define KPodcastDialogOffset 2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
#define KOneHundredPercent 100
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
const TInt KSizeBufLen = 64;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
const TInt KDefaultGran = 5;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
_LIT(KShowsSizeFormatS60, "%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
_LIT(KShowFormat, "%d\t%S\t%S %S\t");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
_LIT(KShowErrorFormat, "%d\t%S\t%S\t");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
_LIT(KShowQueueFormat, "%d\t%S\t%S%S\t");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
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
// these must correspond with TShowsIconIndex
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
const TUint KShowIconArrayIds[] =
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
			EMbmPodcastAudio,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
			EMbmPodcastAudio_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
			EMbmPodcastAudio_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
			EMbmPodcastAudio_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
			EMbmPodcastAudio_queued,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
			EMbmPodcastAudio_queued_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
			EMbmPodcastAudio_downloading,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
			EMbmPodcastAudio_downloading_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
			EMbmPodcastAudio_downloaded,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
			EMbmPodcastAudio_downloaded_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
			EMbmPodcastAudio_downloaded_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
			EMbmPodcastAudio_downloaded_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
			EMbmPodcastAudio_failed,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
			EMbmPodcastAudio_failed_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
			EMbmPodcastAudio_suspended,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
			EMbmPodcastAudio_suspended_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
			0,
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
	};
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
CPodcastQueueView* CPodcastQueueView::NewL(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	CPodcastQueueView* self = CPodcastQueueView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
	}
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
CPodcastQueueView* CPodcastQueueView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	CPodcastQueueView* self = new ( ELeave ) CPodcastQueueView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
	}
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
CPodcastQueueView::CPodcastQueueView(CPodcastModel& aPodcastModel) :
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
	iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
	{
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
void CPodcastQueueView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	BaseConstructL(R_PODCAST_QUEUEVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
		// Load the bitmap for play icon	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
		CFbsBitmap* bitmap= NULL;//iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
		CFbsBitmap* mask=  NULL;////iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos+1] );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
		CleanupStack::PushL(bitmap);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
		// Load the mask for play icon			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
		// Append the play icon to icon array
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
		pos+=2;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
	CleanupStack::Pop(icons); // icons
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
	iListContainer->Listbox()->SetListBoxObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
	iPodcastModel.ShowEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
	TResourceReader reader;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
	iCoeEnv->CreateResourceReaderLC(reader,R_QUEUEVIEW_POPUP_MENU);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
	iStylusPopupMenu->ConstructFromResourceL(reader);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
	CleanupStack::PopAndDestroy();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
	SetEmptyTextL(R_PODCAST_EMPTY_QUEUE);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
	}
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
TKeyResponse CPodcastQueueView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
	if (aType == EEventKey)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
		CShowInfo *activeShow = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
			activeShow = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
		}
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
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
					HandleCommandL(EPodcastMarkAsPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
			case '#':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
				if (activeShow->DownloadState() == ENotDownloaded) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
				HandleCommandL(EPodcastRemoveDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
			UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
		}
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
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
	}
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
CPodcastQueueView::~CPodcastQueueView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
	iPodcastModel.FeedEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
    if(iStylusPopupMenu)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
        delete iStylusPopupMenu, iStylusPopupMenu = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
	}
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
TUid CPodcastQueueView::Id() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
	return KUidPodcastQueueViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
	}
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
void CPodcastQueueView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
	DP("CPodcastQueueView::DoActivateL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 46
diff changeset
   202
	iPreviousView = aPrevViewId;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
	DP("CPodcastQueueView::DoActivateL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
	}
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
void CPodcastQueueView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
	CPodcastListView::DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
	}
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
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
void CPodcastQueueView::ShowListUpdatedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
	}
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
void CPodcastQueueView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
	if (!iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
		return;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
		}
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
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
	if (info) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
		}
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
void CPodcastQueueView::ShowDownloadFinishedL(TUint /*aShowUid*/, TInt aError)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
	{
33
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   236
	if (iListContainer->IsVisible()) 
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
		{
33
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   238
	
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   239
		iProgressAdded = EFalse;
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   240
	
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   241
		iPodcastModel.GetShowsDownloadingL();
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   242
		UpdateListboxItemsL();
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   243
		UpdateToolbar();
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   244
		
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   245
		switch(aError)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
			{
33
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   247
			case KErrCouldNotConnect:
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   248
				{
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   249
				TBuf<KMaxMessageLength> message;
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   250
				iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   251
				ShowErrorMessage(message);
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   252
				}
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   253
				break;
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   254
			default: // Do nothing
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 23
diff changeset
   255
				break;
2
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
	}
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   261
void CPodcastQueueView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   262
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   263
	// 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
   264
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   265
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   266
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 4
diff changeset
   268
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   269
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
		}	
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   273
void CPodcastQueueView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   274
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   275
	DP("CPodcastQueueView::FeedDownloadFinishedL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
	// 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
   277
	// finished instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   278
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 4
diff changeset
   281
		UpdateFeedUpdateStateL();
2
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
	DP("CPodcastQueueView::FeedDownloadFinishedL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   284
	}
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
void CPodcastQueueView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
		TListBoxEvent aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   288
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   289
	switch (aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   290
		{
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   291
#ifndef SYMBIAN1_UI
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   292
		case EEventItemClicked:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   293
#endif
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   294
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   296
		case EEventItemDoubleClicked:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   298
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   299
			break;
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
		UpdateToolbar();
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
void CPodcastQueueView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
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
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   307
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   308
	switch (aShowInfo->DownloadState())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
		{
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   310
		case EDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   311
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   312
				aIconIndex = EDownloadedNewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   313
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   314
				aIconIndex = EDownloadedShowIcon;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   315
			}
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   316
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   317
		case ENotDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   318
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   319
				aIconIndex = ENewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   320
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   321
				aIconIndex = EShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   322
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   323
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   324
		case EQueued:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   325
			aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   326
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   327
		case EDownloading:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   328
			aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   329
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   330
		case EFailedDownload:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   331
			aIconIndex = EFailedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   332
			break;
2
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   335
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
void CPodcastQueueView::UpdateFeedUpdateStateL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
	TBool listboxDimmed = EFalse;
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 (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   342
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
		listboxDimmed = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   345
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
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
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
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
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   351
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   352
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   353
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   354
void CPodcastQueueView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   356
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   357
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   358
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   359
	GetShowIcons(&aShowInfo, iconIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
	if(aSizeDownloaded > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   362
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
		if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   365
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   366
						((float)aShowInfo.ShowSize() / (float)KSizeMb));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   367
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   368
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   369
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   370
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   371
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   372
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   373
	else if (aShowInfo.ShowSize() > 0)
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
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
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
	else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   378
		infoSize = KNullDesC();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   379
	}
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
	if (aShowInfo.PubDate().Int64() == 0)
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
		showDate = KNullDesC();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   384
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   385
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   386
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   387
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   388
		}
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
	if(aShowInfo.LastError() != KErrNone)
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
		TBuf<KSizeBufLen> errorBuffer;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
		iEikonEnv->GetErrorText(errorBuffer, aShowInfo.LastError());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   394
		iListboxFormatbuffer.Format(KShowErrorFormat(), iconIndex, &aShowInfo.Title(), &errorBuffer);
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
	else	
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
		if (infoSize.Length() > 0) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   399
			infoSize.Insert(0,_L(", "));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   400
		}
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
		iListboxFormatbuffer.Format(KShowQueueFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
	}
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
void CPodcastQueueView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
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
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   409
	iItemArray->Delete(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   410
	if(aIndex>= iItemArray->MdcaCount())
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
		iItemArray->AppendL(iListboxFormatbuffer);
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
	else
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
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
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
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   419
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   420
void CPodcastQueueView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   421
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   422
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   423
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   424
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   425
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   426
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   428
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   429
					iListContainer->Listbox()->DrawItem(i);
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
		}
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
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   434
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
void CPodcastQueueView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   436
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   437
	if (iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   438
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   439
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 4
diff changeset
   442
		iPodcastModel.GetShowsDownloadingL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   444
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   445
		len = fItems.Count();
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
		if (iListContainer->Listbox() != NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   449
			TBool allUidsMatch = EFalse;
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
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   452
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   453
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   455
				for (TInt loop = 0; loop< len; loop++)
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
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
					if (fItems[loop]->Uid() != itemId)
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
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   461
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
						}
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
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
			if (allUidsMatch && len > 0)
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
				for (TInt loop = 0; loop< len; loop++)
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
					UpdateShowItemDataL(fItems[loop], loop);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   471
					iListContainer->Listbox()->DrawItem(loop);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   472
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   473
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   474
			else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   476
				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
				iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   481
				if (len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   483
					for (TInt i=0; i<len; i++)
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
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   486
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   487
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
						iItemArray->AppendL(iListboxFormatbuffer);
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
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   491
				else
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
					iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   494
					iItemIdArray.Reset();
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
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   497
					itemProps.SetHiddenSelection(ETrue);
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
				iListContainer->Listbox()->HandleItemAdditionL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   500
				}				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   501
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   502
		}
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
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
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
 * @param aCommand ID of the command to respond to. 
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
void CPodcastQueueView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   512
	switch (aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   513
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
		case EPodcastRemoveAllDownloads:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   515
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   516
			TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   517
			iEikonEnv->ReadResourceL(msg, R_CLEAR_QUERY);
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
			if(ShowQueryMessage(msg))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   521
				iPodcastModel.ShowEngine().RemoveAllDownloads();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
				UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   523
				}
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
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   526
		case EPodcastRemoveDownload:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   527
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   528
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   529
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   530
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   531
				if (iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid()))
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
						iItemArray->Delete(index);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
						iItemIdArray.Remove(index);						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   535
						iListContainer->Listbox()->HandleItemRemovalL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   536
						iListContainer->Listbox()->SetCurrentItemIndex(index - 1 > 0 ? index - 1 : 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   537
						iListContainer->Listbox()->DrawNow();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   538
						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   539
						delete iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   540
						iPodcastModel.ActiveShowList().Remove(index);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   541
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   542
				}
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 EPodcastSuspendDownloads:
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().SuspendDownloads();
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
		case EPodcastResumeDownloads:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   552
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   553
			iPodcastModel.ShowEngine().ResumeDownloadsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   554
			UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   555
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   556
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   557
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   558
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   559
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   560
		}
46
094bbe96dde0 Fix for #2197
teknolog
parents: 34
diff changeset
   561
	iListContainer->SetLongTapDetected(EFalse); // in case we got here by long tapping
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   562
	UpdateToolbar();
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
void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   566
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   567
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   568
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   569
		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   570
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   571
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   572
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   573
void CPodcastQueueView::UpdateToolbar(TBool aVisible)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   574
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   575
	CAknToolbar* toolbar = Toolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   576
	
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   577
	if (toolbar) {
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   578
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   579
		TInt itemCnt = fItems.Count();
14
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   580
		if (iListContainer->IsVisible()) {
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   581
			toolbar->SetToolbarVisibility(aVisible);
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   582
		}
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   583
		toolbar->HideItem(EPodcastRemoveAllDownloads, EFalse, ETrue);
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   584
		toolbar->SetItemDimmed(EPodcastRemoveAllDownloads, itemCnt == 0, ETrue);
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   585
		toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue);
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   586
		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
   587
#ifdef SYMBIAN1_UI
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   588
		toolbar->HideItem(EPodcastRemoveDownload, EFalse, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   589
		toolbar->SetItemDimmed(EPodcastRemoveDownload, itemCnt == 0, ETrue);		
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 14
diff changeset
   590
#endif
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 8
diff changeset
   591
	}
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   594
void CPodcastQueueView::DownloadQueueUpdatedL(TInt /*aDownloadingShows*/, TInt /*aQueuedShows*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   596
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   597
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   598
void CPodcastQueueView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   599
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   600
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   601
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   602
	}