application/src/PodcastFeedView.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 "PodcastFeedView.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 "PodcastUtils.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include "PodcastFeedViewUpdater.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include "Podcast.hrh"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <caknfileselectiondialog.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 <aknquerydialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#include <BAUTILS.H> 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
#include <pathinfo.h> 
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
    34
#include <caknmemoryselectiondialog.h> 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
    35
#include <caknmemoryselectiondialog.h> 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
    36
#include <caknfilenamepromptdialog.h> 
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
    37
#include "Podcatcher.pan"
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
    38
#include <aknmessagequerydialog.h>
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
const TInt KMaxFeedNameLength = 100;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
const TInt KMaxUnplayedFeedsLength =64;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
const TInt KADayInHours = 24;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
#define KMaxMessageLength 200
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
#define KMaxTitleLength 100
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
_LIT(KFeedFormat, "%d\t%S\t%S%S");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
enum 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
 EFeedIcon
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
CPodcastFeedView* CPodcastFeedView::NewL(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
    CPodcastFeedView* self = CPodcastFeedView::NewLC(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
    CleanupStack::Pop( self );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
    return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
CPodcastFeedView* CPodcastFeedView::NewLC(CPodcastModel& aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
    CPodcastFeedView* self = new ( ELeave ) CPodcastFeedView(aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
    CleanupStack::PushL( self );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
    self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
    return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
CPodcastFeedView::CPodcastFeedView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
	iFirstActivateAfterLaunch = ETrue;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
#define KAsterisk iEikonEnv->EikAppUi()->Application()->BitmapStoreName()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
void CPodcastFeedView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
	DP("CPodcastFeedView::ConstructL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
	//_LIT(KAsterisk, "*");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
	BaseConstructL(R_PODCAST_FEEDVIEW);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
	iNeverUpdated = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_NEVER_UPDATED);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
	iFeedsFormat = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_STATUS_FORMAT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
	CPodcastListView::ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	iPodcastModel.FeedEngine().AddObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	CArrayPtr< CGulIcon >* icons = new(ELeave) CArrayPtrFlat< CGulIcon >(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	CleanupStack::PushL( icons );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
	CFbsBitmap* bitmap = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
	CFbsBitmap* mask = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
	// Load the bitmap for empty icon	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	TFileName fname = KAsterisk;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	TParsePtr parser(fname);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
	SetEmptyTextL(R_PODCAST_NO_FEEDS);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
	// Load svg.-image and mask with a single call
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
		AknIconUtils::CreateIconL(bitmap,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
		                          mask,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
		                          iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
		                          EMbmPodcastFeed,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
		                          EMbmPodcastFeed_mask);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
	    
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
	/*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	 * */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
	CleanupStack::PushL( bitmap );		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
	// Load the mask for feed icon	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
	//mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	CleanupStack::PushL( mask );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
	// Append the feed icon to icon array
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
	icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
	CleanupStack::Pop(2); // bitmap, mask
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   108
	iListContainer->SetListboxIcons( icons );
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
	CleanupStack::Pop(icons); // icons
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
    iUpdater = CPodcastFeedViewUpdater::NewL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
	DP("CPodcastFeedView::ConstructL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
    
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
CPodcastFeedView::~CPodcastFeedView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
    {
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   116
	DP("CPodcastFeedView::~CPodcastFeedView BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
	iPodcastModel.FeedEngine().RemoveObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
	delete iFeedsFormat;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
	delete iNeverUpdated;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
	delete iUpdater;
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   121
	iFeedIdForIconArray.Close();
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   122
	DP("CPodcastFeedView::~CPodcastFeedView END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
void CPodcastFeedView::UpdateItemL(TInt aIndex)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
	{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   127
	__ASSERT_DEBUG(iListContainer->IsVisible(), Panic(EPodcatcherPanicFeedView));
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   128
	__ASSERT_ALWAYS(iItemIdArray.Count() > aIndex, Panic(EPodcatcherPanicFeedView));
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
	const RFeedInfoArray& sortedItems = iPodcastModel.FeedEngine().GetSortedFeeds();
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   131
	__ASSERT_ALWAYS(sortedItems.Count() > aIndex, Panic(EPodcatcherPanicFeedView));
2
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
	// Update UID of for the feed at aIndex
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
	iItemIdArray[aIndex] = sortedItems[aIndex]->Uid();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
	// Prepare data to update the listbox item with
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   137
	FormatFeedInfoListBoxItemL(*sortedItems[aIndex], sortedItems[aIndex]->Uid() == iFeedUpdating);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
	// If nothing has changed, we are done here
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
	if (iListboxFormatbuffer == iItemArray->MdcaPoint(aIndex))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
		return;
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
	// Something has changed, update the listbox item
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
	TListItemProperties itemProps;			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
	itemProps.SetDimmed(EFalse);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
	iItemArray->Delete(aIndex);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
	iItemArray->InsertL(aIndex, iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
	iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
	// If item is visible, redraw it
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
	if (iListContainer->Listbox()->TopItemIndex() <= aIndex
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
			&& iListContainer->Listbox()->BottomItemIndex() >= aIndex)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
		iListContainer->Listbox()->DrawItem(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   159
void CPodcastFeedView::UpdateItemsComplete()
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   160
	{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   161
	}
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   162
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
TUid CPodcastFeedView::Id() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
	return KUidPodcastFeedViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
void CPodcastFeedView::DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
	                                  TUid aCustomMessageId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
	                                  const TDesC8& aCustomMessage)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
	{
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   172
	DP("CPodcastFeedView::DoActivateL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 33
diff changeset
   174
	
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   175
	iPodcastModel.ShowEngine().ExpireOldShows();
25
ae65906c4347 Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents: 24
diff changeset
   176
	if (aPrevViewId.iViewUid == KUidPodcastShowsViewID)
ae65906c4347 Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents: 24
diff changeset
   177
		{
ae65906c4347 Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents: 24
diff changeset
   178
		// back key from shows view
ae65906c4347 Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents: 24
diff changeset
   179
		iViewingShows = EFalse;
ae65906c4347 Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents: 24
diff changeset
   180
		}
ae65906c4347 Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents: 24
diff changeset
   181
	
33
64ed1227e68d Fix for problem when new download can not be started after one is completed
teknolog
parents: 32
diff changeset
   182
		UpdateListboxItemsL();		
25
ae65906c4347 Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents: 24
diff changeset
   183
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   184
	// when we receive a UID argument, this comes from search view after
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   185
	// a new feed has been added
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   186
	if (aCustomMessageId.iUid != 0)
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   187
		{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   188
		TUint feedUid = aCustomMessageId.iUid;
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   189
		ShowItem(feedUid);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   190
		TBuf<KMaxMessageLength> message;
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   191
		iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   192
		if(ShowQueryMessageL(message))
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   193
			{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   194
			iPodcastModel.FeedEngine().UpdateFeedL(feedUid);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   195
			}
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   196
		}
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   197
		
50
e7b10d6d7ba3 Merge with symbian1 branch
teknolog
parents: 49 45
diff changeset
   198
	if (iFirstActivateAfterLaunch)
e7b10d6d7ba3 Merge with symbian1 branch
teknolog
parents: 49 45
diff changeset
   199
		{
e7b10d6d7ba3 Merge with symbian1 branch
teknolog
parents: 49 45
diff changeset
   200
		iFirstActivateAfterLaunch = EFalse;
e7b10d6d7ba3 Merge with symbian1 branch
teknolog
parents: 49 45
diff changeset
   201
		}
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   202
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   203
	DP("CPodcastFeedView::DoActivateL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
void CPodcastFeedView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
	iUpdater->StopUpdate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
	CPodcastListView::DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
void CPodcastFeedView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
	{
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   215
//	DP("CPodcastFeedView::HandleListBoxEventL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
	switch(aEventType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
		{
17
4bcc91e70483 Configuration changes to default podcasts. Changed Download to Get in toolbar
teknolog
parents: 14
diff changeset
   219
	case EEventEnterKeyPressed:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
	case EEventItemDoubleClicked:
17
4bcc91e70483 Configuration changes to default podcasts. Changed Download to Get in toolbar
teknolog
parents: 14
diff changeset
   221
	case EEventItemActioned:
2
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
			const RFeedInfoArray* sortedItems = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
			TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
			sortedItems = &iPodcastModel.FeedEngine().GetSortedFeeds();
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
			if(index >= 0 && index < sortedItems->Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
				iPodcastModel.SetActiveFeedInfo((*sortedItems)[index]);			
25
ae65906c4347 Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents: 24
diff changeset
   230
				iViewingShows = ETrue;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
				AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID,  TUid::Uid(0), KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   234
		break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
	default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
		break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
		}
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   238
//	DP("CPodcastFeedView::HandleListBoxEventL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   239
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
void CPodcastFeedView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
	{
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   243
	DP("FeedUpdateAllCompleteL");
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   244
	iFeedUpdating = 0;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   245
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
void CPodcastFeedView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   248
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   249
	// Update status text
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   250
	iFeedUpdating = aFeedUid;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   251
	UpdateFeedInfoStatusL(aFeedUid, ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   252
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   253
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   254
void CPodcastFeedView::FeedDownloadFinishedL(TFeedState aState,TUint aFeedUid, TInt aError)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   255
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   256
	switch(aError)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   257
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   258
		case KErrCouldNotConnect:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   259
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   260
			if(aState == MFeedEngineObserver::EFeedManualUpdate)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   261
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   262
				TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   263
				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: 26
diff changeset
   264
				ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   265
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   266
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   267
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   268
		default: // Do nothing
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   269
			break;
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
	UpdateFeedInfoStatusL(aFeedUid, EFalse);
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   274
void CPodcastFeedView::UpdateFeedInfoStatusL(TUint aFeedUid, TBool aIsUpdating)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   275
	{
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   276
	DP("CPodcastFeedView::UpdateFeedInfoStatusL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
	const RFeedInfoArray& feeds = iPodcastModel.FeedEngine().GetSortedFeeds();
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
	// Find the index for the feed i both the feed-array and the listbox 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
	TInt feedsIdx = KErrNotFound;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
	TInt listboxIdx = KErrNotFound;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   282
	for (TInt i = 0; i < feeds.Count(); i++)
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 (feeds[i]->Uid() == aFeedUid)
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
			feedsIdx = i;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
			break;
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
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   290
	for (TInt j = 0; j < iItemIdArray.Count(); j++)
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
		if (iItemIdArray[j] == aFeedUid)
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
			listboxIdx = j;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   296
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   298
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   299
	if (feedsIdx != KErrNotFound && listboxIdx != KErrNotFound)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   300
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   301
		// TODO In the long run we want to move the sorting resposibility from
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   302
		// CFeedEngine to CPodcastFeedView.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   303
		// Hackish fix to make sure the listbox is sorted.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
		if (listboxIdx != feedsIdx)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   305
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   306
			iItemIdArray.Remove(listboxIdx);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   307
			iItemIdArray.InsertL(aFeedUid, feedsIdx);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   308
			iItemArray->Delete(listboxIdx);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
			iItemArray->InsertL(feedsIdx, KNullDesC);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   310
			iListContainer->Listbox()->HandleItemAdditionL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   311
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   312
		// Update the listbox info
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   313
		UpdateFeedInfoDataL(feeds[feedsIdx], feedsIdx, aIsUpdating);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   314
		//TODO sort the listbox after update
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
		// Update all visible listbox items that are affected by sorting and update.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   317
		TInt minIdx = Max(Min(feedsIdx, listboxIdx), iListContainer->Listbox()->TopItemIndex());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   318
		TInt maxIdx = Min(Max(feedsIdx, listboxIdx), iListContainer->Listbox()->BottomItemIndex());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   319
		for (TInt k = minIdx; k <= maxIdx; k++)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   320
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   321
			iListContainer->Listbox()->DrawItem(k);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   322
			}
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   323
		DP("CPodcastFeedView::UpdateFeedInfoStatusL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   326
void CPodcastFeedView::FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   327
	{
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   328
//	DP("CPodcastFeedView::FormatFeedInfoListBoxItemL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   329
	TBuf<KMaxShortDateFormatSpec*2> updatedDate;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   330
	TBuf<KMaxUnplayedFeedsLength> unplayedShows;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
	TUint unplayedCount = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   332
	TUint showCount = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   333
	TInt iconIndex = EFeedIcon;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   335
	if(aIsUpdating)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
		iEikonEnv->ReadResourceL(updatedDate, R_PODCAST_FEEDS_IS_UPDATING);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
		unplayedShows = KNullDesC();			
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
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
		{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   342
		// we will get a leave if there are no shows for this feed, for instance, which is fine
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   343
		TRAP_IGNORE(iPodcastModel.FeedEngine().GetStatsByFeedL(aFeedInfo.Uid(), showCount, unplayedCount));	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   345
		if (unplayedCount) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
			unplayedShows.Format(*iFeedsFormat, unplayedCount);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   347
		} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   348
			unplayedShows.Zero();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   349
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   351
		if (aFeedInfo.LastUpdated().Int64() == 0) 
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
			updatedDate.Copy(*iNeverUpdated);					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   354
			unplayedShows.Zero();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   356
		else 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   357
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   358
			TTime now;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   359
			TTimeIntervalHours interval;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
			now.HomeTime();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
			now.HoursFrom(aFeedInfo.LastUpdated(), interval);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   362
			if (interval.Int() < KADayInHours) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
				aFeedInfo.LastUpdated().FormatL(updatedDate, KTimeFormat());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   365
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   366
			else 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   367
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   368
				aFeedInfo.LastUpdated().FormatL(updatedDate, KDateFormatShort());
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
			}
32
26a3f2dfba08 Fix for bug where we always load the feed icon a large number of times
teknolog
parents: 26
diff changeset
   371
		
26a3f2dfba08 Fix for bug where we always load the feed icon a large number of times
teknolog
parents: 26
diff changeset
   372
		if(aFeedInfo.LastError() != KErrNone)
26a3f2dfba08 Fix for bug where we always load the feed icon a large number of times
teknolog
parents: 26
diff changeset
   373
			{
26a3f2dfba08 Fix for bug where we always load the feed icon a large number of times
teknolog
parents: 26
diff changeset
   374
			GetFeedErrorText(unplayedShows, aFeedInfo.LastError());
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   375
			updatedDate.Zero();
32
26a3f2dfba08 Fix for bug where we always load the feed icon a large number of times
teknolog
parents: 26
diff changeset
   376
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   377
		}
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   378
	
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   379
	iconIndex = iFeedIdForIconArray.Find(aFeedInfo.Uid());
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   380
//	DP1("    iconIndex = %d", iconIndex);
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   381
	if(iconIndex == KErrNotFound && aFeedInfo.FeedIcon() != NULL && aFeedInfo.ImageFileName().Length() > 0 && 
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   382
			aFeedInfo.FeedIcon()->SizeInPixels().iHeight > 0 &&
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   383
			aFeedInfo.FeedIcon()->SizeInPixels().iWidth > 0)
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   384
		{
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   385
		// Hopefully temporary haxx to prevent double delete. I would prefer if
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   386
		// this could be solved with a little better design.
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   387
		CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   388
		CleanupStack::PushL(bmpCopy);
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   389
		bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle());
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   390
		CArrayPtr<CGulIcon>* icons = iListContainer->ListboxIcons();
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   391
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   392
		icons->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL));
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   393
		
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   394
		iFeedIdForIconArray.Append(aFeedInfo.Uid());
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   395
		CleanupStack::Pop(bmpCopy);			
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   396
		iconIndex = icons->Count()-1;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   397
		}	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   398
	else 
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   399
		{
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   400
		iconIndex++;
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   401
		}	
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   402
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   403
	if (unplayedShows.Length() > 0 && updatedDate.Length() > 0) {
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
		unplayedShows.Insert(0,_L(", "));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   405
	}
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   406
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   407
	iListboxFormatbuffer.Format(KFeedFormat(), iconIndex, &(aFeedInfo.Title()), &updatedDate,  &unplayedShows);
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   408
//	DP("CPodcastFeedView::FormatFeedInfoListBoxItemL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   409
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   410
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   411
void CPodcastFeedView::ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& /*aPodcastModel*/)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   412
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
	if (aError == KErrNone) {
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   414
		UpdateFeedInfoStatusL(aHandle, EFalse);
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   415
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   418
void CPodcastFeedView::UpdateFeedInfoDataL(CFeedInfo* aFeedInfo, TInt aIndex, TBool aIsUpdating )
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   419
	{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   420
	DP("CPodcastFeedView::UpdateFeedInfoDataL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   421
	TListItemProperties itemProps;			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   422
	itemProps.SetDimmed(aIsUpdating);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   423
	FormatFeedInfoListBoxItemL(*aFeedInfo, aIsUpdating);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   424
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   425
	TPtrC compareTo((*iItemArray)[aIndex]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   426
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
	if (iListboxFormatbuffer.Compare(compareTo) != 0) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   428
		iItemArray->Delete(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   429
		if(aIndex>= iItemArray->MdcaCount())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   430
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   431
				iItemArray->AppendL(iListboxFormatbuffer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   432
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   433
			else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   434
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
				iItemArray->InsertL(aIndex, iListboxFormatbuffer);
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
	}
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   438
	//iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   439
	DP("CPodcastFeedView::UpdateFeedInfoDataL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   442
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   443
void CPodcastFeedView::UpdateListboxItemsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   444
	{
164
000f9fc147b2 Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 154
diff changeset
   445
	DP("CPodcastFeedView::UpdateListboxItemsL BEGIN");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   446
	// No reason to do any work if it isn't going to show..
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   447
	if(!iListContainer->IsVisible())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   448
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   449
		return;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   450
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   451
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   452
	TInt nbrItems = iPodcastModel.FeedEngine().GetSortedFeeds().Count();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   453
	if (nbrItems > 0)
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
		// Ensure that there are as many elements in iItemIdArray as in FeedEngine
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   456
		while (iItemIdArray.Count() < nbrItems)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   457
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   458
			iItemIdArray.AppendL(0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   459
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   460
		while (iItemIdArray.Count() > nbrItems)
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
			iItemIdArray.Remove(iItemIdArray.Count() - 1);
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
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   465
		// Ensure that there are as many elements in iItemArray as in FeedEngine
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   466
		while (iItemArray->Count() < nbrItems)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   467
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   468
			iItemArray->AppendL(KNullDesC);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   469
			TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   470
			iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(iItemArray->Count() - 1, itemProps);
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
		while (iItemArray->Count() > nbrItems)
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
			iItemArray->Delete(iItemArray->Count() - 1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   475
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   476
		iUpdater->StartUpdate(nbrItems);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   477
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   478
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   479
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   480
		// No feeds at all in the list , add dummy list item
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   481
		TBuf<KMaxFeedNameLength> itemName;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   482
		iEikonEnv->ReadResourceL(itemName, R_PODCAST_FEEDS_NO_FEEDS);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   483
		iItemArray->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   484
		iItemIdArray.Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   485
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   486
		TListItemProperties itemProps;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   487
		itemProps.SetDimmed(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   488
		itemProps.SetHiddenSelection(ETrue);								
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   489
		iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   490
		}
164
000f9fc147b2 Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 154
diff changeset
   491
	iListContainer->Listbox()->HandleItemAdditionL();
000f9fc147b2 Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 154
diff changeset
   492
	DP("CPodcastFeedView::UpdateListboxItemsL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   493
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   494
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   495
/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   496
 * Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   497
 * Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   498
 * @param aCommand ID of the command to respond to. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   499
 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   500
void CPodcastFeedView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   501
	{
164
000f9fc147b2 Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 154
diff changeset
   502
	DP("CPodcastFeedView::HandleCommandL BEGIN");
000f9fc147b2 Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 154
diff changeset
   503
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   504
	switch(aCommand)
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
		case EPodcastAddFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   507
			HandleAddFeedL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   508
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   509
		case EPodcastImportFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   510
			HandleImportFeedsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   511
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   512
		case EPodcastExportFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   513
			HandleExportFeedsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   514
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   515
		case EPodcastEditFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   516
			HandleEditFeedL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   517
			break;
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   518
		case EPodcastShowInfo:
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   519
			DisplayFeedInfoDialogL();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   520
			break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   521
		case EPodcastDeleteFeedHardware:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   522
		case EPodcastDeleteFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   523
			HandleRemoveFeedL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   524
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   525
		case EPodcastUpdateAllFeeds:
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
			iPodcastModel.FeedEngine().UpdateAllFeedsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   528
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   529
		case EPodcastUpdateFeed:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   530
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   531
			HandleUpdateFeedL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   532
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   533
		case EPodcastCancelUpdateAllFeeds:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   534
			{
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   535
			if(iFeedUpdating)
2
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
				iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
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
			}break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   540
		default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   541
			CPodcastListView::HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   542
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   543
		}
26
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 25
diff changeset
   544
	
164
000f9fc147b2 Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 154
diff changeset
   545
	DP("CPodcastFeedView::HandleCommandL END");
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   546
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   547
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   548
void CPodcastFeedView::DisplayFeedInfoDialogL()
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   549
	{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   550
	const RFeedInfoArray* sortedItems = NULL;
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   551
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   552
	sortedItems = &iPodcastModel.FeedEngine().GetSortedFeeds();
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   553
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   554
	if(index >= 0 && index < sortedItems->Count())
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   555
		{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   556
		CFeedInfo *info = (*sortedItems)[index];
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   557
		HBufC* description = info->Description().AllocL();
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   558
		HBufC* title = info->Title().AllocL();
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   559
		CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title );
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   560
							
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   561
		note->PrepareLC( R_SHOW_INFO_NOTE ); // Adds to CleanupStack
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   562
		note->RunLD();
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   563
		}
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   564
	}
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   565
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   566
void CPodcastFeedView::HandleAddFeedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   567
	{
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   568
	TInt selection;
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   569
	CDesCArrayFlat* array = iCoeEnv->ReadDesC16ArrayResourceL(R_FEEDVIEW_ADD_URL_OR_SEARCH_ARRAY );
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   570
	CleanupStack::PushL( array );
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   571
	
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   572
	CAknListQueryDialog* dialog = new ( ELeave ) CAknListQueryDialog( &selection );
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   573
	CleanupStack::PushL( dialog );
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   574
	dialog->PrepareLC( R_FEEDVIEW_ADD_URL_OR_SEARCH );
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   575
	CleanupStack::Pop( dialog );
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   576
	
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   577
	dialog->SetItemTextArray( array );
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   578
	dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   579
	
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   580
	if ( dialog->RunLD() )
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   581
		{
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   582
		if (selection == 0)
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   583
			{
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   584
			// Enter URL selected
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   585
			HandleAddFeedUrlL();
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   586
			} 
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   587
		else
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   588
			{
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   589
			// Search selected
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   590
			HandleAddFeedSearchL();
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   591
			}	
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   592
		}
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   593
	CleanupStack::PopAndDestroy( array );		
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   594
	}
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   595
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   596
void CPodcastFeedView::ShowItem(TUint aUid)
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   597
	{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   598
	TInt listIndex = -1;
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   599
	for (TInt i=0;i<iItemIdArray.Count();i++)
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   600
		{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   601
		if (iItemIdArray[i] == aUid)
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   602
			{
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   603
			listIndex = i;
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   604
			}
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   605
		}
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   606
		
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   607
	if (listIndex != -1)
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   608
		iListContainer->Listbox()->ScrollToMakeItemVisible(listIndex);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   609
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   610
	}
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   611
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   612
void CPodcastFeedView::HandleAddFeedUrlL()
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   613
	{
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   614
	TBuf<KFeedUrlLength> url;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   615
	url.Copy(_L("http://"));
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   616
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   617
	CAknTextQueryDialog * dlg =CAknTextQueryDialog::NewL(url);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   618
	dlg->PrepareLC(R_PODCAST_ADD_FEED_DLG);
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   619
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   620
	HBufC* prompt = iEikonEnv->AllocReadResourceLC(R_PODCAST_ADDFEED_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   621
	dlg->SetPromptL(*prompt);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   622
	CleanupStack::PopAndDestroy(prompt);
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
	if(dlg->RunLD())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   625
		{
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   626
		PodcastUtils::FixProtocolsL(url);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   627
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   628
		CFeedInfo* newFeedInfo = CFeedInfo::NewL();
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   629
		CleanupStack::PushL(newFeedInfo);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   630
		newFeedInfo->SetUrlL(url);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   631
		newFeedInfo->SetTitleL(newFeedInfo->Url());
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   632
		
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   633
		TBool added = iPodcastModel.FeedEngine().AddFeedL(*newFeedInfo);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   634
		
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   635
		if (added)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   636
			{
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   637
			UpdateListboxItemsL();
154
fd105a5a9dad Fix for bug 3051 - search wait dialog doesn't close if search fails
teknolog
parents: 70
diff changeset
   638
			
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   639
			// ask if users wants to update it now
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   640
			TBuf<KMaxMessageLength> message;
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   641
			iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   642
			if(ShowQueryMessageL(message))
154
fd105a5a9dad Fix for bug 3051 - search wait dialog doesn't close if search fails
teknolog
parents: 70
diff changeset
   643
				{
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   644
				ShowItem(newFeedInfo->Uid());
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   645
				iPodcastModel.FeedEngine().UpdateFeedL(newFeedInfo->Uid());
154
fd105a5a9dad Fix for bug 3051 - search wait dialog doesn't close if search fails
teknolog
parents: 70
diff changeset
   646
				}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   647
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   648
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   649
			{
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   650
			TBuf<KMaxMessageLength> message;
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   651
			iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   652
			ShowErrorMessageL(message);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   653
			}		
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   654
		
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   655
		CleanupStack::PopAndDestroy(newFeedInfo);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   656
		}
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   657
	}
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   658
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   659
void CPodcastFeedView::HandleAddFeedSearchL()
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   660
	{
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   661
	TBuf<KFeedUrlLength> url;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   662
	
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   663
	CAknTextQueryDialog * dlg =CAknTextQueryDialog::NewL(url);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   664
	dlg->PrepareLC(R_PODCAST_ADD_FEED_DLG);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   665
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   666
	HBufC* prompt = iEikonEnv->AllocReadResourceLC(R_PODCAST_SEARCHFEED_PROMPT);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   667
	dlg->SetPromptL(*prompt);
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
   668
	dlg->SetPredictiveTextInputPermitted(ETrue);
206
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   669
	CleanupStack::PopAndDestroy(prompt);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   670
	
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   671
	if(dlg->RunLD())
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   672
		{		
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   673
		HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_SEARCHING);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   674
		ShowWaitDialogL(*waitText);
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   675
		CleanupStack::PopAndDestroy(waitText);	
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   676
	
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   677
		iOpmlState = EOpmlSearching;
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   678
		TRAPD(err, iPodcastModel.FeedEngine().SearchForFeedL(url));
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   679
		
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   680
		if (err != KErrNone)
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   681
			{
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   682
			delete iWaitDialog;
9c3ebab9d24f Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 177
diff changeset
   683
			iOpmlState = EOpmlIdle;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   684
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   685
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   686
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   687
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   688
void CPodcastFeedView::HandleEditFeedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   689
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   690
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   691
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   692
	if(index < iItemArray->MdcaCount() && index >= 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   693
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   694
		CFeedInfo *info = iPodcastModel.FeedEngine().GetSortedFeeds()[index];
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
		TBuf<KFeedTitleLength> title;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   697
		title.Copy(info->Title());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   698
		TBuf<KFeedUrlLength> url;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   699
		url.Copy(info->Url());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   700
		CAknMultiLineDataQueryDialog  *dlg = CAknMultiLineDataQueryDialog ::NewL(title, url);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   701
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   702
		if (dlg->ExecuteLD(R_PODCAST_EDIT_FEED_DLG)) 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   703
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   704
			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   705
			if(info->Url().Compare(url) != 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   706
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   707
				TBuf<KMaxMessageLength> dlgMessage;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   708
				iEikonEnv->ReadResourceL(dlgMessage, R_ADD_FEED_REPLACE);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   709
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   710
				// Ask the user if it is OK to remove all shows
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   711
				if ( ShowQueryMessageL(dlgMessage))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   712
					{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   713
					PodcastUtils::FixProtocolsL(url);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   714
					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   715
					//----- HACK ---- //
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   716
					CFeedInfo* temp = CFeedInfo::NewLC();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   717
					temp->SetUrlL(url);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   718
					TBool added = iPodcastModel.FeedEngine().AddFeedL(*temp);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   719
					if (added) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   720
						// The Feed URL did not exist
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   721
						// Remove the temp entry so that the correct entry could be changed
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   722
						iPodcastModel.FeedEngine().RemoveFeedL(temp->Uid());	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   723
						
12
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   724
						// we remove the existing feed
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   725
						iPodcastModel.FeedEngine().RemoveFeedL(info->Uid());	
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   726
						
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   727
						CFeedInfo* newFeed = CFeedInfo::NewLC();
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   728
						newFeed->SetUrlL(url);
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   729
						newFeed->SetTitleL(title);
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   730
						
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   731
						iPodcastModel.FeedEngine().AddFeedL(*newFeed);
47c8595ffc70 Fix for bug when editing feed URL
teknolog
parents: 11
diff changeset
   732
						CleanupStack::PopAndDestroy(newFeed);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   733
						UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   734
					} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   735
						// the feed existed. Object deleted in AddFeed.	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   736
						TBuf<KMaxMessageLength> dlgMessage;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   737
						iEikonEnv->ReadResourceL(dlgMessage, R_ADD_FEED_EXISTS);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   738
						ShowErrorMessageL(dlgMessage);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   739
					}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   740
					CleanupStack::PopAndDestroy(temp);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   741
				}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   742
			} else { // no url change, maybe title?
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   743
				// Update the title
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   744
				if (info->Title().Compare(title) != 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   745
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   746
					info->SetTitleL(title);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   747
					info->SetCustomTitle();	
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   748
					iPodcastModel.FeedEngine().UpdateFeedInfoL(info);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   749
					UpdateListboxItemsL();
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
		}
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
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   755
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   756
void CPodcastFeedView::HandleRemoveFeedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   757
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   758
	if(iListContainer->Listbox() != NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   759
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   760
		TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   761
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   762
		if(index < iItemArray->MdcaCount() && index >= 0)
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
			CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(iItemIdArray[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   765
			TBuf<KMaxMessageLength> templ;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   766
			TBuf<KMaxMessageLength> message;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   767
			iEikonEnv->ReadResourceL(templ, R_PODCAST_REMOVE_FEED_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   768
			message.Format(templ, &info->Title());					
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   769
			if(ShowQueryMessageL(message))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   770
				{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   771
				iPodcastModel.FeedEngine().RemoveFeedL(iItemIdArray[index]);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   772
				iItemArray->Delete(index);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   773
				iItemIdArray.Remove(index);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   774
				iListContainer->Listbox()->HandleItemRemovalL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   775
				iListContainer->Listbox()->DrawNow();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   776
				}					
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   777
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   778
		UpdateListboxItemsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   779
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   780
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   781
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   782
void CPodcastFeedView::HandleUpdateFeedL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   783
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   784
	TInt index = iListContainer->Listbox()->CurrentItemIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   785
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   786
	if(index < iItemArray->MdcaCount() && index >= 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   787
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   788
		CFeedInfo *info = iPodcastModel.FeedEngine().GetSortedFeeds()[index];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   789
		iPodcastModel.FeedEngine().UpdateFeedL(info->Uid());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   790
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   791
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   792
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   793
void CPodcastFeedView::HandleImportFeedsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   794
	{
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   795
	CAknMemorySelectionDialog* memDlg = 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   796
		CAknMemorySelectionDialog::NewL(ECFDDialogTypeNormal, ETrue);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   797
	CleanupStack::PushL(memDlg);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   798
	CAknMemorySelectionDialog::TMemory memory = 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   799
		CAknMemorySelectionDialog::EPhoneMemory;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   800
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   801
	if (memDlg->ExecuteL(memory))
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   802
		{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   803
		TFileName importName;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   804
	
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   805
		if (memory==CAknMemorySelectionDialog::EMemoryCard)
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   806
		{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   807
			importName = PathInfo:: MemoryCardRootPath();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   808
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   809
		else
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   810
		{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   811
			importName = PathInfo:: PhoneMemoryRootPath();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   812
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   813
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   814
		CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(ECFDDialogTypeNormal, R_PODCAST_IMPORT_PODCAST);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   815
		CleanupStack::PushL(dlg);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   816
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   817
		dlg->SetDefaultFolderL(importName);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   818
		
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   819
		if(dlg->ExecuteL(importName))
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   820
			{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   821
			if(importName.Length()>0)
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   822
				{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   823
				iPodcastModel.FeedEngine().ImportFeedsL(importName);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   824
				UpdateListboxItemsL();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   825
				}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   826
			}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   827
		CleanupStack::PopAndDestroy(dlg);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   828
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   829
	CleanupStack::PopAndDestroy(memDlg);								
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   830
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   831
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   832
void CPodcastFeedView::HandleExportFeedsL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   833
	{
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   834
	CAknMemorySelectionDialog* memDlg = 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   835
		CAknMemorySelectionDialog::NewL(ECFDDialogTypeSave, ETrue);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   836
	CleanupStack::PushL(memDlg);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   837
	CAknMemorySelectionDialog::TMemory memory = 
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   838
		CAknMemorySelectionDialog::EPhoneMemory;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   839
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   840
	if (memDlg->ExecuteL(memory))
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   841
		{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   842
		TFileName pathName;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   843
		
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   844
		if (memory==CAknMemorySelectionDialog::EMemoryCard)
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   845
		{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   846
			pathName = PathInfo::MemoryCardRootPath();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   847
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   848
		else
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   849
		{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   850
			pathName = PathInfo::PhoneMemoryRootPath();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   851
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   852
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   853
		CAknFileSelectionDialog* dlg = CAknFileSelectionDialog::NewL(ECFDDialogTypeSave, R_PODCAST_EXPORT_FEEDS);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   854
		CleanupStack::PushL(dlg);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   855
								
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   856
		if(dlg->ExecuteL(pathName))
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   857
			{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   858
			CAknFileNamePromptDialog *fileDlg = CAknFileNamePromptDialog::NewL(R_PODCAST_FILENAME_PROMPT_DIALOG);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   859
			CleanupStack::PushL(fileDlg);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   860
			fileDlg->SetPathL(pathName);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   861
			TFileName fileName;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   862
			if (fileDlg->ExecuteL(fileName) && fileName.Length() > 0)
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   863
				{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   864
				pathName.Append(fileName);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   865
				TFileName temp;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   866
				iPodcastModel.FeedEngine().ExportFeedsL(temp);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   867
				RFs fs;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   868
				fs.Connect();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   869
				BaflUtils::CopyFile(fs, temp, pathName);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   870
				BaflUtils::DeleteFile(fs,temp);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   871
				fs.Close();
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   872
				}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   873
			CleanupStack::PopAndDestroy(fileDlg);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   874
			}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   875
		CleanupStack::PopAndDestroy(dlg);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   876
	}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
   877
	CleanupStack::PopAndDestroy(memDlg);									
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   878
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   879
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   880
void CPodcastFeedView::CheckResumeDownloadL()
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   881
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   882
	// if there are shows queued for downloading, ask if we should resume now
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   883
	RShowInfoArray showsDownloading;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   884
	iPodcastModel.ShowEngine().GetShowsDownloadingL(showsDownloading);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   885
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   886
	if (showsDownloading.Count() > 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   887
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   888
		TBuf<KMaxMessageLength> msg;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   889
		iEikonEnv->ReadResourceL(msg, R_PODCAST_ENABLE_DOWNLOADS_PROMPT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   890
	
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   891
		if (ShowQueryMessageL(msg))
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   892
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   893
			// need to suspend downloads before ResumeDownloadL will work :)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   894
			iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   895
			// resume downloading if user says yes
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   896
			iPodcastModel.ShowEngine().ResumeDownloadsL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   897
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   898
		else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   899
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   900
			// we disable downloading if user says no
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   901
			iPodcastModel.SettingsEngine().SetDownloadSuspended(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
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   905
	// if no shows in queue, we keep whichever state suspend is in
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   906
	showsDownloading.ResetAndDestroy();
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
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   909
void CPodcastFeedView::CheckConfirmExit()
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   910
	{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   911
	DP("CPodcastFeedView::CheckConfirmExit");
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   912
	RShowInfoArray showsDownloading;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   913
	iPodcastModel.ShowEngine().GetShowsDownloadingL(showsDownloading);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   914
	TUint count = showsDownloading.Count();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   915
	showsDownloading.ResetAndDestroy();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   916
	showsDownloading.Close();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   917
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   918
	if (count > 0 && !iPodcastModel.SettingsEngine().DownloadSuspended())
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   919
		{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   920
		TBuf<256> msg;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   921
		iEikonEnv->ReadResourceL(msg, R_EXIT_SHOWS_DOWNLOADING);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   922
		
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   923
		if (!ShowQueryMessageL(msg))
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   924
			{
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   925
			return;
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   926
			}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   927
		}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   928
	
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   929
	AppUi()->Exit();
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   930
	}
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
   931
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   932
void CPodcastFeedView::OpmlParsingComplete(TInt aError, TUint aNumFeedsImported)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   933
	{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   934
	TRAP_IGNORE(OpmlParsingCompleteL(aError, aNumFeedsImported));
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   935
	}
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   936
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   937
void CPodcastFeedView::OpmlParsingCompleteL(TInt aError, TUint aNumFeedsImported)
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
   938
	{
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   939
	DP("CPodcastFeedView::OpmlParsingComplete BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   940
	
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   941
	switch (aError)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   942
		{
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   943
		case KErrCouldNotConnect:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   944
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   945
			TBuf<KMaxMessageLength> message;
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   946
			iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
154
fd105a5a9dad Fix for bug 3051 - search wait dialog doesn't close if search fails
teknolog
parents: 70
diff changeset
   947
			delete iWaitDialog;
fd105a5a9dad Fix for bug 3051 - search wait dialog doesn't close if search fails
teknolog
parents: 70
diff changeset
   948
			iOpmlState = EOpmlIdle;
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   949
			ShowErrorMessageL(message);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   950
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   951
			break;
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   952
		case KErrNone: 
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   953
		default:			// we don't do more error handling here, just show 0 imported feeds
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   954
		switch (iOpmlState)
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   955
			{
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   956
			case EOpmlIdle:
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   957
				break;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   958
			case EOpmlImporting:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   959
				{
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   960
				UpdateListboxItemsL();
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   961
				delete iWaitDialog;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   962
				iOpmlState = EOpmlIdle;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   963
					
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   964
				TBuf<KMaxMessageLength> message;
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   965
				TBuf<KMaxMessageLength> templ;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   966
				iEikonEnv->ReadResourceL(templ, R_IMPORT_FEED_SUCCESS);
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   967
				message.Format(templ, aNumFeedsImported);
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   968
				
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   969
				if(ShowQueryMessageL(message))
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   970
					{
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   971
					HandleCommandL(EPodcastUpdateAllFeeds);
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   972
					}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   973
				}
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   974
				break;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   975
			case EOpmlSearching:
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   976
				delete iWaitDialog;
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   977
				iWaitDialog = NULL;
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   978
				if (iPodcastModel.FeedEngine().GetSearchResults().Count() == 0)
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   979
					{
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   980
					TBuf<KMaxMessageLength> message;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   981
					iEikonEnv->ReadResourceL(message, R_SEARCH_NORESULTS);
35
66c5303f3610 A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents: 26
diff changeset
   982
					ShowErrorMessageL(message);
7
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   983
					}
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   984
				else
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   985
					{
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   986
					AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID,  TUid::Uid(0), KNullDesC8());
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   987
					}
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   988
				iOpmlState = EOpmlIdle;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   989
				break;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   990
			default:
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   991
				break;
a7a43293ae56 Added error handling for searching
teknolog
parents: 5
diff changeset
   992
			}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   993
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   994
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   995
	DP("CPodcastFeedView::OpmlParsingComplete END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   996
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   997
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   998
void CPodcastFeedView::DialogDismissedL(TInt /*aButtonId*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   999
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1000
	iPodcastModel.FeedEngine().CancelUpdateAllFeeds();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
  1001
	}
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 2
diff changeset
  1002
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 2
diff changeset
  1003
void CPodcastFeedView::GetFeedErrorText(TDes &aErrorMessage, TInt aErrorCode)
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 2
diff changeset
  1004
	{
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 59
diff changeset
  1005
	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
5
ba42cd6670b8 Cleanup of command handling code
teknolog
parents: 2
diff changeset
  1006
	}
8
aab3aa4acdd6 Checked all TRAP_IGNORE
teknolog
parents: 7
diff changeset
  1007
45
56d4e0784e5d Nicer way to handle back from queue view to feed/show view
teknolog
parents: 36
diff changeset
  1008
TBool CPodcastFeedView::ViewingShows()
56d4e0784e5d Nicer way to handle back from queue view to feed/show view
teknolog
parents: 36
diff changeset
  1009
	{
56d4e0784e5d Nicer way to handle back from queue view to feed/show view
teknolog
parents: 36
diff changeset
  1010
	return iViewingShows;
56d4e0784e5d Nicer way to handle back from queue view to feed/show view
teknolog
parents: 36
diff changeset
  1011
	}
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1012
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1013
void CPodcastFeedView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1014
	{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1015
	if(aResourceId == R_PODCAST_FEEDVIEW_MENU)
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1016
		{
343
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
  1017
		aMenuPane->SetItemDimmed(EPodcastUpdateAllFeeds, iFeedUpdating);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
  1018
		aMenuPane->SetItemDimmed(EPodcastCancelUpdateAllFeeds, !iFeedUpdating);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
  1019
		aMenuPane->SetItemDimmed(EPodcastSettings, iFeedUpdating);
9c56bf585696 Catching up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 206
diff changeset
  1020
		aMenuPane->SetItemDimmed(EPodcastFeedFeedMenu, iFeedUpdating);
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1021
//		aMenuPane->SetItemDimmed(EPodcastImportExportFeeds, iUpdatingRunning);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1022
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1023
	}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1024
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1025
TKeyResponse CPodcastFeedView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1026
	{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1027
	if (aType == EEventKey)
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1028
		{
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1029
			switch (aKeyEvent.iCode) {
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1030
			case EKeyBackspace:
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1031
			case EKeyDelete:
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1032
				HandleCommandL(EPodcastDeleteFeedHardware);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1033
				break;
390
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
  1034
			case 106:
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
  1035
			case '#':
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
  1036
				HandleCommandL(EPodcastShowInfo);
d7abecc9d189 Catch up with 5th ed; New SIS version 1.10 (1)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 343
diff changeset
  1037
				break;
177
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1038
			default:
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1039
				break;
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1040
			}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1041
		}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1042
		return CPodcastListView::OfferKeyEventL(aKeyEvent, aType);
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1043
	}
269e3f3e544a Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents: 176
diff changeset
  1044