commit b0a71467ea9a2c29a2844f8ae38b71c8233c80f5 parent 98f62c6d3faf2a9fe1220648b52bd103fb1e7abe Author: Dan Stillman <dstillman@zotero.org> Date: Sun, 3 Mar 2013 05:16:18 -0500 Fix sorting of top-level attachments in attachments column Also hide the attachments column by default in the select-items dialog Diffstat:
| M | chrome/content/zotero/selectItemsDialog.xul | | | 2 | +- |
| M | chrome/content/zotero/xpcom/itemTreeView.js | | | 9 | +++++++-- |
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/selectItemsDialog.xul b/chrome/content/zotero/selectItemsDialog.xul @@ -232,7 +232,7 @@ flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> <treecol - id="zotero-items-column-hasAttachment" + id="zotero-items-column-hasAttachment" hidden="true" class="treecol-image" label="&zotero.tabs.attachments.label;" src="chrome://zotero/skin/attach-small.png" diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -1308,10 +1308,15 @@ Zotero.ItemTreeView.prototype.sort = function(itemID) case 'hasAttachment': getField = function (row) { - if (!row.ref.isRegularItem()) { + if (row.ref.isAttachment()) { + var state = row.ref.fileExists ? 1 : -1; + } + else if (row.ref.isRegularItem()) { + var state = row.ref.getBestAttachmentState(); + } + else { return 0; } - var state = row.ref.getBestAttachmentState(); // Make sort order present, missing, empty when ascending if (state === -1) { state = 2;