Bug 148840: Add "Bookmark This Group of Tabs..." to Bookmarks menu. r=caillon, sr=hewitt

This commit is contained in:
jaggernaut%netscape.com 2002-06-03 21:35:10 +00:00
parent 882d316742
commit a00d23ada6
6 changed files with 33 additions and 7 deletions

View File

@ -458,7 +458,6 @@ function Startup()
// now load bookmarks after a delay
setTimeout(LoadBookmarksCallback, 0);
}
function LoadBookmarksCallback()
@ -721,6 +720,17 @@ function addBookmarkAs()
BookmarksUtils.addBookmarkForBrowser(gBrowser.webNavigation, true);
}
function addGroupmarkAs()
{
BookmarksUtils.addBookmarkForTabBrowser(gBrowser, true);
}
function updateGroupmarkMenuitem(id)
{
const disabled = gBrowser.browsers.length == 1;
document.getElementById(id).setAttribute("disabled", disabled);
}
function readRDFString(aDS,aRes,aProp)
{
var n = aDS.GetTarget(aRes, aProp, true);

View File

@ -262,9 +262,10 @@ Contributor(s): ______________________________________. -->
ref="NC:BookmarksRoot" container="true" flags="dont-test-empty"
template="bookmarksMenuTemplate"
ondraggesture="if (event.target.id=='bookmarks-button') event.preventBubble()">
<menupopup onpopupshowing="checkBookmarksMenuTemplateBuilder();">
<menupopup onpopupshowing="checkBookmarksMenuTemplateBuilder(); updateGroupmarkMenuitem('PT_bookmarks_groupmark');">
<menuitem accesskey="&addCurPageCmd.accesskey;" key="addBookmarkKb" observes="Browser:AddBookmark"/>
<menuitem accesskey="&addCurPageAsCmd.accesskey;" key="addBookmarkAsKb" observes="Browser:AddBookmarkAs"/>
<menuitem id="PT_bookmarks_groupmark" observes="Browser:AddGroupmarkAs"/>
<menuseparator/>
<menuitem accesskey="&manBookmarksCmd.accesskey;" key="manBookmarkKb" observes="Browser:ManageBookmark"/>
<menuseparator id="lastStaticSeparator"/>

View File

@ -148,6 +148,9 @@
<command id="Browser:AddBookmarkAs" label="&addCurPageAsCmd.label;"
accesskey="&addCurPageAsCmd.accesskey;"
oncommand="addBookmarkAs();"/>
<command id="Browser:AddGroupmarkAs" label="&addCurTabsAsCmd.label;"
accesskey="&addCurTabsAsCmd.accesskey;"
oncommand="addGroupmarkAs(); event.preventBubble();"/>
<command id="Browser:ManageBookmark" label="&manBookmarksCmd.label;" accesskey="&manBookmarksCmd.accesskey;"
oncommand="BrowserEditBookmarks();" />
@ -331,10 +334,11 @@
</menupopup>
</rule>
</template>
<menupopup>
<menupopup onpopupshowing="updateGroupmarkMenuitem('bookmarks_groupmark');">
<!-- for some reason these don't work as command="" -->
<menuitem key="addBookmarkKb" observes="Browser:AddBookmark"/>
<menuitem key="addBookmarkAsKb" observes="Browser:AddBookmarkAs"/>
<menuitem id="bookmarks_groupmark" observes="Browser:AddGroupmarkAs"/>
<menuitem key="manBookmarkKb" observes="Browser:ManageBookmark"/>
<menuseparator/>
</menupopup>

View File

@ -131,7 +131,9 @@
<!ENTITY addCurPageCmd.accesskey "B">
<!ENTITY addCurPageCmd.commandkey "d">
<!ENTITY addCurPageAsCmd.label "File Bookmark...">
<!ENTITY addCurPageAsCmd.accesskey "f">
<!ENTITY addCurPageAsCmd.accesskey "F">
<!ENTITY addCurTabsAsCmd.label "Bookmark This Group of Tabs...">
<!ENTITY addCurTabsAsCmd.accesskey "G">
<!ENTITY manBookmarksCmd.label "Manage Bookmarks...">
<!ENTITY manBookmarksCmd.accesskey "M">
<!ENTITY manBookmarksCmd.commandkey "b">

View File

@ -90,6 +90,8 @@
* filing a single bookmark or a group. For the single bookmark the
* values are taken from the name, URL and charset arguments.
* For the group, the values are taken from the sixth argument.
* This parameter can also be String("addGroup,group") where "group"
* specifies that the dialog starts in filing as a group.
*/
var gFld_Name = null;
@ -152,6 +154,13 @@ function Startup()
setupFields();
sizeToFit();
break;
case "addGroup,group":
document.getElementById("showaddgroup").setAttribute("hidden", "false");
gCB_AddGroup.checked = true;
setupFields();
toggleGroup();
sizeToFit();
break;
default:
// Regular Add Bookmark
setupFields();
@ -197,7 +206,7 @@ function setupFields()
onFieldInput();
gFld_Name.select();
gFld_Name.focus();
gBookmarkCharset = window.arguments [3] || null;
gBookmarkCharset = window.arguments[3] || null;
}
function onFieldInput()

View File

@ -863,7 +863,7 @@ var BookmarksUtils = {
},
addBookmarkForTabBrowser: function( aTabBrowser )
addBookmarkForTabBrowser: function( aTabBrowser, aSelect )
{
var tabsInfo = [];
var currentTabInfo = { name: "", url: "", charset: null };
@ -892,7 +892,7 @@ var BookmarksUtils = {
openDialog("chrome://communicator/content/bookmarks/addBookmark.xul", "",
"centerscreen,chrome,dialog=yes,resizable,dependent",
currentTabInfo.name, currentTabInfo.url, null,
currentTabInfo.charset, "addGroup", tabsInfo);
currentTabInfo.charset, "addGroup" + (aSelect ? ",group" : ""), tabsInfo);
},
addBookmarkForBrowser: function (aDocShell, aShowDialog)