Add Filename option for PDF tab title pref

This commit is contained in:
Martynas Bagdonas 2023-02-06 17:44:01 +00:00
parent 962cc23d1a
commit b956d9b429
3 changed files with 5 additions and 2 deletions

View file

@ -102,6 +102,7 @@
<menupopup>
<menuitem label="&zotero.preferences.reader.tabsTitle.titleCreatorYear;" value="titleCreatorYear"/>
<menuitem label="&zotero.preferences.reader.tabsTitle.creatorYearTitle;" value="creatorYearTitle"/>
<menuitem label="&zotero.preferences.reader.tabsTitle.filename;" value="filename"/>
</menupopup>
</menulist>
</hbox>

View file

@ -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();

View file

@ -30,6 +30,7 @@
<!ENTITY zotero.preferences.reader.tabsTitle.label "Show tabs as">
<!ENTITY zotero.preferences.reader.tabsTitle.creatorYearTitle "Creator - Year - Title">
<!ENTITY zotero.preferences.reader.tabsTitle.titleCreatorYear "Title - Creator - Year">
<!ENTITY zotero.preferences.reader.tabsTitle.filename "Filename">
<!ENTITY zotero.preferences.groups "Groups">
<!ENTITY zotero.preferences.groups.whenCopyingInclude "When copying items between libraries, include:">