From b956d9b4299fd6d138c7c2b143b504a56d627358 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Mon, 6 Feb 2023 17:44:01 +0000 Subject: [PATCH] Add Filename option for PDF tab title pref --- chrome/content/zotero/preferences/preferences_general.xul | 1 + chrome/content/zotero/xpcom/reader.js | 5 +++-- chrome/locale/en-US/zotero/preferences.dtd | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_general.xul b/chrome/content/zotero/preferences/preferences_general.xul index 3bffad900e..58c5b8ef19 100644 --- a/chrome/content/zotero/preferences/preferences_general.xul +++ b/chrome/content/zotero/preferences/preferences_general.xul @@ -102,6 +102,7 @@ + diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 5f0c712ca6..f9ffa315f2 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -172,14 +172,15 @@ class ReaderInstance { } async updateTitle() { + let type = Zotero.Prefs.get('tabs.title.reader'); let item = Zotero.Items.get(this._itemID); let readerTitle = item.getDisplayTitle(); let parentItem = item.parentItem; - if (parentItem) { + // If type is "filename", then readerTitle already has it + if (parentItem && type !== 'filename') { let attachment = await parentItem.getBestAttachment(); if (attachment && attachment.id === this._itemID) { let parts = []; - let type = Zotero.Prefs.get('tabs.title.reader'); let creator = parentItem.getField('firstCreator'); let year = parentItem.getField('year'); let title = parentItem.getDisplayTitle(); diff --git a/chrome/locale/en-US/zotero/preferences.dtd b/chrome/locale/en-US/zotero/preferences.dtd index 42c2e84296..6bd8745c5a 100644 --- a/chrome/locale/en-US/zotero/preferences.dtd +++ b/chrome/locale/en-US/zotero/preferences.dtd @@ -30,6 +30,7 @@ +