From 154f9e9494db0d76ce79d58ef0acd4a10a44ca83 Mon Sep 17 00:00:00 2001 From: "rjc%netscape.com" Date: Wed, 15 Mar 2000 03:27:34 +0000 Subject: [PATCH] Part of fix for bug # 17333: add "Properties..." menuitem to context menu (if appropriate). Code from aaronr@us.ibm.com, review/slight mods: me. --- .../bookmarks/resources/bookmarks.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/xpfe/components/bookmarks/resources/bookmarks.js b/xpfe/components/bookmarks/resources/bookmarks.js index 470eadba06a3..356542491f48 100644 --- a/xpfe/components/bookmarks/resources/bookmarks.js +++ b/xpfe/components/bookmarks/resources/bookmarks.js @@ -584,6 +584,32 @@ function fillContextMenu(name) popupNode.appendChild(menuItem); } + // if one and only one node is selected + if (treeNode.selectedItems.length == 1) + { + // and its a bookmark or a bookmark folder (there can be other types, + // not just separators, so check explicitly for what we allow) + var type = select_list[0].getAttribute("type"); + if ((type == "http://home.netscape.com/NC-rdf#Bookmark") || + (type == "http://home.netscape.com/NC-rdf#Folder")) + { + // then add a menu separator (if necessary) + if (popupNode.childNodes.length > 0) + { + var menuSep = document.createElement("menuseparator"); + popupNode.appendChild(menuSep); + } + + // and then add a "Properties" menu items + var propMenuName = "Properties..."; + + var menuItem = document.createElement("menuitem"); + menuItem.setAttribute("value", "Properties..."); // XXX localize + menuItem.setAttribute("oncommand", "return BookmarkProperties();"); + popupNode.appendChild(menuItem); + } + } + return(true); }