diff --git a/browser/components/places/content/commands.inc b/browser/components/places/content/commands.inc index f13c2c19c621..429c9994e018 100755 --- a/browser/components/places/content/commands.inc +++ b/browser/components/places/content/commands.inc @@ -36,7 +36,7 @@ > + onpopupshowing="this._view = PlacesUtils.getViewForNode(document.popupNode); + this._view.buildContextMenu(this);" + onpopuphiding="this._view.destroyContextMenu();"> diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js index aaaeb386d090..00e9c0bf4b7d 100755 --- a/browser/components/places/content/controller.js +++ b/browser/components/places/content/controller.js @@ -181,33 +181,28 @@ PlacesController.prototype = { isCommandEnabled: function PC_isCommandEnabled(command) { switch (command) { case "cmd_undo": - return this._view.enableEditCommands && PlacesUtils.tm.numberOfUndoItems > 0; + return PlacesUtils.tm.numberOfUndoItems > 0; case "cmd_redo": - return this._view.enableEditCommands && PlacesUtils.tm.numberOfRedoItems > 0; + return PlacesUtils.tm.numberOfRedoItems > 0; case "cmd_cut": case "cmd_delete": - return this._view.enableEditCommands && - !this._rootNodeIsSelected() && + return !this._rootNodeIsSelected() && !this._selectionOverlapsSystemArea() && this._hasRemovableSelection(); case "cmd_copy": - return this._view.enableEditCommands && - !this._selectionOverlapsSystemArea() && + return !this._selectionOverlapsSystemArea() && this._view.hasSelection; case "cmd_paste": - return this._view.enableEditCommands && - !this._selectionOverlapsSystemArea() && + return !this._selectionOverlapsSystemArea() && this._canInsert() && this._hasClipboardData() && this._canPaste(); case "cmd_selectAll": - if (this._view.enableEditCommands) { - if (this._view.selType != "single") { - var result = this._view.getResult(); - if (result) { - var container = asContainer(result.root); - if (container.childCount > 0); - return true; - } + if (this._view.selType != "single") { + var result = this._view.getResult(); + if (result) { + var container = asContainer(result.root); + if (container.childCount > 0); + return true; } } return false; diff --git a/browser/components/places/content/menu.xml b/browser/components/places/content/menu.xml index 243a0431b289..190af99cb6c0 100755 --- a/browser/components/places/content/menu.xml +++ b/browser/components/places/content/menu.xml @@ -67,10 +67,7 @@ - - - false - + + + + + + + - if (event.target == this) { - this._enableEditCommands = true; - PlacesUtils.updateAllCommands(); + if (event.target == this) this.onPopupShowing(); - } if (event.target == this) { @@ -750,8 +746,6 @@ // automatically opened when dragged over. Turn off this attribute // when the folder closes because it is no longer applicable. this.removeAttribute("autoopened"); - this._enableEditCommands = false; - PlacesUtils.updateAllCommands(); } - false - - - - - - + + + + + @@ -920,8 +909,6 @@ this._selection = event.target.node; else this._selection = this.getResult().root; - - window.updateCommands("places-select"); ]]> + + + + + - - - - - +