# HG changeset patch # User teknolog # Date 1267117924 0 # Node ID a7a43293ae564bdfedd74586b27bc2c884b1814e # Parent e211a78d3037dbaf480a93e5cfaf0727c5528a5a Added error handling for searching diff -r e211a78d3037 -r a7a43293ae56 application/inc/PodcastFeedView.h --- a/application/inc/PodcastFeedView.h Thu Feb 25 16:47:16 2010 +0000 +++ b/application/inc/PodcastFeedView.h Thu Feb 25 17:12:04 2010 +0000 @@ -78,7 +78,7 @@ void FeedDownloadStartedL(TFeedState aState,TUint aFeedUid); void FeedDownloadFinishedL(TFeedState aState,TUint aFeeidUid, TInt aError); void FeedUpdateAllCompleteL(TFeedState aState); - void OpmlParsingComplete(TUint aNumFeedsImported); + void OpmlParsingComplete(TInt aError, TUint aNumFeedsImported); /** * Command handling function intended for overriding by sub classes. diff -r e211a78d3037 -r a7a43293ae56 application/inc/PodcastQueueView.h --- a/application/inc/PodcastQueueView.h Thu Feb 25 16:47:16 2010 +0000 +++ b/application/inc/PodcastQueueView.h Thu Feb 25 17:12:04 2010 +0000 @@ -78,7 +78,7 @@ void FeedDownloadStartedL(TFeedState aState,TUint aFeedUid); void FeedDownloadFinishedL(TFeedState aState,TUint aFeedUid, TInt aError); void FeedUpdateAllCompleteL(TFeedState aState); - void OpmlParsingComplete(TUint /*aNumFeedsImported*/) {} + void OpmlParsingComplete(TInt /*aError*/, TUint /*aNumFeedsImported*/) {} /** * Command handling function intended for overriding by sub classes. diff -r e211a78d3037 -r a7a43293ae56 application/inc/PodcastSearchView.h --- a/application/inc/PodcastSearchView.h Thu Feb 25 16:47:16 2010 +0000 +++ b/application/inc/PodcastSearchView.h Thu Feb 25 17:12:04 2010 +0000 @@ -69,7 +69,7 @@ void FeedDownloadStartedL(TFeedState /*aState*/,TUint /*aFeedUid*/) {} void FeedDownloadFinishedL(TFeedState /*aState*/,TUint /*aFeedUid*/, TInt /*aError*/) {} void FeedUpdateAllCompleteL(TFeedState /*aState*/) {} - void OpmlParsingComplete(TUint aNumFeedsImported); + void OpmlParsingComplete(TInt aError, TUint aNumFeedsImported); /** * Command handling function intended for overriding by sub classes. diff -r e211a78d3037 -r a7a43293ae56 application/inc/PodcastShowsView.h --- a/application/inc/PodcastShowsView.h Thu Feb 25 16:47:16 2010 +0000 +++ b/application/inc/PodcastShowsView.h Thu Feb 25 17:12:04 2010 +0000 @@ -81,7 +81,7 @@ void FeedDownloadStartedL(TFeedState aState,TUint aFeedUid); void FeedDownloadFinishedL(TFeedState aState,TUint aFeedUid, TInt aError); void FeedUpdateAllCompleteL(TFeedState aState); - void OpmlParsingComplete(TUint /*aNumFeedsImported*/) {} + void OpmlParsingComplete(TInt /*aError*/, TUint /*aNumFeedsImported*/) {} /** * Command handling function intended for overriding by sub classes. diff -r e211a78d3037 -r a7a43293ae56 application/src/PodcastFeedView.cpp --- a/application/src/PodcastFeedView.cpp Thu Feb 25 16:47:16 2010 +0000 +++ b/application/src/PodcastFeedView.cpp Thu Feb 25 17:12:04 2010 +0000 @@ -872,46 +872,59 @@ showsDownloading.ResetAndDestroy(); } -void CPodcastFeedView::OpmlParsingComplete(TUint aNumFeedsImported) +void CPodcastFeedView::OpmlParsingComplete(TInt aError, TUint aNumFeedsImported) { DP("CPodcastFeedView::OpmlParsingComplete BEGIN"); - switch (iOpmlState) + switch (aError) { - case EOpmlIdle: - break; - case EOpmlImporting: + case KErrCouldNotConnect: { - UpdateListboxItemsL(); - delete iWaitDialog; - iOpmlState = EOpmlIdle; - TBuf message; - TBuf templ; - iEikonEnv->ReadResourceL(templ, R_IMPORT_FEED_SUCCESS); - message.Format(templ, aNumFeedsImported); - - if(ShowQueryMessage(message)) - { - HandleCommandL(EPodcastUpdateAllFeeds); - } + iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR); + ShowErrorMessage(message); } break; - case EOpmlSearching: - delete iWaitDialog; - if (iPodcastModel.FeedEngine().GetSearchResults().Count() == 0) + case KErrNone: + default: // we don't do more error handling here, just show 0 imported feeds + switch (iOpmlState) + { + case EOpmlIdle: + break; + case EOpmlImporting: { + UpdateListboxItemsL(); + delete iWaitDialog; + iOpmlState = EOpmlIdle; + TBuf message; - iEikonEnv->ReadResourceL(message, R_SEARCH_NORESULTS); - ShowErrorMessage(message); + TBuf templ; + iEikonEnv->ReadResourceL(templ, R_IMPORT_FEED_SUCCESS); + message.Format(templ, aNumFeedsImported); + + if(ShowQueryMessage(message)) + { + HandleCommandL(EPodcastUpdateAllFeeds); + } } - else - { - AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID, TUid::Uid(0), KNullDesC8()); - } - iOpmlState = EOpmlIdle; - default: - break; + break; + case EOpmlSearching: + delete iWaitDialog; + if (iPodcastModel.FeedEngine().GetSearchResults().Count() == 0) + { + TBuf message; + iEikonEnv->ReadResourceL(message, R_SEARCH_NORESULTS); + ShowErrorMessage(message); + } + else + { + AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID, TUid::Uid(0), KNullDesC8()); + } + iOpmlState = EOpmlIdle; + break; + default: + break; + } } DP("CPodcastFeedView::OpmlParsingComplete END"); diff -r e211a78d3037 -r a7a43293ae56 application/src/PodcastSearchView.cpp --- a/application/src/PodcastSearchView.cpp Thu Feb 25 16:47:16 2010 +0000 +++ b/application/src/PodcastSearchView.cpp Thu Feb 25 17:12:04 2010 +0000 @@ -275,7 +275,7 @@ UpdateToolbar(); } -void CPodcastSearchView::OpmlParsingComplete(TUint /*aNumFeedsImported*/) +void CPodcastSearchView::OpmlParsingComplete(TInt /*aError*/, TUint /*aNumFeedsImported*/) { DP("CPodcastSearchView::OpmlParsingComplete BEGIN"); UpdateListboxItemsL(); diff -r e211a78d3037 -r a7a43293ae56 engine/inc/FeedEngine.h --- a/engine/inc/FeedEngine.h Thu Feb 25 16:47:16 2010 +0000 +++ b/engine/inc/FeedEngine.h Thu Feb 25 17:12:04 2010 +0000 @@ -94,7 +94,7 @@ IMPORT_C void AddSearchResultL(CFeedInfo *item); IMPORT_C const RFeedInfoArray& GetSearchResults(); - IMPORT_C void OpmlParsingComplete(TUint aNumFeedsAdded); + IMPORT_C void OpmlParsingComplete(TInt aError, TUint aNumFeedsAdded); protected: static TInt CompareFeedsByTitle(const CFeedInfo &a, const CFeedInfo &b); @@ -118,7 +118,7 @@ void UpdateNextFeedL(); void NotifyFeedUpdateComplete(TInt aError); - void NotifyOpmlParsingComplete(TUint aNumFeedsAdded); + void NotifyOpmlParsingComplete(TInt aError, TUint aNumFeedsAdded); private: diff -r e211a78d3037 -r a7a43293ae56 engine/inc/FeedEngineObserver.h --- a/engine/inc/FeedEngineObserver.h Thu Feb 25 16:47:16 2010 +0000 +++ b/engine/inc/FeedEngineObserver.h Thu Feb 25 17:12:04 2010 +0000 @@ -30,6 +30,6 @@ virtual void FeedDownloadStartedL(TFeedState aState, TUint aFeedUid) = 0; virtual void FeedDownloadFinishedL(TFeedState aState, TUint aFeedUid, TInt aError) = 0; virtual void FeedUpdateAllCompleteL(TFeedState aState) = 0; - virtual void OpmlParsingComplete(TUint aNumFeedsImported) = 0; + virtual void OpmlParsingComplete(TInt aError, TUint aNumFeedsImported) = 0; }; #endif /*FEEDENGINEOBSERVER_H_*/ diff -r e211a78d3037 -r a7a43293ae56 engine/src/FeedEngine.cpp --- a/engine/src/FeedEngine.cpp Thu Feb 25 16:47:16 2010 +0000 +++ b/engine/src/FeedEngine.cpp Thu Feb 25 17:12:04 2010 +0000 @@ -583,40 +583,44 @@ }break; } - NotifyFeedUpdateComplete(aError); - - // we will wait until the image has been downloaded to start the next feed update. - if (iClientState == EIdle) + NotifyFeedUpdateComplete(aError); + + // we will wait until the image has been downloaded to start the next feed update. + if (iClientState == EIdle) + { + UpdateNextFeedL(); + } + }break; + case EUpdatingImage: + { + // change client state to not updating + iClientState = EIdle; + + NotifyFeedUpdateComplete(aError); + UpdateNextFeedL(); + }break; + case ESearching: { - UpdateNextFeedL(); - } - }break; - case EUpdatingImage: - { - // change client state to not updating - iClientState = EIdle; - - NotifyFeedUpdateComplete(aError); - UpdateNextFeedL(); - }break; - case ESearching: - { - iClientState = EIdle; - - DP2("Search complete, results in %S with error %d", &iSearchResultsFileName, aError); - if(aError == KErrNone) - { - if (!iOpmlParser) + iClientState = EIdle; + + DP2("Search complete, results in %S with error %d", &iSearchResultsFileName, aError); + if(aError == KErrNone) { - iOpmlParser = new COpmlParser(*this, iPodcastModel.FsSession()); + if (!iOpmlParser) + { + iOpmlParser = new COpmlParser(*this, iPodcastModel.FsSession()); + } + + DP("Parsing OPML"); + iOpmlParser->ParseOpmlL(iSearchResultsFileName, ETrue); } - - DP("Parsing OPML"); - iOpmlParser->ParseOpmlL(iSearchResultsFileName, ETrue); - } - - BaflUtils::DeleteFile(iPodcastModel.FsSession(), iSearchResultsFileName); - }break; + else + { + NotifyOpmlParsingComplete(aError, 0); + } + + BaflUtils::DeleteFile(iPodcastModel.FsSession(), iSearchResultsFileName); + }break; } DP("CFeedEngine::CompleteL END"); } @@ -1063,15 +1067,15 @@ } -EXPORT_C void CFeedEngine::OpmlParsingComplete(TUint aNumFeedsAdded) +EXPORT_C void CFeedEngine::OpmlParsingComplete(TInt aError, TUint aNumFeedsAdded) { - NotifyOpmlParsingComplete(aNumFeedsAdded); + NotifyOpmlParsingComplete(aError, aNumFeedsAdded); } -void CFeedEngine::NotifyOpmlParsingComplete(TUint aNumFeedsAdded) +void CFeedEngine::NotifyOpmlParsingComplete(TInt aError, TUint aNumFeedsAdded) { for (TInt i=0;iOpmlParsingComplete(aNumFeedsAdded); + iObservers[i]->OpmlParsingComplete(aError, aNumFeedsAdded); } } diff -r e211a78d3037 -r a7a43293ae56 engine/src/OpmlParser.cpp --- a/engine/src/OpmlParser.cpp Thu Feb 25 16:47:16 2010 +0000 +++ b/engine/src/OpmlParser.cpp Thu Feb 25 17:12:04 2010 +0000 @@ -71,9 +71,9 @@ CleanupStack::PopAndDestroy(charset); } -void COpmlParser::OnEndDocumentL(TInt /*aErrorCode*/) +void COpmlParser::OnEndDocumentL(TInt aErrorCode) { - iFeedEngine.OpmlParsingComplete(iNumFeedsAdded); + iFeedEngine.OpmlParsingComplete(aErrorCode, iNumFeedsAdded); //DP("OnEndDocumentL()"); } @@ -227,7 +227,7 @@ void COpmlParser::OnError(TInt aErrorCode) { DP1("COpmlParser::OnError %d", aErrorCode); - iFeedEngine.OpmlParsingComplete(iNumFeedsAdded); + iFeedEngine.OpmlParsingComplete(aErrorCode, iNumFeedsAdded); } TAny* COpmlParser::GetExtendedInterface(const TInt32 /*aUid*/)