Fix attachment download progress pies

This commit is contained in:
Dan Stillman 2017-05-10 22:48:03 -04:00
parent 5b5da4140b
commit a207e388db
5 changed files with 11 additions and 10 deletions

View file

@ -97,6 +97,10 @@ Zotero.Sync.Storage = new function () {
}
/**
* @param {String} libraryKey
* @param {Number|NULL}
*/
this.setItemDownloadPercentage = function (libraryKey, percentage) {
Zotero.debug("Setting image download percentage to " + percentage
+ " for item " + libraryKey);

View file

@ -209,6 +209,8 @@ Zotero.Sync.Storage.Request.prototype.start = Zotero.Promise.coroutine(function*
this._finished = true;
this._running = false;
Zotero.Sync.Storage.setItemDownloadPercentage(this.name, false);
if (this._onStop) {
this._onStop.forEach(x => x());
}
@ -266,7 +268,7 @@ Zotero.Sync.Storage.Request.prototype.onProgress = function (progress, progressM
Zotero.Sync.Storage.setItemDownloadPercentage(this.name, this.percentage);
}
if (this.onProgress && this._onProgress) {
if (this._onProgress) {
for (let f of this._onProgress) {
f(progress, progressMax);
}

View file

@ -102,7 +102,7 @@ Zotero.Sync.Storage.StreamListener.prototype = {
// nsIWebProgressListener
onProgressChange: function (wp, request, curSelfProgress,
maxSelfProgress, curTotalProgress, maxTotalProgress) {
Zotero.debug("onProgressChange with " + curTotalProgress + "/" + maxTotalProgress);
//Zotero.debug("onProgressChange with " + curTotalProgress + "/" + maxTotalProgress);
// onProgress gets called too, so this isn't necessary
//this._onProgress(request, curTotalProgress, maxTotalProgress);

View file

@ -145,8 +145,8 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
return false;
}),
onProgress: function (a, b, c) {
request.onProgress(a, b, c)
onProgress: function (req, progress, progressMax) {
request.onProgress(progress, progressMax);
},
onStop: function (req, status, res) {
request.setChannel(false);

View file

@ -4119,12 +4119,7 @@ var ZoteroPane = new function()
let downloadedItem = item;
try {
yield Zotero.Sync.Runner.downloadFile(
downloadedItem,
{
onProgress: function (progress, progressMax) {}
}
);
yield Zotero.Sync.Runner.downloadFile(downloadedItem);
}
catch (e) {
// TODO: show error somewhere else