--- a/application/inc/PodcastFeedView.h Sat Mar 06 10:22:09 2010 +0000
+++ b/application/inc/PodcastFeedView.h Sat Mar 06 10:28:29 2010 +0000
@@ -95,7 +95,7 @@
void DialogDismissedL(TInt aButtonId);
// from MImageHandlerCallback
- void ImageOperationCompleteL(TInt aError);
+ void ImageOperationCompleteL(TInt aError, TUint aHandle);
void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation);
--- a/application/inc/PodcastShowsView.h Sat Mar 06 10:22:09 2010 +0000
+++ b/application/inc/PodcastShowsView.h Sat Mar 06 10:28:29 2010 +0000
@@ -109,7 +109,7 @@
* @param aError Error code given by the CImageHandler or 0 (zero) if the
* image was loaded successfully.
*/
- virtual void ImageOperationCompleteL(TInt aError);
+ virtual void ImageOperationCompleteL(TInt aError, TUint aHandle);
void HandleSetShowPlayedL(TBool aPlayed);
void HandleDeleteShowL();
void UpdateViewTitleL();
Binary file application/sis/podcatcher_udeb.sis has changed
Binary file application/sis/podcatcher_udeb_signed.sis has changed
Binary file application/sis/podcatcher_urel.sis has changed
Binary file application/sis/podcatcher_urel_signed.sis has changed
--- a/application/src/PodcastFeedView.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/application/src/PodcastFeedView.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -189,6 +189,7 @@
}
else
{
+ UpdateListboxItemsL();
UpdateToolbar();
if (iFirstActivateAfterLaunch)
@@ -371,6 +372,11 @@
aFeedInfo.LastUpdated().FormatL(updatedDate, KDateFormatShort());
}
}
+
+ if(aFeedInfo.LastError() != KErrNone)
+ {
+ GetFeedErrorText(unplayedShows, aFeedInfo.LastError());
+ }
}
CArrayPtr<CGulIcon>* icons = iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->IconArray();
@@ -395,16 +401,11 @@
if(BaflUtils::FileExists(iPodcastModel.FsSession(), aFeedInfo.ImageFileName()))
{
// If this fails, no reason to worry
- TRAP_IGNORE(iPodcastModel.ImageHandler().LoadFileAndScaleL(aFeedInfo.FeedIcon(), aFeedInfo.ImageFileName(), TSize(64,56), *this));
+ TRAP_IGNORE(iPodcastModel.ImageHandler().LoadFileAndScaleL(aFeedInfo.FeedIcon(), aFeedInfo.ImageFileName(), TSize(64,56), *this, aFeedInfo.Uid()));
}
}
}
- if(aFeedInfo.LastError() != KErrNone)
- {
- GetFeedErrorText(unplayedShows, aFeedInfo.LastError());
- }
-
if (unplayedShows.Length() > 0) {
unplayedShows.Insert(0,_L(", "));
}
@@ -412,10 +413,10 @@
iListboxFormatbuffer.Format(KFeedFormat(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
}
-void CPodcastFeedView::ImageOperationCompleteL(TInt aError)
+void CPodcastFeedView::ImageOperationCompleteL(TInt aError, TUint aHandle)
{
if (aError == KErrNone) {
- UpdateListboxItemsL();
+ UpdateFeedInfoStatusL(aHandle, EFalse);
}
}
--- a/application/src/PodcastListView.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/application/src/PodcastListView.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -261,8 +261,6 @@
AppUi()->AddToStackL(*this, iListContainer);
iListContainer->MakeVisible(ETrue);
- UpdateListboxItemsL();
- iListContainer->DrawNow();
}
DP("CPodcastListView::DoActivateL() END");
--- a/application/src/PodcastQueueView.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/application/src/PodcastQueueView.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -234,23 +234,27 @@
void CPodcastQueueView::ShowDownloadFinishedL(TUint /*aShowUid*/, TInt aError)
{
- iProgressAdded = EFalse;
-
- iPodcastModel.GetShowsDownloadingL();
- UpdateListboxItemsL();
- UpdateToolbar();
-
- switch(aError)
+ if (iListContainer->IsVisible())
{
- case KErrCouldNotConnect:
+
+ iProgressAdded = EFalse;
+
+ iPodcastModel.GetShowsDownloadingL();
+ UpdateListboxItemsL();
+ UpdateToolbar();
+
+ switch(aError)
{
- TBuf<KMaxMessageLength> message;
- iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
- ShowErrorMessageL(message);
+ case KErrCouldNotConnect:
+ {
+ TBuf<KMaxMessageLength> message;
+ iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR);
+ ShowErrorMessageL(message);
+ }
+ break;
+ default: // Do nothing
+ break;
}
- break;
- default: // Do nothing
- break;
}
}
@@ -301,29 +305,32 @@
void CPodcastQueueView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
{
TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
- TUint showDownloadingUid = iPodcastModel.ShowEngine().ShowDownloading() ? iPodcastModel.ShowEngine().ShowDownloading()->Uid() : 0;
-
- if (showDownloadingUid == aShowInfo->Uid())
- {
- aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;
- }
- else
+
+ switch (aShowInfo->DownloadState())
{
- switch (aShowInfo->DownloadState())
- {
- case EQueued:
- aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
- break;
- case EDownloading:
- aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;
- break;
- case EFailedDownload:
- aIconIndex = EFailedShowIcon;
- break;
- default:
- DP("Wrong download state for queue view!");
- break;
+ case EDownloaded:
+ if (aShowInfo->PlayState() == ENeverPlayed) {
+ aIconIndex = EDownloadedNewShowIcon;
+ } else {
+ aIconIndex = EDownloadedShowIcon;
}
+ break;
+ case ENotDownloaded:
+ if (aShowInfo->PlayState() == ENeverPlayed) {
+ aIconIndex = ENewShowIcon;
+ } else {
+ aIconIndex = EShowIcon;
+ }
+ break;
+ case EQueued:
+ aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
+ break;
+ case EDownloading:
+ aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;
+ break;
+ case EFailedDownload:
+ aIconIndex = EFailedShowIcon;
+ break;
}
}
--- a/application/src/PodcastShowsView.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/application/src/PodcastShowsView.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -245,9 +245,23 @@
}
}
-void CPodcastShowsView::ShowDownloadFinishedL(TUint /*aShowUid*/, TInt aError)
+void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
{
iProgressAdded = EFalse;
+ CShowInfo *info = NULL;
+ RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
+
+ for (TInt i=0;i<fItems.Count();i++)
+ {
+ if (fItems[i]->Uid() == aShowUid)
+ {
+ info = fItems[i];
+ }
+ }
+
+ if (info == NULL) {
+ return;
+ }
switch(aError)
{
@@ -336,40 +350,32 @@
void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
{
TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
- TUint showDownloadingUid = iPodcastModel.ShowEngine().ShowDownloading() ? iPodcastModel.ShowEngine().ShowDownloading()->Uid() : 0;
-
- if (showDownloadingUid == aShowInfo->Uid())
- {
- aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;
- }
- else
+
+ switch (aShowInfo->DownloadState())
{
- switch (aShowInfo->DownloadState())
- {
- case EDownloaded:
- if (aShowInfo->PlayState() == ENeverPlayed) {
- aIconIndex = EDownloadedNewShowIcon;
- } else {
- aIconIndex = EDownloadedShowIcon;
- }
- break;
- case ENotDownloaded:
- if (aShowInfo->PlayState() == ENeverPlayed) {
- aIconIndex = ENewShowIcon;
- } else {
- aIconIndex = EShowIcon;
- }
- break;
- case EQueued:
- aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
- break;
- case EDownloading:
- aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;
- break;
- case EFailedDownload:
- aIconIndex = EFailedShowIcon;
- break;
+ case EDownloaded:
+ if (aShowInfo->PlayState() == ENeverPlayed) {
+ aIconIndex = EDownloadedNewShowIcon;
+ } else {
+ aIconIndex = EDownloadedShowIcon;
}
+ break;
+ case ENotDownloaded:
+ if (aShowInfo->PlayState() == ENeverPlayed) {
+ aIconIndex = ENewShowIcon;
+ } else {
+ aIconIndex = EShowIcon;
+ }
+ break;
+ case EQueued:
+ aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
+ break;
+ case EDownloading:
+ aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;
+ break;
+ case EFailedDownload:
+ aIconIndex = EFailedShowIcon;
+ break;
}
}
@@ -509,10 +515,10 @@
if (allUidsMatch && len > 0)
{
for (TInt loop = 0; loop< len; loop++)
- {
+ {
UpdateShowItemDataL(fItems[loop], loop);
- //iListContainer->Listbox()->DrawItem(loop);
}
+ iListContainer->Listbox()->DrawNow();
}
else
{
@@ -570,6 +576,7 @@
case EPodcastDownloadShow:
{
TInt index = iListContainer->Listbox()->CurrentItemIndex();
+
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
{
iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
@@ -619,7 +626,7 @@
}
}
-void CPodcastShowsView::ImageOperationCompleteL(TInt aError)
+void CPodcastShowsView::ImageOperationCompleteL(TInt aError, TUint /*aHandle*/)
{
iLastImageHandlerError = aError;
if(iSetTitlebarImage)
@@ -813,6 +820,7 @@
void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
{
((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
+ UpdateListboxItemsL();
}
void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
--- a/engine/inc/FeedEngine.h Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/inc/FeedEngine.h Sat Mar 06 10:28:29 2010 +0000
@@ -162,6 +162,7 @@
COpmlParser* iOpmlParser;
RFeedInfoArray iSearchResults;
TBool iAutoUpdatedInitiator;
+ TBool iCancelRequested;
};
#endif /*FEEDENGINE_H_*/
--- a/engine/inc/FeedInfo.h Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/inc/FeedInfo.h Sat Mar 06 10:28:29 2010 +0000
@@ -76,7 +76,7 @@
private:
CFeedInfo();
void ConstructL();
- void ImageOperationCompleteL(TInt aError);
+ void ImageOperationCompleteL(TInt aError, TUint aHandle);
private:
HBufC* iUrl;
HBufC* iTitle;
--- a/engine/inc/ImageHandler.h Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/inc/ImageHandler.h Sat Mar 06 10:28:29 2010 +0000
@@ -43,7 +43,7 @@
* @param aError Error code given by the CImageHandler or 0 (zero) if the
* image was loaded successfully.
*/
- virtual void ImageOperationCompleteL(TInt aError) = 0;
+ virtual void ImageOperationCompleteL(TInt aError, TUint aHandle) = 0;
};
// ============================================================================
@@ -54,6 +54,7 @@
TSize iScaledSize;
MImageHandlerCallback* iCallBack;
TFileName iFileName;
+ TUint iHandle;
};
/**
* CImageHandler
@@ -104,6 +105,7 @@
const TFileName& aFileName,
const TSize &aSize,
MImageHandlerCallback& aCallback,
+ TUint aHandle,
TInt aSelectedFrame = 0);
/**
@@ -176,7 +178,10 @@
/** target size for scaled image */
TSize iSize;
- RArray<TImageStruct> iCallbackQue;
+ RArray<TImageStruct> iCallbackQue;
+
+ /* Handle passed back to caller */
+ TUint iHandle;
};
#endif
--- a/engine/inc/PodcastModel.h Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/inc/PodcastModel.h Sat Mar 06 10:28:29 2010 +0000
@@ -102,7 +102,7 @@
CPodcastModel();
void ConstructL();
// From ImageHandler
- void ImageOperationCompleteL(TInt aError);
+ void ImageOperationCompleteL(TInt aError, TUint aHandle);
private:
CShowInfo* iPlayingPodcast;
--- a/engine/src/FeedEngine.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/src/FeedEngine.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -158,6 +158,7 @@
{
if(iClientState != EIdle)
{
+ iCancelRequested = ETrue;
iFeedsUpdating.Reset();
iFeedClient->Stop();
}
@@ -199,12 +200,16 @@
DP("FeedEngine::UpdateFeedL BEGIN");
iActiveFeed = GetFeedInfoByUid(aFeedUid);
iCatchupCounter = 0;
+ iCancelRequested = EFalse;
if (iActiveFeed->LastUpdated() == 0)
{
iCatchupMode = ETrue;
}
-
+
+ iActiveFeed->SetLastError(KErrNone);
+ DBUpdateFeedL(*iActiveFeed);
+
iUpdatingFeedFileName.Copy (iPodcastModel.SettingsEngine().PrivatePath ());
_LIT(KFileNameFormat, "%lu.xml");
iUpdatingFeedFileName.AppendFormat(KFileNameFormat, aFeedUid);
@@ -533,49 +538,52 @@
break;
default:
{
- iActiveFeed->SetLastError(aError);
- TTime time;
- time.HomeTime();
- iActiveFeed->SetLastUpdated(time);
-
- if( aError == KErrNone)
- {
- TRAPD(parserErr, iParser->ParseFeedL(iUpdatingFeedFileName, iActiveFeed, iPodcastModel.SettingsEngine().MaxListItems()));
-
- if(parserErr)
- {
- // we do not need to any special action on this error.
- iActiveFeed->SetLastError(parserErr);
- DP1("CFeedEngine::Complete()\t Failed to parse feed. Leave with error code=%d", parserErr);
- }
- else
- {
- iPodcastModel.ShowEngine().DeleteOldShowsByFeed(iActiveFeed->Uid());
- }
-
- // delete the downloaded XML file as it is no longer needed
- BaflUtils::DeleteFile(iPodcastModel.FsSession(),iUpdatingFeedFileName);
-
- // if the feed has specified a image url. download it if we dont already have it
- if((iActiveFeed->ImageUrl().Length() > 0))
- {
- if ( (iActiveFeed->ImageFileName().Length() == 0) ||
- (iActiveFeed->ImageFileName().Length() > 0 &&
- !BaflUtils::FileExists(iPodcastModel.FsSession(),
- iActiveFeed->ImageFileName()) )
- )
+ if (!iCancelRequested) {
+ iActiveFeed->SetLastError(aError);
+ TTime time;
+ time.HomeTime();
+ iActiveFeed->SetLastUpdated(time);
+
+ if( aError == KErrNone)
+ {
+ TRAPD(parserErr, iParser->ParseFeedL(iUpdatingFeedFileName, iActiveFeed, iPodcastModel.SettingsEngine().MaxListItems()));
+
+ if(parserErr)
+ {
+ // we do not need to any special action on this error.
+ iActiveFeed->SetLastError(parserErr);
+ DP1("CFeedEngine::Complete()\t Failed to parse feed. Leave with error code=%d", parserErr);
+ }
+ else
{
- TRAPD(error, GetFeedImageL(iActiveFeed));
- if (error)
+ iPodcastModel.ShowEngine().DeleteOldShowsByFeed(iActiveFeed->Uid());
+ }
+
+ // delete the downloaded XML file as it is no longer needed
+ BaflUtils::DeleteFile(iPodcastModel.FsSession(),iUpdatingFeedFileName);
+
+ // if the feed has specified a image url. download it if we dont already have it
+ if((iActiveFeed->ImageUrl().Length() > 0))
+ {
+ if ( (iActiveFeed->ImageFileName().Length() == 0) ||
+ (iActiveFeed->ImageFileName().Length() > 0 &&
+ !BaflUtils::FileExists(iPodcastModel.FsSession(),
+ iActiveFeed->ImageFileName()) )
+ )
{
- // we have failed in a very early stage to fetch the image.
- // continue with next Feed update
- iActiveFeed->SetLastError(parserErr);
- iClientState = EIdle;
- }
- }
+ TRAPD(error, GetFeedImageL(iActiveFeed));
+ if (error)
+ {
+ // we have failed in a very early stage to fetch the image.
+ // continue with next Feed update
+ iActiveFeed->SetLastError(parserErr);
+ iClientState = EIdle;
+ }
+ }
+ }
}
}
+ iCancelRequested = EFalse;
}break;
}
--- a/engine/src/FeedInfo.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/src/FeedInfo.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -229,7 +229,7 @@
iFeedIcon->Duplicate(aBitmapToClone->Handle());
}
-void CFeedInfo::ImageOperationCompleteL(TInt /*aError*/)
+void CFeedInfo::ImageOperationCompleteL(TInt /*aError*/, TUint /*aHandle*/)
{
}
--- a/engine/src/ImageHandler.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/src/ImageHandler.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -17,6 +17,7 @@
*/
#include "ImageHandler.h"
+#include "debug.h"
// =============================================================================
// CImageHandler, a utility class for loading images.
@@ -121,8 +122,11 @@
const TFileName& aFileName,
const TSize &aSize,
MImageHandlerCallback& aCallback,
+ TUint aHandle,
TInt aSelectedFrame)
- {
+ {
+ DP1("CImageHandler::LoadFileAndScaleL, iCallbackQueue.Count()=%d", iCallbackQue.Count());
+
if(!IsActive())
{
__ASSERT_ALWAYS(!IsActive(),User::Invariant());
@@ -130,16 +134,26 @@
iScaledBitmap = aScaledBitmap;
iScaledBitmap->Reset();
iScaledBitmap->Create(aSize, EColor16M);
- iCallback = &aCallback;
+ iCallback = &aCallback;
+ iHandle = aHandle;
LoadFileL(aFileName, aSelectedFrame);
}
else
{
+ for (int i=0;i<iCallbackQue.Count();i++)
+ {
+ if (iCallbackQue[i].iFileName.Compare(aFileName) == 0)
+ {
+ User::Leave(KErrAlreadyExists);
+ }
+ }
+
TImageStruct imageStruct;
imageStruct.iCallBack = &aCallback;
imageStruct.iScaledImage = aScaledBitmap;
imageStruct.iScaledSize = aSize;
imageStruct.iFileName = aFileName;
+ imageStruct.iHandle = aHandle;
iCallbackQue.Append(imageStruct);
}
}
@@ -179,6 +193,7 @@
//
void CImageHandler::RunL()
{
+ DP1("CImageHandler::RunL(), iCallbackQueue.Count()=%d", iCallbackQue.Count());
if ((! iStatus.Int()) && (iSize.iWidth != 0) && (iSize.iHeight != 0))
{
ScaleL();
@@ -187,7 +202,7 @@
else
{
// Invoke callback.
- iCallback->ImageOperationCompleteL(iStatus.Int());
+ iCallback->ImageOperationCompleteL(iStatus.Int(), iHandle);
if(iCallbackQue.Count())
{
TInt loaderror = KErrNotFound;
@@ -195,7 +210,7 @@
{
TImageStruct imageStruct= iCallbackQue[0];
iCallbackQue.Remove(0);
- TRAP(loaderror, LoadFileAndScaleL(imageStruct.iScaledImage, imageStruct.iFileName, imageStruct.iScaledSize, *imageStruct.iCallBack));
+ TRAP(loaderror, LoadFileAndScaleL(imageStruct.iScaledImage, imageStruct.iFileName, imageStruct.iScaledSize, *imageStruct.iCallBack, imageStruct.iHandle));
}
}
}
--- a/engine/src/PodcastModel.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/src/PodcastModel.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -435,7 +435,7 @@
}
-void CPodcastModel::ImageOperationCompleteL(TInt /*aError*/)
+void CPodcastModel::ImageOperationCompleteL(TInt /*aError*/, TUint /*aHandle*/)
{
}
--- a/engine/src/ShowEngine.cpp Sat Mar 06 10:22:09 2010 +0000
+++ b/engine/src/ShowEngine.cpp Sat Mar 06 10:28:29 2010 +0000
@@ -1171,19 +1171,20 @@
const TInt count = DBGetDownloadsCount();
DP("CShowEngine::DownloadNextShow\tTrying to start new download");DP1("CShowEngine::DownloadNextShow\tShows in download queue %d", count);
- // Inform the observers
- NotifyDownloadQueueUpdatedL();
-
if (count > 0)
{
if (iPodcastModel.SettingsEngine().DownloadSuspended())
{
DP("CShowEngine::DownloadNextShow\tDownload process is suspended, ABORTING");
+ // Inform the observers
+ NotifyDownloadQueueUpdatedL();
return;
}
else if (iShowClient->IsActive())
{
DP("CShowEngine::DownloadNextShow\tDownload process is already active.");
+ // Inform the observers
+ NotifyDownloadQueueUpdatedL();
return;
}
else
@@ -1201,6 +1202,10 @@
info->SetLastError(KErrNone);
DBUpdateShowL(*info);
iShowDownloading = info;
+ // Inform the observers
+ // important to do this after we change download state
+ NotifyDownloadQueueUpdatedL();
+
TRAPD(error,getOk = GetShowL(info));
if (error != KErrNone || !getOk)
{
@@ -1224,6 +1229,8 @@
}
else
{
+ // Inform the observers
+ NotifyDownloadQueueUpdatedL();
iShowDownloading = NULL;DP("CShowEngine::DownloadNextShow\tNothing to download");
}
DP("CShowEngine::DownloadNextShowL END");