Bug #252394 --> Make parsing RSS feeds asynch and report the progress on each item as we store it

to a folder back in the subscriptions UI dialog.
This commit is contained in:
scott%scott-macgregor.org 2004-07-21 19:47:14 +00:00
Родитель b02a2798b9
Коммит affc8bca44
3 изменённых файлов: 23 добавлений и 6 удалений

Просмотреть файл

@ -449,10 +449,16 @@ var gItemsToStoreIndex = 0;
// otherwise it triggers a download done notification to the UI
function storeNextItem()
{
var item = gItemsToStore[gItemsToStoreIndex++];
var item = gItemsToStore[gItemsToStoreIndex];
item.store();
item.markValid();
// if the listener is tracking progress for storing each item, report it here...
if (item.feed.downloadCallback.onFeedItemStored)
item.feed.downloadCallback.onFeedItemStored(item.feed, gItemsToStoreIndex, gItemsToStore.length);
gItemsToStoreIndex++
// eventually we'll report individual progress here....
if (gItemsToStoreIndex < gItemsToStore.length)

Просмотреть файл

@ -53,7 +53,6 @@ function openFeedEditor(feedProperties)
return feedProperties;
}
// status helper routines
function updateStatusItem(aID, aValue)
@ -78,8 +77,6 @@ var feedDownloadCallback = {
if (feed)
{
updateStatusItem('progressMeter', 100);
updateStatusItem('statusText', document.getElementById("bundle_newsblog").getString('subscribe-validFeedFound'));
updateStatusItem('statusText', 'Valid Feed Found!');
var server = getIncomingServer();
// if we get here...we should always have a folder by now...either
@ -101,6 +98,16 @@ var feedDownloadCallback = {
setTimeout(clearStatusInfo, 1000);
},
// this gets called after the RSS parser finishes storing a feed item to disk
// aCurrentFeedItems is an integer corresponding to how many feed items have been downloaded so far
// aMaxFeedItems is an integer corresponding to the total number of feed items to download
onFeedItemStored: function (feed, aCurrentFeedItems, aMaxFeedItems)
{
updateStatusItem('statusText',
document.getElementById("bundle_newsblog").getFormattedString("subscribe-fetchingFeedItems", [aCurrentFeedItems, aMaxFeedItems]) );
this.onProgress(aCurrentFeedItems, aMaxFeedItems);
},
onProgress: function(aProgress, aProgressMax)
{
updateStatusItem('progressMeter', (aProgress * 100) / aProgressMax);

Просмотреть файл

@ -1,6 +1,10 @@
# Status strings used in the subscribe dialog
subscribe-validFeedFound=Valid Feed Found!
subscribe-validating=Validating the feed...
subscribe-validating=Verifying the feed...
# when downloading new feed items from the subscribe dialog.
# LOCALIZATION NOTE: Do not translate %d in the following line.
# The first %S will receive the number of messages received so far;
# the second %S will receive the total number of messages
subscribe-fetchingFeedItems=Downloading feed articles (%S of %S)