Bug 364644 - Re-enable livemark-reload functionality. r=sspitzer.

This commit is contained in:
mozilla.mano%sent.com 2007-02-19 20:12:25 +00:00
Родитель 7a6c67d2e7
Коммит 7bd928ec02
4 изменённых файлов: 64 добавлений и 87 удалений

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

@ -275,6 +275,30 @@ PlacesController.prototype = {
}
}
return false;
case "placesCmd_reload":
if (this._view.hasSingleSelection) {
var selectedNode = this._view.selectedNode;
// Livemark containers
if (PlacesUtils.nodeIsLivemarkContainer(selectedNode))
return true;
#ifdef EXTENDED_LIVEBOOKMARKS_UI
// Subscriptions View - not yet exposed anywhere
if (selectedNode.uri.indexOf("livemark%2F") != -1)
return true;
// children of a live bookmark (legacy bookmarks UI doesn't support
// this)
if (PlacesUtils.nodeIsURI(selectedNode)) {
var uri = PlacesUtils._uri(selectedNode.uri);
if (PlacesUtils.annotations
.hasAnnotation(uri, "livemark/bookmarkFeedURI"))
return true;
}
#endif
}
return false;
#endif
default:
return false;
@ -353,6 +377,9 @@ PlacesController.prototype = {
case "placesCmd_moveBookmarks":
this.moveSelectedBookmarks();
break;
case "placesCmd_reload":
this.reloadSelectedLivemarks();
break;
#endif
}
},
@ -647,50 +674,6 @@ PlacesController.prototype = {
return false;
},
#ifdef MOZ_PLACES_BOOKMARKS
/**
* Updates Livemark Commands: Reload
* @param hasSingleSelection
* true if only one item is selected in the view
* @param selectedNode
* The selected nsINavHistoryResultNode
*/
_updateLivemarkCommands:
function PC__updateLivemarkCommands(hasSingleSelection, selectedNode) {
var isLivemarkItem = false;
var strings = document.getElementById("placeBundle");
var command = document.getElementById("placesCmd_reload");
if (hasSingleSelection) {
if (selectedNode.uri.indexOf("livemark%2F") != -1) {
isLivemarkItem = true;
command.setAttribute("label", PlacesUtils.getString("livemarkReloadAll"));
}
else {
var name;
if (PlacesUtils.nodeIsLivemarkContainer(selectedNode)) {
isLivemarkItem = true;
name = selectedNode.title;
}
else if (PlacesUtils.nodeIsURI(selectedNode)) {
var uri = PlacesUtils._uri(selectedNode.uri);
isLivemarkItem = PlacesUtils.annotations.hasAnnotation(uri, "livemark/bookmarkFeedURI");
if (isLivemarkItem)
name = selectedNode.parent.title;
}
if (isLivemarkItem)
command.setAttribute("label", PlacesUtils.getFormattedString("livemarkReloadOne", [name]));
}
}
if (!isLivemarkItem)
command.setAttribute("label", PlacesUtils.getString("livemarkReload"));
this._setEnabled("placesCmd_reload", isLivemarkItem);
},
#endif
/**
* Gathers information about the selected nodes according to the following
* rules:
@ -965,31 +948,35 @@ PlacesController.prototype = {
},
/**
*
* Reloads the livemarks associated with the selection. For the "Subscriptions"
* folder, reloads all livemarks; for a livemark folder, reloads its children;
* for a single livemark, reloads its siblings (the children of its parent).
* Reloads the livemarks associated with the selection. For the
* "Subscriptions" folder, reloads all livemarks; for a livemark folder,
* reloads its children; for a single livemark, reloads its siblings (the
* children of its parent).
*/
reloadSelectedLivemarks: function PC_reloadSelectedLivemarks() {
var selectedNode = this._view.selectedNode;
if (this._view.hasSingleSelection) {
#ifdef EXTENDED_LIVEBOOKMARKS_UI
if (selectedNode.uri.indexOf("livemark%2F") != -1) {
PlacesUtils.livemarks.reloadAllLivemarks();
return;
}
else {
var folder = null;
if (PlacesUtils.nodeIsLivemarkContainer(selectedNode)) {
folder = asFolder(selectedNode);
}
else if (PlacesUtils.nodeIsURI(selectedNode)) {
var uri = PlacesUtils._uri(selectedNode.uri);
var isLivemarkItem = PlacesUtils.annotations.hasAnnotation(uri, "livemark/bookmarkFeedURI");
if (isLivemarkItem)
folder = asFolder(selectedNode.parent);
}
if (folder)
PlacesUtils.livemarks.reloadLivemarkFolder(folder.folderId);
#endif
var folder = null;
if (PlacesUtils.nodeIsLivemarkContainer(selectedNode)) {
folder = asFolder(selectedNode);
}
#ifdef EXTENDED_LIVEBOOKMARKS_UI
else if (PlacesUtils.nodeIsURI(selectedNode)) {
var uri = PlacesUtils._uri(selectedNode.uri);
var isLivemarkItem =
PlacesUtils.annotations.hasAnnotation(uri, "livemark/bookmarkFeedURI");
if (isLivemarkItem)
folder = asFolder(selectedNode.parent);
}
#endif
if (folder)
PlacesUtils.livemarks.reloadLivemarkFolder(folder.folderId);
}
},
@ -2145,6 +2132,7 @@ function goUpdatePlacesCommands() {
goUpdateCommand("placesCmd_new:separator");
goUpdateCommand("placesCmd_show:info");
goUpdateCommand("placesCmd_moveBookmarks");
// XXXmano todo: sort and livemarks commands handling
goUpdateCommand("placesCmd_reload");
// XXXmano todo: sort commands handling
#endif
}

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

@ -142,10 +142,6 @@
<key id="placesKey_rename"
command="placesCmd_rename"
keycode="VK_F2"/>
<key id="placesKey_reload"
command="placesCmd_reload"
key="&cmd.reload.key;"
modifiers="accel"/>
</keyset>
<keyset id="editMenuKeys">
@ -203,11 +199,6 @@
<menuseparator/>
<menuitem id="menu_selectAll"/>
<menuseparator/>
<menuitem id="editSortByName"
command="placesCmd_sortby:name"
label="&cmd.sortby_name.label;"
accesskey="&cmd.sortby_name.accesskey;"/>
<menuseparator/>
<menuitem id="editFindAll"
command="OrganizerCommand_find:all"
key="placesKey_find:all"/>
@ -219,6 +210,11 @@
label="&cmd.moveBookmarks.menuLabel;"
accesskey="&cmd.moveBookmarks.menuAccesskey;"/>
<menuseparator/>
<menuitem id="editReload"
command="placesCmd_reload"
label="&cmd.reloadLivebookmark.label;"
accesskey="&cmd.reloadLivebookmark.accesskey;"/>
<menuseparator/>
<menuitem id="properties"
command="placesCmd_show:info"
key="placesKey_show:info"
@ -235,12 +231,6 @@
onpopupshowing="ViewMenu.populate(event);"
oncommand="ViewMenu.setSortColumn(event.target.getAttribute('column'), null);">
<menupopup>
<menuitem id="viewReload"
command="placesCmd_reload"
key="placesKey_reload"
label="&cmd.reload.label;"
accesskey="&cmd.reload.accesskey;"/>
<menuseparator/>
<menuitem id="viewToolbar" type="checkbox"
label="&view.toolbar.label;" accesskey="&view.toolbar.accesskey;"/>
<menu id="viewColumns"

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

@ -83,10 +83,11 @@
<command id="placesCmd_rename"
oncommand="goDoCommand('placesCmd_show:info');"
observes="placesCmd_show:info"/>
<!-- XXXmano bug 364644: not yet supported -->
<command id="placesCmd_reload"
disabled="true"/>
<command id="placesCmd_sortby:name"/>
oncommand="goDoCommand('placesCmd_reload');"/>
<!-- Bug 325342 -->
<command id="placesCmd_sortby:name" disabled="true"/>
<command id="placesCmd_moveBookmarks"
oncommand="goDoCommand('placesCmd_moveBookmarks');"/>
@ -166,8 +167,8 @@
<menuseparator id="placesContext_deleteSeparator"/>
<menuitem id="placesContext_reload"
command="placesCmd_reload"
label="&cmd.reload.label;"
accesskey="&cmd.reload.accesskey;"
label="&cmd.reloadLivebookmark.label;"
accesskey="&cmd.reloadLivebookmark.accesskey;"
selection="livemark/feedURI|allLivemarks"/>
<menuitem id="placesContext_sortby:name"
command="placesCmd_sortby:name"

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

@ -157,12 +157,10 @@
"New Separator">
<!ENTITY cmd.new_separator.accesskey
"S">
<!ENTITY cmd.reload.label
"Reload">
<!ENTITY cmd.reload.accesskey
<!ENTITY cmd.reloadLivebookmark.label
"Reload Live Bookmark">
<!ENTITY cmd.reloadLivebookmark.accesskey
"R">
<!ENTITY cmd.reload.key
"r">
<!ENTITY cmd.groupby_site.label
"Group by Site">
<!ENTITY cmd.groupby_site.accesskey