diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc
index 3fb99ca3a4b6..cac28f5aa399 100644
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -155,9 +155,7 @@
label="&viewSidebarMenu.label;"
accesskey="&viewSidebarMenu.accesskey;">
-#ifndef MOZ_PLACES_BOOKMARKS
-#endif
diff --git a/browser/components/places/content/bookmarksPanel.js b/browser/components/places/content/bookmarksPanel.js
new file mode 100644
index 000000000000..5ea819e9f9f1
--- /dev/null
+++ b/browser/components/places/content/bookmarksPanel.js
@@ -0,0 +1,49 @@
+# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla 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/MPL/
+#
+# 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 Mozilla Corporation.
+# Portions created by the Initial Developer are Copyright (C) 2007
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Dan Mills (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 MPL, 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 MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+function init() {
+ document.getElementById('search-box').focus();
+}
+
+function searchBookmarks(aSearchString) {
+ var tree = document.getElementById('bookmarks-view');
+ if (!aSearchString)
+ tree.place = tree.place;
+ else
+ tree.applyFilter(aSearchString, true);
+}
+
diff --git a/browser/components/places/content/bookmarksPanel.xul b/browser/components/places/content/bookmarksPanel.xul
new file mode 100644
index 000000000000..0b9ad19f819e
--- /dev/null
+++ b/browser/components/places/content/bookmarksPanel.xul
@@ -0,0 +1,82 @@
+
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla 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/MPL/
+#
+# 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):
+# Ben Goodger (Original Author, v2.0)
+# Pierre Chanial
+# Dan Mills
+#
+# 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 MPL, 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 MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/browser/components/places/content/history-panel.js b/browser/components/places/content/history-panel.js
index f0575b043fcc..33c7cd8c8eea 100644
--- a/browser/components/places/content/history-panel.js
+++ b/browser/components/places/content/history-panel.js
@@ -68,29 +68,6 @@ function HistorySidebarInit()
searchHistory(gSearchBox.value);
gSearchBox.focus();
}
-
-function checkURLSecurity(aURL)
-{
- var uri = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Ci.nsIIOService)
- .newURI(aURL, null, null);
-
- if (uri.schemeIs("javascript") || uri.schemeIs("data")) {
- var strBundleService =
- Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Ci.nsIStringBundleService);
- var promptService =
- Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Ci.nsIPromptService);
- var historyBundle = strBundleService.createBundle("chrome://global/locale/history/history.properties");
- var brandBundle = strBundleService.createBundle("chrome://branding/locale/brand.properties");
- var brandStr = brandBundle.GetStringFromName("brandShortName");
- var errorStr = historyBundle.GetStringFromName("load-js-data-url-error");
- promptService.alert(window, brandStr, errorStr);
- return false;
- }
- return true;
-}
function GroupBy(groupingType)
{
@@ -103,59 +80,6 @@ function collapseExpand()
{
var currentIndex = gHistoryTree.currentIndex;
gHistoryTree.view.toggleOpenState(currentIndex);
-}
-
-function openURLIn(aWhere)
-{
- // 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.selectedURINode;
- if (!node)
- return;
-
- if (!checkURLSecurity(node.uri))
- return;
-
- openUILinkIn(node.uri, aWhere);
-}
-
-function openURL(aEvent)
-{
- openURLIn(whereToOpenLink(aEvent));
-}
-
-function handleHistoryClick(aEvent)
-{
- var tbo = gHistoryTree.treeBoxObject;
-
- var row = { }, col = { }, obj = { };
- tbo.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
-
- var x = { }, y = { }, w = { }, h = { };
- tbo.getCoordsForCellItem(row.value, col.value, "image",
- x, y, w, h);
- var mouseInGutter = aEvent.clientX < x.value;
-
- if (row.value == -1 || obj.value == "twisty")
- return;
-
- var modifKey = aEvent.shiftKey || aEvent.ctrlKey || aEvent.altKey ||
- aEvent.metaKey || (aEvent.button != 0);
- if (!modifKey && tbo.view.isContainer(row.value)) {
- tbo.view.toggleOpenState(row.value);
- return;
- }
- if (!mouseInGutter &&
- aEvent.originalTarget.localName == "treechildren" &&
- (aEvent.button == 0 || aEvent.button == 1)) {
- // Clear all other selection since we're loading a link now. We must
- // do this *before* attempting to load the link since openURL uses
- // selection as an indication of which link to load.
- tbo.view.selection.select(row.value);
-
- openURL(aEvent);
- }
}
function historyAddBookmarks()
diff --git a/browser/components/places/content/history-panel.xul b/browser/components/places/content/history-panel.xul
index 4526bdd0b4a2..a096ade6bbea 100644
--- a/browser/components/places/content/history-panel.xul
+++ b/browser/components/places/content/history-panel.xul
@@ -60,6 +60,8 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="HistorySidebarInit();">
+
#ifndef MOZ_PLACES_BOOKMARKS
@@ -143,9 +145,9 @@
type="places"
place="place:&beginTime=-2592000000000&beginTimeRef=1&endTime=7200000000&endTimeRef=2&type=1"
context="historyContextMenu"
- onkeypress="if (event.keyCode == 13) openURL(event);"
+ onkeypress="if (event.keyCode == 13) this.controller.openSelectedNodeWithEvent(event);"
hidecolumnpicker="true"
- onclick="handleHistoryClick(event);">
+ onclick="SidebarUtils.handleClick(this, event, true);">
diff --git a/browser/components/places/content/sidebarUtils.js b/browser/components/places/content/sidebarUtils.js
new file mode 100644
index 000000000000..0771c4096a6c
--- /dev/null
+++ b/browser/components/places/content/sidebarUtils.js
@@ -0,0 +1,73 @@
+# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla 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/MPL/
+#
+# 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):
+# Dan Mills (Ported from history-panel.js)
+#
+# 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 MPL, 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 MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+var SidebarUtils = {
+ handleClick: function SU_handleClick(aTree, aEvent, aGutterSelect) {
+ var tbo = aTree.treeBoxObject;
+
+ var row = { }, col = { }, obj = { };
+ tbo.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
+
+ if (row.value == -1 || obj.value == "twisty")
+ return;
+
+ var mouseInGutter = false;
+ if (aGutterSelect) {
+ var x = { }, y = { }, w = { }, h = { };
+ tbo.getCoordsForCellItem(row.value, col.value, "image",
+ x, y, w, h);
+ mouseInGutter = aEvent.clientX < x.value;
+ }
+
+ var modifKey = aEvent.shiftKey || aEvent.ctrlKey || aEvent.altKey ||
+ aEvent.metaKey || (aEvent.button != 0);
+ if (!modifKey && tbo.view.isContainer(row.value)) {
+ tbo.view.toggleOpenState(row.value);
+ return;
+ }
+ if (!mouseInGutter &&
+ aEvent.originalTarget.localName == "treechildren" &&
+ (aEvent.button == 0 || aEvent.button == 1)) {
+ // Clear all other selection since we're loading a link now. We must
+ // do this *before* attempting to load the link since openURL uses
+ // selection as an indication of which link to load.
+ tbo.view.selection.select(row.value);
+ aTree.controller.openSelectedNodeWithEvent(aEvent);
+ }
+ }
+};
diff --git a/browser/components/places/content/tree.xml b/browser/components/places/content/tree.xml
index 686c1d36fbb7..d4667d6ec1e6 100644
--- a/browser/components/places/content/tree.xml
+++ b/browser/components/places/content/tree.xml
@@ -104,22 +104,18 @@
query.searchTerms = filterString;
query.onlyBookmarked = onlyBookmarks;
- // If we're searching over everything, or this is not an exclusively
- // bookmarks search, we need to make sure that we remove "group by
- // folder" from the options list, because otherwise we will end up
- // with _no_ results if the user searches while a bookmarks folder
- // is selected, since the options for the current view say group by
- // folder and none of the results will match!
- if (!onlyBookmarks) {
- var groupings = options.getGroupingMode({});
- function isFolderGrouping(grouping, index, ary) {
- return grouping != Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER;
- }
- var folderGroupings = groupings.filter(isFolderGrouping);
- options.setGroupingMode(folderGroupings, folderGroupings.length);
+ // Remove "group by folder" from the options list, because
+ // nsNavHistory::RecursiveGroup doesn't support it.
+ function isFolderGrouping(grouping, index, ary) {
+ return grouping != Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER;
}
- if (onlyBookmarks)
+ var groupings = options.getGroupingMode({});
+ var folderGroupings = groupings.filter(isFolderGrouping);
+ options.setGroupingMode(folderGroupings, folderGroupings.length);
+
+ if (onlyBookmarks && folderRestrict)
query.setFolders(folderRestrict, folderRestrict.length);
+
this.load([query], options);
]]>