diff --git a/chrome/content/zotero/elements/zoteroSearch.js b/chrome/content/zotero/elements/zoteroSearch.js index 419fc0d7d3..9823b6e659 100644 --- a/chrome/content/zotero/elements/zoteroSearch.js +++ b/chrome/content/zotero/elements/zoteroSearch.js @@ -476,7 +476,7 @@ case 'fileTypeID': var rows = Zotero.FileTypes.getTypes().map(type => ({ - name: Zotero.getString('fileTypes.' + type.name), + name: Zotero.getString('file-type-' + type.name), value: type.id })); diff --git a/chrome/content/zotero/preferences/preferences_general.js b/chrome/content/zotero/preferences/preferences_general.js index 87dca20bea..717688e1f4 100644 --- a/chrome/content/zotero/preferences/preferences_general.js +++ b/chrome/content/zotero/preferences/preferences_general.js @@ -217,10 +217,30 @@ Zotero_Preferences.General = { } }), + setAutoRenameFileTypes: function () { + let typesBox = document.getElementById('zotero-prefpane-file-renaming-file-types-box'); + let enabledTypes = new Set(Zotero.Prefs.get('autoRenameFiles.fileTypes').split(',')); + for (let checkbox of typesBox.querySelectorAll('checkbox')) { + if (checkbox.checked) { + enabledTypes.add(checkbox.dataset.contentType); + } + else { + enabledTypes.delete(checkbox.dataset.contentType); + } + } + Zotero.Prefs.set('autoRenameFiles.fileTypes', [...enabledTypes].join(',')); + }, + updateAutoRenameFilesUI: function () { setTimeout(() => { document.getElementById('rename-linked-files').disabled = !Zotero.Prefs.get('autoRenameFiles'); }); + + let typesBox = document.getElementById('zotero-prefpane-file-renaming-file-types-box'); + let enabledTypes = Zotero.Prefs.get('autoRenameFiles.fileTypes').split(','); + for (let checkbox of typesBox.querySelectorAll('checkbox')) { + checkbox.checked = enabledTypes.includes(checkbox.dataset.contentType); + } }, // diff --git a/chrome/content/zotero/preferences/preferences_general.xhtml b/chrome/content/zotero/preferences/preferences_general.xhtml index f93a6862f7..6ebb903b29 100644 --- a/chrome/content/zotero/preferences/preferences_general.xhtml +++ b/chrome/content/zotero/preferences/preferences_general.xhtml @@ -116,6 +116,40 @@ preference="extensions.zotero.autoRenameFiles.linked" oncommand="Zotero_Preferences.General.updateAutoRenameFilesUI()" native="true" /> + +