# HG changeset patch # User Sebastian Brannstrom # Date 1290131251 0 # Node ID 31968c23152c877b67991b7997d0d4e8f98a30a9 # Parent 83825edad8e1d664499d3cb6fff9f3f0ed9ebb94 Merging fixes from Symbian 1 diff -r 83825edad8e1 -r 31968c23152c application/data/PodcastClient_common.rls --- a/application/data/PodcastClient_common.rls Tue Nov 16 18:02:18 2010 +0000 +++ b/application/data/PodcastClient_common.rls Fri Nov 19 01:47:31 2010 +0000 @@ -24,4 +24,4 @@ rls_string STRING_r_short_caption "Podcatcher" rls_string STRING_r_about_title "About Podcatcher" -rls_string STRING_r_about_body "Version 1.10 (%d) for S60 5th ed.\nŠ 2007-2010 Sebastian Brannstrom, Lars Persson, Anders Fridlund" +rls_string STRING_r_about_body "Version 1.10 (%d) for Symbian^3\nŠ 2007-2010 Sebastian Brannstrom, Lars Persson, Anders Fridlund" diff -r 83825edad8e1 -r 31968c23152c application/data/PodcastClient_english.rls --- a/application/data/PodcastClient_english.rls Tue Nov 16 18:02:18 2010 +0000 +++ b/application/data/PodcastClient_english.rls Fri Nov 19 01:47:31 2010 +0000 @@ -134,7 +134,9 @@ rls_string STRING_r_view_mark_as_unplayed_cmd "Mark show new" rls_string STRING_r_view_mark_as_unplayed_cmd_short "Mark new" rls_string STRING_r_view_download_show_cmd "Download show" +rls_string STRING_r_view_download_show_cmd_short "Download" rls_string STRING_r_view_delete_show_cmd "Delete show" +rls_string STRING_r_view_delete_show_cmd_short "Delete" rls_string STRING_r_view_show_info_cmd "Info" rls_string STRING_r_error_playback_failed "Could not play show" diff -r 83825edad8e1 -r 31968c23152c application/data/PodcastShowsView.ra --- a/application/data/PodcastShowsView.ra Tue Nov 16 18:02:18 2010 +0000 +++ b/application/data/PodcastShowsView.ra Fri Nov 19 01:47:31 2010 +0000 @@ -70,13 +70,13 @@ }, MENU_ITEM { - txt = STRING_r_view_download_show_cmd; + txt = STRING_r_view_download_show_cmd_short; command = EPodcastDownloadShow; flags = EEikMenuItemSpecific; }, MENU_ITEM { - txt = STRING_r_view_delete_show_cmd; + txt = STRING_r_view_delete_show_cmd_short; command = EPodcastDeleteShow; flags = EEikMenuItemSpecific; } @@ -145,6 +145,25 @@ }; }; }, + TBAR_CTRL + { + type = EAknCtButton; + id = EPodcastDownloadAll; + control = AVKON_BUTTON + { + states = + { + AVKON_BUTTON_STATE + { + bmpfile = APPICON; + bmpid = EMbmPodcastDownload_all; + bmpmask = EMbmPodcastDownload_all_mask; + //txt = STRING_r_cancel_update_all_feeds_short_cmd; + helptxt = STRING_r_download_all_shows; + } + }; + }; + }, TBAR_CTRL { type = EAknCtButton; @@ -164,25 +183,6 @@ }; }; }, - TBAR_CTRL - { - type = EAknCtButton; - id = EPodcastDownloadAll; - control = AVKON_BUTTON - { - states = - { - AVKON_BUTTON_STATE - { - bmpfile = APPICON; - bmpid = EMbmPodcastDownload_all; - bmpmask = EMbmPodcastDownload_all_mask; - //txt = STRING_r_cancel_update_all_feeds_short_cmd; - helptxt = STRING_r_download_all_shows; - } - }; - }; - }, // we keep the download toolbar button in S^3, but always disable it // because there are drawing issues with only one item in the toolbar TBAR_CTRL diff -r 83825edad8e1 -r 31968c23152c application/src/PodcastShowsView.cpp --- a/application/src/PodcastShowsView.cpp Tue Nov 16 18:02:18 2010 +0000 +++ b/application/src/PodcastShowsView.cpp Fri Nov 19 01:47:31 2010 +0000 @@ -883,9 +883,21 @@ info->SetDownloadState(ENotDownloaded); info->SetPlayState(EPlayed); iPodcastModel.ShowEngine().UpdateShowL(*info); - - UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); - iListContainer->Listbox()->DrawItem(index); + + if (iShowNewShows) + { + UpdateListboxItemsL(); + + if (index > 0) + { + iListContainer->Listbox()->SetCurrentItemIndex(index - 1); + } + } + else + { + UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); + iListContainer->Listbox()->DrawItem(index); + } } } } diff -r 83825edad8e1 -r 31968c23152c engine/inc/FeedEngine.h --- a/engine/inc/FeedEngine.h Tue Nov 16 18:02:18 2010 +0000 +++ b/engine/inc/FeedEngine.h Fri Nov 19 01:47:31 2010 +0000 @@ -97,6 +97,7 @@ IMPORT_C void OpmlParsingCompleteL(TInt aError, TUint aNumFeedsAdded); void NotifyFeedUpdateComplete(TInt aFeedUid, TInt aError); + void ParserShowUpdatedL(CShowInfo& aShow); protected: @@ -154,10 +155,6 @@ // observers that will receive callbacks, not owning RArray iObservers; - // new feeds only add one show to download list when auto downloading - TBool newFeed; - TUint showsAdded; - // offline mode detection CRepository* iRepository; diff -r 83825edad8e1 -r 31968c23152c engine/inc/FeedParser.h --- a/engine/inc/FeedParser.h Tue Nov 16 18:02:18 2010 +0000 +++ b/engine/inc/FeedParser.h Fri Nov 19 01:47:31 2010 +0000 @@ -94,13 +94,15 @@ void OnError(TInt aErrorCode); TAny* GetExtendedInterface(const TInt32 aUid); CFeedInfo& ActiveFeed(); + private: MFeedParserObserver& iCallbacks; TFeedState iFeedState; CShowInfo* iActiveShow; CFeedInfo *iActiveFeed; - + CShowInfo *iNewestShow; + TBuf iBuffer; TUint iUid; TUint iMaxItems; @@ -111,6 +113,7 @@ TInt iFileSize; TFeedDirection iFeedDirection; TTime iPreviousPubDate; + TBool iNewFeed; }; #endif diff -r 83825edad8e1 -r 31968c23152c engine/inc/FeedParserObserver.h --- a/engine/inc/FeedParserObserver.h Tue Nov 16 18:02:18 2010 +0000 +++ b/engine/inc/FeedParserObserver.h Fri Nov 19 01:47:31 2010 +0000 @@ -27,6 +27,7 @@ public: virtual void NewShowL(CShowInfo& item) = 0; virtual void ParsingCompleteL(CFeedInfo *item) = 0; + virtual void ParserShowUpdatedL(CShowInfo& item) = 0; }; #endif diff -r 83825edad8e1 -r 31968c23152c engine/src/FeedEngine.cpp --- a/engine/src/FeedEngine.cpp Tue Nov 16 18:02:18 2010 +0000 +++ b/engine/src/FeedEngine.cpp Fri Nov 19 01:47:31 2010 +0000 @@ -261,15 +261,7 @@ } iActiveFeed = GetFeedInfoByUid(aFeedUid); - iCancelRequested = EFalse; - - if (iActiveFeed->LastUpdated() == 0) - { - newFeed = ETrue; - } - - showsAdded = 0; iActiveFeed->SetLastError(KErrNone); DBUpdateFeedL(*iActiveFeed); @@ -312,14 +304,6 @@ aItem.SetDescriptionL(*description); CleanupStack::PopAndDestroy(description); - if (newFeed) { - // for new feeds, set all shows played - aItem.SetPlayState(EPlayed); - // except the first one - if (showsAdded == 0) { - aItem.SetPlayState(ENeverPlayed); - } - } TRAPD(err, iPodcastModel.ShowEngine().AddShowL(aItem)); @@ -329,7 +313,6 @@ iPodcastModel.ShowEngine().AddDownloadL(aItem); } - showsAdded++; DP("CFeedEngine::NewShowL END"); } @@ -609,10 +592,7 @@ { if (!iCancelRequested) { iActiveFeed->SetLastError(aError); - TTime time; - time.HomeTime(); - iActiveFeed->SetLastUpdated(time); - + if( aError == KErrNone) { // Parse the feed. We need to trap this call since it could leave and then @@ -655,6 +635,9 @@ // even if it fails, this will allow us to move on iClientState = EIdle; } + TTime time; + time.HomeTime(); + iActiveFeed->SetLastUpdated(time); } iCancelRequested = EFalse; }break; @@ -1214,3 +1197,13 @@ iObservers[i]->OpmlParsingComplete(aError, aNumFeedsAdded); } } + +void CFeedEngine::ParserShowUpdatedL(CShowInfo& aShow) + { + iPodcastModel.ShowEngine().UpdateShowL(aShow); + if (aShow.PlayState() == ENeverPlayed && + iPodcastModel.SettingsEngine().DownloadAutomatically()) + { + iPodcastModel.ShowEngine().AddDownloadL(aShow); + } + } diff -r 83825edad8e1 -r 31968c23152c engine/src/FeedParser.cpp --- a/engine/src/FeedParser.cpp Tue Nov 16 18:02:18 2010 +0000 +++ b/engine/src/FeedParser.cpp Fri Nov 19 01:47:31 2010 +0000 @@ -54,6 +54,11 @@ iMaxItems = aMaxItems; iStoppedParsing = EFalse; iEncoding = ELatin1; + if (iNewestShow) + delete iNewestShow; + iNewestShow = 0; + + iNewFeed = (iActiveFeed->LastUpdated() == 0) ? ETrue : EFalse; TEntry entry; User::LeaveIfError(iRfs.Entry(feedFileName, entry)); @@ -89,6 +94,18 @@ void CFeedParser::OnEndDocumentL(TInt /*aErrorCode*/) { //DP("OnEndDocumentL()"); + if (iNewFeed) + { + // if the feed adds at bottom, this + if (iNewestShow) + { + iNewestShow->SetPlayState(ENeverPlayed); + iCallbacks.ParserShowUpdatedL(*iNewestShow); + delete iNewestShow; + iNewestShow = 0; + } + } + iCallbacks.ParsingCompleteL(iActiveFeed); } @@ -321,12 +338,25 @@ iPreviousPubDate = iActiveShow->PubDate(); } - if (iUid) { iActiveShow->SetUid(iUid); } + + if (iNewFeed) + { + // set all played, except for the newest one + iActiveShow->SetPlayState(EPlayed); + + if (!iNewestShow || iActiveShow->PubDate() > iNewestShow->PubDate()) + { + if (iNewestShow) + delete iNewestShow; + iNewestShow = new CShowInfo(iActiveShow); + } + } + iCallbacks.NewShowL(*iActiveShow); delete iActiveShow; diff -r 83825edad8e1 -r 31968c23152c engine/src/ShowEngine.cpp --- a/engine/src/ShowEngine.cpp Tue Nov 16 18:02:18 2010 +0000 +++ b/engine/src/ShowEngine.cpp Fri Nov 19 01:47:31 2010 +0000 @@ -545,7 +545,7 @@ // TTimeIntervalYears years(5); // now += years; - _LIT(KSqlStatement, "select filename from shows where downloadstate=%d and deletedate < \"%Ld\""); + _LIT(KSqlStatement, "select filename from shows where downloadstate=%d and deletedate != 0 and deletedate < \"%Ld\""); iSqlBuffer.Format(KSqlStatement, EDownloaded, now.Int64()); sqlite3_stmt *st; @@ -1481,6 +1481,12 @@ EXPORT_C void CShowEngine::UpdateShowL(CShowInfo& aInfo) { DBUpdateShowL(aInfo); + + // hack to ensure change in playstate is stored for the show actively downloading + if (iShowDownloading && iShowDownloading->Uid() == aInfo.Uid()) + { + iShowDownloading->SetPlayState(aInfo.PlayState()); + } } EXPORT_C CMetaDataReader& CShowEngine::MetaDataReader()