application/src/PodcastShowsView.cpp
author Sebastian Brannstrom <sebastianb@symbian.org>
Mon, 22 Nov 2010 15:41:41 +0000
branch3rded
changeset 390 d7abecc9d189
parent 343 9c56bf585696
permissions -rw-r--r--
Catch up with 5th ed; New SIS version 1.10 (1)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
* All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
* This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
* under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
* which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
* Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
* EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
* Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
* Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#include "PodcastShowsView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#include "PodcastAppUi.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
#include "ShowEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include "SettingsEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include "PodcastApp.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include "imagehandler.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include "constants.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <akntitle.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include <podcast.rsg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include <podcast.mbg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include <gulicon.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include <barsread.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#include <aknnotedialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
#include <aknmessagequerydialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
#define KMaxMessageLength 200
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
_LIT(KShowsSizeFormatS60, "%.1f MB");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 4
diff changeset
    40
_LIT(KShowFormat, "%d\t%S\t%S%S\t");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
// these must correspond with TShowsIconIndex
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
const TUint KShowIconArrayIds[] =
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
	{
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    46
	//	EShowIcon = 0,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    47
	EMbmPodcastAudio,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    48
	EMbmPodcastAudio_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    49
	//	EShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    50
	EMbmPodcastAudio_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    51
	EMbmPodcastAudio_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    52
	//	EQuedShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    53
	EMbmPodcastAudio_dl_queued,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    54
	EMbmPodcastAudio_dl_queued_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    55
	//	EQuedShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    56
	EMbmPodcastAudio_dl_queued_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    57
	EMbmPodcastAudio_dl_queued_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    58
	//	EDownloadingShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    59
	EMbmPodcastAudio_dl_active,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    60
	EMbmPodcastAudio_dl_active_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    61
	//	EDownloadingShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    62
	EMbmPodcastAudio_dl_active_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    63
	EMbmPodcastAudio_dl_active_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    64
	//	EDownloadedShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    65
	EMbmPodcastAudio_dl,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    66
	EMbmPodcastAudio_dl_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    67
	//	EDownloadedShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    68
	EMbmPodcastAudio_dl_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    69
	EMbmPodcastAudio_dl_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    70
	//	EFailedShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    71
	EMbmPodcastAudio_dl_failed,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    72
	EMbmPodcastAudio_dl_failed_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    73
	//	EFailedShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    74
	EMbmPodcastAudio_dl_failed_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    75
	EMbmPodcastAudio_dl_failed_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    76
	//	ESuspendedShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    77
	EMbmPodcastAudio_dl_suspended,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    78
	EMbmPodcastAudio_dl_suspended_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    79
	//	ESuspendedShowIconNew
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    80
	EMbmPodcastAudio_dl_suspended_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    81
	EMbmPodcastAudio_dl_suspended_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    82
	//	EShowIcon = 0,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    83
	EMbmPodcastVideo,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    84
	EMbmPodcastVideo_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    85
	//	EShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    86
	EMbmPodcastVideo_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    87
	EMbmPodcastVideo_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    88
	//	EQuedShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    89
	EMbmPodcastVideo_dl_queued,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    90
	EMbmPodcastVideo_dl_queued_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    91
	//	EQuedShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    92
	EMbmPodcastVideo_dl_queued_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    93
	EMbmPodcastVideo_dl_queued_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    94
	//	EDownloadingShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    95
	EMbmPodcastVideo_dl_active,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    96
	EMbmPodcastVideo_dl_active_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    97
	//	EDownloadingShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    98
	EMbmPodcastVideo_dl_active_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
    99
	EMbmPodcastVideo_dl_active_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   100
	//	EDownloadedShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   101
	EMbmPodcastVideo_dl,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   102
	EMbmPodcastVideo_dl_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   103
	//	EDownloadedShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   104
	EMbmPodcastVideo_dl_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   105
	EMbmPodcastVideo_dl_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   106
	//	EFailedShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   107
	EMbmPodcastVideo_dl_failed,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   108
	EMbmPodcastVideo_dl_failed_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   109
	//	EFailedShowIconNew,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   110
	EMbmPodcastVideo_dl_failed_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   111
	EMbmPodcastVideo_dl_failed_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   112
	//	ESuspendedShowIcon,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   113
	EMbmPodcastVideo_dl_suspended,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   114
	EMbmPodcastVideo_dl_suspended_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   115
	//	ESuspendedShowIconNew
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   116
	EMbmPodcastVideo_dl_suspended_new,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   117
	EMbmPodcastVideo_dl_suspended_new_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   118
	EMbmPodcastFeed,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   119
	EMbmPodcastFeed_mask,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   120
	0,
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   121
	0
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   124
const TInt KVideoIconOffset = 12;
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   125
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
	CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
	CleanupStack::Pop(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
	}
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
CPodcastShowsView* CPodcastShowsView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
	CPodcastShowsView* self = new ( ELeave ) CPodcastShowsView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
	CleanupStack::PushL(self);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
	self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
	return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
CPodcastShowsView::CPodcastShowsView(CPodcastModel& aPodcastModel) :
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
	iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
	}
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
void CPodcastShowsView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
	BaseConstructL(R_PODCAST_SHOWSVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
	CreateIconsL();
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   152
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
	iPodcastModel.ShowEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
	
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   156
	DP("CPodcastShowsView::ConstructL END");
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
void CPodcastShowsView::CreateIconsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
	CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
	CleanupStack::PushL(icons);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
	TInt pos = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
	while (KShowIconArrayIds[pos] > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
		{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   166
		// Load the icon	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   167
		CFbsBitmap* bitmap= NULL;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   168
		CFbsBitmap* mask=  NULL;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
					                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
					                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
					                          KShowIconArrayIds[pos],
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
					                          KShowIconArrayIds[pos+1]);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
		CleanupStack::PushL(bitmap);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
		CleanupStack::PushL(mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
		
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   177
		// Append the icon to icon array
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
		CleanupStack::Pop(2); // bitmap, mask
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
		pos+=2;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
		
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   183
	//iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   184
	iListContainer->SetListboxIcons(icons);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
	CleanupStack::Pop(icons); // icons
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
	if (aType == EEventKey)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
		CShowInfo *activeShow = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
		if(index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
			activeShow = iPodcastModel.ActiveShowList()[index];
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
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
		if (activeShow != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
			DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
			switch (aKeyEvent.iCode) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
			case 117: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
			case '*':
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
			case EKeySpace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
				if (activeShow->PlayState() == EPlayed) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
					HandleCommandL(EPodcastMarkAsUnplayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
				} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
					HandleCommandL(EPodcastMarkAsPlayed);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
			case 106:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
			case '#':
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   214
				HandleCommandL(EPodcastShowInfo);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
			case EKeyBackspace:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
			case EKeyDelete:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
					HandleCommandL(EPodcastDeleteShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
			default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
				break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
CPodcastShowsView::~CPodcastShowsView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
	{
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   230
	DP("CPodcastShowsView::~CPodcastShowsView BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
	iPodcastModel.ShowEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
	iPodcastModel.FeedEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
	
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   234
    DP("CPodcastShowsView::~CPodcastShowsView END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
TUid CPodcastShowsView::Id() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   239
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
	return KUidPodcastShowsViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   243
void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   244
		TUid aCustomMessageId, const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   245
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
	DP("CPodcastShowsView::DoActivateL BEGIN");
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   247
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   248
	
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 38
diff changeset
   249
	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   250
	
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   251
	iShowNewShows = (aCustomMessageId.iUid == 1);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   252
	
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   253
	if (iShowNewShows)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   254
		{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   255
		CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   256
		cba->SetCommandSetL(R_PODCAST_CBA);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   257
		cba->DrawDeferred();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   258
		}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   259
	else
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   260
		{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   261
		CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   262
		cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   263
		cba->DrawDeferred();		
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   264
		}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   265
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   266
	UpdateViewTitleL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
	UpdateFeedUpdateStateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   268
	DP("CPodcastShowsView::DoActivateL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   269
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   270
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   271
void CPodcastShowsView::DoDeactivate()
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
	CPodcastListView::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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
// Engine callback when new shows are available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
void CPodcastShowsView::ShowListUpdatedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   278
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   282
void CPodcastShowsView::ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt /*aBytesTotal*/)
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
	if (!iListContainer->IsVisible())
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
		return;
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
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   289
	CShowInfo *info = iPodcastModel.ShowEngine().ShowDownloading();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   290
	if (info) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   291
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   292
		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   296
void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   298
	iProgressAdded = EFalse;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   299
	CShowInfo *info = NULL;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   300
	RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   301
	
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   302
	for (TInt i=0;i<fItems.Count();i++)
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
		if (fItems[i]->Uid() == aShowUid)
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
			info = fItems[i];
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
		}
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
	if (info == NULL) {
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   311
		return;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   312
	}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   313
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   314
	switch(aError)
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
		case KErrCouldNotConnect:
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
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   319
			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
   320
			ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   322
			break;
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   323
		default:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   326
	UpdateListboxItemsL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   327
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   328
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
void CPodcastShowsView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
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
	// 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
   333
	// started instead of checking feed engine states in UpdateFeedUpdateStateL.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
	if (iPodcastModel.ActiveFeedInfo() != NULL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   335
			&& iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   337
		UpdateFeedUpdateStateL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
		}	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   339
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
void CPodcastShowsView::FeedDownloadFinishedL(TFeedState /*aState*/, TUint aFeedUid, TInt /*aError*/)
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
	DP("CPodcastShowsView::FeedDownloadFinishedL BEGIN");
166
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   344
	if (iListContainer->IsVisible() &&
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   345
			iPodcastModel.ActiveFeedInfo() != NULL &&
58268495eb35 Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 164
diff changeset
   346
			iPodcastModel.ActiveFeedInfo()->Uid() == aFeedUid)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   347
		{
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   348
		UpdateFeedUpdateStateL();
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 6
diff changeset
   349
		UpdateViewTitleL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   351
	DP("CPodcastShowsView::FeedDownloadFinishedL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   352
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   353
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   354
void CPodcastShowsView::HandleListBoxEventL(CEikListBox* /*aListBox*/,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
		TListBoxEvent aEventType)
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
	switch (aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   358
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   359
		case EEventEnterKeyPressed:		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
		case EEventItemActioned:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
		case EEventItemDoubleClicked:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   362
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
			RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   365
			if (index>=0 && index< fItems.Count())
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
				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
   368
				CShowInfo *showInfo = fItems[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   369
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   370
				switch (showInfo->DownloadState()) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   371
				case ENotDownloaded:
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   372
				case EFailedDownload:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   373
					HandleCommandL(EPodcastDownloadShow);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   374
					break;
38
c11e52c5acd2 Fix for download state not taking user from shows view to queue view
teknolog
parents: 34
diff changeset
   375
				case EDownloading:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   376
				case EQueued:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   377
					AppUi()->ActivateLocalViewL(KUidPodcastQueueViewID,  TUid::Uid(0), KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   378
					((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdQueue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   379
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   380
				case EDownloaded:
136
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   381
					{
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   382
					TRAPD(err, iPodcastModel.PlayPausePodcastL(showInfo, ETrue));
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   383
					if (err != KErrNone)
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   384
						{
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   385
						HBufC *error = iEikonEnv->AllocReadResourceLC(R_ERROR_PLAYBACK_FAILED);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   386
						ShowErrorMessageL(*error);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   387
						CleanupStack::PopAndDestroy(error);
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   388
						}
90
d0c0c3e6f7a1 Added support for launching music and video player when tapping on a downloaded show
teknolog
parents: 70
diff changeset
   389
					UpdateListboxItemsL();
136
cee38af14bcf Merged show playback error handling from S^3 branch
teknolog
parents: 130
diff changeset
   390
					}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   391
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   392
				default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
					break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   394
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   395
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   396
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   397
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   398
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   399
			break;
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   402
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
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
	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   406
	TBool isNew = aShowInfo->PlayState() == ENeverPlayed;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   407
	switch (aShowInfo->DownloadState())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   408
		{
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   409
		case EDownloaded:
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   410
			aIconIndex = isNew ? EDownloadedShowIconNew : EDownloadedShowIcon;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   411
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   412
		case ENotDownloaded:
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   413
			aIconIndex = isNew ? EShowIconNew : EShowIcon;
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   414
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   415
		case EQueued:
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   416
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   417
								  (isNew ? EQuedShowIconNew : EQuedShowIcon);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   418
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   419
		case EDownloading:
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   420
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   421
								  (isNew ? EDownloadingShowIconNew : EDownloadingShowIcon);	
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   422
			break;
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   423
		case EFailedDownload:
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   424
			aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : 
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   425
								  (isNew ? EFailedShowIconNew : EFailedShowIconNew);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   426
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
		}
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   428
	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   429
	if (aShowInfo->ShowType() == EVideoPodcast)
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   430
		{
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   431
		aIconIndex += KVideoIconOffset;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   432
		}
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   433
	
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   434
	//DP3("dlStop=%d, isNew=%d, aIconIndex=%d", dlStop, isNew, aIconIndex);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   436
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   437
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   438
void CPodcastShowsView::UpdateFeedUpdateStateL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   439
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
	TBool listboxDimmed = EFalse;
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
	if (iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
			!= NULL && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid())
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
		listboxDimmed = ETrue;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
	if ((iListContainer->Listbox()->IsDimmed() && !listboxDimmed) || (!iListContainer->Listbox()->IsDimmed() && listboxDimmed))
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
		iListContainer->Listbox()->SetDimmed(listboxDimmed);
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
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   453
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   454
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   455
void CPodcastShowsView::FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   456
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   457
	TBuf<32> infoSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
	TInt iconIndex = 0;	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   459
	TBuf<KMaxShortDateFormatSpec*2> showDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   460
	GetShowIcons(&aShowInfo, iconIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   461
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   462
	if(aSizeDownloaded > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   463
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   464
		if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
			{
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   466
				TUint showSize = aShowInfo.ShowSize() >= (TUint) aSizeDownloaded ? aShowInfo.ShowSize() : (TUint) aSizeDownloaded;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   467
				infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb),
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   468
						((float) showSize / (float)KSizeMb));
2
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
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   471
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   472
			infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   473
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   474
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
	else if (aShowInfo.ShowSize() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   476
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
		infoSize.Format(KShowsSizeFormatS60(), (float)aShowInfo.ShowSize() / (float)KSizeMb);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
		} 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
	else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
		infoSize = KNullDesC();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   481
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   483
	if (aShowInfo.PubDate().Int64() == 0)
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
		showDate = KNullDesC();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   486
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   487
	else
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
		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   490
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   491
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   492
	if(aShowInfo.LastError() != KErrNone)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
		{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   494
		GetShowErrorText(infoSize, aShowInfo.LastError());
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   495
		showDate.Zero();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   496
		}
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   497
	
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   498
	if (infoSize.Length() > 0 && showDate.Length() > 0)
2
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
		infoSize.Insert(0,_L(", "));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   501
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   502
		
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   503
	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   504
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   505
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   506
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
	{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 38
diff changeset
   508
	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   509
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   510
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
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
	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
	iItemArray->Delete(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   515
	if(aIndex>= iItemArray->MdcaCount())
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
		iItemArray->AppendL(iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   518
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   519
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   520
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   521
		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   523
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   524
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   525
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   526
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   527
	RShowInfoArray& array = iPodcastModel.ActiveShowList();
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
	for (int i=0;i<array.Count();i++) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   530
		if (array[i]->Uid() == aUid) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   531
			UpdateShowItemDataL(array[i], i, aSizeDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   532
			if (iListContainer->Listbox()->TopItemIndex() <= i &&
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   533
				iListContainer->Listbox()->BottomItemIndex() >= i) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
					iListContainer->Listbox()->DrawItem(i);
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
		}
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
}
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
void CPodcastShowsView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   541
	{
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   542
	DP("CPodcastShowsView::UpdateListboxItemsL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   543
	if (iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   544
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   545
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   546
		TInt len = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   547
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   548
		if (iShowNewShows)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   549
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   550
			iPodcastModel.GetNewShowsL();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   551
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   552
		else
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   553
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   554
			iPodcastModel.GetShowsByFeedL(iPodcastModel.ActiveFeedInfo()->Uid());
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   555
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   556
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   557
		RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   558
		len = fItems.Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   559
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   560
		if (iListContainer->Listbox() != NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   561
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   562
			TBool allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   563
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   564
			if (len == iListContainer->Listbox()->Model()->NumberOfItems())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   565
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   566
				allUidsMatch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   567
				TUint itemId = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   568
				for (TInt loop = 0; loop< len; loop++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   569
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   570
					itemId = iItemIdArray[loop];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   571
					if (fItems[loop]->Uid() != itemId)
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
						allUidsMatch = EFalse;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   574
						break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   575
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   576
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   577
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   578
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   579
			if (allUidsMatch && len > 0)
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
				for (TInt loop = 0; loop< len; loop++)
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   582
					{
6
e211a78d3037 Fix for incorrect error handling of show downloads
teknolog
parents: 5
diff changeset
   583
					UpdateShowItemDataL(fItems[loop], loop);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   584
					}
31
8a5ead064c4f Shows view now updates correctl after Mark all played
teknolog
parents: 28
diff changeset
   585
				iListContainer->Listbox()->DrawNow();
2
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
			else
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
				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   590
				iListContainer->Listbox()->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   591
				iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   592
				iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   593
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   594
				if (len > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   595
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   596
					for (TInt i=0; i<len; i++)
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
						CShowInfo *si = fItems[i];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   599
						FormatShowInfoListBoxItemL(*si);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   600
						iItemIdArray.Append(si->Uid());						
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   601
						iItemArray->AppendL(iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   602
						}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   603
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   604
				else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   605
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   606
					iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   607
					iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   608
					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   609
					itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   610
					itemProps.SetHiddenSelection(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   611
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   612
				iListContainer->Listbox()->HandleItemAdditionL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   613
				}				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   614
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   615
		}
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   616
	DP("CPodcastShowsView::UpdateListboxItemsL END");
2
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
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
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   621
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   622
 * @param aCommand ID of the command to respond to. 
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
void CPodcastShowsView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   625
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   626
	switch (aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   627
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   628
		case EPodcastMarkAsPlayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   629
			HandleSetShowPlayedL(ETrue);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   630
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   631
		case EPodcastMarkAsUnplayed:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   632
			HandleSetShowPlayedL(EFalse);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   633
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   634
		case EPodcastMarkAllPlayed:
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   635
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   636
			TBuf<KMaxMessageLength> msg;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   637
			iEikonEnv->ReadResourceL(msg, R_MARK_ALL_OLD_QUERY);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   638
			if (!ShowQueryMessageL(msg))
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   639
				{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   640
				break;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   641
				}
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   642
			iPodcastModel.MarkSelectionPlayedL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   643
			UpdateListboxItemsL();
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   644
			}
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 EPodcastDeleteShow:
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   647
			HandleDeleteShowL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   648
			break;
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   649
		case EPodcastDownloadAll:
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   650
			HandleDownloadAllL();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   651
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   652
		case EPodcastDownloadShow:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   653
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   654
			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
   655
			
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   656
			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   657
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   658
				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   659
				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   660
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   661
			}
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 EPodcastUpdateFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   664
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   665
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   666
			if (iPodcastModel.ActiveFeedInfo()->Url().Length()>0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   667
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   668
				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   669
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   670
//				if (error != KErrNone)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   671
//					{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   672
//					HBufC* str =
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   673
//							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   674
//					User::InfoPrint(*str);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   675
//					CleanupStack::PopAndDestroy(str);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   676
//					}
2
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;
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   680
		case EPodcastUpdateAllFeeds:
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   681
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   682
			iPodcastModel.FeedEngine().UpdateAllFeedsL();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   683
			}break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   684
		case EPodcastCancelUpdateAllFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   685
			iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   686
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   687
		case EPodcastShowInfo:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   688
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   689
			DisplayShowInfoDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   690
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   691
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   692
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   693
			break;
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
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   697
void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   698
{
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   699
	TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() && 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   700
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   701
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   702
	if(aResourceId == R_PODCAST_SHOWSVIEW_MENU)
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   703
		{	
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   704
		
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   705
		TBool hideDownloadAll = ETrue;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   706
		TBool hideMarkAllPlayed = ETrue;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   707
	
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   708
		for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   709
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   710
			CShowInfo* info = iPodcastModel.ActiveShowList()[i];
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   711
			if (info->PlayState() == ENeverPlayed)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   712
				{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   713
				hideMarkAllPlayed = EFalse;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   714
				}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   715
			if (info->DownloadState() == ENotDownloaded)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   716
				{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   717
				hideDownloadAll = EFalse;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   718
				}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   719
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   720
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   721
		if (!iShowNewShows) {
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   722
			hideDownloadAll = ETrue;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   723
		}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   724
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   725
		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, hideMarkAllPlayed);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   726
		aMenuPane->SetItemDimmed(EPodcastDownloadAll, hideDownloadAll);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   727
				
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   728
		aMenuPane->SetItemDimmed(EPodcastUpdateFeed, updatingState); 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   729
		aMenuPane->SetItemDimmed(EPodcastCancelUpdateAllFeeds, !updatingState);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   730
		aMenuPane->SetItemDimmed(EPodcastShowsShowMenu, updatingState || iPodcastModel.ActiveShowList().Count() == 0);
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   731
		aMenuPane->SetItemDimmed(EPodcastUpdateAllFeeds, !iShowNewShows);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   732
		aMenuPane->SetItemDimmed(EPodcastUpdateFeed, iShowNewShows);		
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   733
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   734
	else if (aResourceId == R_SHOWS_SHOW_MENU)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   735
		{
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   736
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   737
		if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   738
			{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   739
			CShowInfo *info = iPodcastModel.ActiveShowList()[index];
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   740
			TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded;
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   741
			TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded;
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   742
			TBool hideMarkOld = info->PlayState() == EPlayed;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   743
			
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   744
			aMenuPane->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   745
			aMenuPane->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld);			
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   746
			aMenuPane->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd);
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   747
			aMenuPane->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd);
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 175
diff changeset
   748
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   749
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   750
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   751
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   752
void CPodcastShowsView::DisplayShowInfoDialogL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   753
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   754
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   755
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   756
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   757
		CShowInfo* info = iPodcastModel.ActiveShowList()[index];
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   758
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   759
		HBufC *title = info->Title().AllocL();
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   760
		HBufC *description = info->Description().AllocL();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   761
		
24
ca50ea154990 Moved search result title to navipane. Fixed but 1832
teknolog
parents: 23
diff changeset
   762
		CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   763
							
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   764
		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
   765
		note->RunLD();
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   766
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   767
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   768
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   769
void CPodcastShowsView::HandleDownloadAllL()
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   770
	{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   771
	
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   772
	TBuf<KMaxMessageLength> msg;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   773
	iEikonEnv->ReadResourceL(msg, R_DOWNLOAD_ALL_QUERY);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   774
	if (!ShowQueryMessageL(msg))
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   775
		{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   776
		return;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   777
		}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   778
		
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   779
	for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   780
		{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   781
		CShowInfo* info = iPodcastModel.ActiveShowList()[i];
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   782
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   783
		if (info->DownloadState() == ENotDownloaded)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   784
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   785
			TRAP_IGNORE(iPodcastModel.ShowEngine().AddDownloadL(*info));
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   786
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   787
		}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   788
	}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   789
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   790
void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   791
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   792
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   793
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   794
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   795
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   796
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   797
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   798
		info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed);
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   799
		if (aPlayed && info->DownloadState() == EDownloaded)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   800
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   801
			// PostPlayHandling calls UpdateShow, which is slow, so we don't need to do it again
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   802
			iPodcastModel.ShowEngine().PostPlayHandling(info);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   803
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   804
		else
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   805
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   806
			iPodcastModel.ShowEngine().UpdateShowL(*info);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   807
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   808
		
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   809
		if (iShowNewShows)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   810
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   811
			UpdateListboxItemsL();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   812
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   813
			if (index > 0)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   814
				{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   815
				iListContainer->Listbox()->SetCurrentItemIndex(index - 1);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   816
				}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   817
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   818
		else
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   819
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   820
			UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   821
			iListContainer->Listbox()->DrawItem(index);	
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   822
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   823
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   824
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   825
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   826
void CPodcastShowsView::HandleDeleteShowL()
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
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   829
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   830
	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
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
		CShowInfo *info = iPodcastModel.ActiveShowList()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   833
		TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   834
		TBuf<KMaxMessageLength> templ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   835
		iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   836
		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
   837
		if (ShowQueryMessageL(msg))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   838
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   839
			iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   840
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   841
			// and mark as played, and not downloaded
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   842
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   843
			info->SetDownloadState(ENotDownloaded);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   844
			info->SetPlayState(EPlayed);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   845
			iPodcastModel.ShowEngine().UpdateShowL(*info);
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   846
		
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   847
			if (iShowNewShows)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   848
				{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   849
				UpdateListboxItemsL();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   850
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   851
				if (index > 0)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   852
					{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   853
					iListContainer->Listbox()->SetCurrentItemIndex(index - 1);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   854
					}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   855
				}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   856
			else
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   857
				{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   858
				UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   859
				iListContainer->Listbox()->DrawItem(index);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   860
				}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   861
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   862
		}
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
16
7a4b769d94c8 Re-enabled queue count in tabs
teknolog
parents: 14
diff changeset
   865
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   866
	{
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 28
diff changeset
   867
	((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
34
a6046405f1aa Fix for download icons not updating correctly
teknolog
parents: 33
diff changeset
   868
	UpdateListboxItemsL();
2
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   871
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   872
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   873
	UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   874
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   875
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   876
void CPodcastShowsView::UpdateViewTitleL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   877
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   878
	DP("CPodcastShowsView::UpdateViewTitleL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   879
	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   880
		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   881
		 
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   882
		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() &&
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   883
				iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   884
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   885
		if (updatingState) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   886
			SetEmptyTextL(R_PODCAST_EMPTY_LIST_UPDATING);		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   887
		} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   888
			SetEmptyTextL(R_PODCAST_EMPTY_LIST);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   889
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   890
		
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   891
		if(iShowNewShows)
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   892
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   893
			HBufC *title = iEikonEnv->AllocReadResourceLC(R_NEW_SHOWS);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   894
			titlePane->SetTextL(*title);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   895
			CleanupStack::PopAndDestroy(title);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   896
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   897
		else if(iPodcastModel.ActiveFeedInfo())
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   898
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   899
			if (iPodcastModel.ActiveFeedInfo()->Title() != KNullDesC)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   900
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   901
				titlePane->SetTextL( iPodcastModel.ActiveFeedInfo()->Title(), ETrue );
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
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   905
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   906
			titlePane->SetTextToDefaultL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   907
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   908
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   909
	DP("CPodcastShowsView::UpdateViewTitleL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   910
	}