Bug 374613 - the context menu of places bookmarks with live titles is missing the 'reload' option. patch from Steve Won <swon@mozilla.com>, r=me, a=mconnor.

This commit is contained in:
mozilla.mano@sent.com 2007-05-31 17:39:09 -07:00
parent 748826034d
commit bbb80514d6
5 changed files with 56 additions and 3 deletions

View File

@ -180,6 +180,16 @@ PlacesController.prototype = {
return true; return true;
} }
return false; 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": case "placesCmd_reload":
if (this._view.hasSingleSelection) { if (this._view.hasSingleSelection) {
var selectedNode = this._view.selectedNode; var selectedNode = this._view.selectedNode;
@ -298,6 +308,9 @@ PlacesController.prototype = {
case "placesCmd_reload": case "placesCmd_reload":
this.reloadSelectedLivemarks(); this.reloadSelectedLivemarks();
break; break;
case "placesCmd_reloadMicrosummary":
this.reloadSelectedMicrosummary();
break;
case "placesCmd_sortBy:name": case "placesCmd_sortBy:name":
this.sortFolderByName(); this.sortFolderByName();
break; break;
@ -514,8 +527,12 @@ PlacesController.prototype = {
case Ci.nsINavHistoryResultNode.RESULT_TYPE_FULL_VISIT: case Ci.nsINavHistoryResultNode.RESULT_TYPE_FULL_VISIT:
nodeData["link"] = true; nodeData["link"] = true;
uri = PlacesUtils._uri(node.uri); uri = PlacesUtils._uri(node.uri);
if (PlacesUtils.nodeIsBookmark(node)) if (PlacesUtils.nodeIsBookmark(node)) {
nodeData["bookmark"] = true; nodeData["bookmark"] = true;
var mss = PlacesUtils.microsummaries;
if (mss.hasMicrosummary(node.itemId))
nodeData["microsummary"] = true;
}
break; break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_DAY: case Ci.nsINavHistoryResultNode.RESULT_TYPE_DAY:
nodeData["day"] = true; 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 * Gives the user a chance to cancel loading lots of tabs at once
*/ */
@ -2137,8 +2164,7 @@ function PlacesEditBookmarkMicrosummaryTransaction(aID, newMicrosummary) {
PlacesEditBookmarkMicrosummaryTransaction.prototype = { PlacesEditBookmarkMicrosummaryTransaction.prototype = {
__proto__: PlacesBaseTransaction.prototype, __proto__: PlacesBaseTransaction.prototype,
mss: Cc["@mozilla.org/microsummary/service;1"]. mss: PlacesUtils.microsummaries,
getService(Ci.nsIMicrosummaryService),
doTransaction: function PEBMT_doTransaction() { doTransaction: function PEBMT_doTransaction() {
this._oldMicrosummary = this.mss.getMicrosummary(this.id); this._oldMicrosummary = this.mss.getMicrosummary(this.id);
@ -2231,6 +2257,7 @@ function goUpdatePlacesCommands() {
goUpdateCommand("placesCmd_moveBookmarks"); goUpdateCommand("placesCmd_moveBookmarks");
goUpdateCommand("placesCmd_setAsBookmarksToolbarFolder"); goUpdateCommand("placesCmd_setAsBookmarksToolbarFolder");
goUpdateCommand("placesCmd_reload"); goUpdateCommand("placesCmd_reload");
goUpdateCommand("placesCmd_reloadMicrosummary");
goUpdateCommand("placesCmd_sortBy:name"); goUpdateCommand("placesCmd_sortBy:name");
#endif #endif
} }

View File

@ -223,6 +223,10 @@
command="placesCmd_reload" command="placesCmd_reload"
label="&cmd.reloadLivebookmark.label;" label="&cmd.reloadLivebookmark.label;"
accesskey="&cmd.reloadLivebookmark.accesskey;"/> accesskey="&cmd.reloadLivebookmark.accesskey;"/>
<menuitem id="editReloadMicrosummary"
command="placesCmd_reloadMicrosummary"
label="&cmd.reloadMicrosummary.label;"
accesskey="&cmd.reloadMicrosummary.accesskey;"/>
<menuseparator/> <menuseparator/>
<menuitem id="properties" <menuitem id="properties"
command="placesCmd_show:info" command="placesCmd_show:info"

View File

@ -89,6 +89,8 @@
observes="placesCmd_show:info"/> observes="placesCmd_show:info"/>
<command id="placesCmd_reload" <command id="placesCmd_reload"
oncommand="goDoCommand('placesCmd_reload');"/> oncommand="goDoCommand('placesCmd_reload');"/>
<command id="placesCmd_reloadMicrosummary"
oncommand="goDoCommand('placesCmd_reloadMicrosummary');"/>
<command id="placesCmd_sortBy:name" <command id="placesCmd_sortBy:name"
oncommand="goDoCommand('placesCmd_sortBy:name');"/> oncommand="goDoCommand('placesCmd_sortBy:name');"/>
<command id="placesCmd_moveBookmarks" <command id="placesCmd_moveBookmarks"
@ -179,6 +181,11 @@
label="&cmd.reloadLivebookmark.label;" label="&cmd.reloadLivebookmark.label;"
accesskey="&cmd.reloadLivebookmark.accesskey;" accesskey="&cmd.reloadLivebookmark.accesskey;"
selection="livemark/feedURI|allLivemarks"/> selection="livemark/feedURI|allLivemarks"/>
<menuitem id="placesContext_reloadMicrosummary"
command="placesCmd_reloadMicrosummary"
label="&cmd.reloadMicrosummary.label;"
accesskey="&cmd.reloadMicrosummary.accesskey;"
selection="microsummary"/>
<menuitem id="placesContext_sortBy:name" <menuitem id="placesContext_sortBy:name"
command="placesCmd_sortBy:name" command="placesCmd_sortBy:name"
label="&cmd.sortby_name.label;" label="&cmd.sortby_name.label;"

View File

@ -138,6 +138,17 @@ var PlacesUtils = {
return this._favicons; return this._favicons;
}, },
/**
* The Microsummary Service
*/
_microsummaries: null,
get microsummaries() {
if (!this._microsummaries)
this._microsummaries = Cc["@mozilla.org/microsummary/service;1"].
getService(Ci.nsIMicrosummaryService);
return this._microsummaries;
},
_RDF: null, _RDF: null,
get RDF() { get RDF() {
if (!this._RDF) if (!this._RDF)

View File

@ -161,6 +161,10 @@
"Reload Live Bookmark"> "Reload Live Bookmark">
<!ENTITY cmd.reloadLivebookmark.accesskey <!ENTITY cmd.reloadLivebookmark.accesskey
"R"> "R">
<!ENTITY cmd.reloadMicrosummary.label
"Reload Live Title">
<!ENTITY cmd.reloadMicrosummary.accesskey
"R">
<!ENTITY cmd.groupby_site.label <!ENTITY cmd.groupby_site.label
"Group by Site"> "Group by Site">
<!ENTITY cmd.groupby_site.accesskey <!ENTITY cmd.groupby_site.accesskey