application/src/PodcastShowsView.cpp
author teknolog
Thu, 04 Mar 2010 22:06:39 +0000
changeset 34 a6046405f1aa
parent 33 64ed1227e68d
child 36 e010fc411ddc
child 38 c11e52c5acd2
permissions -rw-r--r--
Fix for download icons not updating correctly
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
#define KPodcastImageWidth 160
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
#define KPodcastImageHeight 120
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
#define KPodcastDialogOffset 2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
#define KOneHundredPercent 100
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
const TInt KSizeBufLen = 64;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
const TInt KDefaultGran = 5;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
_LIT(KShowsSizeFormatS60, "%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
    48
_LIT(KShowFormat, "%d\t%S\t%S%S\t");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
_LIT(KShowErrorFormat, "%d\t%S\t%S\t");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
_LIT(KShowQueueFormat, "%d\t%S\t%S%S\t");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
// these must correspond with TShowsIconIndex
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
const TUint KShowIconArrayIds[] =
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
			EMbmPodcastAudio,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
			EMbmPodcastAudio_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
			EMbmPodcastAudio_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
			EMbmPodcastAudio_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
			EMbmPodcastAudio_queued,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
			EMbmPodcastAudio_queued_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
			EMbmPodcastAudio_downloading,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
			EMbmPodcastAudio_downloading_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
			EMbmPodcastAudio_downloaded,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
			EMbmPodcastAudio_downloaded_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
			EMbmPodcastAudio_downloaded_new,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
			EMbmPodcastAudio_downloaded_new_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
			EMbmPodcastAudio_failed,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
			EMbmPodcastAudio_failed_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
			EMbmPodcastAudio_suspended,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
			EMbmPodcastAudio_suspended_mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
			0,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
			0
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
	CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
CPodcastShowsView* CPodcastShowsView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
	CPodcastShowsView* self = new ( ELeave ) CPodcastShowsView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
CPodcastShowsView::CPodcastShowsView(CPodcastModel& aPodcastModel) :
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
	iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
void CPodcastShowsView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
	BaseConstructL(R_PODCAST_SHOWSVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
	CreateIconsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
	iListContainer->Listbox()->SetListBoxObserver(this);
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
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
	iPodcastModel.ShowEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
	TResourceReader reader;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
	iCoeEnv->CreateResourceReaderLC(reader,R_SHOWVIEW_POPUP_MENU);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
	iStylusPopupMenu->ConstructFromResourceL(reader);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
	CleanupStack::PopAndDestroy();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
void CPodcastShowsView::CreateIconsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
		// Load the bitmap for play icon	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
		CFbsBitmap* bitmap= NULL;//iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
		CFbsBitmap* mask=  NULL;////iEikonEnv->CreateBitmapL( _L("*"), KIconArrayIds[pos+1] );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
		CleanupStack::PushL(bitmap);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
		// Append the play icon to icon array
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
		pos+=2;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
	CleanupStack::Pop(icons); // icons
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
	if (aType == EEventKey)
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
		CShowInfo *activeShow = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
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
			activeShow = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
					HandleCommandL(EPodcastMarkAsPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
			case '#':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
				if (activeShow->DownloadState() == ENotDownloaded) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
					HandleCommandL(EPodcastDeleteShow);
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
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
			UpdateToolbar();
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
CPodcastShowsView::~CPodcastShowsView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
	iPodcastModel.FeedEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
    if(iStylusPopupMenu)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
        delete iStylusPopupMenu, iStylusPopupMenu = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
TUid CPodcastShowsView::Id() const
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
	return KUidPodcastShowsViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
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
	DP("CPodcastShowsView::DoActivateL BEGIN");
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
	UpdateViewTitleL();
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
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
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
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
	DP("CPodcastShowsView::DoActivateL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
void CPodcastShowsView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
	CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
		     ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
//	titlePane->SetSmallPicture(NULL, NULL, ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
	titlePane->SetPicture(NULL, NULL);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
	titlePane->SetTextToDefaultL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
	CPodcastListView::DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
void CPodcastShowsView::ShowListUpdatedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   234
void CPodcastShowsView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
	if (!iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
		return;
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
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
	if (info) 
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
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   245
		}		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   248
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
2
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
	iProgressAdded = EFalse;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   251
	CShowInfo *info = NULL;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   252
	RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   253
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   254
	for (TInt i=0;i<fItems.Count();i++)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   255
		{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   256
		if (fItems[i]->Uid() == aShowUid)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   257
			{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   258
			info = fItems[i];
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   259
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   260
		}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   261
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   262
	if (info == NULL) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   263
		return;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   264
	}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   265
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   266
	switch(aError)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   268
		case KErrCouldNotConnect:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   269
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   271
			iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   272
			ShowErrorMessage(message);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   273
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   274
			break;
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   275
		default:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   278
	UpdateListboxItemsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   282
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   283
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   284
	// 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
   285
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   286
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   288
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   289
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   290
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   291
		}	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   292
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   293
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   294
void CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   296
	DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
	// 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
   298
	// finished instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   299
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   300
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   301
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   302
		UpdateFeedUpdateStateL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   303
		UpdateViewTitleL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   305
	DP("CPodcastShowsView::FeedDownloadFinishedL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   306
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   307
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   308
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
		TListBoxEvent aEventType)
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
	switch (aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   312
		{
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   313
#ifndef SYMBIAN1_UI
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   314
		case EEventItemClicked:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   315
#endif
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   316
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   317
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   318
		case EEventItemDoubleClicked:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   319
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   320
			RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   322
			if (index>=0 && index< fItems.Count())
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
				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
   325
				CShowInfo *showInfo = fItems[index];
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 (showInfo->DownloadState()) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   328
				case ENotDownloaded:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   329
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   330
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
				case EQueued:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   332
					AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID,  TUid::Uid(0), KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   333
					((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   335
				case EDownloaded:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
					#pragma message("LAPER Replace activate playview with activate playback in mpx")
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
				default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   339
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   342
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   345
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   347
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   348
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   349
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   351
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   352
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   353
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   354
	switch (aShowInfo->DownloadState())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
		{
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   356
		case EDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   357
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   358
				aIconIndex = EDownloadedNewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   359
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   360
				aIconIndex = EDownloadedShowIcon;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
			}
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   362
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   363
		case ENotDownloaded:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   364
			if (aShowInfo->PlayState() == ENeverPlayed) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   365
				aIconIndex = ENewShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   366
			} else {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   367
				aIconIndex = EShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   368
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   369
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   370
		case EQueued:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   371
			aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   372
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   373
		case EDownloading:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   374
			aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   375
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   376
		case EFailedDownload:
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   377
			aIconIndex = EFailedShowIcon;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   378
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   379
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   380
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   381
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   382
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   383
void CPodcastShowsView::UpdateFeedUpdateStateL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   384
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   385
	TBool listboxDimmed = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   386
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   387
	if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   388
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   389
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   390
		listboxDimmed = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   391
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   392
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   394
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   395
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   396
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   397
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   398
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   399
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   400
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   401
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   402
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   405
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
	GetShowIcons(&aShowInfo, iconIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   407
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   408
	if(aSizeDownloaded > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   409
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   410
		if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   411
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   412
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
						((float)aShowInfo.ShowSize() / (float)KSizeMb));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   414
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   415
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   418
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   419
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   420
	else if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   421
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   422
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
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
	else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   425
		infoSize = KNullDesC();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   426
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   428
	if (aShowInfo.PubDate().Int64() == 0)
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
		showDate = KNullDesC();
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
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   433
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   434
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   436
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   437
	if(aShowInfo.LastError() != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   438
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   439
		GetShowErrorText(infoSize, aShowInfo.LastError());
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   441
	
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   442
	if (infoSize.Length() > 0)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   444
		infoSize.Insert(0,_L(", "));
2
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
		
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   447
	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   449
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   450
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   451
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   452
	iEikonEnv->GetErrorText(aErrorMessage, aErrorCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   453
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   455
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
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
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
	iItemArray->Delete(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   459
	if(aIndex>= iItemArray->MdcaCount())
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
		iItemArray->AppendL(iListboxFormatbuffer);
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
	else
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
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   467
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   468
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   469
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   470
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   471
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   472
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   473
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   474
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   476
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
					iListContainer->Listbox()->DrawItem(i);
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   483
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   484
void CPodcastShowsView::UpdateListboxItemsL()
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
	if (iListContainer->IsVisible())
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
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   490
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   491
		iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid());
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   492
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   494
		len = fItems.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   495
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   496
		if (iListContainer->Listbox() != NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   497
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   498
			TBool allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   499
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   500
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
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
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   503
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   504
				for (TInt loop = 0; loop< len; loop++)
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
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
					if (fItems[loop]->Uid() != itemId)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
						{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   509
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   510
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   512
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   513
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   515
			if (allUidsMatch && len > 0)
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
				for (TInt loop = 0; loop< len; loop++)
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   518
					{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   519
					UpdateShowItemDataL(fItems[loop], loop);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
					}
31
8a5ead064c4f Shows view now updates correctl after Mark all played
teknolog
parents: 28
diff changeset
   521
				iListContainer->Listbox()->DrawNow();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   523
			else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   524
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   525
				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   526
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   527
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   528
				iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   529
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   530
				if (len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   531
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   532
					for (TInt i=0; i<len; i++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   533
						{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   535
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   536
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   537
						iItemArray->AppendL(iListboxFormatbuffer);
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
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   540
				else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   541
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   542
					iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   543
					iItemIdArray.Reset();
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
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   546
					itemProps.SetHiddenSelection(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   547
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   548
				iListContainer->Listbox()->HandleItemAdditionL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   549
				}				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   550
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   551
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   552
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   553
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   554
/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   555
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   556
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   557
 * @param aCommand ID of the command to respond to. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   558
 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   559
void CPodcastShowsView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   560
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   561
	switch (aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   562
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   563
		case EPodcastMarkAsPlayed:
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   564
			HandleSetShowPlayed(ETrue);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   565
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   566
		case EPodcastMarkAsUnplayed:
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   567
			HandleSetShowPlayed(EFalse);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   568
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   569
		case EPodcastMarkAllPlayed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   570
			iPodcastModel.MarkSelectionPlayed();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   571
			UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   572
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   573
		case EPodcastDeleteShow:
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   574
			HandleDeleteShow();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   575
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   576
		case EPodcastDownloadShow:
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
			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
   579
			
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   580
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   581
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   582
				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   583
				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
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
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   587
		case EPodcastUpdateFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   588
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   589
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   590
			if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0)
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
				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   593
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   594
				if (error != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
					{
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   596
					HBufC* str =
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   597
							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   598
					User::InfoPrint(*str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   599
					CleanupStack::PopAndDestroy(str);
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
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   604
		case EPodcastCancelUpdateAllFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   605
			iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   606
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   607
		case EPodcastShowInfo:
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
			DisplayShowInfoDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   610
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   611
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   612
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   613
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   614
		}
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   615
	iListContainer->SetLongTapDetected(EFalse);
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   616
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   617
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   618
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   619
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   620
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   621
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   622
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   623
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   624
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   625
		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   626
		}
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
	
32
26a3f2dfba08 Fix for bug where we always load the feed icon a large number of times
teknolog
parents: 31
diff changeset
   629
void CPodcastShowsView::ImageOperationCompleteL(TInt aError, TUint /*aHandle*/)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   630
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   631
	iLastImageHandlerError = aError;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   632
	if(iSetTitlebarImage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   633
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   634
		iSetTitlebarImage = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   635
		if(aError == KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   636
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   637
			CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   638
						 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   639
			titlePane->SetSmallPicture(iPodcastModel.ImageHandler().ScaledBitmap(), NULL, ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   640
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   641
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   642
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   643
			iPodcastModel.ImageHandler().ScaledBitmap();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   644
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   645
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   646
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   647
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   648
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   649
		CActiveScheduler::Stop();
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
void CPodcastShowsView::DisplayShowInfoDialogL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   654
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   655
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   656
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   657
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   658
		CShowInfo* info = iPodcastModel.ActiveShowList()[index];
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   659
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   660
		HBufC *title = info->Title().AllocL();
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   661
		HBufC *description = info->Description().AllocL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   662
		
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   663
		CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   664
							
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   665
		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
   666
		note->RunLD();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   667
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   668
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   669
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   670
void CPodcastShowsView::UpdateToolbar(TBool aVisible)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   671
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   672
	CAknToolbar* toolbar = Toolbar();
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   673
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   674
	if (toolbar) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   675
		if (iListContainer->IsVisible()) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   676
			toolbar->SetToolbarVisibility(aVisible);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   677
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   678
	
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   679
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && 
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   680
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
14
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   681
	
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   682
		toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); 
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   683
		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue );
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   684
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   685
#ifdef SYMBIAN1_UI
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   686
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   687
		TInt itemCnt = fItems.Count();
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   688
	
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   689
		TBool hideDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   690
		TBool dimDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   691
		TBool hideSetPlayed = EFalse;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   692
	
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   693
		if(iListContainer->Listbox() != NULL)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   694
		{
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   695
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   696
			
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   697
			if(index>= 0 && index < itemCnt)
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   698
			{
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   699
				switch(fItems[index]->DownloadState())
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   700
					{
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   701
					case ENotDownloaded:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   702
					case EFailedDownload:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   703
						hideDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   704
						dimDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   705
						break;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   706
					case EQueued:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   707
					case EDownloading:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   708
						hideDownloadShowCmd = EFalse;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   709
						dimDownloadShowCmd = ETrue;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   710
						break;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   711
					case EDownloaded:
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   712
						hideDownloadShowCmd = ETrue;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   713
						break;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   714
					}
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   715
					
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   716
				if(fItems[index]->PlayState() == EPlayed) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   717
					hideSetPlayed = ETrue;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   718
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   719
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   720
		}
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   721
		
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   722
		if (hideDownloadShowCmd) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   723
			toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   724
			toolbar->HideItem(EPodcastDeleteShow, EFalse, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   725
			toolbar->SetItemDimmed(EPodcastDeleteShow, updatingState, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   726
		} else {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   727
			toolbar->HideItem(EPodcastDownloadShow, EFalse, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   728
			toolbar->HideItem(EPodcastDeleteShow, ETrue, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   729
			toolbar->SetItemDimmed(EPodcastDownloadShow, updatingState || dimDownloadShowCmd, ETrue);	
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   730
		}
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   731
		
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   732
		if (hideSetPlayed) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   733
			toolbar->HideItem(EPodcastMarkAsPlayed, ETrue, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   734
			toolbar->HideItem(EPodcastMarkAsUnplayed, EFalse, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   735
			toolbar->SetItemDimmed(EPodcastMarkAsUnplayed, updatingState, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   736
		} else {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   737
			toolbar->HideItem(EPodcastMarkAsPlayed, EFalse, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   738
			toolbar->HideItem(EPodcastMarkAsUnplayed, ETrue, ETrue );
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   739
			toolbar->SetItemDimmed(EPodcastMarkAsPlayed, updatingState, ETrue);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   740
		}
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   741
#endif
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   742
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   743
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   744
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   745
void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   746
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   747
	DP("CPodcastShowsView::HandleLongTapEventL BEGIN");
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   748
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   749
	iListContainer->SetLongTapDetected(ETrue);
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   750
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
   751
	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
   752
	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
   753
			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
   754
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
   755
    if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   756
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   757
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   758
		if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   759
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   760
			CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   761
			TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   762
			TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   763
			TBool hideMarkOld = info->PlayState() == EPlayed;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   764
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   765
			iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   766
			iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   767
						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   768
			iStylusPopupMenu->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   769
			iStylusPopupMenu->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   770
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   771
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   772
		iStylusPopupMenu->ShowMenu();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   773
		iStylusPopupMenu->SetPosition(aPenEventLocation);
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
	DP("CPodcastShowsView::HandleLongTapEventL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   776
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   777
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   778
void CPodcastShowsView::HandleSetShowPlayed(TBool aPlayed)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   779
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   780
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   781
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   782
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   783
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   784
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   785
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   786
		info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   787
		iPodcastModel.ShowEngine().UpdateShow(*info);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   788
		UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   789
		iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   790
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   791
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   792
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   793
void CPodcastShowsView::HandleDeleteShow()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   794
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   795
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
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
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
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
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   800
		TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   801
		TBuf<KMaxMessageLength> templ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   802
		iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   803
		msg.Format(templ, &(info->Title()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   804
		if (ShowQueryMessage(msg))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   805
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   806
			iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   807
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   808
			// and mark as played, and not downloaded
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   809
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   810
			info->SetDownloadState(ENotDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   811
			info->SetPlayState(EPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   812
			iPodcastModel.ShowEngine().UpdateShow(*info);
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
			UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   815
			iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   816
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   817
		}
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
16
7a4b769d94c8 Re-enabled queue count in tabs
teknolog
parents: 14
diff changeset
   820
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   821
	{
16
7a4b769d94c8 Re-enabled queue count in tabs
teknolog
parents: 14
diff changeset
   822
	((CPodcastAppUi*)AppUi())->UpdateQueueTab(aDownloadingShows+aQueuedShows);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   823
	UpdateListboxItemsL();
2
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
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   827
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   828
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   829
	UpdateToolbar();
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   832
void CPodcastShowsView::UpdateViewTitleL()
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
	DP("CPodcastShowsView::UpdateViewTitleL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   835
	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   836
		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   837
		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   838
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   839
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   840
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   841
		if (updatingState) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   842
			SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   843
		} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   844
			SetEmptyTextL(R_PODCAST_EMPTY_LIST);
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
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   847
		if(iPodcastModel.ActiveFeedInfo())
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
			if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC)
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
				titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue );
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
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   854
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   855
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   856
			titlePane->SetPicture(NULL, NULL);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   857
			titlePane->SetTextToDefaultL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   858
			}
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
	DP("CPodcastShowsView::UpdateViewTitleL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   861
	}