зеркало из https://github.com/mozilla/gecko-dev.git
Bookmark Panel landing + its own Quick Search
Workaround for the hang using QS (bug 167167) Conflicting accesskey for QS (bug 171545) Focus the content after loading bm from the panel (bug 171584) key enter not working in the manager/panel (bug 171610) and other bugs/tweaks not reported
This commit is contained in:
Родитель
8b7e89cc3e
Коммит
bb3ed3ed6b
|
@ -475,6 +475,7 @@ var BookmarksCommand = {
|
|||
// requires utilityOverlay.js if opening in new window for getTopWin()
|
||||
openOneBookmark: function (aURI, aTargetBrowser, aDS)
|
||||
{
|
||||
var w, browser
|
||||
var url = BookmarksUtils.getProperty(aURI, NC_NS+"URL", aDS)
|
||||
// Ignore "NC:" and empty urls.
|
||||
if (url == "" || url.substring(0,3) == "NC:")
|
||||
|
@ -484,19 +485,23 @@ var BookmarksCommand = {
|
|||
openTopWin(url);
|
||||
break;
|
||||
case "tab":
|
||||
var w = getTopWin();
|
||||
w = getTopWin();
|
||||
if (!w) {
|
||||
openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url);
|
||||
break;
|
||||
}
|
||||
w.focus();
|
||||
var browser = w.document.getElementById("content");
|
||||
browser = w.document.getElementById("content");
|
||||
var tab = browser.addTab(url);
|
||||
browser.selectedTab = tab;
|
||||
browser.focus();
|
||||
break;
|
||||
case "window":
|
||||
openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url);
|
||||
break;
|
||||
case "properties":
|
||||
openDialog("chrome://browser/content/bookmarks/bookmarksProperties.xul",
|
||||
"", "centerscreen,chrome,resizable=no", url);
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -536,8 +541,7 @@ var BookmarksCommand = {
|
|||
|
||||
showProperties: function (aSelection)
|
||||
{
|
||||
openDialog("chrome://browser/content/bookmarks/bookmarksProperties.xul",
|
||||
"", "centerscreen,chrome,resizable=no", aSelection.item[0].Value);
|
||||
this.openBookmark(aSelection, "properties");
|
||||
},
|
||||
|
||||
findBookmark: function ()
|
||||
|
@ -1537,7 +1541,7 @@ var BookmarksUtils = {
|
|||
getBrowserTargetFromEvent: function (aEvent)
|
||||
{
|
||||
// note: modifier keys are ignored in menuitems (bug 126189)
|
||||
var button = aEvent.type == "command"? 0:aEvent.button;
|
||||
var button = aEvent.type == "command" || aEvent.type == "keypress"? 0:aEvent.button;
|
||||
if (button == 2)
|
||||
return "";
|
||||
if (aEvent.metaKey || aEvent.ctrlKey || button == 1)
|
||||
|
@ -1545,6 +1549,8 @@ var BookmarksUtils = {
|
|||
return "window";
|
||||
else
|
||||
return "tab";
|
||||
else if (aEvent.altKey)
|
||||
return "properties"
|
||||
else
|
||||
return "current";
|
||||
},
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
var gSearchBox;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Initialize the command controllers, set focus, tree root,
|
||||
// window title state, etc.
|
||||
|
@ -217,14 +218,3 @@ function onViewMenuColumnItemSelected(aEvent)
|
|||
|
||||
aEvent.preventBubble();
|
||||
}
|
||||
|
||||
function searchBookmarks(aInput)
|
||||
{
|
||||
var bookmarksView = document.getElementById("bookmarks-view");
|
||||
if (!aInput)
|
||||
bookmarksView.tree.setAttribute("ref", "NC:BookmarksRoot");
|
||||
else
|
||||
bookmarksView.tree.setAttribute("ref",
|
||||
"find:datasource=rdf:bookmarks&match=http://home.netscape.com/NC-rdf#Name&method=contains&text=" + escape(aInput));
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
|
||||
<!-- Shared Libraries -->
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js"></script>
|
||||
|
||||
<!-- XXX - This should SO become an XBL widget -->
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"></script>
|
||||
|
||||
|
@ -66,12 +65,10 @@
|
|||
<!-- Bookmarks Window -->
|
||||
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarksManager.js"/>
|
||||
|
||||
<!-- Bookmarks Window Drag & Drop -->
|
||||
<!-- Bookmarks Window Drag and Drop -->
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
|
||||
<popupset id="bookmarksPopupset"/>
|
||||
|
||||
<commands id="commands">
|
||||
<commandset id="CommandUpdate_Bookmarks"
|
||||
commandupdater="true"
|
||||
|
@ -270,7 +267,7 @@
|
|||
<label value="&find.label;" accesskey="&find.accesskey;" control="search-box"/>
|
||||
<textbox id="search-box" flex="1"
|
||||
type="timed" timeout="500"
|
||||
callback="searchBookmarks(gSearchBox.value);"/>
|
||||
callback="document.getElementById('bookmarks-view').searchBookmarks(gSearchBox.value);"/>
|
||||
</toolbar>
|
||||
|
||||
</toolbox>
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gSearchBox;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Get the two bookmarks utility libraries running, attach controllers, focus
|
||||
|
@ -44,10 +45,11 @@ function Startup()
|
|||
{
|
||||
var bookmarksView = document.getElementById("bookmarks-view");
|
||||
bookmarksView.treeBoxObject.selection.select(0);
|
||||
gSearchBox = document.getElementById("search-box");
|
||||
}
|
||||
|
||||
function manageBookmarks() {
|
||||
openDialog("chrome://communicator/content/bookmarks/bookmarksManager.xul", "", "chrome,dialog=no,resizable=yes");
|
||||
openDialog("chrome://browser/content/bookmarks/bookmarksManager.xul", "", "chrome,dialog=no,resizable=yes");
|
||||
}
|
||||
|
||||
function addBookmark() {
|
||||
|
|
|
@ -23,43 +23,31 @@
|
|||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/sidebar/sidebarListView.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarksWindow.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/content/bookmarks/bookmarks.css" type="text/css"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/content/bookmarks/bookmarks.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/bookmarks/bookmarksOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/communicatorOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/bookmarks/bookmarks.dtd">
|
||||
<!DOCTYPE window SYSTEM "chrome://browser/locale/bookmarks/bookmarks.dtd">
|
||||
|
||||
<page id="bookmarksPanel"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup();" elementtofocus="bookmarks-view">
|
||||
|
||||
<!-- XXX - would like to cut this dependency out -->
|
||||
<!-- Shared libraries XXX - would like to cut this dependency out -->
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<!-- Bookmarks Shell -->
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/bookmarks/bookmarksOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/bookmarks/bookmarksPanel.js"/>
|
||||
<!-- Shared Bookmarks Utility Library -->
|
||||
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
|
||||
<!-- Bookmarks Panel -->
|
||||
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarksPanel.js"/>
|
||||
|
||||
<!-- Drag and Drop -->
|
||||
<!-- Bookmarks Panel Drag and Drop -->
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/bookmarks/bookmarksDD.js"/>
|
||||
|
||||
|
||||
<!-- context menu, tooltips, etc -->
|
||||
<popupset id="bookmarksPopupset"/>
|
||||
|
||||
<!-- bookmarks string bundle -->
|
||||
<stringbundleset id="stringbundleset"/>
|
||||
|
||||
<!-- bookmarks & edit commands -->
|
||||
<commands id="commands">
|
||||
|
@ -68,18 +56,32 @@
|
|||
events="click,focus"
|
||||
oncommandupdate="document.getElementById('bookmarks-view').onCommandUpdate();">
|
||||
</commandset>
|
||||
<commandset id="bookmarksItems"/>
|
||||
<commandset id="bookmarksItems">
|
||||
<command id="cmd_bm_open" oncommand="goDoCommand('cmd_bm_open');"/>
|
||||
<command id="cmd_bm_openinnewwindow" oncommand="goDoCommand('cmd_bm_openinnewwindow');"/>
|
||||
<command id="cmd_bm_openinnewtab" oncommand="goDoCommand('cmd_bm_openinnewtab');"/>
|
||||
<command id="cmd_bm_expandfolder" oncommand="goDoCommand('cmd_bm_expandfolder');"/>
|
||||
<command id="cmd_bm_managefolder" oncommand="goDoCommand('cmd_bm_managefolder');"/>
|
||||
<command id="cmd_bm_newfolder" oncommand="goDoCommand('cmd_bm_newfolder');"/>
|
||||
<command id="cmd_bm_newbookmark" oncommand="goDoCommand('cmd_bm_newbookmark');"/>
|
||||
<command id="cmd_bm_newseparator" oncommand="goDoCommand('cmd_bm_newseparator');"/>
|
||||
<command id="cmd_bm_find" oncommand="goDoCommand('cmd_bm_find');"/>
|
||||
<command id="cmd_bm_properties" oncommand="goDoCommand('cmd_bm_properties');"/>
|
||||
<command id="cmd_bm_cut" oncommand="goDoCommand('cmd_bm_cut');"/>
|
||||
<command id="cmd_bm_copy" oncommand="goDoCommand('cmd_bm_copy');"/>
|
||||
<command id="cmd_bm_paste" oncommand="goDoCommand('cmd_bm_paste');"/>
|
||||
<command id="cmd_bm_delete" oncommand="goDoCommand('cmd_bm_delete');"/>
|
||||
<command id="cmd_bm_selectAll" oncommand="goDoCommand('cmd_bm_selectAll');"/>
|
||||
</commandset>
|
||||
</commands>
|
||||
|
||||
<hbox id="panel-bar" class="toolbar">
|
||||
<hbox id="panel-bar" align="center" pack="center" class="toolbar">
|
||||
<toolbarbutton id="btnAddBookmark" label="&command.addBookmark.label;"
|
||||
oncommand="addBookmark();"/>
|
||||
<toolbarbutton id="btnManageBookmarks" label="&command.manageBookmarks.label;"
|
||||
oncommand="manageBookmarks();"/>
|
||||
<spacer flex="1"/>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton id="btnFindBookmarks" label="&command.findBookmarks.label;"
|
||||
oncommand="document.getElementById('bookmarks-view').openFindDialog();"/>
|
||||
<label value="&find.label;" accesskey="&find.accesskey;" control="search-box"/>
|
||||
<textbox id="search-box" flex="1"
|
||||
type="timed" timeout="500"
|
||||
callback="document.getElementById('bookmarks-view').searchBookmarks(gSearchBox.value);"/>
|
||||
</hbox>
|
||||
|
||||
<bookmarks-tree id="bookmarks-view" class="sidebar" type="single-column" flex="1"/>
|
||||
|
|
|
@ -427,6 +427,7 @@ dump("error in refresh sort:"+e)
|
|||
return;
|
||||
if (aClickCount == 1 && this.clickCount == 2 && aEvent.button != 1)
|
||||
return;
|
||||
|
||||
var row = {};
|
||||
var col = {};
|
||||
var obj = {};
|
||||
|
@ -435,11 +436,9 @@ dump("error in refresh sort:"+e)
|
|||
if (row == -1 || obj.value == "twisty")
|
||||
return;
|
||||
var browserTarget = BookmarksUtils.getBrowserTargetFromEvent(aEvent);
|
||||
if (browserTarget != "current" && this.clickCount == aClickCount) {
|
||||
if (!this.treeBoxObject.selection.isSelected(row)) {
|
||||
if (this.clickCount == 1 || browserTarget != "current" &&
|
||||
this.clickCount == aClickCount && !this.treeBoxObject.selection.isSelected(row))
|
||||
this.treeBoxObject.selection.select(row)
|
||||
}
|
||||
}
|
||||
|
||||
var selection = this.getTreeSelection();
|
||||
this._selection = selection;
|
||||
|
@ -447,24 +446,37 @@ dump("error in refresh sort:"+e)
|
|||
|
||||
if (!isFolderGroup && selection.isContainer[0]) {
|
||||
if (this.clickCount == 1) {
|
||||
if (row.value >= 0) {
|
||||
this.treeBoxObject.view.toggleOpenState(row.value);
|
||||
if (row >= 0) {
|
||||
this.treeBoxObject.view.toggleOpenState(row);
|
||||
}
|
||||
}
|
||||
if (selection.protocol[0] == "file")
|
||||
BookmarksCommand.openBookmark(selection, browserTarget, this.db);
|
||||
if (selection.protocol[0] != "file")
|
||||
return;
|
||||
}
|
||||
|
||||
if (aEvent.altKey) {
|
||||
BookmarksCommand.showProperties(selection);
|
||||
return
|
||||
}
|
||||
|
||||
BookmarksCommand.openBookmark(selection, browserTarget, this.db);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="loadBookmarkBrowser">
|
||||
<parameter name="aEvent"/>
|
||||
<body><![CDATA[
|
||||
var browserTarget = BookmarksUtils.getBrowserTargetFromEvent(aEvent);
|
||||
BookmarksCommand.openBookmark(this._selection, browserTarget, this.db)
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="searchBookmarks">
|
||||
<parameter name="aInput"/>
|
||||
<body><![CDATA[
|
||||
this.treeBoxObject.selection.currentIndex=-1;
|
||||
if (!aInput)
|
||||
this.tree.setAttribute("ref", "NC:BookmarksRoot");
|
||||
else
|
||||
this.tree.setAttribute("ref",
|
||||
"find:datasource=rdf:bookmarks&match=http://home.netscape.com/NC-rdf#Name&method=contains&text=" + escape(aInput));
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- observer -->
|
||||
<field name="DNDObserver" readonly="true"><![CDATA[(
|
||||
{
|
||||
|
@ -583,6 +595,7 @@ dump("error in refresh sort:"+e)
|
|||
else
|
||||
BookmarksUtils.moveSelection ("drag", selection, target);
|
||||
observer.endUpdateBatch(this.db);
|
||||
this.mOuter.treeBoxObject.selection.currentIndex=-1;
|
||||
this.mOuter.treeBuilder.rebuild();
|
||||
// temporary hack: for an unknown reason, rebuilding cause a scroll to the bottom
|
||||
// if the first visible row is not 0
|
||||
|
@ -711,7 +724,7 @@ dump("ONSELECTION CHANGED\n")
|
|||
<vbox flex="1">
|
||||
<tree anonid="bookmarks-tree" flex="1" class="plain" enableColumnDrag="true"
|
||||
datasources="rdf:bookmarks rdf:internetsearch rdf:files rdf:localsearch" ref="NC:BookmarksRoot" flags="dont-build-content"
|
||||
onkeypress="if (event.keyCode == 13) this.parentNode.parentNode.openItem(event);"
|
||||
onkeypress="if (event.keyCode == 13) this.parentNode.parentNode.loadBookmarkBrowser(event);"
|
||||
onclick="this.parentNode.parentNode.openItem(event, 1);"
|
||||
ondblclick="this.parentNode.parentNode.openItem(event, 2);"
|
||||
ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, this.parentNode.parentNode.DNDObserver);"
|
||||
|
@ -819,9 +832,9 @@ dump("ONSELECTION CHANGED\n")
|
|||
onpopuphidden ="if (content) content.focus()"/>
|
||||
<tree anonid="bookmarks-tree" flex="1" hidecolumnpicker="true" class="plain"
|
||||
datasources="rdf:bookmarks rdf:internetsearch rdf:files rdf:localsearch" ref="NC:BookmarksRoot" flags="dont-build-content"
|
||||
onkeypress="if (event.keyCode == 13) this.parentNode.openItem(event); event.preventBubble();"
|
||||
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);"
|
||||
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">
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<!ENTITY bookmarksWindowTitle.label "Bookmark Manager">
|
||||
|
||||
<!ENTITY find.label "Find">
|
||||
<!ENTITY find.accesskey "F">
|
||||
<!ENTITY find.accesskey "n">
|
||||
<!ENTITY fileMenu.label "File">
|
||||
<!ENTITY fileMenu.accesskey "F">
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче