application/src/PodcastShowsView.cpp
author teknolog
Thu, 13 May 2010 13:56:05 +0100
changeset 126 c2f1ea38ec70
parent 121 1cc7501102a8
child 133 5f9e7e14eb11
permissions -rw-r--r--
Import from FCL default branch
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");
126
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 121
diff changeset
    41
//_LIT(KShowErrorFormat, "%d\t%S\t%S\t");
c2f1ea38ec70 Import from FCL default branch
teknolog
parents: 121
diff changeset
    42
//_LIT(KShowQueueFormat, "%d\t%S\t%S%S\t");
2
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
// these must correspond with TShowsIconIndex
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
const TUint KShowIconArrayIds[] =
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
			EMbmPodcastAudio,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
			EMbmPodcastAudio_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
			EMbmPodcastAudio_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
			EMbmPodcastAudio_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
			EMbmPodcastAudio_queued,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
			EMbmPodcastAudio_queued_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
			EMbmPodcastAudio_downloading,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
			EMbmPodcastAudio_downloading_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
			EMbmPodcastAudio_downloaded,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
			EMbmPodcastAudio_downloaded_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
			EMbmPodcastAudio_downloaded_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
			EMbmPodcastAudio_downloaded_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
			EMbmPodcastAudio_failed,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
			EMbmPodcastAudio_failed_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
			EMbmPodcastAudio_suspended,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
			EMbmPodcastAudio_suspended_mask,
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    64
			EMbmPodcastVideo,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    65
			EMbmPodcastVideo_mask,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    66
			EMbmPodcastVideo_new,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    67
			EMbmPodcastVideo_new_mask,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    68
			EMbmPodcastVideo_queued,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    69
			EMbmPodcastVideo_queued_mask,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    70
			EMbmPodcastVideo_downloading,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    71
			EMbmPodcastVideo_downloading_mask,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    72
			EMbmPodcastVideo_downloaded,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    73
			EMbmPodcastVideo_downloaded_mask,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    74
			EMbmPodcastVideo_downloaded_new,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    75
			EMbmPodcastVideo_downloaded_new_mask,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    76
			EMbmPodcastVideo_failed,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    77
			EMbmPodcastVideo_failed_mask,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    78
			EMbmPodcastVideo_suspended,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    79
			EMbmPodcastVideo_suspended_mask,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    80
			EMbmPodcastFeed,
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    81
			EMbmPodcastFeed_mask,
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
			0,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
			0
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    86
const TInt KVideoIconOffset = 8;
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
    87
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
	CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
CPodcastShowsView* CPodcastShowsView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
	CPodcastShowsView* self = new ( ELeave ) CPodcastShowsView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
CPodcastShowsView::CPodcastShowsView(CPodcastModel& aPodcastModel) :
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	iPodcastModel(aPodcastModel)
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
void CPodcastShowsView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
	BaseConstructL(R_PODCAST_SHOWSVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
	CreateIconsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
	iListContainer->Listbox()->SetListBoxObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
	iPodcastModel.ShowEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
	TResourceReader reader;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
	iCoeEnv->CreateResourceReaderLC(reader,R_SHOWVIEW_POPUP_MENU);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
	iStylusPopupMenu->ConstructFromResourceL(reader);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
	CleanupStack::PopAndDestroy();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
void CPodcastShowsView::CreateIconsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
		{
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   135
		// Load the icon	
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   136
		CFbsBitmap* bitmap= NULL;
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   137
		CFbsBitmap* mask=  NULL;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
		CleanupStack::PushL(bitmap);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
		
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   146
		// Append the icon to icon array
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
		pos+=2;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
	CleanupStack::Pop(icons); // icons
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
	}
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
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
	if (aType == EEventKey)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
		CShowInfo *activeShow = NULL;
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
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
			activeShow = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
					HandleCommandL(EPodcastMarkAsPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
			case '#':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
				if (activeShow->DownloadState() == ENotDownloaded) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
					HandleCommandL(EPodcastDownloadShow);
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
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
					HandleCommandL(EPodcastDeleteShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
			UpdateToolbar();
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
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
CPodcastShowsView::~CPodcastShowsView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
	iPodcastModel.FeedEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
    if(iStylusPopupMenu)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
        delete iStylusPopupMenu, iStylusPopupMenu = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
TUid CPodcastShowsView::Id() const
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
	return KUidPodcastShowsViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
	DP("CPodcastShowsView::DoActivateL BEGIN");
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   218
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   219
	
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   220
	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
	UpdateViewTitleL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
	DP("CPodcastShowsView::DoActivateL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
void CPodcastShowsView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
	CPodcastListView::DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   234
void CPodcastShowsView::ShowListUpdatedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
	}
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
void CPodcastShowsView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
	if (!iListContainer->IsVisible())
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
		return;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   244
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   245
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
	if (info) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   248
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   249
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   250
		}		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   251
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   252
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   253
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   254
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   255
	iProgressAdded = EFalse;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   256
	CShowInfo *info = NULL;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   257
	RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   258
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   259
	for (TInt i=0;i<fItems.Count();i++)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   260
		{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   261
		if (fItems[i]->Uid() == aShowUid)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   262
			{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   263
			info = fItems[i];
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   264
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   265
		}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   266
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   267
	if (info == NULL) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   268
		return;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   269
	}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   271
	switch(aError)
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
		case KErrCouldNotConnect:
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
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
			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
   277
			ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   278
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
			break;
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   280
		default:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   282
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   283
	UpdateListboxItemsL();
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   288
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   289
	// 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
   290
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   291
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   292
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   293
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   294
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   296
		}	
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::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   300
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   301
	DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   302
	// 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
   303
	// finished instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   305
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   306
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   307
		UpdateFeedUpdateStateL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   308
		UpdateViewTitleL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   310
	DP("CPodcastShowsView::FeedDownloadFinishedL END");
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   313
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   314
		TListBoxEvent aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   315
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   316
	switch (aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   317
		{
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   318
		case EEventItemClicked:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   319
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   320
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
		case EEventItemDoubleClicked:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   322
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   323
			RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
			if (index>=0 && index< fItems.Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   326
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   327
				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
   328
				CShowInfo *showInfo = fItems[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   329
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   330
				switch (showInfo->DownloadState()) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
				case ENotDownloaded:
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   332
				case EFailedDownload:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   333
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
					break;
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   335
				case EDownloading:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
				case EQueued:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
					AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID,  TUid::Uid(0), KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
					((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   339
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
				case EDownloaded:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
					#pragma message("LAPER Replace activate playview with activate playback in mpx")
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
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   349
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   351
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   352
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   353
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   354
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   356
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   357
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   358
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   359
	switch (aShowInfo->DownloadState())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
		{
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   361
		case EDownloaded:
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 = EDownloadedNewShowIcon;
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 = EDownloadedShowIcon;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   366
			}
34
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 ENotDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   369
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   370
				aIconIndex = ENewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   371
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   372
				aIconIndex = EShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   373
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   374
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   375
		case EQueued:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   376
			aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   377
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   378
		case EDownloading:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   379
			aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   380
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   381
		case EFailedDownload:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   382
			aIconIndex = EFailedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   383
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   384
		}
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   385
	
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   386
	if (aShowInfo->ShowType() == EVideoPodcast)
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   387
		{
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   388
		aIconIndex += KVideoIconOffset;
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   389
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   390
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   391
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   392
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
void CPodcastShowsView::UpdateFeedUpdateStateL()
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
	TBool listboxDimmed = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   396
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   397
	if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   398
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
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
		listboxDimmed = ETrue;
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
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
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
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   407
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   408
	UpdateToolbar();
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   411
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   412
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   414
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   415
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
	GetShowIcons(&aShowInfo, iconIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   418
	if(aSizeDownloaded > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   419
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   420
		if (aShowInfo.ShowSize() > 0)
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
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   423
						((float)aShowInfo.ShowSize() / (float)KSizeMb));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   424
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   425
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   426
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
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
	else if (aShowInfo.ShowSize() > 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
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
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
		infoSize = KNullDesC();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   436
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   437
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   438
	if (aShowInfo.PubDate().Int64() == 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   439
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
		showDate = KNullDesC();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   442
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   444
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   445
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   446
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   447
	if(aShowInfo.LastError() != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   449
		GetShowErrorText(infoSize, aShowInfo.LastError());
112
0bd6b9a3f027 Don't show feed/show date when an error occured
teknolog
parents: 107
diff changeset
   450
		showDate.Zero();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   451
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   452
	
112
0bd6b9a3f027 Don't show feed/show date when an error occured
teknolog
parents: 107
diff changeset
   453
	if (infoSize.Length() > 0 && showDate.Length() > 0)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   455
		infoSize.Insert(0,_L(", "));
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
		
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   458
	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   461
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
	{
117
3b59b88b089e Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents: 115
diff changeset
   463
	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   464
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
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
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   469
	iItemArray->Delete(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   470
	if(aIndex>= iItemArray->MdcaCount())
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
		iItemArray->AppendL(iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   473
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   474
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   476
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   481
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
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
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   485
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   486
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   487
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
					iListContainer->Listbox()->DrawItem(i);
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
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   492
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   494
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   495
void CPodcastShowsView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   496
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   497
	if (iListContainer->IsVisible())
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
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   500
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   501
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   502
		iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid());
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   503
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   504
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   505
		len = fItems.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   506
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
		if (iListContainer->Listbox() != NULL)
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
			TBool allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   510
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   512
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   513
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   515
				for (TInt loop = 0; loop< len; loop++)
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
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   518
					if (fItems[loop]->Uid() != itemId)
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
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   521
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   523
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   524
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   525
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   526
			if (allUidsMatch && len > 0)
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
				for (TInt loop = 0; loop< len; loop++)
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   529
					{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   530
					UpdateShowItemDataL(fItems[loop], loop);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   531
					}
31
8a5ead064c4f Shows view now updates correctl after Mark all played
teknolog
parents: 28
diff changeset
   532
				iListContainer->Listbox()->DrawNow();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   533
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
			else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   535
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   536
				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   537
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   538
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   539
				iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   540
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   541
				if (len > 0)
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
					for (TInt i=0; i<len; i++)
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
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   546
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   547
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   548
						iItemArray->AppendL(iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   549
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   550
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   551
				else
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
					iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   554
					iItemIdArray.Reset();
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
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   557
					itemProps.SetHiddenSelection(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   558
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   559
				iListContainer->Listbox()->HandleItemAdditionL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   560
				}				
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
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   563
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   564
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   565
/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   566
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   567
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   568
 * @param aCommand ID of the command to respond to. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   569
 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   570
void CPodcastShowsView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   571
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   572
	switch (aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   573
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   574
		case EPodcastMarkAsPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   575
			HandleSetShowPlayedL(ETrue);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   576
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   577
		case EPodcastMarkAsUnplayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   578
			HandleSetShowPlayedL(EFalse);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   579
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   580
		case EPodcastMarkAllPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   581
			iPodcastModel.MarkSelectionPlayedL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   582
			UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   583
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   584
		case EPodcastDeleteShow:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   585
			HandleDeleteShowL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   586
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   587
		case EPodcastDownloadShow:
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
			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
   590
			
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   591
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
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
				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   594
				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   596
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   597
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   598
		case EPodcastUpdateFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   599
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   600
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   601
			if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   602
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   603
				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
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
				if (error != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   606
					{
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   607
					HBufC* str =
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   608
							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   609
					User::InfoPrint(*str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   610
					CleanupStack::PopAndDestroy(str);
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
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   613
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   614
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   615
		case EPodcastCancelUpdateAllFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   616
			iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   617
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   618
		case EPodcastShowInfo:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   619
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   620
			DisplayShowInfoDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   621
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   622
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   623
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   624
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   625
		}
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   626
	iListContainer->SetLongTapDetectedL(EFalse);
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   627
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   628
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   629
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   630
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   631
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   632
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   633
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
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
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   636
		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   637
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   638
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   639
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   640
void CPodcastShowsView::DisplayShowInfoDialogL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   641
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   642
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   643
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   644
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   645
		CShowInfo* info = iPodcastModel.ActiveShowList()[index];
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   646
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   647
		HBufC *title = info->Title().AllocL();
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   648
		HBufC *description = info->Description().AllocL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   649
		
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   650
		CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   651
							
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   652
		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
   653
		note->RunLD();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   654
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   655
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   656
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   657
void CPodcastShowsView::UpdateToolbar(TBool aVisible)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   658
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   659
	CAknToolbar* toolbar = Toolbar();
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   660
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   661
	if (toolbar) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   662
		if (iListContainer->IsVisible()) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   663
			toolbar->SetToolbarVisibility(aVisible);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   664
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   665
	
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   666
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && 
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   667
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
14
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   668
	
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   669
		toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); 
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   670
		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue );
54
21ffe6559297 Fix for middle toolbar button being drawn in single tap mode when there is only 1 button
teknolog
parents: 50
diff changeset
   671
		// there seems to be drawing bugs in the toolbar if there is only
21ffe6559297 Fix for middle toolbar button being drawn in single tap mode when there is only 1 button
teknolog
parents: 50
diff changeset
   672
		// one or two buttons defined in the resource, so we have download
21ffe6559297 Fix for middle toolbar button being drawn in single tap mode when there is only 1 button
teknolog
parents: 50
diff changeset
   673
		// there but always hidden
21ffe6559297 Fix for middle toolbar button being drawn in single tap mode when there is only 1 button
teknolog
parents: 50
diff changeset
   674
		toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue );
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
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   677
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   678
void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
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
	DP("CPodcastShowsView::HandleLongTapEventL BEGIN");
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   681
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   682
	iListContainer->SetLongTapDetectedL(ETrue);
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   683
4
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 3
diff changeset
   684
	const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 3
diff changeset
   685
	TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems(
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 3
diff changeset
   686
			iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight;
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 3
diff changeset
   687
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 3
diff changeset
   688
    if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   689
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   690
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   691
		if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   692
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   693
			CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   694
			TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   695
			TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   696
			TBool hideMarkOld = info->PlayState() == EPlayed;
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
			iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   699
			iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   700
						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   701
			iStylusPopupMenu->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   702
			iStylusPopupMenu->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   703
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   704
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   705
		iStylusPopupMenu->ShowMenu();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   706
		iStylusPopupMenu->SetPosition(aPenEventLocation);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   707
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   708
	DP("CPodcastShowsView::HandleLongTapEventL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   709
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   710
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   711
void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed)
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   714
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   715
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   716
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   717
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   718
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   719
		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
   720
		iPodcastModel.ShowEngine().UpdateShowL(*info);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   721
		UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   722
		iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   723
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   724
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   725
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   726
void CPodcastShowsView::HandleDeleteShowL()
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
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   729
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   730
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   731
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   732
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   733
		TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   734
		TBuf<KMaxMessageLength> templ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   735
		iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   736
		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
   737
		if (ShowQueryMessageL(msg))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   738
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   739
			iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   740
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   741
			// and mark as played, and not downloaded
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
			info->SetDownloadState(ENotDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   744
			info->SetPlayState(EPlayed);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   745
			iPodcastModel.ShowEngine().UpdateShowL(*info);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   746
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   747
			UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   748
			iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   749
			}
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   752
16
7a4b769d94c8 Re-enabled queue count in tabs
teknolog
parents: 14
diff changeset
   753
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   754
	{
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   755
	((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   756
	UpdateListboxItemsL();
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   759
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
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
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   762
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   763
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   764
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   765
void CPodcastShowsView::UpdateViewTitleL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   766
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   767
	DP("CPodcastShowsView::UpdateViewTitleL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   768
	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   769
		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   770
		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   771
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   772
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   773
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   774
		if (updatingState) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   775
			SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   776
		} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   777
			SetEmptyTextL(R_PODCAST_EMPTY_LIST);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   778
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   779
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   780
		if(iPodcastModel.ActiveFeedInfo())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   781
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   782
			if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   783
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   784
				titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   785
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   786
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   787
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   788
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   789
			titlePane->SetTextToDefaultL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   790
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   791
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   792
	DP("CPodcastShowsView::UpdateViewTitleL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   793
	}