From f8b41c971c89ffb474df2103c4bf1a49389a5048 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 27 Feb 2018 01:40:07 -0500 Subject: [PATCH] Automatic attachment file renaming changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic renaming is now done for dragging of an external file onto an item (as added in 7cb95f41) as well as dragging as a linked file, dragging a non-native (not text or HTML) URL, "Attach Link to File…", "Attach Stored Copy of File…", and "Retrieve Metadata for PDF". It only applies if a single file is being added and if the parent item has no non-HTML attachments. By default, the renaming only applies to PDFs, but this can be changed with the renameAttachmentFiles.automatic.fileTypes hidden pref. A new General pref, "Automatically rename attachment files using parent metadata", controls whether the renaming happens. Files saved via web translators are renamed regardless of this pref, because they would often be gibberish otherwise. Closes #113 --- .../preferences/preferences_general.xul | 2 + chrome/content/zotero/xpcom/attachments.js | 45 +++++- chrome/content/zotero/xpcom/data/item.js | 9 ++ chrome/content/zotero/xpcom/itemTreeView.js | 61 ++++++--- chrome/content/zotero/xpcom/recognizePDF.js | 60 +++++--- chrome/content/zotero/zoteroPane.js | 102 +++++++++----- chrome/locale/en-US/zotero/preferences.dtd | 1 + defaults/preferences/zotero.js | 2 + test/tests/itemTreeViewTest.js | 128 ++++++++++++++++-- test/tests/recognizePDFTest.js | 21 +-- 10 files changed, 335 insertions(+), 96 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_general.xul b/chrome/content/zotero/preferences/preferences_general.xul index 2ef9b2814..fc0c087e8 100644 --- a/chrome/content/zotero/preferences/preferences_general.xul +++ b/chrome/content/zotero/preferences/preferences_general.xul @@ -37,6 +37,7 @@ + @@ -122,6 +123,7 @@ label="&zotero.preferences.automaticSnapshots;" preference="pref-automaticSnapshots"/> +