application/src/PodcastShowsView.cpp
author Sebastian Brannstrom <sebastianb@symbian.org>
Fri, 19 Nov 2010 00:16:55 +0000
branchsymbian1
changeset 373 f5de49b27caf
parent 364 998e9d114bd5
child 377 684802056d6f
permissions -rw-r--r--
Popup menus tweaked
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
* All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
* This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
* under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
* which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
* Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
* EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
* Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
* Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#include "PodcastShowsView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#include "PodcastAppUi.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
#include "ShowEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include "SettingsEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include "PodcastApp.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include "imagehandler.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include "constants.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <akntitle.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include <podcast.rsg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include <podcast.mbg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include <gulicon.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include <barsread.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#include <aknnotedialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
#include <aknmessagequerydialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
#define KMaxMessageLength 200
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
_LIT(KShowsSizeFormatS60, "%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
    40
_LIT(KShowFormat, "%d\t%S\t%S%S");
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
    41
_LIT(KShowFormatLandscape, "%d\t%S");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
// these must correspond with TShowsIconIndex
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
const TUint KShowIconArrayIds[] =
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
	{
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    47
	//	EShowIcon = 0,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    48
	EMbmPodcastAudio,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    49
	EMbmPodcastAudio_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    50
	//	EShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    51
	EMbmPodcastAudio_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    52
	EMbmPodcastAudio_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    53
	//	EQuedShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    54
	EMbmPodcastAudio_dl_queued,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    55
	EMbmPodcastAudio_dl_queued_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    56
	//	EQuedShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    57
	EMbmPodcastAudio_dl_queued_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    58
	EMbmPodcastAudio_dl_queued_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    59
	//	EDownloadingShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    60
	EMbmPodcastAudio_dl_active,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    61
	EMbmPodcastAudio_dl_active_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    62
	//	EDownloadingShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    63
	EMbmPodcastAudio_dl_active_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    64
	EMbmPodcastAudio_dl_active_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    65
	//	EDownloadedShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    66
	EMbmPodcastAudio_dl,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    67
	EMbmPodcastAudio_dl_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    68
	//	EDownloadedShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    69
	EMbmPodcastAudio_dl_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    70
	EMbmPodcastAudio_dl_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    71
	//	EFailedShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    72
	EMbmPodcastAudio_dl_failed,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    73
	EMbmPodcastAudio_dl_failed_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    74
	//	EFailedShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    75
	EMbmPodcastAudio_dl_failed_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    76
	EMbmPodcastAudio_dl_failed_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    77
	//	ESuspendedShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    78
	EMbmPodcastAudio_dl_suspended,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    79
	EMbmPodcastAudio_dl_suspended_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    80
	//	ESuspendedShowIconNew
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    81
	EMbmPodcastAudio_dl_suspended_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    82
	EMbmPodcastAudio_dl_suspended_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    83
	//	EShowIcon = 0,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    84
	EMbmPodcastVideo,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    85
	EMbmPodcastVideo_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    86
	//	EShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    87
	EMbmPodcastVideo_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    88
	EMbmPodcastVideo_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    89
	//	EQuedShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    90
	EMbmPodcastVideo_dl_queued,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    91
	EMbmPodcastVideo_dl_queued_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    92
	//	EQuedShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    93
	EMbmPodcastVideo_dl_queued_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    94
	EMbmPodcastVideo_dl_queued_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    95
	//	EDownloadingShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    96
	EMbmPodcastVideo_dl_active,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    97
	EMbmPodcastVideo_dl_active_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    98
	//	EDownloadingShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
    99
	EMbmPodcastVideo_dl_active_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   100
	EMbmPodcastVideo_dl_active_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   101
	//	EDownloadedShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   102
	EMbmPodcastVideo_dl,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   103
	EMbmPodcastVideo_dl_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   104
	//	EDownloadedShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   105
	EMbmPodcastVideo_dl_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   106
	EMbmPodcastVideo_dl_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   107
	//	EFailedShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   108
	EMbmPodcastVideo_dl_failed,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   109
	EMbmPodcastVideo_dl_failed_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   110
	//	EFailedShowIconNew,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   111
	EMbmPodcastVideo_dl_failed_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   112
	EMbmPodcastVideo_dl_failed_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   113
	//	ESuspendedShowIcon,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   114
	EMbmPodcastVideo_dl_suspended,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   115
	EMbmPodcastVideo_dl_suspended_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   116
	//	ESuspendedShowIconNew
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   117
	EMbmPodcastVideo_dl_suspended_new,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   118
	EMbmPodcastVideo_dl_suspended_new_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   119
	EMbmPodcastFeed,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   120
	EMbmPodcastFeed_mask,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   121
	0,
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   122
	0
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   125
const TInt KVideoIconOffset = 12;
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   126
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
	CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
	}
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
CPodcastShowsView* CPodcastShowsView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
	CPodcastShowsView* self = new ( ELeave ) CPodcastShowsView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
CPodcastShowsView::CPodcastShowsView(CPodcastModel& aPodcastModel) :
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
	iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
void CPodcastShowsView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
	BaseConstructL(R_PODCAST_SHOWSVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
	CreateIconsL();
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   153
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
	iPodcastModel.ShowEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
	TResourceReader reader;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
	iCoeEnv->CreateResourceReaderLC(reader,R_SHOWVIEW_POPUP_MENU);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
	iStylusPopupMenu->ConstructFromResourceL(reader);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
	CleanupStack::PopAndDestroy();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
void CPodcastShowsView::CreateIconsL()
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
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
		{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   172
		// Load the icon	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   173
		CFbsBitmap* bitmap= NULL;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   174
		CFbsBitmap* mask=  NULL;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
		CleanupStack::PushL(bitmap);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
		
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   183
		// Append the icon to icon array
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
		pos+=2;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
		
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   189
	//iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   190
	iListContainer->SetListboxIcons(icons);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
	CleanupStack::Pop(icons); // icons
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
	if (aType == EEventKey)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
		CShowInfo *activeShow = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
			activeShow = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
					HandleCommandL(EPodcastMarkAsPlayed);
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
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
			case '#':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
				if (activeShow->DownloadState() == ENotDownloaded) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
					HandleCommandL(EPodcastDeleteShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
				break;
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
			UpdateToolbar();
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
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
CPodcastShowsView::~CPodcastShowsView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
	{
355
075b3a49cb55 Fixed more usability issues; Updated version to 1.10
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 354
diff changeset
   239
	DP("CPodcastShowsView::~CPodcastShowsView BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
	iPodcastModel.FeedEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   243
    if(iStylusPopupMenu)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   244
        delete iStylusPopupMenu, iStylusPopupMenu = NULL;
355
075b3a49cb55 Fixed more usability issues; Updated version to 1.10
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 354
diff changeset
   245
	
075b3a49cb55 Fixed more usability issues; Updated version to 1.10
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 354
diff changeset
   246
    DP("CPodcastShowsView::~CPodcastShowsView END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   248
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
TUid CPodcastShowsView::Id() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   251
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   252
	return KUidPodcastShowsViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   253
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   254
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   255
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   256
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   257
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   258
	DP("CPodcastShowsView::DoActivateL BEGIN");
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   259
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   260
	
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   261
	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   262
	
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   263
	iShowNewShows = (aCustomMessageId.iUid == 1);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   264
	
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   265
	if (iShowNewShows)
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   266
		{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   267
		CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   268
		cba->SetCommandSetL(R_PODCAST_CBA);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   269
		cba->DrawDeferred();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   270
		}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   271
	else
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   272
		{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   273
		CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   274
		cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   275
		cba->DrawDeferred();		
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   276
		}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   277
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   278
	UpdateViewTitleL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
	DP("CPodcastShowsView::DoActivateL END");
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   283
void CPodcastShowsView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   284
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   285
	CPodcastListView::DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   286
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   288
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   289
void CPodcastShowsView::ShowListUpdatedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   290
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   291
	UpdateListboxItemsL();
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::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
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
	if (!iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   298
		return;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   299
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   300
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   301
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   302
	if (info) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   303
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   305
		}		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   306
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   307
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   308
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   310
	iProgressAdded = EFalse;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   311
	CShowInfo *info = NULL;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   312
	RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   313
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   314
	for (TInt i=0;i<fItems.Count();i++)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   315
		{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   316
		if (fItems[i]->Uid() == aShowUid)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   317
			{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   318
			info = fItems[i];
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   319
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   320
		}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   321
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   322
	if (info == NULL) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   323
		return;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   324
	}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   326
	switch(aError)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   327
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   328
		case KErrCouldNotConnect:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   329
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   330
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
			iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   332
			ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   333
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
			break;
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   335
		default:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   338
	UpdateListboxItemsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   339
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   342
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
	// 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
   345
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   347
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   348
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   349
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
		UpdateToolbar();
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   353
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   354
void CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   356
	DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN");
166
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   357
	if (iListContainer->IsVisible() &&
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   358
			iPodcastModel.ActiveFeedInfo() != NULL &&
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   359
			iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   361
		UpdateFeedUpdateStateL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   362
		UpdateViewTitleL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
	DP("CPodcastShowsView::FeedDownloadFinishedL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   365
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   366
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   367
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   368
		TListBoxEvent aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   369
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   370
	switch (aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   371
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   372
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   373
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   374
		case EEventItemDoubleClicked:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   375
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   376
			RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   377
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   378
			if (index>=0 && index< fItems.Count())
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
				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
   381
				CShowInfo *showInfo = fItems[index];
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
				switch (showInfo->DownloadState()) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   384
				case ENotDownloaded:
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   385
				case EFailedDownload:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   386
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   387
					break;
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   388
				case EDownloading:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   389
				case EQueued:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   390
					AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID,  TUid::Uid(0), KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   391
					((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   392
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
				case EDownloaded:
136
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   394
					{
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   395
					TRAPD(err, iPodcastModel.PlayPausePodcastL(showInfo, ETrue));
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   396
					if (err != KErrNone)
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   397
						{
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   398
						HBufC *error = iEikonEnv->AllocReadResourceLC(R_ERROR_PLAYBACK_FAILED);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   399
						ShowErrorMessageL(*error);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   400
						CleanupStack::PopAndDestroy(error);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   401
						}
90
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 70
diff changeset
   402
					UpdateListboxItemsL();
136
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   403
					}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   405
				default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
					break;
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
				}
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
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   411
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   412
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   414
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   415
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
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
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   420
	TBool isNew = aShowInfo->PlayState() == ENeverPlayed;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   421
	switch (aShowInfo->DownloadState())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   422
		{
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   423
		case EDownloaded:
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   424
			aIconIndex = isNew ? EDownloadedShowIconNew : EDownloadedShowIcon;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   425
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   426
		case ENotDownloaded:
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   427
			aIconIndex = isNew ? EShowIconNew : EShowIcon;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   428
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   429
		case EQueued:
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   430
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   431
								  (isNew ? EQuedShowIconNew : EQuedShowIcon);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   432
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   433
		case EDownloading:
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   434
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   435
								  (isNew ? EDownloadingShowIconNew : EDownloadingShowIcon);	
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   436
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   437
		case EFailedDownload:
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   438
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   439
								  (isNew ? EFailedShowIconNew : EFailedShowIconNew);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   440
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
		}
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   442
	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   443
	if (aShowInfo->ShowType() == EVideoPodcast)
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   444
		{
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   445
		aIconIndex += KVideoIconOffset;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   446
		}
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   447
	
354
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   448
	//DP3("dlStop=%d, isNew=%d, aIconIndex=%d", dlStop, isNew, aIconIndex);
2
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
	
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
void CPodcastShowsView::UpdateFeedUpdateStateL()
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
	TBool listboxDimmed = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   455
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   456
	if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   457
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   459
		listboxDimmed = ETrue;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   463
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   464
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   467
	UpdateToolbar();
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   470
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   471
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   472
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   473
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   474
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
	GetShowIcons(&aShowInfo, iconIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   476
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
	if(aSizeDownloaded > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
		if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
			{
361
861a25b8306b Fix for mark all old visibility
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 358
diff changeset
   481
				TUint showSize = aShowInfo.ShowSize() >= (TUint) aSizeDownloaded ? aShowInfo.ShowSize() : (TUint) aSizeDownloaded;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
354
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   483
						((float) showSize / (float)KSizeMb));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   484
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   485
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   486
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   487
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   490
	else if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   491
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   492
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
		} 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   494
	else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   495
		infoSize = KNullDesC();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   496
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   497
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   498
	if (aShowInfo.PubDate().Int64() == 0)
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
		showDate = KNullDesC();
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
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   503
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   504
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
	if(aShowInfo.LastError() != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   509
		GetShowErrorText(infoSize, aShowInfo.LastError());
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   510
		showDate.Zero();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   512
	
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   513
	if (infoSize.Length() > 0 && showDate.Length() > 0)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   515
		infoSize.Insert(0,_L(", "));
2
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
		
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   518
	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   519
	iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title());
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   521
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   523
	{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   524
	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   525
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   526
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   527
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   528
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   529
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   530
	iItemArray->Delete(aIndex);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   531
	iItemArrayShort->Delete(aIndex);
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   532
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   533
	if(aIndex>= iItemArray->MdcaCount())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   535
		iItemArray->AppendL(iListboxFormatbuffer);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   536
		iItemArrayShort->AppendL(iListboxFormatbufferShort);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   537
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   538
	else
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
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   541
		iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   542
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   543
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   544
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   545
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   546
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   547
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   548
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   549
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   550
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   551
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   552
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   553
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   554
					iListContainer->Listbox()->DrawItem(i);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   555
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   556
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   557
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   558
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   559
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   560
void CPodcastShowsView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   561
	{
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   562
	DP("CPodcastShowsView::UpdateListboxItemsL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   563
	if (iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   564
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   565
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   566
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   567
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   568
		if (iShowNewShows)
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   569
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   570
			iPodcastModel.GetNewShowsL();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   571
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   572
		else
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   573
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   574
			iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid());
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   575
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   576
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   577
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   578
		len = fItems.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   579
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   580
		if (iListContainer->Listbox() != NULL)
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
			TBool allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   583
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   584
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
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
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   587
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   588
				for (TInt loop = 0; loop< len; loop++)
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
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   591
					if (fItems[loop]->Uid() != itemId)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   592
						{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   593
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   594
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   596
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   597
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   598
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   599
			if (allUidsMatch && len > 0)
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
				for (TInt loop = 0; loop< len; loop++)
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   602
					{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   603
					UpdateShowItemDataL(fItems[loop], loop);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   604
					}
31
8a5ead064c4f Shows view now updates correctl after Mark all played
teknolog
parents: 28
diff changeset
   605
				iListContainer->Listbox()->DrawNow();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   606
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   607
			else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   608
				{
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   609
				//iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   610
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   611
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   612
				iItemArray->Reset();
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   613
				iItemArrayShort->Reset();
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   614
				
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   615
				if (len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   616
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   617
					for (TInt i=0; i<len; i++)
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
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   620
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   621
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   622
						iItemArray->AppendL(iListboxFormatbuffer);
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   623
						iItemArrayShort->AppendL(iListboxFormatbufferShort);
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   624
												
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   625
						}
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
				else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   628
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   629
					iItemArray->Reset();
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   630
					iItemArrayShort->Reset();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   631
					iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   632
					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   633
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   634
					itemProps.SetHiddenSelection(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   635
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   636
				iListContainer->Listbox()->HandleItemAdditionL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   637
				}				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   638
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   639
		}
336
3d6c1417e8bd Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 288
diff changeset
   640
	DP("CPodcastShowsView::UpdateListboxItemsL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   641
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   642
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   643
/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   644
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   645
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   646
 * @param aCommand ID of the command to respond to. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   647
 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   648
void CPodcastShowsView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   649
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   650
	switch (aCommand)
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
		case EPodcastMarkAsPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   653
			HandleSetShowPlayedL(ETrue);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   654
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   655
		case EPodcastMarkAsUnplayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   656
			HandleSetShowPlayedL(EFalse);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   657
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   658
		case EPodcastMarkAllPlayed:
364
998e9d114bd5 Sync with symbian3 branch
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 361
diff changeset
   659
			{
358
d2ce95126703 Added query before marking all shows played in new list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 355
diff changeset
   660
			if (iShowNewShows) {
d2ce95126703 Added query before marking all shows played in new list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 355
diff changeset
   661
				TBuf<KMaxMessageLength> msg;
d2ce95126703 Added query before marking all shows played in new list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 355
diff changeset
   662
				iEikonEnv->ReadResourceL(msg, R_MARK_ALL_OLD_QUERY);
d2ce95126703 Added query before marking all shows played in new list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 355
diff changeset
   663
				if (!ShowQueryMessageL(msg))
d2ce95126703 Added query before marking all shows played in new list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 355
diff changeset
   664
					{
d2ce95126703 Added query before marking all shows played in new list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 355
diff changeset
   665
					break;
d2ce95126703 Added query before marking all shows played in new list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 355
diff changeset
   666
					}
d2ce95126703 Added query before marking all shows played in new list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 355
diff changeset
   667
			}
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   668
			iPodcastModel.MarkSelectionPlayedL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   669
			UpdateListboxItemsL();
364
998e9d114bd5 Sync with symbian3 branch
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 361
diff changeset
   670
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   671
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   672
		case EPodcastDeleteShow:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   673
			HandleDeleteShowL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   674
			break;
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   675
		case EPodcastDownloadAll:
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   676
			HandleDownloadAllL();
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   677
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   678
		case EPodcastDownloadShow:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   679
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   680
			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
   681
			
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   682
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   683
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   684
				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   685
				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   686
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   687
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   688
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   689
		case EPodcastUpdateFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   690
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   691
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   692
			if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   693
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   694
				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   695
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   696
				if (error != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   697
					{
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   698
					HBufC* str =
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   699
							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   700
					User::InfoPrint(*str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   701
					CleanupStack::PopAndDestroy(str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   702
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   703
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   704
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   705
			break;
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   706
		case EPodcastUpdateAllFeeds:
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   707
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   708
			iPodcastModel.FeedEngine().UpdateAllFeedsL();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   709
			UpdateToolbar();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   710
			}break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   711
		case EPodcastCancelUpdateAllFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   712
			iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   713
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   714
		case EPodcastShowInfo:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   715
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   716
			DisplayShowInfoDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   717
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   718
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   719
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   720
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   721
		}
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   722
	iListContainer->SetLongTapDetectedL(EFalse);
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   723
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   724
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   725
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   726
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   727
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   728
{
361
861a25b8306b Fix for mark all old visibility
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 358
diff changeset
   729
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   730
		{
361
861a25b8306b Fix for mark all old visibility
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 358
diff changeset
   731
		TBool hideMarkAllPlayed = ETrue;
288
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   732
		for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   733
			{
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   734
			CShowInfo* info = iPodcastModel.ActiveShowList()[i];
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   735
			if (info->PlayState() == ENeverPlayed)
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   736
				{
361
861a25b8306b Fix for mark all old visibility
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 358
diff changeset
   737
				hideMarkAllPlayed = EFalse;
288
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   738
				break;
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   739
				}
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   740
			
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   741
			}
757e84a30b9a Added selective availability of the mark all played command
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 166
diff changeset
   742
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   743
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
361
861a25b8306b Fix for mark all old visibility
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 358
diff changeset
   744
		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState || hideMarkAllPlayed || iShowNewShows);	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   745
		}
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
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   748
void CPodcastShowsView::DisplayShowInfoDialogL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   749
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   750
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   751
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   752
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   753
		CShowInfo* info = iPodcastModel.ActiveShowList()[index];
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   754
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   755
		HBufC *title = info->Title().AllocL();
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   756
		HBufC *description = info->Description().AllocL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   757
		
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   758
		CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
2
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
		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
   761
		note->RunLD();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   762
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   763
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   764
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   765
void CPodcastShowsView::HandleDownloadAllL()
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   766
	{
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   767
	
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   768
	TBuf<KMaxMessageLength> msg;
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   769
	iEikonEnv->ReadResourceL(msg, R_DOWNLOAD_ALL_QUERY);
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   770
	if (!ShowQueryMessageL(msg))
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   771
		{
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   772
		return;
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   773
		}
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   774
		
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   775
	for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   776
		{
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   777
		CShowInfo* info = iPodcastModel.ActiveShowList()[i];
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   778
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   779
		if (info->DownloadState() == ENotDownloaded)
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   780
			{
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   781
			TRAP_IGNORE(iPodcastModel.ShowEngine().AddDownloadL(*info));
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   782
			}
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   783
		}
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   784
	}
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   785
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   786
void CPodcastShowsView::UpdateToolbar(TBool aVisible)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   787
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   788
	CAknToolbar* toolbar = Toolbar();
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   789
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   790
	if (toolbar) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   791
		if (iListContainer->IsVisible()) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   792
			toolbar->SetToolbarVisibility(aVisible);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   793
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   794
	
156
48cdb40709e7 Fix for bug 2819 - Crash when updating and connection set to "Always ask"
teknolog
parents: 136
diff changeset
   795
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() && 
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   796
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
14
4e75731546eb Fix so toolbars only change visibility for the visible view
teknolog
parents: 13
diff changeset
   797
	
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   798
		if (iShowNewShows)
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   799
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   800
			updatingState = iPodcastModel.FeedEngine().ClientState();
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   801
			toolbar->HideItem(EPodcastUpdateFeed, ETrue, ETrue ); 
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   802
			toolbar->HideItem(EPodcastUpdateAllFeeds, updatingState, ETrue ); 
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   803
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   804
		else
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   805
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   806
			toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); 
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   807
			toolbar->HideItem(EPodcastUpdateAllFeeds, ETrue, ETrue ); 
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   808
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   809
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   810
		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue );
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   811
		toolbar->HideItem(EPodcastDownloadAll, !iShowNewShows, ETrue);
352
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   812
		toolbar->HideItem(EPodcastMarkAllPlayed, !iShowNewShows, ETrue );
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
   813
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   814
		if (iShowNewShows) 
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   815
			{
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   816
			toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue );
352
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   817
			toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue );
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   818
			toolbar->HideItem(EPodcastDeleteShow, ETrue, ETrue);
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   819
			toolbar->HideItem(EPodcastMarkAsPlayed, ETrue, ETrue );
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   820
			toolbar->HideItem(EPodcastMarkAsUnplayed, ETrue, ETrue );
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   821
			
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   822
			TBool showDownloadAll = EFalse;
354
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   823
			TInt count = iPodcastModel.ActiveShowList().Count();
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   824
			for (int i=0;i<count;i++)
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   825
				{
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   826
				CShowInfo* info = iPodcastModel.ActiveShowList()[i];
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   827
				if (info->DownloadState() == ENotDownloaded)
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   828
					{
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   829
					showDownloadAll = ETrue;
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   830
					}
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   831
				}
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   832
	
354
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   833
			toolbar->SetItemDimmed(EPodcastMarkAllPlayed, !count, ETrue);
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   834
			toolbar->SetItemDimmed(EPodcastDownloadAll, !showDownloadAll, ETrue);
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   835
			}
352
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   836
		else
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   837
			{
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   838
			RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   839
			TInt itemCnt = fItems.Count();
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   840
		
352
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   841
			TBool hideDownloadShowCmd = EFalse;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   842
			TBool dimDownloadShowCmd = EFalse;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   843
			TBool hideSetPlayed = EFalse;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   844
		
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   845
				if(iListContainer->Listbox() != NULL)
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   846
				{
352
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   847
					TInt index = iListContainer->Listbox()->CurrentItemIndex();
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   848
					
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   849
					if(index>= 0 && index < itemCnt)
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   850
					{
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   851
						switch(fItems[index]->DownloadState())
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   852
							{
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   853
							case ENotDownloaded:
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   854
							case EFailedDownload:
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   855
								hideDownloadShowCmd = EFalse;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   856
								dimDownloadShowCmd = EFalse;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   857
								break;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   858
							case EQueued:
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   859
							case EDownloading:
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   860
								hideDownloadShowCmd = EFalse;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   861
								dimDownloadShowCmd = ETrue;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   862
								break;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   863
							case EDownloaded:
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   864
								hideDownloadShowCmd = ETrue;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   865
								break;
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   866
							}
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   867
							
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   868
						if(fItems[index]->PlayState() == EPlayed) {
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   869
							hideSetPlayed = ETrue;
350
9c4fd008e20f Updated icons and other UI fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 348
diff changeset
   870
						}
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   871
					}
352
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   872
				}		
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   873
			
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   874
			if (hideDownloadShowCmd) {
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   875
				toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue );
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   876
				toolbar->HideItem(EPodcastDeleteShow, EFalse, ETrue);
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   877
				toolbar->SetItemDimmed(EPodcastDeleteShow, updatingState , ETrue);
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   878
			} else {
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   879
				toolbar->HideItem(EPodcastDownloadShow, EFalse, ETrue );
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   880
				toolbar->HideItem(EPodcastDeleteShow, ETrue, ETrue);
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   881
				toolbar->SetItemDimmed(EPodcastDownloadShow, updatingState || dimDownloadShowCmd || !itemCnt, ETrue);	
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   882
			}
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   883
			
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   884
			if (hideSetPlayed) {
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   885
				toolbar->HideItem(EPodcastMarkAsPlayed, ETrue, ETrue );
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   886
				toolbar->HideItem(EPodcastMarkAsUnplayed, EFalse, ETrue );
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   887
				toolbar->SetItemDimmed(EPodcastMarkAsUnplayed, updatingState, ETrue);
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   888
			} else {
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   889
				toolbar->HideItem(EPodcastMarkAsPlayed, EFalse, ETrue );
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   890
				toolbar->HideItem(EPodcastMarkAsUnplayed, ETrue, ETrue );
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   891
				toolbar->SetItemDimmed(EPodcastMarkAsPlayed, updatingState|| !itemCnt, ETrue);
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   892
			}
31f9864a37ac Various fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 350
diff changeset
   893
		}		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   894
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   895
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   896
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   897
void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   898
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   899
	DP("CPodcastShowsView::HandleLongTapEventL BEGIN");
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   900
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   901
	iListContainer->SetLongTapDetectedL(ETrue);
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   902
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
   903
	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
   904
	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
   905
			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
   906
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
   907
    if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   908
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   909
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   910
		if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   911
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   912
			CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   913
			TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   914
			TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   915
			TBool hideMarkOld = info->PlayState() == EPlayed;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   916
			
373
f5de49b27caf Popup menus tweaked
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 364
diff changeset
   917
			iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
f5de49b27caf Popup menus tweaked
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 364
diff changeset
   918
			iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   919
						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   920
			iStylusPopupMenu->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   921
			iStylusPopupMenu->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   922
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   923
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   924
		iStylusPopupMenu->ShowMenu();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   925
		iStylusPopupMenu->SetPosition(aPenEventLocation);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   926
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   927
	DP("CPodcastShowsView::HandleLongTapEventL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   928
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   929
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   930
void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   931
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   932
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   933
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   934
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   935
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   936
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   937
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   938
		info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed);
354
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   939
		if (aPlayed)
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   940
			{
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   941
			// PostPlayHandling calls UpdateShow, which is slow, so we don't need to do it again
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   942
			iPodcastModel.ShowEngine().PostPlayHandling(info);
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   943
			}
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   944
		else
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   945
			{
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   946
			iPodcastModel.ShowEngine().UpdateShowL(*info);
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   947
			}
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   948
		
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   949
		if (iShowNewShows)
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   950
			{
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   951
			UpdateListboxItemsL();
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   952
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   953
			if (index > 0)
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   954
				{
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   955
				iListContainer->Listbox()->SetCurrentItemIndex(index - 1);
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   956
				}
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   957
			}
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   958
		else
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   959
			{
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   960
			UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   961
			iListContainer->Listbox()->DrawItem(index);	
a2713e6a41a9 Further UI tweaks
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 352
diff changeset
   962
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   963
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   964
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   965
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   966
void CPodcastShowsView::HandleDeleteShowL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   967
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   968
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   969
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   970
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   971
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   972
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   973
		TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   974
		TBuf<KMaxMessageLength> templ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   975
		iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   976
		msg.Format(templ, &(info->Title()));
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   977
		if (ShowQueryMessageL(msg))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   978
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   979
			iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   980
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   981
			// and mark as played, and not downloaded
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   982
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   983
			info->SetDownloadState(ENotDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   984
			info->SetPlayState(EPlayed);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   985
			iPodcastModel.ShowEngine().UpdateShowL(*info);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   986
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   987
			UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   988
			iListContainer->Listbox()->DrawItem(index);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   989
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   990
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   991
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   992
16
7a4b769d94c8 Re-enabled queue count in tabs
teknolog
parents: 14
diff changeset
   993
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   994
	{
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   995
	((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   996
	UpdateListboxItemsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   997
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   998
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   999
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1000
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1001
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1002
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1003
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1004
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1005
void CPodcastShowsView::UpdateViewTitleL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1006
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1007
	DP("CPodcastShowsView::UpdateViewTitleL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1008
	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1009
		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1010
		 
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
  1011
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() &&
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1012
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1013
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1014
		if (updatingState) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1015
			SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1016
		} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1017
			SetEmptyTextL(R_PODCAST_EMPTY_LIST);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1018
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1019
		
347
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
  1020
		if(iShowNewShows)
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
  1021
			{
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
  1022
			HBufC *title = iEikonEnv->AllocReadResourceLC(R_NEW_SHOWS);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
  1023
			titlePane->SetTextL(*title);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
  1024
			CleanupStack::PopAndDestroy(title);
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
  1025
			}
b8d687bb7ca1 Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 336
diff changeset
  1026
		else if(iPodcastModel.ActiveFeedInfo())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1027
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1028
			if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1029
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1030
				titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1031
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1032
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1033
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1034
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1035
			titlePane->SetTextToDefaultL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1036
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1037
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1038
	DP("CPodcastShowsView::UpdateViewTitleL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1039
	}