diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index 954ca4a582..799d452213 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -155,6 +155,13 @@ var ItemTree = class ItemTree extends LibraryTree { 50 ); } + this._prefsObserverIDs = [ + Zotero.Prefs.registerObserver('recursiveCollections', this.refreshAndMaintainSelection.bind(this)), + Zotero.Prefs.registerObserver('showAttachmentFilenames', () => { + this._rowCache = {}; + this.tree.invalidate(); + }), + ]; this._itemsPaneMessage = null; @@ -170,6 +177,9 @@ var ItemTree = class ItemTree extends LibraryTree { unregister() { this._uninitialized = true; Zotero.Notifier.unregisterObserver(this._unregisterID); + for (let id of this._prefsObserverIDs) { + Zotero.Prefs.unregisterObserver(id); + } this._writeColumnPrefsToFile(true); } @@ -3407,7 +3417,16 @@ var ItemTree = class ItemTree extends LibraryTree { } row.numNotes = treeRow.numNotes() || ""; row.feed = (treeRow.ref.isFeedItem && Zotero.Feeds.get(treeRow.ref.libraryID).name) || ""; - row.title = treeRow.ref.getDisplayTitle(); + + if (treeRow.ref.isFileAttachment() + // TODO: Adjust this if we localize "Snapshot" + && !(treeRow.ref.isSnapshotAttachment() && /snapshot/i.test(treeRow.ref.getField('title'))) + && Zotero.Prefs.get('showAttachmentFilenames')) { + row.title = treeRow.ref.attachmentFilename; + } + else { + row.title = treeRow.ref.getDisplayTitle(); + } const columns = this.getColumns(); for (let col of columns) { diff --git a/chrome/content/zotero/preferences/preferences_general.xhtml b/chrome/content/zotero/preferences/preferences_general.xhtml index 932e146eb2..d62826c7ce 100644 --- a/chrome/content/zotero/preferences/preferences_general.xhtml +++ b/chrome/content/zotero/preferences/preferences_general.xhtml @@ -171,6 +171,20 @@ + + + + + + + + + diff --git a/chrome/content/zotero/xpcom/prefs.js b/chrome/content/zotero/xpcom/prefs.js index 732fb3178e..7b341ef81f 100644 --- a/chrome/content/zotero/xpcom/prefs.js +++ b/chrome/content/zotero/xpcom/prefs.js @@ -350,9 +350,6 @@ Zotero.Prefs = new function () { ["uiDensity", function () { Zotero.UIProperties.setAll(); }], - ["recursiveCollections", function () { - Zotero.getActiveZoteroPane().itemsView.refreshAndMaintainSelection(); - }], [ "layout", function (val) { Zotero.getActiveZoteroPane().updateLayout(); }], diff --git a/chrome/locale/en-US/zotero/preferences.ftl b/chrome/locale/en-US/zotero/preferences.ftl index 3c7dedd938..0a71b07189 100644 --- a/chrome/locale/en-US/zotero/preferences.ftl +++ b/chrome/locale/en-US/zotero/preferences.ftl @@ -34,6 +34,11 @@ preferences-file-renaming-format-instructions-more = See the . To support some workflows, { -app-name } can show filenames instead of attachment titles in the items list. +preferences-attachment-titles-show-filenames = + .label = Show attachment filenames in the items list + preferences-reader-title = Reader preferences-reader-open-epubs-using = Open EPUBs using preferences-reader-open-snapshots-using = Open snapshots using