From bbb80514d6ff1e8f7b495a979d0bfddf598e4f78 Mon Sep 17 00:00:00 2001 From: "mozilla.mano@sent.com" Date: Thu, 31 May 2007 17:39:09 -0700 Subject: [PATCH] Bug 374613 - the context menu of places bookmarks with live titles is missing the 'reload' option. patch from Steve Won , r=me, a=mconnor. --- .../components/places/content/controller.js | 33 +++++++++++++++++-- browser/components/places/content/places.xul | 4 +++ .../places/content/placesOverlay.xul | 7 ++++ browser/components/places/content/utils.js | 11 +++++++ .../en-US/chrome/browser/places/places.dtd | 4 +++ 5 files changed, 56 insertions(+), 3 deletions(-) diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js index 6bdda075c489..cc6508f310a9 100755 --- a/browser/components/places/content/controller.js +++ b/browser/components/places/content/controller.js @@ -180,6 +180,16 @@ PlacesController.prototype = { return true; } return false; + case "placesCmd_reloadMicrosummary": + if (this._view.hasSingleSelection) { + var selectedNode = this._view.selectedNode; + if (PlacesUtils.nodeIsBookmark(selectedNode)) { + var mss = PlacesUtils.microsummaries; + if (mss.hasMicrosummary(selectedNode.itemId)) + return true; + } + } + return false; case "placesCmd_reload": if (this._view.hasSingleSelection) { var selectedNode = this._view.selectedNode; @@ -298,6 +308,9 @@ PlacesController.prototype = { case "placesCmd_reload": this.reloadSelectedLivemarks(); break; + case "placesCmd_reloadMicrosummary": + this.reloadSelectedMicrosummary(); + break; case "placesCmd_sortBy:name": this.sortFolderByName(); break; @@ -514,8 +527,12 @@ PlacesController.prototype = { case Ci.nsINavHistoryResultNode.RESULT_TYPE_FULL_VISIT: nodeData["link"] = true; uri = PlacesUtils._uri(node.uri); - if (PlacesUtils.nodeIsBookmark(node)) + if (PlacesUtils.nodeIsBookmark(node)) { nodeData["bookmark"] = true; + var mss = PlacesUtils.microsummaries; + if (mss.hasMicrosummary(node.itemId)) + nodeData["microsummary"] = true; + } break; case Ci.nsINavHistoryResultNode.RESULT_TYPE_DAY: nodeData["day"] = true; @@ -775,6 +792,16 @@ PlacesController.prototype = { } }, + /** + * Reload the microsummary associated with the selection + */ + reloadSelectedMicrosummary: function PC_reloadSelectedMicrosummary() { + var selectedNode = this._view.selectedNode; + var mss = PlacesUtils.microsummaries; + if (mss.hasMicrosummary(selectedNode.itemId)) + mss.refreshMicrosummary(selectedNode.itemId); + }, + /** * Gives the user a chance to cancel loading lots of tabs at once */ @@ -2137,8 +2164,7 @@ function PlacesEditBookmarkMicrosummaryTransaction(aID, newMicrosummary) { PlacesEditBookmarkMicrosummaryTransaction.prototype = { __proto__: PlacesBaseTransaction.prototype, - mss: Cc["@mozilla.org/microsummary/service;1"]. - getService(Ci.nsIMicrosummaryService), + mss: PlacesUtils.microsummaries, doTransaction: function PEBMT_doTransaction() { this._oldMicrosummary = this.mss.getMicrosummary(this.id); @@ -2231,6 +2257,7 @@ function goUpdatePlacesCommands() { goUpdateCommand("placesCmd_moveBookmarks"); goUpdateCommand("placesCmd_setAsBookmarksToolbarFolder"); goUpdateCommand("placesCmd_reload"); + goUpdateCommand("placesCmd_reloadMicrosummary"); goUpdateCommand("placesCmd_sortBy:name"); #endif } diff --git a/browser/components/places/content/places.xul b/browser/components/places/content/places.xul index 7bf698f5f942..efb347805bba 100755 --- a/browser/components/places/content/places.xul +++ b/browser/components/places/content/places.xul @@ -223,6 +223,10 @@ command="placesCmd_reload" label="&cmd.reloadLivebookmark.label;" accesskey="&cmd.reloadLivebookmark.accesskey;"/> + + + + +