Add right-click menu read state choices for feeds
This commit is contained in:
parent
9e88969f3d
commit
39aca505e0
5 changed files with 57 additions and 9 deletions
|
@ -2137,7 +2137,7 @@ Zotero.ItemTreeView.prototype.getSortFields = function () {
|
|||
*/
|
||||
Zotero.ItemTreeView.prototype.getSortDirection = function() {
|
||||
if (this.collectionTreeRow.isFeed) {
|
||||
return Zotero.Prefs.get('feedSortAsc') ? 'asc' : 'desc';
|
||||
return Zotero.Prefs.get('feedSortAsc') ? 'ascending' : 'descending';
|
||||
}
|
||||
var column = this._treebox.columns.getSortedColumn();
|
||||
if (!column) {
|
||||
|
|
|
@ -1911,6 +1911,19 @@ var ZoteroPane = new function()
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.toggleSelectedItemsRead = function() {
|
||||
return Zotero.FeedItems.toggleReadByID(this.getSelectedItems(true));
|
||||
};
|
||||
|
||||
this.markFeedRead = Zotero.Promise.coroutine(function* () {
|
||||
if (!this.collectionsView.selection.count) return;
|
||||
|
||||
let feed = this.collectionsView.getRow(this.collectionsView.selection.currentIndex).ref;
|
||||
let feedItemIDs = yield Zotero.FeedItems.getAll(feed.libraryID, true, false, true);
|
||||
yield Zotero.FeedItems.toggleReadByID(feedItemIDs, true);
|
||||
});
|
||||
|
||||
|
||||
this.editSelectedFeed = Zotero.Promise.coroutine(function* () {
|
||||
if (!this.collectionsView.selection.count) return;
|
||||
|
@ -2216,6 +2229,7 @@ var ZoteroPane = new function()
|
|||
"showDuplicates",
|
||||
"showUnfiled",
|
||||
"editSelectedCollection",
|
||||
"markReadFeed",
|
||||
"editSelectedFeed",
|
||||
"deleteCollection",
|
||||
"deleteCollectionAndItems",
|
||||
|
@ -2276,6 +2290,7 @@ var ZoteroPane = new function()
|
|||
show = [
|
||||
m.refreshFeed,
|
||||
m.sep1,
|
||||
m.markReadFeed,
|
||||
m.editSelectedFeed,
|
||||
m.deleteCollectionAndItems,
|
||||
m.sep2,
|
||||
|
@ -2290,6 +2305,10 @@ var ZoteroPane = new function()
|
|||
disable.push(m.exportCollection);
|
||||
}
|
||||
}
|
||||
|
||||
if (collectionTreeRow.ref.unreadCount == 0) {
|
||||
disable.push(m.markReadFeed);
|
||||
}
|
||||
|
||||
// Adjust labels
|
||||
menu.childNodes[m.deleteCollectionAndItems].setAttribute('label', Zotero.getString('pane.collections.menu.delete.feedAndItems'));
|
||||
|
@ -2394,6 +2413,7 @@ var ZoteroPane = new function()
|
|||
'addNote',
|
||||
'addAttachments',
|
||||
'sep2',
|
||||
'toggleRead',
|
||||
'duplicateItem',
|
||||
'deleteItem',
|
||||
'restoreToLibrary',
|
||||
|
@ -2439,7 +2459,7 @@ var ZoteroPane = new function()
|
|||
else if (collectionTreeRow.isPublications()) {
|
||||
show.push(m.deleteFromLibrary);
|
||||
}
|
||||
else {
|
||||
else if (! collectionTreeRow.isFeed()) {
|
||||
show.push(m.moveToTrash);
|
||||
}
|
||||
|
||||
|
@ -2452,6 +2472,8 @@ var ZoteroPane = new function()
|
|||
|
||||
var items = this.getSelectedItems();
|
||||
var canMerge = true, canIndex = true, canRecognize = true, canRename = true;
|
||||
var canMarkRead = collectionTreeRow.isFeed();
|
||||
var markUnread = true;
|
||||
|
||||
if (!Zotero.Fulltext.pdfConverterIsRegistered()) {
|
||||
canIndex = false;
|
||||
|
@ -2459,7 +2481,7 @@ var ZoteroPane = new function()
|
|||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let item = items[i];
|
||||
if (canMerge && !item.isRegularItem() || collectionTreeRow.isDuplicates()) {
|
||||
if (canMerge && !item.isRegularItem() || item.isFeedItem || collectionTreeRow.isDuplicates()) {
|
||||
canMerge = false;
|
||||
}
|
||||
|
||||
|
@ -2475,6 +2497,10 @@ var ZoteroPane = new function()
|
|||
if (canRename && (!item.isAttachment() || item.isTopLevelItem() || item.attachmentLinkMode == Zotero.Attachments.LINK_MODE_LINKED_URL)) {
|
||||
canRename = false;
|
||||
}
|
||||
|
||||
if(canMarkRead && markUnread && !item.isRead) {
|
||||
markUnread = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (canMerge) {
|
||||
|
@ -2489,10 +2515,19 @@ var ZoteroPane = new function()
|
|||
show.push(m.recognizePDF);
|
||||
}
|
||||
|
||||
if (canMarkRead) {
|
||||
show.push(m.toggleRead);
|
||||
if (markUnread) {
|
||||
menu.childNodes[m.toggleRead].setAttribute('label', Zotero.getString('pane.collections.menu.toggleRead.markUnread'));
|
||||
} else {
|
||||
menu.childNodes[m.toggleRead].setAttribute('label', Zotero.getString('pane.collections.menu.toggleRead.markRead'));
|
||||
}
|
||||
}
|
||||
|
||||
var canCreateParent = true;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let item = items[i];
|
||||
if (!item.isTopLevelItem() || !item.isAttachment()) {
|
||||
if (!item.isTopLevelItem() || !item.isAttachment() || item.isFeedItem) {
|
||||
canCreateParent = false;
|
||||
break;
|
||||
}
|
||||
|
@ -2540,7 +2575,7 @@ var ZoteroPane = new function()
|
|||
show.push(m.showInLibrary, m.sep1);
|
||||
}
|
||||
|
||||
if (item.isRegularItem()) {
|
||||
if (item.isRegularItem() && !item.isFeedItem) {
|
||||
show.push(m.addNote, m.addAttachments, m.sep2);
|
||||
}
|
||||
|
||||
|
@ -2575,6 +2610,14 @@ var ZoteroPane = new function()
|
|||
show.push(m.sep4);
|
||||
}
|
||||
}
|
||||
else if (item.isFeedItem) {
|
||||
show.push(m.toggleRead);
|
||||
if (item.isRead) {
|
||||
menu.childNodes[m.toggleRead].setAttribute('label', Zotero.getString('pane.collections.menu.toggleRead.markUnread'));
|
||||
} else {
|
||||
menu.childNodes[m.toggleRead].setAttribute('label', Zotero.getString('pane.collections.menu.toggleRead.markRead'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
show.push(m.duplicateItem);
|
||||
}
|
||||
|
|
|
@ -247,6 +247,7 @@
|
|||
<menuitem class="menuitem-iconic zotero-menuitem-show-duplicates" label="&zotero.toolbar.duplicate.label;" oncommand="ZoteroPane_Local.setVirtual(ZoteroPane_Local.getSelectedLibraryID(), 'duplicates', true)"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-show-unfiled" label="&zotero.collections.showUnfiledItems;" oncommand="ZoteroPane_Local.setVirtual(ZoteroPane_Local.getSelectedLibraryID(), 'unfiled', true)"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-edit-collection" oncommand="ZoteroPane_Local.editSelectedCollection();"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-mark-read-feed" label="&zotero.toolbar.markFeedRead.label;" oncommand="ZoteroPane_Local.markFeedRead();"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-edit-feed" label="&zotero.toolbar.editFeed.label;" oncommand="ZoteroPane_Local.editSelectedFeed();"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-delete-collection" oncommand="ZoteroPane_Local.deleteSelectedCollection();"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-move-to-trash" oncommand="ZoteroPane_Local.deleteSelectedCollection(true);"/>
|
||||
|
@ -275,6 +276,7 @@
|
|||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-toggle-read-item" oncommand="ZoteroPane_Local.toggleSelectedItemsRead();"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-duplicate-item" label="&zotero.items.menu.duplicateItem;" oncommand="ZoteroPane_Local.duplicateSelectedItem().done();"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-delete-collection" oncommand="ZoteroPane_Local.deleteSelectedItems();"/>
|
||||
<menuitem class="menuitem-iconic zotero-menuitem-restore-to-library" label="&zotero.items.menu.restoreToLibrary;" oncommand="ZoteroPane_Local.restoreSelectedItems();"/>
|
||||
|
|
|
@ -104,9 +104,10 @@
|
|||
<!ENTITY zotero.toolbar.lookup.label "Add Item(s) by Identifier">
|
||||
<!ENTITY zotero.toolbar.removeItem.label "Remove Item…">
|
||||
<!ENTITY zotero.toolbar.newCollection.label "New Collection…">
|
||||
<!ENTITY zotero.toolbar.newFeed.label "New Feed…">
|
||||
<!ENTITY zotero.toolbar.refreshFeed.label "Refresh Feed">
|
||||
<!ENTITY zotero.toolbar.editFeed.label "Edit Feed…">
|
||||
<!ENTITY zotero.toolbar.newFeed.label "New Feed…">
|
||||
<!ENTITY zotero.toolbar.refreshFeed.label "Refresh Feed">
|
||||
<!ENTITY zotero.toolbar.editFeed.label "Edit Feed…">
|
||||
<!ENTITY zotero.toolbar.markFeedRead.label "Mark Feed Read">
|
||||
<!ENTITY zotero.toolbar.newGroup "New Group…">
|
||||
<!ENTITY zotero.toolbar.newSubcollection.label "New Subcollection…">
|
||||
<!ENTITY zotero.toolbar.newSavedSearch.label "New Saved Search…">
|
||||
|
|
|
@ -200,7 +200,9 @@ pane.collections.menu.generateReport.collection = Generate Report from Collectio
|
|||
pane.collections.menu.generateReport.savedSearch = Generate Report from Saved Search…
|
||||
pane.collections.menu.generateReport.feed = Generate Report from Feed…
|
||||
|
||||
pane.collections.menu.refresh.feed = Refresh Feed
|
||||
pane.collections.menu.refresh.feed = Refresh Feed
|
||||
pane.collections.menu.toggleRead.markRead = Mark Read
|
||||
pane.collections.menu.toggleRead.markUnread = Mark Unread
|
||||
|
||||
pane.tagSelector.rename.title = Rename Tag
|
||||
pane.tagSelector.rename.message = Please enter a new name for this tag.\n\nThe tag will be changed in all associated items.
|
||||
|
|
Loading…
Reference in a new issue