equal
deleted
inserted
replaced
206 { |
206 { |
207 iCatchupMode = ETrue; |
207 iCatchupMode = ETrue; |
208 } |
208 } |
209 |
209 |
210 iActiveFeed->SetLastError(KErrNone); |
210 iActiveFeed->SetLastError(KErrNone); |
211 DBUpdateFeed(*iActiveFeed); |
211 DBUpdateFeedL(*iActiveFeed); |
212 |
212 |
213 iUpdatingFeedFileName.Copy (iPodcastModel.SettingsEngine().PrivatePath ()); |
213 iUpdatingFeedFileName.Copy (iPodcastModel.SettingsEngine().PrivatePath ()); |
214 _LIT(KFileNameFormat, "%lu.xml"); |
214 _LIT(KFileNameFormat, "%lu.xml"); |
215 iUpdatingFeedFileName.AppendFormat(KFileNameFormat, aFeedUid); |
215 iUpdatingFeedFileName.AppendFormat(KFileNameFormat, aFeedUid); |
216 |
216 |
275 relPath.Append(fileName); |
275 relPath.Append(fileName); |
276 PodcastUtils::EnsureProperPathName(relPath); |
276 PodcastUtils::EnsureProperPathName(relPath); |
277 |
277 |
278 // complete file path is base dir + rel path |
278 // complete file path is base dir + rel path |
279 filePath.Append(relPath); |
279 filePath.Append(relPath); |
280 // This file might exist in the podcast directory already so check this first |
280 aFeedInfo->SetImageFileNameL(filePath); |
281 if(BaflUtils::FileExists(iPodcastModel.FsSession(), filePath)) |
281 |
282 { |
282 if(iFeedClient->GetL(aFeedInfo->ImageUrl(), filePath, ETrue)) |
283 aFeedInfo->SetImageFileNameL(filePath, &iPodcastModel); |
283 { |
284 } |
284 iClientState = EUpdatingImage; |
285 else |
|
286 { |
|
287 aFeedInfo->SetImageFileNameL(filePath, NULL); |
|
288 if(iFeedClient->GetL(aFeedInfo->ImageUrl(), filePath, ETrue)) |
|
289 { |
|
290 iClientState = EUpdatingImage; |
|
291 } |
|
292 } |
285 } |
293 } |
286 } |
294 |
287 |
295 EXPORT_C TBool CFeedEngine::AddFeedL(const CFeedInfo&aItem) |
288 EXPORT_C TBool CFeedEngine::AddFeedL(const CFeedInfo&aItem) |
296 { |
289 { |
373 for (int i=0;i<iSortedFeeds.Count();i++) |
366 for (int i=0;i<iSortedFeeds.Count();i++) |
374 { |
367 { |
375 if (iSortedFeeds[i]->Uid() == aUid) |
368 if (iSortedFeeds[i]->Uid() == aUid) |
376 { |
369 { |
377 iPodcastModel.ShowEngine().DeleteAllShowsByFeedL(aUid); |
370 iPodcastModel.ShowEngine().DeleteAllShowsByFeedL(aUid); |
378 |
371 |
379 CFeedInfo* feedToRemove = iSortedFeeds[i]; |
372 CFeedInfo* feedToRemove = iSortedFeeds[i]; |
380 |
373 |
381 //delete the image file if it exists |
374 //delete the image file if it exists |
382 if ((feedToRemove->ImageFileName().Length() >0) |
375 if ((feedToRemove->ImageFileName().Length() >0) |
383 && BaflUtils::FileExists(iPodcastModel.FsSession(), feedToRemove->ImageFileName())) |
376 && BaflUtils::FileExists(iPodcastModel.FsSession(), feedToRemove->ImageFileName())) |
432 } |
425 } |
433 } |
426 } |
434 return EFalse; |
427 return EFalse; |
435 } |
428 } |
436 |
429 |
437 TBool CFeedEngine::DBUpdateFeed(const CFeedInfo &aItem) |
430 TBool CFeedEngine::DBUpdateFeedL(const CFeedInfo &aItem) |
438 { |
431 { |
439 DP2("CFeedEngine::DBUpdateFeed, title=%S, URL=%S", &aItem.Title(), &aItem.Url()); |
432 DP2("CFeedEngine::DBUpdateFeed, title=%S, URL=%S", &aItem.Title(), &aItem.Url()); |
440 |
433 |
441 HBufC* titleBuf = HBufC::NewLC(KMaxLineLength); |
434 HBufC* titleBuf = HBufC::NewLC(KMaxLineLength); |
442 TPtr titlePtr(titleBuf->Des()); |
435 TPtr titlePtr(titleBuf->Des()); |
522 { |
515 { |
523 TTime time; |
516 TTime time; |
524 time.HomeTime(); |
517 time.HomeTime(); |
525 iActiveFeed->SetLastUpdated(time); |
518 iActiveFeed->SetLastUpdated(time); |
526 iActiveFeed->SetLastError(aError); |
519 iActiveFeed->SetLastError(aError); |
527 NotifyFeedUpdateComplete(aError); |
520 NotifyFeedUpdateComplete(iActiveFeed->Uid(), aError); |
528 } |
521 } |
529 break; |
522 break; |
530 case EUpdatingFeed: |
523 case EUpdatingFeed: |
531 { |
524 { |
532 // Parse the feed. We need to trap this call since it could leave and then |
525 // Parse the feed. We need to trap this call since it could leave and then |
592 } |
585 } |
593 iCancelRequested = EFalse; |
586 iCancelRequested = EFalse; |
594 }break; |
587 }break; |
595 } |
588 } |
596 |
589 |
597 n NotifyFeedUpdateComplete(aError); |
590 NotifyFeedUpdateComplete(iActiveFeed->Uid(), aError); |
598 |
591 |
599 // we will wait until the image has been downloaded to start the next feed update. |
592 // we will wait until the image has been downloaded to start the next feed update. |
600 if (iClientState == EIdle) |
593 if (iClientState == EIdle) |
601 { |
594 { |
602 UpdateNextFeedL(); |
595 UpdateNextFeedL(); |
603 } |
596 } |
613 // If this fails, no reason to worry |
606 // If this fails, no reason to worry |
614 TRAP_IGNORE(iPodcastModel.ImageHandler().LoadFileAndScaleL(iActiveFeed->FeedIcon(), iActiveFeed->ImageFileName(), TSize(64,56), *iActiveFeed, iActiveFeed->Uid())); |
607 TRAP_IGNORE(iPodcastModel.ImageHandler().LoadFileAndScaleL(iActiveFeed->FeedIcon(), iActiveFeed->ImageFileName(), TSize(64,56), *iActiveFeed, iActiveFeed->Uid())); |
615 } |
608 } |
616 } |
609 } |
617 |
610 |
618 NotifyFeedUpdateComplete(aError); |
611 NotifyFeedUpdateComplete(iActiveFeed->Uid(), aError); |
619 UpdateNextFeedL(); |
612 UpdateNextFeedL(); |
620 }break; |
613 }break; |
621 case ESearching: |
614 case ESearching: |
622 { |
615 { |
623 iClientState = EIdle; |
616 iClientState = EIdle; |
633 DP("Parsing OPML"); |
626 DP("Parsing OPML"); |
634 iOpmlParser->ParseOpmlL(iSearchResultsFileName, ETrue); |
627 iOpmlParser->ParseOpmlL(iSearchResultsFileName, ETrue); |
635 } |
628 } |
636 else |
629 else |
637 { |
630 { |
638 NotifyOpmlParsingComplete(aError, 0); |
631 NotifyOpmlParsingCompleteL(aError, 0); |
639 } |
632 } |
640 |
633 |
641 BaflUtils::DeleteFile(iPodcastModel.FsSession(), iSearchResultsFileName); |
634 BaflUtils::DeleteFile(iPodcastModel.FsSession(), iSearchResultsFileName); |
642 }break; |
635 }break; |
643 } |
636 } |
644 DP("CFeedEngine::CompleteL END"); |
637 DP("CFeedEngine::CompleteL END"); |
645 } |
|
646 |
|
647 void CFeedEngine::NotifyFeedUpdateComplete(TInt aError) |
|
648 { |
|
649 DP("CFeedEngine::NotifyFeedUpdateComplete"); |
|
650 DBUpdateFeed(*iActiveFeed); |
|
651 for (TInt i=0;i<iObservers.Count();i++) |
|
652 { |
|
653 TRAP_IGNORE(iObservers[i]->FeedDownloadFinishedL(iAutoUpdatedInitiator?MFeedEngineObserver::EFeedAutoUpdate:MFeedEngineObserver::EFeedManualUpdate, iActiveFeed->Uid(), aError)); |
|
654 } |
|
655 } |
638 } |
656 |
639 |
657 void CFeedEngine::NotifyFeedUpdateComplete(TInt aFeedUid, TInt aError) |
640 void CFeedEngine::NotifyFeedUpdateComplete(TInt aFeedUid, TInt aError) |
658 { |
641 { |
659 DP("CFeedEngine::NotifyFeedUpdateComplete"); |
642 DP("CFeedEngine::NotifyFeedUpdateComplete"); |
931 TPtrC16 image((const TUint16*)imagez); |
914 TPtrC16 image((const TUint16*)imagez); |
932 feedInfo->SetImageUrlL(image); |
915 feedInfo->SetImageUrlL(image); |
933 |
916 |
934 const void *imagefilez = sqlite3_column_text16(st, 4); |
917 const void *imagefilez = sqlite3_column_text16(st, 4); |
935 TPtrC16 imagefile((const TUint16*)imagefilez); |
918 TPtrC16 imagefile((const TUint16*)imagefilez); |
936 feedInfo->SetImageFileNameL(imagefile, &iPodcastModel); |
919 feedInfo->SetImageFileNameL(imagefile); |
937 |
920 |
938 const void *linkz = sqlite3_column_text16(st, 5); |
921 const void *linkz = sqlite3_column_text16(st, 5); |
939 TPtrC16 link((const TUint16*)linkz); |
922 TPtrC16 link((const TUint16*)linkz); |
940 feedInfo->SetDescriptionL(link); |
923 feedInfo->SetDescriptionL(link); |
941 |
924 |
1035 } |
1018 } |
1036 |
1019 |
1037 return feedInfo; |
1020 return feedInfo; |
1038 } |
1021 } |
1039 |
1022 |
1040 EXPORT_C void CFeedEngine::UpdateFeed(CFeedInfo *aItem) |
1023 EXPORT_C void CFeedEngine::UpdateFeedL(CFeedInfo *aItem) |
1041 { |
1024 { |
1042 DBUpdateFeed(*aItem); |
1025 DBUpdateFeedL(*aItem); |
1043 } |
1026 } |
1044 |
1027 |
1045 EXPORT_C void CFeedEngine::SearchForFeedL(TDesC& aSearchString) |
1028 EXPORT_C void CFeedEngine::SearchForFeedL(TDesC& aSearchString) |
1046 { |
1029 { |
1047 DP1("FeedEngine::SearchForFeedL BEGIN, aSearchString=%S", &aSearchString); |
1030 DP1("FeedEngine::SearchForFeedL BEGIN, aSearchString=%S", &aSearchString); |
1093 { |
1076 { |
1094 return iSearchResults; |
1077 return iSearchResults; |
1095 } |
1078 } |
1096 |
1079 |
1097 |
1080 |
1098 EXPORT_C void CFeedEngine::OpmlParsingComplete(TInt aError, TUint aNumFeedsAdded) |
1081 EXPORT_C void CFeedEngine::OpmlParsingCompleteL(TInt aError, TUint aNumFeedsAdded) |
1099 { |
1082 { |
1100 NotifyOpmlParsingComplete(aError, aNumFeedsAdded); |
1083 NotifyOpmlParsingCompleteL(aError, aNumFeedsAdded); |
1101 } |
1084 } |
1102 |
1085 |
1103 void CFeedEngine::NotifyOpmlParsingComplete(TInt aError, TUint aNumFeedsAdded) |
1086 void CFeedEngine::NotifyOpmlParsingCompleteL(TInt aError, TUint aNumFeedsAdded) |
1104 { |
1087 { |
1105 for (TInt i=0;i<iObservers.Count();i++) |
1088 for (TInt i=0;i<iObservers.Count();i++) |
1106 { |
1089 { |
1107 iObservers[i]->OpmlParsingComplete(aError, aNumFeedsAdded); |
1090 iObservers[i]->OpmlParsingComplete(aError, aNumFeedsAdded); |
1108 } |
1091 } |