Fix attachment download progress pies
This commit is contained in:
parent
5b5da4140b
commit
a207e388db
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user