application/src/PodcastShowsView.cpp
author Sebastian Brannstrom <sebastianb@symbian.org>
Sat, 16 Oct 2010 15:58:45 +0100
branch3rded
changeset 276 4357d59592dd
parent 177 269e3f3e544a
child 343 9c56bf585696
permissions -rw-r--r--
Fix for bug 3540 - show sorting when pubDate is not set in feed
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 "PodcastShowsView.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 "imagehandler.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include "constants.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <akntitle.h>
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
#define KMaxMessageLength 200
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
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
_LIT(KShowsSizeFormatS60, "%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
    40
_LIT(KShowFormat, "%d\t%S\t%S%S\t");
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
// these must correspond with TShowsIconIndex
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 TUint KShowIconArrayIds[] =
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
			EMbmPodcastAudio,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
			EMbmPodcastAudio_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
			EMbmPodcastAudio_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
			EMbmPodcastAudio_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
			EMbmPodcastAudio_queued,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
			EMbmPodcastAudio_queued_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
			EMbmPodcastAudio_downloading,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
			EMbmPodcastAudio_downloading_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
			EMbmPodcastAudio_downloaded,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
			EMbmPodcastAudio_downloaded_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
			EMbmPodcastAudio_downloaded_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
			EMbmPodcastAudio_downloaded_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
			EMbmPodcastAudio_failed,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
			EMbmPodcastAudio_failed_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
			EMbmPodcastAudio_suspended,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
			EMbmPodcastAudio_suspended_mask,
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    62
			EMbmPodcastVideo,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    63
			EMbmPodcastVideo_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    64
			EMbmPodcastVideo_new,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    65
			EMbmPodcastVideo_new_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    66
			EMbmPodcastVideo_queued,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    67
			EMbmPodcastVideo_queued_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    68
			EMbmPodcastVideo_downloading,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    69
			EMbmPodcastVideo_downloading_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    70
			EMbmPodcastVideo_downloaded,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    71
			EMbmPodcastVideo_downloaded_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    72
			EMbmPodcastVideo_downloaded_new,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    73
			EMbmPodcastVideo_downloaded_new_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    74
			EMbmPodcastVideo_failed,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    75
			EMbmPodcastVideo_failed_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    76
			EMbmPodcastVideo_suspended,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    77
			EMbmPodcastVideo_suspended_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    78
			EMbmPodcastFeed,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    79
			EMbmPodcastFeed_mask,
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
			0,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
			0
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    84
const TInt KVideoIconOffset = 8;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    85
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
CPodcastShowsView* CPodcastShowsView::NewL(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
	CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
	CleanupStack::Pop(self);
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
CPodcastShowsView* CPodcastShowsView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
	CPodcastShowsView* self = new ( ELeave ) CPodcastShowsView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
	return self;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
CPodcastShowsView::CPodcastShowsView(CPodcastModel& aPodcastModel) :
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
	iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
void CPodcastShowsView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
	{
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   108
	DP("CPodcastShowsView::ConstructL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
	BaseConstructL(R_PODCAST_SHOWSVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
	CreateIconsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
	iListContainer->Listbox()->SetListBoxObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
	iPodcastModel.ShowEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
	
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   119
	DP("CPodcastShowsView::ConstructL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
void CPodcastShowsView::CreateIconsL()
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
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
		{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   129
		// Load the icon	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   130
		CFbsBitmap* bitmap= NULL;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   131
		CFbsBitmap* mask=  NULL;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
		CleanupStack::PushL(bitmap);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
		
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   140
		// Append the icon to icon array
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
		pos+=2;
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
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
	CleanupStack::Pop(icons); // icons
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
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
	if (aType == EEventKey)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
		CShowInfo *activeShow = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
			activeShow = iPodcastModel.ActiveShowList()[index];
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
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
					HandleCommandL(EPodcastMarkAsPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
				}
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
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
			case '#':
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   176
				HandleCommandL(EPodcastShowInfo);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
					HandleCommandL(EPodcastDeleteShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
			}
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
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
CPodcastShowsView::~CPodcastShowsView()
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
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
	iPodcastModel.FeedEngine().RemoveObserver(this);
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
TUid CPodcastShowsView::Id() const
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
	return KUidPodcastShowsViewID;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
	DP("CPodcastShowsView::DoActivateL BEGIN");
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   207
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   208
	
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   209
	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
2
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
	UpdateViewTitleL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
	DP("CPodcastShowsView::DoActivateL END");
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
void CPodcastShowsView::DoDeactivate()
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
	CPodcastListView::DoDeactivate();
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
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
void CPodcastShowsView::ShowListUpdatedL()
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
	UpdateListboxItemsL();
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
void CPodcastShowsView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
	if (!iListContainer->IsVisible())
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
		return;
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
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
	if (info) 
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
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
		}		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   239
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   241
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
2
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
	iProgressAdded = EFalse;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   244
	CShowInfo *info = NULL;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   245
	RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   246
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   247
	for (TInt i=0;i<fItems.Count();i++)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   248
		{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   249
		if (fItems[i]->Uid() == aShowUid)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   250
			{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   251
			info = fItems[i];
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   252
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   253
		}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   254
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   255
	if (info == NULL) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   256
		return;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   257
	}
2
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
	switch(aError)
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
		case KErrCouldNotConnect:
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
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   264
			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: 28
diff changeset
   265
			ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   266
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
			break;
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   268
		default:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   269
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   271
	UpdateListboxItemsL();
2
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
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
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
	// 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
   278
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   282
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   283
		}	
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 CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   288
	DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN");
166
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   289
	if (iListContainer->IsVisible() &&
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   290
			iPodcastModel.ActiveFeedInfo() != NULL &&
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   291
			iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   292
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   293
		UpdateFeedUpdateStateL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   294
		UpdateViewTitleL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   296
	DP("CPodcastShowsView::FeedDownloadFinishedL END");
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   299
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   300
		TListBoxEvent aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   301
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   302
	switch (aEventType)
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
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   305
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   306
		case EEventItemDoubleClicked:
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
			RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   310
			if (index>=0 && index< fItems.Count())
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
				DP2("Handle event for podcast %S, downloadState is %d", &(fItems[index]->Title()), fItems[index]->DownloadState());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   313
				CShowInfo *showInfo = fItems[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   314
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   315
				switch (showInfo->DownloadState()) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   316
				case ENotDownloaded:
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   317
				case EFailedDownload:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   318
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   319
					break;
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   320
				case EDownloading:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
				case EQueued:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   322
					AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID,  TUid::Uid(0), KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   323
					((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
				case EDownloaded:
136
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   326
					{
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   327
					TRAPD(err, iPodcastModel.PlayPausePodcastL(showInfo, ETrue));
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   328
					if (err != KErrNone)
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   329
						{
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   330
						HBufC *error = iEikonEnv->AllocReadResourceLC(R_ERROR_PLAYBACK_FAILED);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   331
						ShowErrorMessageL(*error);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   332
						CleanupStack::PopAndDestroy(error);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   333
						}
90
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 70
diff changeset
   334
					UpdateListboxItemsL();
136
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   335
					}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
				default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
					break;
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
				}
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
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
			break;
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
	}
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 CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
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
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   351
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   352
	switch (aShowInfo->DownloadState())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   353
		{
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   354
		case EDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   355
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   356
				aIconIndex = EDownloadedNewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   357
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   358
				aIconIndex = EDownloadedShowIcon;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   359
			}
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   360
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   361
		case ENotDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   362
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   363
				aIconIndex = ENewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   364
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   365
				aIconIndex = EShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   366
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   367
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   368
		case EQueued:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   369
			aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   370
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   371
		case EDownloading:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   372
			aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   373
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   374
		case EFailedDownload:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   375
			aIconIndex = EFailedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   376
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   377
		}
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   378
	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   379
	if (aShowInfo->ShowType() == EVideoPodcast)
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   380
		{
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   381
		aIconIndex += KVideoIconOffset;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   382
		}
2
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
	
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
void CPodcastShowsView::UpdateFeedUpdateStateL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   387
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   388
	TBool listboxDimmed = EFalse;
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 (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   391
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   392
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
		listboxDimmed = ETrue;
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
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
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
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
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
	UpdateListboxItemsL();
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
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
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   407
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   408
	GetShowIcons(&aShowInfo, iconIndex);	
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
	if(aSizeDownloaded > 0)
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
		if (aShowInfo.ShowSize() > 0)
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
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   415
						((float)aShowInfo.ShowSize() / (float)KSizeMb));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
		else
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
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   420
			}
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
	else if (aShowInfo.ShowSize() > 0)
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
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
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
	else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
		infoSize = KNullDesC();	
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   430
	if (aShowInfo.PubDate().Int64() == 0)
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
		showDate = KNullDesC();
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
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   436
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   439
	if(aShowInfo.LastError() != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   441
		GetShowErrorText(infoSize, aShowInfo.LastError());
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   442
		showDate.Zero();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   444
	
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   445
	if (infoSize.Length() > 0 && showDate.Length() > 0)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   446
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   447
		infoSize.Insert(0,_L(", "));
2
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
		
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   450
	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   451
	}
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
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
	{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   455
	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
2
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
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
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
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   461
	iItemArray->Delete(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
	if(aIndex>= iItemArray->MdcaCount())
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
		iItemArray->AppendL(iListboxFormatbuffer);
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
	else
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
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
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
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   471
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   472
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
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
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
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
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   481
					iListContainer->Listbox()->DrawItem(i);
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
		}
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
}
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
void CPodcastShowsView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
	if (iListContainer->IsVisible())
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
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   492
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   494
		iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid());
2
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
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   497
		len = fItems.Count();
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
		if (iListContainer->Listbox() != NULL)
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
			TBool allUidsMatch = EFalse;
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
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
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
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   506
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
				for (TInt loop = 0; loop< len; loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   509
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   510
					if (fItems[loop]->Uid() != itemId)
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
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   513
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
						}
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
				}
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
			if (allUidsMatch && len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   519
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
				for (TInt loop = 0; loop< len; loop++)
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   521
					{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   522
					UpdateShowItemDataL(fItems[loop], loop);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   523
					}
31
8a5ead064c4f Shows view now updates correctl after Mark all played
teknolog
parents: 28
diff changeset
   524
				iListContainer->Listbox()->DrawNow();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   525
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   526
			else
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
				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   529
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   530
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   531
				iItemArray->Reset();
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
				if (len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   535
					for (TInt i=0; i<len; i++)
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
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   538
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   539
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   540
						iItemArray->AppendL(iListboxFormatbuffer);
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
				else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   544
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   545
					iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   546
					iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   547
					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   548
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   549
					itemProps.SetHiddenSelection(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   550
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   551
				iListContainer->Listbox()->HandleItemAdditionL();
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
			}
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
	}
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
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   559
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   560
 * @param aCommand ID of the command to respond to. 
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
void CPodcastShowsView::HandleCommandL(TInt aCommand)
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
	switch (aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   565
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   566
		case EPodcastMarkAsPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   567
			HandleSetShowPlayedL(ETrue);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   568
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   569
		case EPodcastMarkAsUnplayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   570
			HandleSetShowPlayedL(EFalse);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   571
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   572
		case EPodcastMarkAllPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   573
			iPodcastModel.MarkSelectionPlayedL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   574
			UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   575
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   576
		case EPodcastDeleteShow:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   577
			HandleDeleteShowL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   578
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   579
		case EPodcastDownloadShow:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   580
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   581
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
33
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 32
diff changeset
   582
			
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   583
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   584
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   585
				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   586
				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   587
				}
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
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   590
		case EPodcastUpdateFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   591
			{
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
			if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   594
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
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
				if (error != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   598
					{
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   599
					HBufC* str =
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   600
							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   601
					User::InfoPrint(*str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   602
					CleanupStack::PopAndDestroy(str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   603
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   604
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   605
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   606
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   607
		case EPodcastCancelUpdateAllFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   608
			iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   609
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   610
		case EPodcastShowInfo:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   611
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   612
			DisplayShowInfoDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   613
			}break;
130
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   614
		case EPodcastFilterShowsAll:
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   615
			iPodcastModel.ShowEngine().SetShowFilter(EAllShows);
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   616
			UpdateListboxItemsL();
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   617
			break;
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   618
		case EPodcastFilterShowsDownloaded:
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   619
			iPodcastModel.ShowEngine().SetShowFilter(EDownloadedShows);
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   620
			UpdateListboxItemsL();
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   621
			break;			
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   622
		case EPodcastFilterShowsNew:
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   623
			iPodcastModel.ShowEngine().SetShowFilter(ENewShows);
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   624
			UpdateListboxItemsL();
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   625
			break;
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   626
		case EPodcastFilterShowsNewAndDownloaded:
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   627
			iPodcastModel.ShowEngine().SetShowFilter(ENewAndDownloadedShows);
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   628
			UpdateListboxItemsL();
92572a695a1d Added new experimental feature to show only new and downloaded shows; Updated SIS files
teknolog
parents: 90
diff changeset
   629
			break;	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   630
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   631
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   632
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   633
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   634
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   635
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   636
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   637
{
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   638
	TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() && 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   639
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   640
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   641
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   642
		{	
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   643
		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState || iPodcastModel.ActiveShowList().Count() == 0);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   644
		aMenuPane->SetItemDimmed(EPodcastUpdateFeed, updatingState); 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   645
		aMenuPane->SetItemDimmed(EPodcastCancelUpdateAllFeeds, !updatingState);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   646
		aMenuPane->SetItemDimmed(EPodcastShowsShowMenu, updatingState || iPodcastModel.ActiveShowList().Count() == 0);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   647
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   648
	else if (aResourceId == R_SHOWS_SHOW_MENU)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   649
		{
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   650
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   651
		if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   652
			{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   653
			CShowInfo *info = iPodcastModel.ActiveShowList()[index];
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   654
			TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   655
			TBool hideMarkOld = info->PlayState() == EPlayed;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   656
			
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   657
			aMenuPane->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   658
			aMenuPane->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);			
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   659
			aMenuPane->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   660
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   661
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   662
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   663
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   664
void CPodcastShowsView::DisplayShowInfoDialogL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   665
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   666
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   667
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   668
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   669
		CShowInfo* info = iPodcastModel.ActiveShowList()[index];
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   670
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   671
		HBufC *title = info->Title().AllocL();
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   672
		HBufC *description = info->Description().AllocL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   673
		
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   674
		CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   675
							
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   676
		note->PrepareLC( R_SHOW_INFO_NOTE ); // Adds to CleanupStack
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   677
		note->RunLD();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   678
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   679
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   680
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   681
void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   682
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   683
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   684
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   685
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   686
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   687
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   688
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   689
		info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   690
		iPodcastModel.ShowEngine().UpdateShowL(*info);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   691
		UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   692
		iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   693
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   694
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   695
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   696
void CPodcastShowsView::HandleDeleteShowL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   697
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   698
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   699
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   700
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   701
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   702
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   703
		TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   704
		TBuf<KMaxMessageLength> templ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   705
		iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   706
		msg.Format(templ, &(info->Title()));
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   707
		if (ShowQueryMessageL(msg))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   708
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   709
			iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   710
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   711
			// and mark as played, and not downloaded
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   712
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   713
			info->SetDownloadState(ENotDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   714
			info->SetPlayState(EPlayed);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   715
			iPodcastModel.ShowEngine().UpdateShowL(*info);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   716
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   717
			UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   718
			iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   719
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   720
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   721
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   722
16
7a4b769d94c8 Re-enabled queue count in tabs
teknolog
parents: 14
diff changeset
   723
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   724
	{
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   725
	((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   726
	UpdateListboxItemsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   727
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   728
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   729
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   730
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   731
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   732
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   733
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   734
void CPodcastShowsView::UpdateViewTitleL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   735
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   736
	DP("CPodcastShowsView::UpdateViewTitleL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   737
	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   738
		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   739
		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   740
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   741
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   742
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   743
		if (updatingState) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   744
			SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   745
		} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   746
			SetEmptyTextL(R_PODCAST_EMPTY_LIST);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   747
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   748
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   749
		if(iPodcastModel.ActiveFeedInfo())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   750
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   751
			if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   752
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   753
				titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   754
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   755
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   756
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   757
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   758
			titlePane->SetTextToDefaultL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   759
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   760
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   761
	DP("CPodcastShowsView::UpdateViewTitleL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   762
	}