Skip to content

Commit

Permalink
Fix attachment download progress pies
Browse files Browse the repository at this point in the history
  • Loading branch information
dstillman committed May 11, 2017
1 parent 5b5da41 commit a207e38
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 4 additions & 0 deletions chrome/content/zotero/xpcom/storage.js
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion chrome/content/zotero/xpcom/storage/storageRequest.js
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/content/zotero/xpcom/storage/streamListener.js
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions chrome/content/zotero/xpcom/storage/zfs.js
Expand Up @@ -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);
Expand Down
7 changes: 1 addition & 6 deletions chrome/content/zotero/zoteroPane.js
Expand Up @@ -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
Expand Down

0 comments on commit a207e38

Please sign in to comment.