application/src/PodcastShowsView.cpp
author Sebastian Brannstrom <sebastianb@symbian.org>
Sun, 14 Nov 2010 13:06:35 +0000
branchnewlist
changeset 348 bd7f3de17443
parent 347 b8d687bb7ca1
child 350 9c4fd008e20f
permissions -rw-r--r--
Fixes
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
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
    40
_LIT(KShowFormat, "%d\t%S\t%S%S");
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
    41
_LIT(KShowFormatLandscape, "%d\t%S");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
// these must correspond with TShowsIconIndex
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
const TUint KShowIconArrayIds[] =
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
			EMbmPodcastAudio,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
			EMbmPodcastAudio_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
			EMbmPodcastAudio_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
			EMbmPodcastAudio_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
			EMbmPodcastAudio_queued,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
			EMbmPodcastAudio_queued_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
			EMbmPodcastAudio_downloading,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
			EMbmPodcastAudio_downloading_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
			EMbmPodcastAudio_downloaded,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
			EMbmPodcastAudio_downloaded_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
			EMbmPodcastAudio_downloaded_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
			EMbmPodcastAudio_downloaded_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
			EMbmPodcastAudio_failed,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
			EMbmPodcastAudio_failed_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
			EMbmPodcastAudio_suspended,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
			EMbmPodcastAudio_suspended_mask,
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    63
			EMbmPodcastVideo,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    64
			EMbmPodcastVideo_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    65
			EMbmPodcastVideo_new,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    66
			EMbmPodcastVideo_new_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    67
			EMbmPodcastVideo_queued,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    68
			EMbmPodcastVideo_queued_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    69
			EMbmPodcastVideo_downloading,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    70
			EMbmPodcastVideo_downloading_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    71
			EMbmPodcastVideo_downloaded,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    72
			EMbmPodcastVideo_downloaded_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    73
			EMbmPodcastVideo_downloaded_new,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    74
			EMbmPodcastVideo_downloaded_new_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    75
			EMbmPodcastVideo_failed,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    76
			EMbmPodcastVideo_failed_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    77
			EMbmPodcastVideo_suspended,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    78
			EMbmPodcastVideo_suspended_mask,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    79
			EMbmPodcastFeed,
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    80
			EMbmPodcastFeed_mask,
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
			0,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
			0
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    85
const TInt KVideoIconOffset = 8;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
    86
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
	CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
CPodcastShowsView* CPodcastShowsView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
	CPodcastShowsView* self = new ( ELeave ) CPodcastShowsView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
CPodcastShowsView::CPodcastShowsView(CPodcastModel& aPodcastModel) :
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
	iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
void CPodcastShowsView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
	BaseConstructL(R_PODCAST_SHOWSVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
	CreateIconsL();
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   113
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
	iPodcastModel.ShowEngine().AddObserver(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
	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
	TResourceReader reader;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
	iCoeEnv->CreateResourceReaderLC(reader,R_SHOWVIEW_POPUP_MENU);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
	iStylusPopupMenu->ConstructFromResourceL(reader);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
	CleanupStack::PopAndDestroy();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
void CPodcastShowsView::CreateIconsL()
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
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
		{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   132
		// Load the icon	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   133
		CFbsBitmap* bitmap= NULL;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   134
		CFbsBitmap* mask=  NULL;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
		CleanupStack::PushL(bitmap);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
		
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   143
		// Append the icon to icon array
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
		pos+=2;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
		
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   149
	//iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   150
	iListContainer->SetListboxIcons(icons);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
	CleanupStack::Pop(icons); // icons
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
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
	if (aType == EEventKey)
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
		CShowInfo *activeShow = NULL;
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
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
			activeShow = iPodcastModel.ActiveShowList()[index];
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
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
					HandleCommandL(EPodcastMarkAsPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
			case '#':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
				if (activeShow->DownloadState() == ENotDownloaded) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
					HandleCommandL(EPodcastDeleteShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
			default:
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
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
			UpdateToolbar();
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
CPodcastShowsView::~CPodcastShowsView()
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
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
	iPodcastModel.FeedEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
    if(iStylusPopupMenu)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
        delete iStylusPopupMenu, iStylusPopupMenu = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
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
TUid CPodcastShowsView::Id() const
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
	return KUidPodcastShowsViewID;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
	DP("CPodcastShowsView::DoActivateL BEGIN");
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   216
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   217
	
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   218
	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
	
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   220
	iShowNewShows = (aCustomMessageId.iUid == 1);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   221
	
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   222
	if (iShowNewShows)
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   223
		{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   224
		CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   225
		cba->SetCommandSetL(R_PODCAST_CBA);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   226
		cba->DrawDeferred();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   227
		}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   228
	else
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   229
		{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   230
		CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   231
		cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   232
		cba->DrawDeferred();		
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   233
		}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   234
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
	UpdateViewTitleL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
	DP("CPodcastShowsView::DoActivateL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   239
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
void CPodcastShowsView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
	CPodcastListView::DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   243
	}
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
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
void CPodcastShowsView::ShowListUpdatedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   248
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   249
	}
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
void CPodcastShowsView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   252
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   253
	if (!iListContainer->IsVisible())
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
		return;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   256
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   257
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   258
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   259
	if (info) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   260
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   261
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   262
		}		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   263
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   264
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   265
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   266
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
	iProgressAdded = EFalse;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   268
	CShowInfo *info = NULL;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   269
	RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   270
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   271
	for (TInt i=0;i<fItems.Count();i++)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   272
		{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   273
		if (fItems[i]->Uid() == aShowUid)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   274
			{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   275
			info = fItems[i];
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   276
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   277
		}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   278
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   279
	if (info == NULL) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   280
		return;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   281
	}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   282
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   283
	switch(aError)
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
		case KErrCouldNotConnect:
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
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   288
			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
   289
			ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   290
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   291
			break;
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   292
		default:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   293
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   294
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   295
	UpdateListboxItemsL();
2
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::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
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
	// 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
   302
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   303
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   305
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   306
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   307
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   308
		}	
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   311
void CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
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
	DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN");
166
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   314
	if (iListContainer->IsVisible() &&
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   315
			iPodcastModel.ActiveFeedInfo() != NULL &&
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   316
			iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   317
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   318
		UpdateFeedUpdateStateL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   319
		UpdateViewTitleL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   320
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
	DP("CPodcastShowsView::FeedDownloadFinishedL END");
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
		TListBoxEvent aEventType)
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
	switch (aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   328
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   329
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   330
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
		case EEventItemDoubleClicked:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   332
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   333
			RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   335
			if (index>=0 && index< fItems.Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
				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
   338
				CShowInfo *showInfo = fItems[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   339
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
				switch (showInfo->DownloadState()) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
				case ENotDownloaded:
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   342
				case EFailedDownload:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
					break;
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   345
				case EDownloading:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
				case EQueued:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   347
					AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID,  TUid::Uid(0), KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   348
					((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   349
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
				case EDownloaded:
136
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   351
					{
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   352
					TRAPD(err, iPodcastModel.PlayPausePodcastL(showInfo, ETrue));
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   353
					if (err != KErrNone)
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   354
						{
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   355
						HBufC *error = iEikonEnv->AllocReadResourceLC(R_ERROR_PLAYBACK_FAILED);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   356
						ShowErrorMessageL(*error);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   357
						CleanupStack::PopAndDestroy(error);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   358
						}
90
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 70
diff changeset
   359
					UpdateListboxItemsL();
136
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   360
					}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   362
				default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   365
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   366
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   367
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   368
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   369
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   370
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   371
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   372
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   373
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   374
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   375
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   376
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   377
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   378
	switch (aShowInfo->DownloadState())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   379
		{
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   380
		case EDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   381
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   382
				aIconIndex = EDownloadedNewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   383
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   384
				aIconIndex = EDownloadedShowIcon;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   385
			}
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   386
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   387
		case ENotDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   388
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   389
				aIconIndex = ENewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   390
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   391
				aIconIndex = EShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   392
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   393
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   394
		case EQueued:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   395
			aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   396
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   397
		case EDownloading:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   398
			aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   399
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   400
		case EFailedDownload:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   401
			aIconIndex = EFailedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   402
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
		}
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   404
	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   405
	if (aShowInfo->ShowType() == EVideoPodcast)
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   406
		{
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   407
		aIconIndex += KVideoIconOffset;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   408
		}
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   412
void CPodcastShowsView::UpdateFeedUpdateStateL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   414
	TBool listboxDimmed = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   415
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
	if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   418
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   419
		listboxDimmed = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   420
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   421
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   422
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   423
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   424
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   425
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   426
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
	UpdateToolbar();
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
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
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
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   433
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   434
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
	GetShowIcons(&aShowInfo, iconIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   436
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   437
	if(aSizeDownloaded > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   438
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   439
		if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   442
						((float)aShowInfo.ShowSize() / (float)KSizeMb));
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
		else
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
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   447
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   449
	else if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   450
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   451
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   452
		} 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   453
	else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
		infoSize = KNullDesC();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   455
	}
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
	if (aShowInfo.PubDate().Int64() == 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   459
		showDate = KNullDesC();
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
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   463
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   464
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
	if(aShowInfo.LastError() != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   467
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   468
		GetShowErrorText(infoSize, aShowInfo.LastError());
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   469
		showDate.Zero();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   470
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   471
	
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   472
	if (infoSize.Length() > 0 && showDate.Length() > 0)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   473
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   474
		infoSize.Insert(0,_L(", "));
2
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
		
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   477
	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   478
	iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title());
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   481
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
	{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   483
	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   484
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   485
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   486
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   487
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
	iItemArray->Delete(aIndex);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   490
	iItemArrayShort->Delete(aIndex);
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   491
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   492
	if(aIndex>= iItemArray->MdcaCount())
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
		iItemArray->AppendL(iListboxFormatbuffer);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   495
		iItemArrayShort->AppendL(iListboxFormatbufferShort);
2
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
	else
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
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   500
		iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   501
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   502
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   503
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   504
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   505
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   506
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   509
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   510
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   512
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   513
					iListContainer->Listbox()->DrawItem(i);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   515
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   516
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   517
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   518
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   519
void CPodcastShowsView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
	{
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   521
	DP("CPodcastShowsView::UpdateListboxItemsL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
	if (iListContainer->IsVisible())
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
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   525
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   526
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   527
		if (iShowNewShows)
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   528
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   529
			iPodcastModel.GetNewShowsL();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   530
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   531
		else
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   532
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   533
			iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid());
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   534
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   535
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   536
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   537
		len = fItems.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   538
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   539
		if (iListContainer->Listbox() != NULL)
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
			TBool allUidsMatch = EFalse;
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
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
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
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   546
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   547
				for (TInt loop = 0; loop< len; loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   548
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   549
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   550
					if (fItems[loop]->Uid() != itemId)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   551
						{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   552
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   553
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   554
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   555
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   556
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   557
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   558
			if (allUidsMatch && len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   559
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   560
				for (TInt loop = 0; loop< len; loop++)
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   561
					{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   562
					UpdateShowItemDataL(fItems[loop], loop);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   563
					}
31
8a5ead064c4f Shows view now updates correctl after Mark all played
teknolog
parents: 28
diff changeset
   564
				iListContainer->Listbox()->DrawNow();
2
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
			else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   567
				{
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   568
				//iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   569
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   570
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   571
				iItemArray->Reset();
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   572
				iItemArrayShort->Reset();
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   573
				
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   574
				if (len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   575
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   576
					for (TInt i=0; i<len; i++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   577
						{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   578
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   579
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   580
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   581
						iItemArray->AppendL(iListboxFormatbuffer);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   582
						iItemArrayShort->AppendL(iListboxFormatbufferShort);
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   583
												
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   584
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   585
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   586
				else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   587
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   588
					iItemArray->Reset();
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   589
					iItemArrayShort->Reset();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   590
					iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   591
					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   592
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   593
					itemProps.SetHiddenSelection(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   594
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
				iListContainer->Listbox()->HandleItemAdditionL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   596
				}				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   597
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   598
		}
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   599
	DP("CPodcastShowsView::UpdateListboxItemsL END");
2
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
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
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   604
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   605
 * @param aCommand ID of the command to respond to. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   606
 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   607
void CPodcastShowsView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   608
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   609
	switch (aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   610
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   611
		case EPodcastMarkAsPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   612
			HandleSetShowPlayedL(ETrue);
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   613
			if (iShowNewShows) UpdateListboxItemsL();
2
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 EPodcastMarkAsUnplayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   616
			HandleSetShowPlayedL(EFalse);
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   617
			if (iShowNewShows) UpdateListboxItemsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   618
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   619
		case EPodcastMarkAllPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   620
			iPodcastModel.MarkSelectionPlayedL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   621
			UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   622
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   623
		case EPodcastDeleteShow:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   624
			HandleDeleteShowL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   625
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   626
		case EPodcastDownloadShow:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   627
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   628
			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
   629
			
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   630
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   631
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   632
				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   633
				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   634
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   635
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   636
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   637
		case EPodcastUpdateFeed:
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
			if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0)
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
				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   643
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   644
				if (error != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   645
					{
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   646
					HBufC* str =
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   647
							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   648
					User::InfoPrint(*str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   649
					CleanupStack::PopAndDestroy(str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   650
					}
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
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   653
			break;
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   654
		case EPodcastUpdateAllFeeds:
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   655
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   656
			iPodcastModel.FeedEngine().UpdateAllFeedsL();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   657
			UpdateToolbar();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   658
			}break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   659
		case EPodcastCancelUpdateAllFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   660
			iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   661
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   662
		case EPodcastShowInfo:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   663
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   664
			DisplayShowInfoDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   665
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   666
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   667
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   668
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   669
		}
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   670
	iListContainer->SetLongTapDetectedL(EFalse);
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   671
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   672
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   673
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   674
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   675
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
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
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   678
		{
288
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   679
		TBool showMarkAllPlayed = EFalse;
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   680
		for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   681
			{
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   682
			CShowInfo* info = iPodcastModel.ActiveShowList()[i];
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   683
			if (info->PlayState() == ENeverPlayed)
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   684
				{
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   685
				showMarkAllPlayed = ETrue;
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   686
				break;
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   687
				}
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   688
			
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   689
			}
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   690
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   691
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
288
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   692
		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState || !showMarkAllPlayed);
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   693
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   694
			
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   695
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   696
}
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
void CPodcastShowsView::DisplayShowInfoDialogL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   699
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   700
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   701
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   702
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   703
		CShowInfo* info = iPodcastModel.ActiveShowList()[index];
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   704
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   705
		HBufC *title = info->Title().AllocL();
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   706
		HBufC *description = info->Description().AllocL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   707
		
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   708
		CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
2
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
		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
   711
		note->RunLD();
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
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   715
void CPodcastShowsView::UpdateToolbar(TBool aVisible)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   716
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   717
	CAknToolbar* toolbar = Toolbar();
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   718
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   719
	if (toolbar) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   720
		if (iListContainer->IsVisible()) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   721
			toolbar->SetToolbarVisibility(aVisible);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   722
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   723
	
156
48cdb40709e7 Fix for bug 2819 - Crash when updating and connection set to "Always ask"
teknolog
parents: 136
diff changeset
   724
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() && 
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   725
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
14
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   726
	
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   727
		if (iShowNewShows)
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   728
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   729
			updatingState = iPodcastModel.FeedEngine().ClientState();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   730
			toolbar->HideItem(EPodcastUpdateFeed, ETrue, ETrue ); 
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   731
			toolbar->HideItem(EPodcastUpdateAllFeeds, updatingState, ETrue ); 
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   732
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   733
		else
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   734
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   735
			toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); 
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   736
			toolbar->HideItem(EPodcastUpdateAllFeeds, ETrue, ETrue ); 
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   737
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   738
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   739
		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue );
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   740
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   741
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   742
		TInt itemCnt = fItems.Count();
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   743
	
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   744
		TBool hideDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   745
		TBool dimDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   746
		TBool hideSetPlayed = EFalse;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   747
	
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   748
		if(iListContainer->Listbox() != NULL)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   749
		{
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   750
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   751
			
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   752
			if(index>= 0 && index < itemCnt)
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   753
			{
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   754
				switch(fItems[index]->DownloadState())
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   755
					{
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   756
					case ENotDownloaded:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   757
					case EFailedDownload:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   758
						hideDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   759
						dimDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   760
						break;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   761
					case EQueued:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   762
					case EDownloading:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   763
						hideDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   764
						dimDownloadShowCmd = ETrue;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   765
						break;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   766
					case EDownloaded:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   767
						hideDownloadShowCmd = ETrue;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   768
						break;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   769
					}
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   770
					
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   771
				if(fItems[index]->PlayState() == EPlayed) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   772
					hideSetPlayed = ETrue;
2
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
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   775
		}
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   776
		
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   777
		if (hideDownloadShowCmd) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   778
			toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   779
			toolbar->HideItem(EPodcastDeleteShow, EFalse, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   780
			toolbar->SetItemDimmed(EPodcastDeleteShow, updatingState, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   781
		} else {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   782
			toolbar->HideItem(EPodcastDownloadShow, EFalse, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   783
			toolbar->HideItem(EPodcastDeleteShow, ETrue, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   784
			toolbar->SetItemDimmed(EPodcastDownloadShow, updatingState || dimDownloadShowCmd, ETrue);	
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   785
		}
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   786
		
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   787
		if (hideSetPlayed) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   788
			toolbar->HideItem(EPodcastMarkAsPlayed, ETrue, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   789
			toolbar->HideItem(EPodcastMarkAsUnplayed, EFalse, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   790
			toolbar->SetItemDimmed(EPodcastMarkAsUnplayed, updatingState, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   791
		} else {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   792
			toolbar->HideItem(EPodcastMarkAsPlayed, EFalse, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   793
			toolbar->HideItem(EPodcastMarkAsUnplayed, ETrue, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   794
			toolbar->SetItemDimmed(EPodcastMarkAsPlayed, updatingState, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   795
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   796
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   797
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   798
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   799
void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   800
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   801
	DP("CPodcastShowsView::HandleLongTapEventL BEGIN");
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   802
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   803
	iListContainer->SetLongTapDetectedL(ETrue);
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   804
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
   805
	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
   806
	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
   807
			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
   808
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
   809
    if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   810
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   811
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   812
		if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   813
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   814
			CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   815
			TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   816
			TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   817
			TBool hideMarkOld = info->PlayState() == EPlayed;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   818
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   819
			iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   820
			iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   821
						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   822
			iStylusPopupMenu->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   823
			iStylusPopupMenu->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   824
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   825
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   826
		iStylusPopupMenu->ShowMenu();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   827
		iStylusPopupMenu->SetPosition(aPenEventLocation);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   828
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   829
	DP("CPodcastShowsView::HandleLongTapEventL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   830
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   831
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   832
void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   833
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   834
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   835
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   836
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   837
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   838
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   839
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   840
		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
   841
		iPodcastModel.ShowEngine().UpdateShowL(*info);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   842
		UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   843
		iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   844
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   845
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   846
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   847
void CPodcastShowsView::HandleDeleteShowL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   848
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   849
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   850
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   851
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   852
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   853
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   854
		TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   855
		TBuf<KMaxMessageLength> templ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   856
		iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   857
		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
   858
		if (ShowQueryMessageL(msg))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   859
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   860
			iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   861
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   862
			// and mark as played, and not downloaded
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   863
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   864
			info->SetDownloadState(ENotDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   865
			info->SetPlayState(EPlayed);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   866
			iPodcastModel.ShowEngine().UpdateShowL(*info);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   867
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   868
			UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   869
			iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   870
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   871
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   872
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   873
16
7a4b769d94c8 Re-enabled queue count in tabs
teknolog
parents: 14
diff changeset
   874
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   875
	{
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   876
	((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   877
	UpdateListboxItemsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   878
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   879
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   880
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   881
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   882
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   883
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   884
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   885
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   886
void CPodcastShowsView::UpdateViewTitleL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   887
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   888
	DP("CPodcastShowsView::UpdateViewTitleL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   889
	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   890
		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   891
		 
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   892
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() &&
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   893
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   894
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   895
		if (updatingState) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   896
			SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   897
		} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   898
			SetEmptyTextL(R_PODCAST_EMPTY_LIST);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   899
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   900
		
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   901
		if(iShowNewShows)
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   902
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   903
			HBufC *title = iEikonEnv->AllocReadResourceLC(R_NEW_SHOWS);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   904
			titlePane->SetTextL(*title);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   905
			CleanupStack::PopAndDestroy(title);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   906
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   907
		else if(iPodcastModel.ActiveFeedInfo())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   908
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   909
			if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   910
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   911
				titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   912
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   913
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   914
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   915
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   916
			titlePane->SetTextToDefaultL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   917
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   918
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   919
	DP("CPodcastShowsView::UpdateViewTitleL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   920
	}