Bug 422181 - Add Create Bookmark in history item context menu, r=mak77

This commit is contained in:
Michael Kohler 2009-05-11 11:06:06 +02:00
Родитель a2ec3984cf
Коммит 4b73eab455
6 изменённых файлов: 20 добавлений и 29 удалений

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

@ -192,6 +192,9 @@ PlacesController.prototype = {
!PlacesUtils.nodeIsReadOnly(selectedNode) &&
this._view.getResult().sortingMode ==
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
case "placesCmd_createBookmark":
var node = this._view.selectedNode;
return node && PlacesUtils.nodeIsURI(node) && node.itemId == -1;
default:
return false;
}
@ -280,6 +283,10 @@ PlacesController.prototype = {
case "placesCmd_sortBy:name":
this.sortFolderByName();
break;
case "placesCmd_createBookmark":
var node = this._view.selectedNode;
PlacesUIUtils.showMinimalAddBookmarkUI(PlacesUtils._uri(node.uri), node.title);
break;
}
},

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

@ -61,35 +61,16 @@ function HistorySidebarInit()
document.getElementById("bydayandsite").setAttribute("checked", "true");
else
document.getElementById("byday").setAttribute("checked", "true");
initContextMenu();
searchHistory("");
}
function initContextMenu() {
// Insert "Bookmark This Link" right before the copy item
document.getElementById("placesContext")
.insertBefore(document.getElementById("addBookmarkContextItem"),
document.getElementById("placesContext_copy"));
}
function GroupBy(groupingType)
{
gHistoryGrouping = groupingType;
searchHistory(gSearchBox.value);
}
function historyAddBookmarks()
{
// no need to check gHistoryTree.view.selection.count
// node will be null if there is a multiple selection
// or if the selected item is not a URI node
var node = gHistoryTree.selectedNode;
if (node && PlacesUtils.nodeIsURI(node))
PlacesUIUtils.showMinimalAddBookmarkUI(PlacesUtils._uri(node.uri), node.title);
}
function searchHistory(aInput)
{
var query = PlacesUtils.history.getNewQuery();

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

@ -74,14 +74,8 @@
#endif
</keyset>
<popup id="placesContext">
<menuitem id="addBookmarkContextItem"
label="&bookmarkLink.label;"
accesskey="&bookmarkLink.accesskey;"
selection="link"
selectiontype="single"
oncommand="historyAddBookmarks();"/>
</popup>
<!-- required to overlay the context menu -->
<popup id="placesContext" />
<hbox align="center">
<label value="&find.label;" accesskey="&find.accesskey;"

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

@ -20,6 +20,7 @@
# Contributor(s):
# Ben Goodger <beng@google.com>
# Asaf Romano <mano@mozilla.com>
# Michael Kohler <michaelkohler@live.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -93,6 +94,8 @@
oncommand="goDoCommand('placesCmd_moveBookmarks');"/>
<command id="placesCmd_deleteDataHost"
oncommand="goDoCommand('placesCmd_deleteDataHost');"/>
<command id="placesCmd_createBookmark"
oncommand="goDoCommand('placesCmd_createBookmark');"/>
</commandset>
<popup id="placesContext"
@ -155,6 +158,12 @@
selection="any"
hideifnoinsertionpoint="true"/>
<menuseparator id="placesContext_newSeparator"/>
<menuitem id="placesContext_createBookmark"
command="placesCmd_createBookmark"
label="&cmd.bookmarkLink.label;"
accesskey="&cmd.bookmarkLink.accesskey;"
selection="link"
forcehideselection="bookmark|tagChild"/>
<menuitem id="placesContext_cut"
command="cmd_cut"
label="&cutCmd.label;"

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

@ -22,7 +22,5 @@
<!ENTITY openInNewTab.accesskey "T">
<!ENTITY openInNewWindow.label "Open in New Window">
<!ENTITY openInNewWindow.accesskey "W">
<!ENTITY bookmarkLink.label "Bookmark This Link…">
<!ENTITY bookmarkLink.accesskey "B">
<!ENTITY copyLink.label "Copy Link Location">
<!ENTITY copyLink.accesskey "C">

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

@ -71,6 +71,8 @@
<!ENTITY cmd.edit_redo.accesskey "R">
<!ENTITY cmd.edit_redo.key "y">
<!ENTITY cmd.bookmarkLink.label "Bookmark This Page…">
<!ENTITY cmd.bookmarkLink.accesskey "B">
<!ENTITY cmd.delete.label "Delete This Page">
<!ENTITY cmd.delete.accesskey "D">
<!ENTITY cmd.deleteDomainData.label "Forget About This Site">