Added (Empty) menu item for menus that don't have any results.

bug=320876 r=brettw
This commit is contained in:
annie.sullivan%gmail.com 2005-12-20 01:31:51 +00:00
parent e68d7c5bb6
commit 90ce75f82a
2 changed files with 37 additions and 26 deletions

View File

@ -93,33 +93,43 @@
this._cleanMenu();
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var cc = this._result.childCount;
for (var i = 0; i < cc; ++i) {
var child = this._result.getChild(i);
if (cc > 0) {
for (var i = 0; i < cc; ++i) {
var child = this._result.getChild(i);
var element = null;
if (PlacesController.nodeIsURL(child)) {
element = document.createElementNS(XULNS, "menuitem");
element.setAttribute("label", child.title);
element.setAttribute("url", child.url);
element.setAttribute("statustext", child.url);
element.setAttribute("image", child.icon.spec);
element.className = "menuitem-iconic bookmark-item";
}
else if (PlacesController.nodeIsFolder(child)) {
element = document.createElementNS(XULNS, "menu");
element.setAttribute("type", "menu");
element.setAttribute("container", "true");
element.setAttribute("label", child.title);
var popup = document.createElementNS(XULNS, "menupopup");
popup.setAttribute("type", "places");
element.appendChild(popup);
popup.folderId = child.folderId;
element.className = "menu-iconic bookmark-item";
}
// else if (nodeIsQuery) ... add menu to build kids
if (element) {
element.node = child;
this.appendChild(element);
}
}
} else {
var bundle = document.getElementById("placeBundle");
var label = bundle.getString("bookmarksMenuEmptyFolder");
var element = null;
if (PlacesController.nodeIsURL(child)) {
element = document.createElementNS(XULNS, "menuitem");
element.setAttribute("label", child.title);
element.setAttribute("url", child.url);
element.setAttribute("statustext", child.url);
element.setAttribute("image", child.icon.spec);
element.className = "menuitem-iconic bookmark-item";
}
else if (PlacesController.nodeIsFolder(child)) {
element = document.createElementNS(XULNS, "menu");
element.setAttribute("type", "menu");
element.setAttribute("container", "true");
element.setAttribute("label", child.title);
var popup = document.createElementNS(XULNS, "menupopup");
popup.setAttribute("type", "places");
element.appendChild(popup);
popup.folderId = child.folderId;
element.className = "menu-iconic bookmark-item";
}
// else if (nodeIsQuery) ... add menu to build kids
if (element) {
element.node = child;
this.appendChild(element);
}
element = document.createElementNS(XULNS, "menuitem");
element.setAttribute("label", label);
element.setAttribute("disabled", true);
this.appendChild(element);
}
]]></body>
</method>

View File

@ -20,6 +20,7 @@ newFolderDefault=New Folder
bookmarksMenuName=Bookmarks Menu
bookmarksToolbarName=Bookmarks Toolbar
bookmarksMenuEmptyFolder=(Empty)
bookmarksLivemarkLoading=Live Bookmark loading...
bookmarksLivemarkFailed=Live Bookmark feed failed to load.