зеркало из https://github.com/mozilla/gecko-dev.git
bug 171327: implement "Use Bookmark" menubutton in General prefs
This commit is contained in:
Родитель
0abe2200b6
Коммит
32e3001f88
|
@ -76,6 +76,9 @@
|
|||
type="timed" timeout="500"
|
||||
callback="document.getElementById('bookmarks-view').searchBookmarks(gSearchBox.value);"/>
|
||||
</hbox>
|
||||
<bookmarks-tree id="bookmarks-view" type="single-column" flex="1"/>
|
||||
<bookmarks-tree id="bookmarks-view" type="single-column" flex="1"
|
||||
onkeypress="if (event.keyCode == 13) {this.loadBookmarkBrowser(event); if (content) content.focus()}"
|
||||
ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, this.DNDObserver);"
|
||||
onclick="this.openItem(event, 1); if (content) content.focus()"/>
|
||||
|
||||
</page>
|
||||
|
|
|
@ -834,13 +834,11 @@ dump("ONSELECTION CHANGED\n")
|
|||
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl" contextmenu="_child">
|
||||
<!-- context menu -->
|
||||
<menupopup onpopupshowing="this.parentNode.createTreeContextMenu(event);"
|
||||
<menupopup xbl:inherits="onpopupshowing"
|
||||
onpopupshowing="this.parentNode.createTreeContextMenu(event);"
|
||||
onpopuphidden ="if (content) content.focus()"/>
|
||||
<tree anonid="bookmarks-tree" flex="1" class="plain" hidecolumnpicker="true"
|
||||
datasources="rdf:bookmarks rdf:internetsearch rdf:files rdf:localsearch" ref="NC:BookmarksRoot" flags="dont-build-content"
|
||||
onkeypress="if (event.keyCode == 13) {this.parentNode.loadBookmarkBrowser(event); if (content) content.focus()}"
|
||||
ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, this.parentNode.DNDObserver);"
|
||||
onclick="this.parentNode.openItem(event, 1); if (content) content.focus()"
|
||||
onselect="this.parentNode.treeBoxObject.view.selectionChanged();">
|
||||
<template xmlns:nc="http://home.netscape.com/NC-rdf#">
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Chanial <chanial@noos.fr> (Original Author)
|
||||
*
|
||||
* 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
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gBookmarkTree;
|
||||
var gOK;
|
||||
|
||||
function Startup()
|
||||
{
|
||||
var textNode = document.createTextNode(window.arguments[0]);
|
||||
document.getElementById("selectBookmarkDescription").appendChild(textNode);
|
||||
gBookmarkTree = document.getElementById("bookmarks-view");
|
||||
gBookmarkTree.treeBoxObject.selection.select(0);
|
||||
gBookmarkTree.tree.focus();
|
||||
gOK = document.documentElement.getButton("accept");
|
||||
}
|
||||
|
||||
function onDblClick()
|
||||
{
|
||||
if (!gOK.disabled)
|
||||
document.documentElement.acceptDialog();
|
||||
|
||||
}
|
||||
|
||||
function updateOK()
|
||||
{
|
||||
var selection = gBookmarkTree._selection;
|
||||
gOK.disabled = selection.length != 1 ||
|
||||
(selection.type[0] != "Bookmark" && selection.type[0] != "")
|
||||
}
|
||||
|
||||
function onOK(aEvent)
|
||||
{
|
||||
var selection = gBookmarkTree._selection;
|
||||
var url = BookmarksUtils.getProperty(selection.item[0], NC_NS+"URL", gBookmarkTree.tree.database);
|
||||
window.arguments[1].url = url;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- -*- Mode: HTML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is mozilla.org code.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Pierre Chanial <chanial@noos.fr> (Original Author)
|
||||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/bookmarks/bookmarks.css"?>
|
||||
|
||||
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/bookmarks/bookmarks.dtd">
|
||||
|
||||
<dialog id="selectBookmarkDialog" style="width: 22em"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
ondialogaccept="return onOK(event)"
|
||||
title="&selectBookmark.title;"
|
||||
onload="Startup();"
|
||||
persist="screenX screenY width height"
|
||||
screenX="24" screenY="24">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/selectBookmark.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
|
||||
|
||||
<hbox align="start">
|
||||
<image class="question-icon"/>
|
||||
<separator class="thin" orient="vertical"/>
|
||||
<description id="selectBookmarkDescription" flex="1"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<bookmarks-tree id="bookmarks-view" style="height:15em;" flex="1" type="single-column"
|
||||
onpopupshowing="return false;"
|
||||
ondblclick="onDblClick()"
|
||||
onselect="updateOK();"
|
||||
/>
|
||||
<separator/>
|
||||
|
||||
</dialog>
|
|
@ -26,6 +26,8 @@ browser.jar:
|
|||
content/browser/bookmarks/addBookmark.js (content/addBookmark.js)
|
||||
content/browser/bookmarks/findBookmark.xul (content/findBookmark.xul)
|
||||
content/browser/bookmarks/findBookmark.js (content/findBookmark.js)
|
||||
content/browser/bookmarks/selectBookmark.xul (content/selectBookmark.xul)
|
||||
content/browser/bookmarks/selectBookmark.js (content/selectBookmark.js)
|
||||
content/browser/bookmarks/bookmarksProperties.xul (content/bookmarksProperties.xul)
|
||||
content/browser/bookmarks/bookmarksProperties.js (content/bookmarksProperties.js)
|
||||
content/browser/bookmarks/bookmarksManager.xul (content/bookmarksManager.xul)
|
||||
|
|
|
@ -92,6 +92,8 @@
|
|||
<!ENTITY helpMenu.accesskey "H">
|
||||
<!ENTITY releaseCmd.label "Release Notes">
|
||||
<!ENTITY releaseCmd.accesskey "R">
|
||||
<!ENTITY aboutCmd.label "About &brandShortName;">
|
||||
<!ENTITY aboutCmd.accesskey "A">
|
||||
<!ENTITY aboutCmd.label "About &brandShortName;">
|
||||
<!ENTITY aboutCmd.accesskey "A">
|
||||
|
||||
<!-- selectBookmark.xul -->
|
||||
<!ENTITY selectBookmark.title "Select a bookmark...">
|
||||
|
|
|
@ -27,6 +27,23 @@ function setHomePageToCurrentPage()
|
|||
}
|
||||
}
|
||||
|
||||
function setHomePageToBookmark()
|
||||
{
|
||||
var prefutilitiesBundle = document.getElementById("bundle_prefutilities");
|
||||
var title = prefutilitiesBundle.getString("choosebookmark");
|
||||
var brandBundle = document.getElementById("bundle_brand");
|
||||
var brand = brandBundle.getString("brandShortName");
|
||||
title = title.replace(/%brand%/g, brand);
|
||||
|
||||
var rv = { url: null };
|
||||
openDialog("chrome://browser/content/bookmarks/selectBookmark.xul", "",
|
||||
"centerscreen,chrome,modal=yes,dialog=yes,resizable=yes", title, rv);
|
||||
if (rv.url) {
|
||||
var homePageField = document.getElementById("browserStartupHomepage");
|
||||
homePageField.value = rv.url;
|
||||
}
|
||||
}
|
||||
|
||||
function setHomePageToDefaultPage()
|
||||
{
|
||||
var prefService = Components.classes[PREFSERVICE_CONTRACTID]
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
headertitle="&lHeader;">
|
||||
|
||||
<stringbundle id="bundle_prefutilities" src="chrome://browser/locale/pref/prefutilities.properties"/>
|
||||
<stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/pref/pref-navigator.js"/>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
@ -56,6 +57,10 @@
|
|||
oncommand="setHomePageToCurrentPage();"
|
||||
id="browserUseCurrent"
|
||||
prefstring="pref.browser.homepage.disable_button.current_page"/>
|
||||
<button label="&useBookmark.label;" accesskey="&useBookmark.accesskey;"
|
||||
oncommand="setHomePageToBookmark();"
|
||||
id="browserUseBookmark"
|
||||
prefstring="pref.browser.homepage.disable_button.bookmark_page"/>
|
||||
<button label="&useBlank.label;" accesskey="&useBlank.accesskey;"
|
||||
oncommand="document.getElementById('browserStartupHomepage').value = 'about:blank';"
|
||||
id="browserUseBlank"
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
<!ENTITY location.label "Location:">
|
||||
<!ENTITY location.accesskey "a">
|
||||
<!ENTITY useCurrent.label "Use Current Page">
|
||||
<!ENTITY useCurrent.accesskey "U">
|
||||
<!ENTITY useCurrent.accesskey "c">
|
||||
<!ENTITY useBookmark.label "Use Bookmark">
|
||||
<!ENTITY useBookmark.accesskey "u">
|
||||
<!ENTITY useBlank.label "Use Blank Page">
|
||||
<!ENTITY useBlank.accesskey "B">
|
||||
<!ENTITY useBlank.accesskey "b">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
cachefolder=Choose Cache Folder
|
||||
choosehomepage=Choose Home Page
|
||||
choosebookmark=%brand% can set your home page to a site you have already added to your Bookmarks. Select a Bookmark below and click OK.
|
||||
choosefile=Choose a file
|
||||
viewrow=View...
|
||||
hiderow=Hide
|
||||
|
|
Загрузка…
Ссылка в новой задаче