diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index bb0a6f5ab..8ca57c620 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -1116,6 +1116,7 @@ Zotero.ItemTreeView.prototype.getImageSrc = function(row, col) } var itemID = item.id; + let suffix = Zotero.hiDPISuffix; if (treerow.level === 0) { if (item.isRegularItem()) { @@ -1123,10 +1124,10 @@ Zotero.ItemTreeView.prototype.getImageSrc = function(row, col) if (state !== null) { switch (state) { case 1: - return "chrome://zotero/skin/bullet_blue.png"; + return `chrome://zotero/skin/bullet_blue${suffix}.png`; case -1: - return "chrome://zotero/skin/bullet_blue_empty.png"; + return `chrome://zotero/skin/bullet_blue_empty${suffix}.png`; default: return ""; @@ -1145,7 +1146,6 @@ Zotero.ItemTreeView.prototype.getImageSrc = function(row, col) if (item.isFileAttachment()) { let exists = item.fileExistsCached(); if (exists !== null) { - let suffix = Zotero.hiDPISuffix; return exists ? `chrome://zotero/skin/bullet_blue${suffix}.png` : `chrome://zotero/skin/bullet_blue_empty${suffix}.png`; @@ -1310,10 +1310,24 @@ Zotero.ItemTreeView.prototype.isSorted = function() return true; } -Zotero.ItemTreeView.prototype.cycleHeader = function (column) { +Zotero.ItemTreeView.prototype.cycleHeader = Zotero.Promise.coroutine(function* (column) { if (this.collectionTreeRow.isFeed()) { return; } + if (column.id == 'zotero-items-column-hasAttachment') { + Zotero.debug("Caching best attachment states"); + if (!this._cachedBestAttachmentStates) { + let t = new Date(); + for (let i = 0; i < this._rows.length; i++) { + let item = this.getRow(i).ref; + if (item.isRegularItem()) { + yield item.getBestAttachmentState(); + } + } + Zotero.debug("Cached best attachment states in " + (new Date - t) + " ms"); + this._cachedBestAttachmentStates = true; + } + } for(var i=0, len=this._treebox.columns.count; i