application/src/PodcastShowsView.cpp
author Sebastian Brannstrom <sebastianb@symbian.org>
Sun, 21 Nov 2010 20:11:07 +0000
branchRCL_3
changeset 383 931d0db6374d
parent 376 31968c23152c
child 388 5f24605de6cf
permissions -rw-r--r--
Catchup with Symbian1
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
314
e7776f6a2198 Dual listbox solution now mostly works
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 313
diff changeset
    40
_LIT(KShowFormat, "%d\t%S\t%S%S");
316
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
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
	{
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    47
	//	EShowIcon = 0,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    48
	EMbmPodcastAudio,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    49
	EMbmPodcastAudio_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    50
	//	EShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    51
	EMbmPodcastAudio_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    52
	EMbmPodcastAudio_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    53
	//	EQuedShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    54
	EMbmPodcastAudio_dl_queued,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    55
	EMbmPodcastAudio_dl_queued_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    56
	//	EQuedShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    57
	EMbmPodcastAudio_dl_queued_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    58
	EMbmPodcastAudio_dl_queued_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    59
	//	EDownloadingShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    60
	EMbmPodcastAudio_dl_active,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    61
	EMbmPodcastAudio_dl_active_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    62
	//	EDownloadingShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    63
	EMbmPodcastAudio_dl_active_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    64
	EMbmPodcastAudio_dl_active_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    65
	//	EDownloadedShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    66
	EMbmPodcastAudio_dl,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    67
	EMbmPodcastAudio_dl_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    68
	//	EDownloadedShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    69
	EMbmPodcastAudio_dl_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    70
	EMbmPodcastAudio_dl_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    71
	//	EFailedShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    72
	EMbmPodcastAudio_dl_failed,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    73
	EMbmPodcastAudio_dl_failed_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    74
	//	EFailedShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    75
	EMbmPodcastAudio_dl_failed_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    76
	EMbmPodcastAudio_dl_failed_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    77
	//	ESuspendedShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    78
	EMbmPodcastAudio_dl_suspended,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    79
	EMbmPodcastAudio_dl_suspended_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    80
	//	ESuspendedShowIconNew
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    81
	EMbmPodcastAudio_dl_suspended_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    82
	EMbmPodcastAudio_dl_suspended_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    83
	//	EShowIcon = 0,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    84
	EMbmPodcastVideo,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    85
	EMbmPodcastVideo_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    86
	//	EShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    87
	EMbmPodcastVideo_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    88
	EMbmPodcastVideo_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    89
	//	EQuedShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    90
	EMbmPodcastVideo_dl_queued,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    91
	EMbmPodcastVideo_dl_queued_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    92
	//	EQuedShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    93
	EMbmPodcastVideo_dl_queued_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    94
	EMbmPodcastVideo_dl_queued_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    95
	//	EDownloadingShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    96
	EMbmPodcastVideo_dl_active,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    97
	EMbmPodcastVideo_dl_active_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    98
	//	EDownloadingShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
    99
	EMbmPodcastVideo_dl_active_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   100
	EMbmPodcastVideo_dl_active_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   101
	//	EDownloadedShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   102
	EMbmPodcastVideo_dl,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   103
	EMbmPodcastVideo_dl_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   104
	//	EDownloadedShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   105
	EMbmPodcastVideo_dl_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   106
	EMbmPodcastVideo_dl_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   107
	//	EFailedShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   108
	EMbmPodcastVideo_dl_failed,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   109
	EMbmPodcastVideo_dl_failed_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   110
	//	EFailedShowIconNew,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   111
	EMbmPodcastVideo_dl_failed_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   112
	EMbmPodcastVideo_dl_failed_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   113
	//	ESuspendedShowIcon,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   114
	EMbmPodcastVideo_dl_suspended,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   115
	EMbmPodcastVideo_dl_suspended_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   116
	//	ESuspendedShowIconNew
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   117
	EMbmPodcastVideo_dl_suspended_new,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   118
	EMbmPodcastVideo_dl_suspended_new_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   119
	EMbmPodcastFeed,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   120
	EMbmPodcastFeed_mask,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   121
	0,
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
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
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   125
const TInt KVideoIconOffset = 12;
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
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();
318
a231cc388498 Improved event handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 317
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
void CPodcastShowsView::CreateIconsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
		{
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   165
		// Load the icon	
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   166
		CFbsBitmap* bitmap= NULL;
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   167
		CFbsBitmap* mask=  NULL;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
		CleanupStack::PushL(bitmap);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
		
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   176
		// Append the icon to icon array
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
		pos+=2;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
		
313
0f30a75610de First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 294
diff changeset
   182
	//iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
0f30a75610de First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 294
diff changeset
   183
	iListContainer->SetListboxIcons(icons);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
	CleanupStack::Pop(icons); // icons
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
	if (aType == EEventKey)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
		CShowInfo *activeShow = NULL;
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
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
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
			activeShow = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
					HandleCommandL(EPodcastMarkAsPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
			case '#':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
				if (activeShow->DownloadState() == ENotDownloaded) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
					HandleCommandL(EPodcastDeleteShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
			UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
CPodcastShowsView::~CPodcastShowsView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
	{
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   232
	DP("CPodcastShowsView::~CPodcastShowsView BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   234
	iPodcastModel.FeedEngine().RemoveObserver(this);
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   235
    DP("CPodcastShowsView::~CPodcastShowsView END");
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   239
TUid CPodcastShowsView::Id() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
	return KUidPodcastShowsViewID;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   244
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   245
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
	DP("CPodcastShowsView::DoActivateL BEGIN");
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   248
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   249
	
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   250
	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   251
	
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   252
	iShowNewShows = (aCustomMessageId.iUid == 1);
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   253
	
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   254
	if (iShowNewShows)
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   255
		{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   256
		CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   257
		cba->SetCommandSetL(R_PODCAST_CBA);
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   258
		cba->DrawDeferred();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   259
		}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   260
	else
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   261
		{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   262
		CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   263
		cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   264
		cba->DrawDeferred();		
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   265
		}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   266
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
	UpdateViewTitleL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   268
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   269
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
	DP("CPodcastShowsView::DoActivateL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   271
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   272
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   273
void CPodcastShowsView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   274
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   275
	CPodcastListView::DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   278
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
void CPodcastShowsView::ShowListUpdatedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
	UpdateListboxItemsL();
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   284
void CPodcastShowsView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   285
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   286
	if (!iListContainer->IsVisible())
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
		return;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   289
		}
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
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   292
	if (info) 
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
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   298
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
2
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
	iProgressAdded = EFalse;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   301
	CShowInfo *info = NULL;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   302
	RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   303
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   304
	for (TInt i=0;i<fItems.Count();i++)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   305
		{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   306
		if (fItems[i]->Uid() == aShowUid)
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   307
			{
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   308
			info = fItems[i];
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   309
			}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   310
		}
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   311
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   312
	if (info == NULL) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   313
		return;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   314
	}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   315
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   316
	switch(aError)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   317
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   318
		case KErrCouldNotConnect:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   319
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   320
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
			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
   322
			ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   323
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
			break;
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   325
		default:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   326
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   327
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   328
	UpdateListboxItemsL();
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   332
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
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
	// 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
   335
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   339
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
		}	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   342
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
void CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   345
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
	DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN");
165
d886725e4499 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 163
diff changeset
   347
	if (iListContainer->IsVisible() &&
d886725e4499 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 163
diff changeset
   348
			iPodcastModel.ActiveFeedInfo() != NULL &&
d886725e4499 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 163
diff changeset
   349
			iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   351
		UpdateFeedUpdateStateL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   352
		UpdateViewTitleL();
2
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
	DP("CPodcastShowsView::FeedDownloadFinishedL END");
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   357
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   358
		TListBoxEvent aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   359
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
	switch (aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
		{
137
eefed4bda2e2 Minor fixes to comply with single tap technical solution description. By this I consider bug 2056 closed.
teknolog
parents: 134
diff changeset
   362
		case EEventItemSingleClicked:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   365
		case EEventItemDoubleClicked:
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
			RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   368
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   369
			if (index>=0 && index< fItems.Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   370
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   371
				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
   372
				CShowInfo *showInfo = fItems[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   373
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   374
				switch (showInfo->DownloadState()) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   375
				case ENotDownloaded:
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   376
				case EFailedDownload:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   377
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   378
					break;
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   379
				case EDownloading:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   380
				case EQueued:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   381
					AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID,  TUid::Uid(0), KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   382
					((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   383
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   384
				case EDownloaded:
134
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   385
					{
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   386
					TRAPD(err, iPodcastModel.PlayPausePodcastL(showInfo, ETrue));
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   387
					if (err != KErrNone)
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   388
						{
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   389
						HBufC *error = iEikonEnv->AllocReadResourceLC(R_ERROR_PLAYBACK_FAILED);
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   390
						ShowErrorMessageL(*error);
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   391
						CleanupStack::PopAndDestroy(error);
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   392
						}
133
5f9e7e14eb11 Merged playback functionality from FCL Symbian1 branch
teknolog
parents: 126
diff changeset
   393
					UpdateListboxItemsL();
134
46baf9a7cadd Fix for KErrCorrupted bug in ShowEngine; Capabilities added to allow interaction with music player and MPXCollection
teknolog
parents: 133
diff changeset
   394
					}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   395
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   396
				default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   397
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   398
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   399
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   400
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   401
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   402
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   405
		UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   407
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   408
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
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
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   411
	TBool isNew = aShowInfo->PlayState() == ENeverPlayed;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   412
	switch (aShowInfo->DownloadState())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
		{
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   414
		case EDownloaded:
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   415
			aIconIndex = isNew ? EDownloadedShowIconNew : EDownloadedShowIcon;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   416
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   417
		case ENotDownloaded:
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   418
			aIconIndex = isNew ? EShowIconNew : EShowIcon;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   419
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   420
		case EQueued:
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   421
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   422
								  (isNew ? EQuedShowIconNew : EQuedShowIcon);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   423
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   424
		case EDownloading:
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   425
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   426
								  (isNew ? EDownloadingShowIconNew : EDownloadingShowIcon);	
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   427
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   428
		case EFailedDownload:
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   429
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   430
								  (isNew ? EFailedShowIconNew : EFailedShowIconNew);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   431
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   432
		}
120
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   433
	
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   434
	if (aShowInfo->ShowType() == EVideoPodcast)
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   435
		{
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   436
		aIconIndex += KVideoIconOffset;
31d05afa1a52 Added video podcast icons, but they don't work correctly yet.
teknolog
parents: 117
diff changeset
   437
		}
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   438
	
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   439
	//DP3("dlStop=%d, isNew=%d, aIconIndex=%d", dlStop, isNew, aIconIndex);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   442
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
void CPodcastShowsView::UpdateFeedUpdateStateL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   444
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   445
	TBool listboxDimmed = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   446
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   447
	if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
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
		listboxDimmed = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   451
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   452
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   453
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   455
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   456
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   457
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   459
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   460
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   461
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   463
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   464
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
	GetShowIcons(&aShowInfo, iconIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   467
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   468
	if(aSizeDownloaded > 0)
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
		if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   471
			{
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   472
				TUint showSize = aShowInfo.ShowSize() >= (TUint) aSizeDownloaded ? aShowInfo.ShowSize() : (TUint) aSizeDownloaded;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   473
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   474
						((float) showSize / (float)KSizeMb));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   476
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   481
	else if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   483
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
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
		infoSize = KNullDesC();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   487
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
	if (aShowInfo.PubDate().Int64() == 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   490
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   491
		showDate = KNullDesC();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   492
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   494
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   495
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
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.LastError() != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   499
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   500
		GetShowErrorText(infoSize, aShowInfo.LastError());
112
0bd6b9a3f027 Don't show feed/show date when an error occured
teknolog
parents: 107
diff changeset
   501
		showDate.Zero();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   502
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   503
	
112
0bd6b9a3f027 Don't show feed/show date when an error occured
teknolog
parents: 107
diff changeset
   504
	if (infoSize.Length() > 0 && showDate.Length() > 0)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   505
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   506
		infoSize.Insert(0,_L(", "));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
		
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   509
	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
317
5afc95a6ad83 Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 316
diff changeset
   510
	iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title());
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   512
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   513
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
	{
117
3b59b88b089e Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents: 115
diff changeset
   515
	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   518
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   519
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   521
	iItemArray->Delete(aIndex);
316
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   522
	iItemArrayShort->Delete(aIndex);
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   523
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   524
	if(aIndex>= iItemArray->MdcaCount())
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
		iItemArray->AppendL(iListboxFormatbuffer);
316
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   527
		iItemArrayShort->AppendL(iListboxFormatbufferShort);
2
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
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   530
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   531
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
316
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   532
		iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   533
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   535
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   536
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
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
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
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
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   541
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   542
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   543
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   544
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   545
					iListContainer->Listbox()->DrawItem(i);
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
		}
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
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   550
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   551
void CPodcastShowsView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   552
	{
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   553
	DP("CPodcastShowsView::UpdateListboxItemsL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   554
	if (iListContainer->IsVisible())
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
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   557
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   558
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   559
		if (iShowNewShows)
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   560
			{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   561
			iPodcastModel.GetNewShowsL();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   562
			}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   563
		else
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   564
			{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   565
			iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid());
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   566
			}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   567
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   568
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   569
		len = fItems.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   570
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   571
		if (iListContainer->Listbox() != NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   572
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   573
			TBool allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   574
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   575
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   576
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   577
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   578
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   579
				for (TInt loop = 0; loop< len; loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   580
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   581
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   582
					if (fItems[loop]->Uid() != itemId)
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
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   585
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   586
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   587
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   588
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   589
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   590
			if (allUidsMatch && len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   591
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   592
				for (TInt loop = 0; loop< len; loop++)
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   593
					{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   594
					UpdateShowItemDataL(fItems[loop], loop);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
					}
31
8a5ead064c4f Shows view now updates correctl after Mark all played
teknolog
parents: 28
diff changeset
   596
				iListContainer->Listbox()->DrawNow();
2
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
			else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   599
				{
317
5afc95a6ad83 Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 316
diff changeset
   600
				//iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   601
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   602
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   603
				iItemArray->Reset();
316
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   604
				iItemArrayShort->Reset();
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   605
				
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   606
				if (len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   607
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   608
					for (TInt i=0; i<len; i++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   609
						{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   610
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   611
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   612
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   613
						iItemArray->AppendL(iListboxFormatbuffer);
316
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   614
						iItemArrayShort->AppendL(iListboxFormatbufferShort);
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   615
												
2
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
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   618
				else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   619
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   620
					iItemArray->Reset();
316
841ccfa933ac More cleanup
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 314
diff changeset
   621
					iItemArrayShort->Reset();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   622
					iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   623
					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   624
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   625
					itemProps.SetHiddenSelection(ETrue);
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
				iListContainer->Listbox()->HandleItemAdditionL();
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
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   630
		}
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   631
	DP("CPodcastShowsView::UpdateListboxItemsL END");
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   634
/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   635
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   636
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   637
 * @param aCommand ID of the command to respond to. 
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
void CPodcastShowsView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   640
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   641
	switch (aCommand)
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
		case EPodcastMarkAsPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   644
			HandleSetShowPlayedL(ETrue);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   645
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   646
		case EPodcastMarkAsUnplayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   647
			HandleSetShowPlayedL(EFalse);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   648
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   649
		case EPodcastMarkAllPlayed:
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   650
			{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   651
			if (iShowNewShows) {
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   652
				TBuf<KMaxMessageLength> msg;
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   653
				iEikonEnv->ReadResourceL(msg, R_MARK_ALL_OLD_QUERY);
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   654
				if (!ShowQueryMessageL(msg))
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   655
					{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   656
					break;
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   657
					}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   658
			}
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   659
			iPodcastModel.MarkSelectionPlayedL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   660
			UpdateListboxItemsL();
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   661
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   662
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   663
		case EPodcastDeleteShow:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   664
			HandleDeleteShowL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   665
			break;
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   666
		case EPodcastDownloadAll:
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   667
			HandleDownloadAllL();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   668
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   669
		case EPodcastDownloadShow:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   670
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   671
			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
   672
			
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   673
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   674
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   675
				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   676
				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   677
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   678
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   679
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   680
		case EPodcastUpdateFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   681
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   682
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   683
			if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   684
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   685
				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
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
				if (error != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   688
					{
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
   689
					HBufC* str =
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   690
							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   691
					User::InfoPrint(*str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   692
					CleanupStack::PopAndDestroy(str);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   693
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   694
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   695
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   696
			break;
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   697
		case EPodcastUpdateAllFeeds:
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   698
			{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   699
			iPodcastModel.FeedEngine().UpdateAllFeedsL();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   700
			UpdateToolbar();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   701
			}break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   702
		case EPodcastCancelUpdateAllFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   703
			iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   704
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   705
		case EPodcastShowInfo:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   706
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   707
			DisplayShowInfoDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   708
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   709
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   710
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   711
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   712
		}
28
7aa3544d8be3 Long tap fix applied to show view too
teknolog
parents: 24
diff changeset
   713
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   714
	UpdateToolbar();
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
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   717
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   718
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   719
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   720
		{
243
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   721
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   722
		
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   723
		if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   724
			{			
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   725
			CShowInfo* info = iPodcastModel.ActiveShowList()[index];
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   726
	
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   727
			TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded;
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   728
			TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   729
			TBool hideMarkOld = info->PlayState() == EPlayed;
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   730
			
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   731
			aMenuPane->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   732
			aMenuPane->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   733
						
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   734
			aMenuPane->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd);
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   735
			aMenuPane->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
44d205147a83 Fix for bug 3730 by switching to proper S3 context menu handling
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 165
diff changeset
   736
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   737
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   738
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   739
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   740
void CPodcastShowsView::DisplayShowInfoDialogL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   741
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   742
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   743
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   744
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   745
		CShowInfo* info = iPodcastModel.ActiveShowList()[index];
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   746
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   747
		HBufC *title = info->Title().AllocL();
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   748
		HBufC *description = info->Description().AllocL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   749
		
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   750
		CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   751
							
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   752
		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
   753
		note->RunLD();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   754
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   755
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   756
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   757
void CPodcastShowsView::HandleDownloadAllL()
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   758
	{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   759
	
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   760
	TBuf<KMaxMessageLength> msg;
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   761
	iEikonEnv->ReadResourceL(msg, R_DOWNLOAD_ALL_QUERY);
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   762
	if (!ShowQueryMessageL(msg))
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   763
		{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   764
		return;
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   765
		}
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   766
		
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   767
	for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   768
		{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   769
		CShowInfo* info = iPodcastModel.ActiveShowList()[i];
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   770
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   771
		if (info->DownloadState() == ENotDownloaded)
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   772
			{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   773
			TRAP_IGNORE(iPodcastModel.ShowEngine().AddDownloadL(*info));
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   774
			}
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   775
		}
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   776
	}
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   777
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   778
void CPodcastShowsView::UpdateToolbar(TBool aVisible)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   779
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   780
	CAknToolbar* toolbar = Toolbar();
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 10
diff changeset
   781
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   782
	if (toolbar) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   783
		if (iListContainer->IsVisible()) {
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   784
			toolbar->SetToolbarVisibility(aVisible);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   785
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   786
	
155
4ec84fbc7b27 Fix for bug 2819 - Crash when updating and connection set to "Always ask"
teknolog
parents: 137
diff changeset
   787
		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
   788
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   789
	
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   790
		if (iShowNewShows)
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   791
			{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   792
			updatingState = iPodcastModel.FeedEngine().ClientState();
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   793
			toolbar->HideItem(EPodcastUpdateFeed, ETrue, ETrue ); 
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   794
			toolbar->HideItem(EPodcastUpdateAllFeeds, updatingState, ETrue ); 
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   795
			}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   796
		else
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   797
			{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   798
			toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); 
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   799
			toolbar->HideItem(EPodcastUpdateAllFeeds, ETrue, ETrue ); 
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   800
			}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   801
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 16
diff changeset
   802
		toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue );
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   803
		
383
931d0db6374d Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 376
diff changeset
   804
	
931d0db6374d Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 376
diff changeset
   805
		toolbar->HideItem(EPodcastEmpty, EFalse, ETrue );
931d0db6374d Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 376
diff changeset
   806
		toolbar->SetItemDimmed(EPodcastEmpty, ETrue, ETrue);
931d0db6374d Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 376
diff changeset
   807
		
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   808
		toolbar->HideItem(EPodcastDownloadAll, !iShowNewShows, ETrue);
290
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   809
		
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   810
		TBool showMarkAllPlayed = EFalse;
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   811
		TBool showDownloadAll = EFalse;
290
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   812
		for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   813
			{
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   814
			CShowInfo* info = iPodcastModel.ActiveShowList()[i];
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   815
			if (info->PlayState() == ENeverPlayed)
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   816
				{
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   817
				showMarkAllPlayed = ETrue;
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   818
				}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   819
			if (info->DownloadState() == ENotDownloaded)
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   820
				{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   821
				showDownloadAll = ETrue;
290
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   822
				}
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   823
			}
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   824
290
0d5e69a7cda9 Added Mark all played button in show view
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 243
diff changeset
   825
		toolbar->SetItemDimmed(EPodcastMarkAllPlayed, !showMarkAllPlayed, ETrue);
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   826
		toolbar->SetItemDimmed(EPodcastDownloadAll, !showDownloadAll, ETrue);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   827
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   828
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   829
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   830
void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   831
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   832
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   833
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   834
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   835
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   836
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   837
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   838
		info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed);
368
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   839
		if (aPlayed)
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   840
			{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   841
			// PostPlayHandling calls UpdateShow, which is slow, so we don't need to do it again
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   842
			iPodcastModel.ShowEngine().PostPlayHandling(info);
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   843
			}
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   844
		else
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   845
			{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   846
			iPodcastModel.ShowEngine().UpdateShowL(*info);
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   847
			}
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   848
		
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   849
		if (iShowNewShows)
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   850
			{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   851
			UpdateListboxItemsL();
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   852
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   853
			if (index > 0)
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   854
				{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   855
				iListContainer->Listbox()->SetCurrentItemIndex(index - 1);
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   856
				}
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   857
			}
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   858
		else
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   859
			{
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   860
			UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   861
			iListContainer->Listbox()->DrawItem(index);	
b131f7696342 Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 367
diff changeset
   862
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   863
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   864
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   865
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   866
void CPodcastShowsView::HandleDeleteShowL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   867
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   868
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   869
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   870
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   871
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   872
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   873
		TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   874
		TBuf<KMaxMessageLength> templ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   875
		iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   876
		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
   877
		if (ShowQueryMessageL(msg))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   878
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   879
			iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   880
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   881
			// and mark as played, and not downloaded
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   882
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   883
			info->SetDownloadState(ENotDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   884
			info->SetPlayState(EPlayed);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   885
			iPodcastModel.ShowEngine().UpdateShowL(*info);
376
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   886
		
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   887
			if (iShowNewShows)
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   888
				{
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   889
				UpdateListboxItemsL();
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   890
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   891
				if (index > 0)
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   892
					{
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   893
					iListContainer->Listbox()->SetCurrentItemIndex(index - 1);
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   894
					}
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   895
				}
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   896
			else
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   897
				{
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   898
				UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   899
				iListContainer->Listbox()->DrawItem(index);
31968c23152c Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 368
diff changeset
   900
				}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   901
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   902
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   903
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   904
16
7a4b769d94c8 Re-enabled queue count in tabs
teknolog
parents: 14
diff changeset
   905
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   906
	{
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   907
	((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   908
	UpdateListboxItemsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   909
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   910
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   911
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   912
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   913
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   914
	UpdateToolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   915
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   916
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   917
void CPodcastShowsView::UpdateViewTitleL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   918
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   919
	DP("CPodcastShowsView::UpdateViewTitleL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   920
	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   921
		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   922
		 
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   923
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() &&
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   924
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   925
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   926
		if (updatingState) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   927
			SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   928
		} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   929
			SetEmptyTextL(R_PODCAST_EMPTY_LIST);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   930
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   931
		
367
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   932
		if(iShowNewShows)
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   933
			{
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   934
			HBufC *title = iEikonEnv->AllocReadResourceLC(R_NEW_SHOWS);
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   935
			titlePane->SetTextL(*title);
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   936
			CleanupStack::PopAndDestroy(title);
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   937
			}
4b75876aa85a Added new shows list
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 318
diff changeset
   938
		else if(iPodcastModel.ActiveFeedInfo())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   939
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   940
			if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   941
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   942
				titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   943
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   944
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   945
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   946
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   947
			titlePane->SetTextToDefaultL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   948
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   949
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   950
	DP("CPodcastShowsView::UpdateViewTitleL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   951
	}