Allow double-click on a saved search to edit

This commit is contained in:
Dan Stillman 2007-02-01 02:19:31 +00:00
parent c33da4ff73
commit cec78ed348
2 changed files with 23 additions and 14 deletions

View File

@ -381,7 +381,7 @@ var ZoteroPane = new function()
height = height + 121; height = height + 121;
} }
Zotero.debug('Setting Zotero pane minheight to ' + height); //Zotero.debug('Setting Zotero pane minheight to ' + height);
zoteroPane.setAttribute('minheight', height); zoteroPane.setAttribute('minheight', height);
// Fix bug whereby resizing the Z pane downward after resizing // Fix bug whereby resizing the Z pane downward after resizing
@ -1125,22 +1125,30 @@ var ZoteroPane = new function()
// Adapted from: http://www.xulplanet.com/references/elemref/ref_tree.html#cmnote-9 // Adapted from: http://www.xulplanet.com/references/elemref/ref_tree.html#cmnote-9
function onDoubleClick(event, tree) function onDoubleClick(event, tree)
{ {
if (event && tree && (event.type == "click" || event.type == "dblclick")) if (event && tree && event.type == "dblclick") {
{
var row = {}, col = {}, obj = {}; var row = {}, col = {}, obj = {};
tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj); tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj);
// obj.value == cell/text/image
// TODO: handle collection double-click // obj.value == 'cell'/'text'/'image'
if (obj.value && itemsView && itemsView.selection.currentIndex > -1) if (!obj.value) {
{ return false;
}
if (tree.id == 'zotero-collections-tree') {
var s = this.getSelectedSavedSearch();
if (s) {
this.editSelectedCollection();
}
}
else if (tree.id == 'zotero-items-tree') {
if (itemsView && itemsView.selection.currentIndex > -1) {
var item = getSelectedItems()[0]; var item = getSelectedItems()[0];
if(item && item.isNote()) if (item && item.isNote()) {
{
document.getElementById('zotero-view-note-button').doCommand(); document.getElementById('zotero-view-note-button').doCommand();
} }
else if(item && item.isAttachment()) else if (item && item.isAttachment()) {
{ this.viewSelectedAttachment();
viewSelectedAttachment(); }
} }
} }
} }

View File

@ -120,6 +120,7 @@
</toolbarbutton> </toolbarbutton>
</toolbar> </toolbar>
<tree id="zotero-collections-tree" hidecolumnpicker="true" context="zotero-collectionmenu" <tree id="zotero-collections-tree" hidecolumnpicker="true" context="zotero-collectionmenu"
ondblclick="ZoteroPane.onDoubleClick(event, this);"
onselect="ZoteroPane.onCollectionSelected();" seltype="single" onselect="ZoteroPane.onCollectionSelected();" seltype="single"
ondragdrop="nsDragAndDrop.drop(event,ZoteroPane.getCollectionsView())" ondragdrop="nsDragAndDrop.drop(event,ZoteroPane.getCollectionsView())"
ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ZoteroPane.getCollectionsView());" ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ZoteroPane.getCollectionsView());"