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) { this.setItemDownloadPercentage = function (libraryKey, percentage) {
Zotero.debug("Setting image download percentage to " + percentage Zotero.debug("Setting image download percentage to " + percentage
+ " for item " + libraryKey); + " for item " + libraryKey);

View File

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

View File

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

View File

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

View File

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