commit aee214ed44a866c81fc7ecfbdfc80e2874837fe0
parent bb4db297c490d642b294e6ef04d9fa521c20d482
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 11 Apr 2016 02:52:09 -0400
Update collection context menu once items have loaded
Otherwise, when right-clicking on a collection that's not currently
selected, some of the menu items appear gray at first, and a second
right-click is necessary after the items have loaded. This way the menu
items turn black once the items have loaded.
Diffstat:
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/xpcom/libraryTreeView.js b/chrome/content/zotero/xpcom/libraryTreeView.js
@@ -37,6 +37,10 @@ Zotero.LibraryTreeView = function () {
};
Zotero.LibraryTreeView.prototype = {
+ get initialized() {
+ return this._initialized;
+ },
+
addEventListener: function(event, listener) {
if (event == 'load') {
// If already initialized run now
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -2338,13 +2338,18 @@ var ZoteroPane = new function()
m.loadReport
];
var s = [m.exportCollection, m.createBibCollection, m.loadReport];
+
if (!this.itemsView.rowCount) {
- if (!this.collectionsView.isContainerEmpty(this.collectionsView.selection.currentIndex)) {
- disable = [m.createBibCollection, m.loadReport];
- }
- else {
- disable = s;
+ // If no items, it might be because this was a right-click on a different collection
+ // and the new collection's items are still loading, so update the menu after loading.
+ // This causes export/createBib/loadReport to appear gray in the menu at first and then
+ // turn black once there are items.
+ if (!this.itemsView.initialized) {
+ this.itemsView.addEventListener('load', function () {
+ this.buildCollectionContextMenu();
+ }.bind(this));
}
+ disable = s;
}
// Adjust labels