Fix error in in Error Conosle when clicking on some items

This commit is contained in:
Dan Stillman 2013-02-22 18:41:49 -05:00
parent ab1d7a0f25
commit 937c0a3a3a

View file

@ -2380,11 +2380,11 @@ var ZoteroPane = new function()
return;
}
var itemGroup = ZoteroPane_Local.collectionsView._getItemAtRow(row.value);
if (tree.id == 'zotero-collections-tree') {
let itemGroup = ZoteroPane_Local.collectionsView._getItemAtRow(row.value);
// Prevent the tree's select event from being called for a click
// on a library sync error icon
if (tree.id == 'zotero-collections-tree') {
if (itemGroup.isLibrary(true)) {
if (col.value.id == 'zotero-collections-sync-status-column') {
var libraryID = itemGroup.isLibrary() ? 0 : itemGroup.ref.libraryID;
@ -2399,7 +2399,10 @@ var ZoteroPane = new function()
// Automatically select all equivalent items when clicking on an item
// in duplicates view
else if (tree.id == 'zotero-items-tree' && itemGroup.isDuplicates()) {
else if (tree.id == 'zotero-items-tree') {
let itemGroup = ZoteroPane_Local.getItemGroup();
if (itemGroup.isDuplicates()) {
// Trigger only on primary-button single clicks with modifiers
// (so that items can still be selected and deselected manually)
if (!event || event.detail != 1 || event.button != 0 || event.metaKey || event.shiftKey) {
@ -2432,6 +2435,7 @@ var ZoteroPane = new function()
event.stopPropagation();
}
}
}
// Adapted from: http://www.xulplanet.com/references/elemref/ref_tree.html#cmnote-9
@ -2452,7 +2456,9 @@ var ZoteroPane = new function()
if (row.value == -1) {
return;
}
var itemGroup = ZoteroPane_Local.collectionsView._getItemAtRow(row.value);
if (tree.id == 'zotero-collections-tree') {
let itemGroup = ZoteroPane_Local.collectionsView._getItemAtRow(row.value);
// Show the error panel when clicking a library-specific
// sync error icon
@ -2476,16 +2482,18 @@ var ZoteroPane = new function()
panel.openPopup(anchor, "after_start", x, y, false, false);
}
return;
}
}
// The Mozilla tree binding fires select() in mousedown(),
// but if when it gets to click() the selection differs from
// what it expects (say, because multiple items had been
// selected during mousedown(), as is the case in duplicates mode),
// it fires select() again. We prevent that here.
else if (itemGroup.isDuplicates() && tree.id == 'zotero-items-tree') {
else if (tree.id == 'zotero-items-tree') {
let itemGroup = ZoteroPane_Local.getItemGroup();
if (itemGroup.isDuplicates()) {
if (event.metaKey || event.shiftKey) {
return;
}
@ -2497,6 +2505,7 @@ var ZoteroPane = new function()
event.stopPropagation();
event.preventDefault();
}
}
return;
}