Fix bug # 22521: context menus should work on background of bookmarks window and background of bookmarks sidebar panel.

This commit is contained in:
rjc%netscape.com 2000-03-15 09:59:04 +00:00
Родитель 574b4eddae
Коммит 438c8f8399
2 изменённых файлов: 29 добавлений и 11 удалений

Просмотреть файл

@ -205,7 +205,7 @@ function doPaste()
if (RDFC.IndexOf(IDRes) > 0)
{
dump("Unable to add ID:'" + theID + "' as its already in this folder.\n");
debug("Unable to add ID:'" + theID + "' as its already in this folder.\n");
continue;
}
@ -506,17 +506,29 @@ function fillContextMenu(name)
var select_list = treeNode.selectedItems;
debug("# of Nodes selected: " + treeNode.selectedItems.length);
debug("# of Nodes selected: " + treeNode.selectedItems.length + "\n");
// perform intersection of commands over selected nodes
var cmdArray = new Array();
for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++)
var selectLength = select_list.length;
if (selectLength == 0) selectLength = 1;
for (var nodeIndex=0; nodeIndex < selectLength; nodeIndex++)
{
var node = select_list[nodeIndex];
if (!node) break;
var id = node.getAttribute("id");
if (!id) break;
var id = null;
// if nothing is selected, get commands for the "ref" of the bookmarks root
if (select_list.length == 0)
{
id = treeNode.getAttribute("ref");
if (!id) break;
}
else
{
var node = select_list[nodeIndex];
if (!node) break;
id = node.getAttribute("id");
if (!id) break;
}
var rdfNode = rdf.GetResource(id);
if (!rdfNode) break;
var cmdEnum = db.GetAllCmds(rdfNode);
@ -562,8 +574,10 @@ function fillContextMenu(name)
var rdfNameResource = rdf.GetResource("http://home.netscape.com/NC-rdf#Name");
if (!rdfNameResource) return(false);
/*
// build up menu items
if (cmdArray.length < 1) return(false);
*/
for (var cmdIndex = 0; cmdIndex < cmdArray.length; cmdIndex++)
{
@ -604,10 +618,10 @@ function fillContextMenu(name)
}
// and then add a "Properties" menu items
var propMenuName = "Properties...";
var propMenuName = "Properties..."; // XXX localize
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("value", "Properties..."); // XXX localize
menuItem.setAttribute("value", propMenuName);
menuItem.setAttribute("oncommand", "return BookmarkProperties();");
popupNode.appendChild(menuItem);
}

Просмотреть файл

@ -3239,7 +3239,7 @@ nsBookmarksService::GetAllCmds(nsIRDFResource* source,
{
cmdArray->AppendElement(kNC_BookmarkCommand_DeleteBookmark);
}
if (isBookmarkFolder)
if (isBookmarkFolder && (source != kNC_BookmarksRoot))
{
cmdArray->AppendElement(kNC_BookmarkCommand_DeleteBookmarkFolder);
}
@ -3640,6 +3640,10 @@ nsBookmarksService::ReadBookmarks()
NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to make NC:BookmarksRoot a sequence");
if (NS_FAILED(rv)) return rv;
// Make sure bookmark's root has the correct type
rv = mInner->Assert(kNC_BookmarksRoot, kRDF_type, kNC_Folder, PR_TRUE);
if (NS_FAILED(rv)) return rv;
PRBool foundIERoot = PR_FALSE;
#ifdef DEBUG