make MOZ_PLACES (if enabled) only build the places based history UI, use MOZ_PLACES_BOOKMARKS to turn off the places based bookmarks UI.

also addresses bugs:

bug #330923:  "View -> Sidebar menu" is empty if you build with places
bug #355738:  implement history sidebar on top of places backend
bug #356175:  hook up the history menu to the places backend
bug #356453:  add back "Clear Private Data" menu item
bug #356630:  add back "History | Show in Sidebar" menu item
bug #356631:  remove "search in history" and "view all history" menu items
bug #357301:  add back history and bookmark sidebar toolbar button items, remove places toolbar button
bug #358831:  history sidebar, right mouse button click should not expand / collapse item

r=dietrich, r=gavin
This commit is contained in:
sspitzer%mozilla.org 2006-11-04 04:48:06 +00:00
Родитель 9a94b25ee5
Коммит d7263a337d
39 изменённых файлов: 612 добавлений и 2632 удалений

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

@ -55,7 +55,7 @@
<menuitem id="context-bookmarklink"
label="&bookmarkLinkCmd.label;"
accesskey="&bookmarkLinkCmd.accesskey;"
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
command="Browser:AddLinkBookmark"/>
#else
oncommand="BookmarksUtils.addBookmark(gContextMenu.linkURL,
@ -130,7 +130,7 @@
<menuitem id="context-bookmarkpage"
label="&bookmarkPageCmd.label;"
accesskey="&bookmarkPageCmd.accesskey;"
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
command="Browser:AddBookmarkAs"/>
#else
oncommand="gContextMenu.bookmarkThisPage();"/>

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

@ -155,10 +155,10 @@
label="&viewSidebarMenu.label;"
accesskey="&viewSidebarMenu.accesskey;">
<menupopup id="viewSidebarMenu">
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
<menuitem key="viewBookmarksSidebarKb" observes="viewBookmarksSidebar" accesskey="&bookmarksSidebarCmd.accesskey;"/>
<menuitem key="key_gotoHistory" observes="viewHistorySidebar" label="&historyButton.label;" accesskey="&historySidebarCmd.accesskey;"/>
#endif
<menuitem key="key_gotoHistory" observes="viewHistorySidebar" label="&historyButton.label;" accesskey="&historySidebarCmd.accesskey;"/>
</menupopup>
</menu>
<menuseparator/>
@ -355,22 +355,22 @@
<menuitem label="&historyHomeCmd.label;"
command="Browser:Home"
key="historyHome"/>
#ifdef MOZ_PLACES_NEW_HISTORY_UI
<menuseparator/>
<menuitem label="&historySearchCmd.label;"
command="Browser:SearchHistory"
key="searchHistoryKb"/>
<menuitem label="&historyShowCmd.label;"
command="Browser:ShowHistory"/>
#endif
<menuseparator id="startTabHistorySeparator"/>
<menuseparator hidden="true" id="endTabHistorySeparator"/>
<menu id="historyUndoMenu" label="&historyUndoMenu.label;" disabled="true">
<menupopup id="historyUndoPopup" onpopupshowing="HistoryMenu.populateUndoSubmenu();"/>
</menu>
<menuseparator id="endUndoSeparator"/>
<menuitem id="sanitizeItem"
accesskey="&clearPrivateDataCmd.accesskey;"
label="&clearPrivateDataCmd.label;"
key="key_sanitize" command="Tools:Sanitize"/>
<menuitem observes="viewHistorySidebar" label="&historyShowSidebarCmd.label;"
key="key_gotoHistory"/>
</menupopup>
</menu>
#else
@ -415,7 +415,7 @@
</menu>
#endif
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
<menu id="bookmarks-menu" label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;"
datasources="rdf:bookmarks rdf:files"
ref="NC:BookmarksRoot" flags="dont-test-empty"
@ -521,13 +521,11 @@
<menuitem accesskey="&pageInfoCmd.accesskey;" label="&pageInfoCmd.label;"
key="key_viewInfo" command="View:PageInfo"/>
#endif
#ifndef MOZ_PLACES
<menuseparator id="sanitizeSeparator"/>
<menuitem id="sanitizeItem"
accesskey="&clearPrivateDataCmd.accesskey;"
label="&clearPrivateDataCmd.label;"
key="key_sanitize" command="Tools:Sanitize"/>
#endif
#ifndef XP_UNIX
<menuseparator id="prefSep"/>
<menuitem id="menu_preferences"
@ -544,7 +542,7 @@
<menu id="helpMenu" />
</menubar>
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
<template id='bookmarks-template' xmlns:nc="http://home.netscape.com/NC-rdf#">
<rule parent="hbox" rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<toolbarseparator uri="rdf:*"

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

@ -139,7 +139,7 @@
<command id="cmd_find" oncommand="gFindBar.onFindCmd();" observes="isImage"/>
<command id="cmd_findAgain" oncommand="gFindBar.onFindAgainCmd(false);" observes="isImage"/>
<command id="cmd_findPrevious" oncommand="gFindBar.onFindAgainCmd(true);" observes="isImage"/>
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
<command id="Browser:AddLinkBookmark"
oncommand="PlacesCommandHook.bookmarkLink(gContextMenu.linkURL, gContextMenu.linkText());"/>
<command id="Browser:AddBookmarkAs"
@ -169,16 +169,17 @@
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
#ifdef MOZ_PLACES
#include ../../components/places/content/commands.inc
<command id="Browser:ShowBookmarks"
oncommand="PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_BOOKMARKS);"/>
<command id="Browser:ShowHistory"
oncommand="PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_HISTORY);"/>
<command id="Browser:SearchHistory" oncommand="HistoryMenu.showPlacesSearch();"/>
#endif
#ifdef MOZ_PLACES_BOOKMARKS
<command id="Browser:ShowBookmarks"
oncommand="PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_BOOKMARKS);"/>
#endif
</commandset>
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
<commandset id="multipleTabsCommands"
commandupdater="true" events="select"
oncommandupdate="BrowserController.onEvent(BrowserController.EVENT_TABCHANGE);">
@ -187,7 +188,7 @@
#endif
<broadcasterset id="mainBroadcasterSet">
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_NEW_HISTORY_UI
<broadcaster id="viewHistoryPlaces" autoCheck="false" label="&historyButton.label;"
oncommand="PlacesCommandHook.showPlacesPopup(event);"/>
#else
@ -195,8 +196,12 @@
type="checkbox" group="sidebar" sidebarurl="chrome://browser/content/bookmarks/bookmarksPanel.xul"
oncommand="toggleSidebar('viewBookmarksSidebar');"/>
<!-- for both places and non-places, the sidebar lives at
chrome://browser/content/history/history-panel.xul so there are no
problems when switching between versions -->
<broadcaster id="viewHistorySidebar" autoCheck="false" sidebartitle="&historyButton.label;"
type="checkbox" group="sidebar" sidebarurl="chrome://browser/content/history/history-panel.xul"
type="checkbox" group="sidebar"
sidebarurl="chrome://browser/content/history/history-panel.xul"
oncommand="toggleSidebar('viewHistorySidebar');"/>
<broadcaster id="viewWebPanelsSidebar" autoCheck="false"
@ -326,7 +331,7 @@
#ifndef MOZ_WIDGET_GTK2
<key id="bookmarkAllTabsKb" key="&addCurPageAsCmd.commandkey;" command="Browser:BookmarkAllTabs" modifiers="accel,shift"/>
#endif
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
<key id="searchBookmarksKb" key="&searchBookmarksCmd.commandkey;" command="Browser:ShowBookmarks" modifiers="accel"/>
#else
<key id="viewBookmarksSidebarKb" key="&bookmarksSidebarCmd.commandkey;" command="viewBookmarksSidebar" modifiers="accel"/>
@ -345,7 +350,7 @@
<key id="key_stop_mac" modifiers="accel" key="&stopCmd.macCommandKey;" oncommand="BrowserStop();"/>
#endif
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_NEW_HISTORY_UI
<key id="searchHistoryKb"
key="&historySidebarCmd.commandKey;"
#ifdef XP_MACOSX

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

@ -21,7 +21,7 @@ menuitem.spell-suggestion {
-moz-user-focus: normal;
}
%ifdef MOZ_PLACES
%ifdef MOZ_PLACES_BOOKMARKS
#PersonalToolbar > #bookmarksBarShowPlaces > .toolbarbutton-text {
visibility: collapse;
}

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

@ -150,7 +150,7 @@ function pageShowEventHandlers(event)
targetBrowser = gBrowser.mCurrentBrowser;
}
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
// update the last visited date
if (targetBrowser.currentURI.spec)
BMSVC.updateLastVisitedDate(targetBrowser.currentURI.spec,
@ -276,7 +276,7 @@ function SetClickAndHoldHandlers()
}
#endif
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
function UpdateBookmarkAllTabsMenuitem()
{
var tabbrowser = getBrowser();
@ -976,7 +976,7 @@ function delayedStartup()
gFindBar.initFindBar();
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
// add bookmark options to context menu for tabs
addBookmarkMenuitems();
initServices();
@ -1121,7 +1121,7 @@ function BrowserShutdown()
} catch (ex) {
}
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
try {
document.getElementById("PersonalToolbar")
.controllers.removeController(BookmarksMenuController);
@ -1223,7 +1223,7 @@ function nonBrowserWindowStartup()
function nonBrowserWindowDelayedStartup()
{
// loads the services
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
initServices();
initBMService();
#else
@ -1690,7 +1690,9 @@ function updateGoMenu(aEvent, goMenu)
if (showSep)
endSep.hidden = false;
}
#endif
#ifndef MOZ_PLACES_BOOKMARKS
function addBookmarkAs(aBrowser, aBookmarkAllTabs, aIsWebPanel)
{
const browsers = aBrowser.browsers;
@ -1940,7 +1942,7 @@ function getShortcutOrURI(aURL, aPostDataRef)
// rjc: added support for URL shortcuts (3/30/1999)
try {
var shortcutURL = null;
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
var bookmarkService = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]
.getService(nsCI.nsINavBookmarksService);
var shortcutURI = bookmarkService.getURIForKeyword(aURL);
@ -1956,7 +1958,7 @@ function getShortcutOrURI(aURL, aPostDataRef)
if (aOffset > 0) {
var cmd = aURL.substr(0, aOffset);
var text = aURL.substr(aOffset+1);
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
shortcutURI = bookmarkService.getURIForKeyword(cmd);
if (shortcutURI)
shortcutURL = shortcutURI.spec;
@ -1972,8 +1974,8 @@ function getShortcutOrURI(aURL, aPostDataRef)
shortcutURL = matches[1];
charset = matches[2];
}
#ifndef MOZ_PLACES
// FIXME: Bug 327328, we don't have last charset in places yet.
#ifndef MOZ_PLACES_BOOKMARKS
// FIXME: Bug #317472, we don't have last charset in places yet.
else if (/%s/.test(shortcutURL) ||
(aPostDataRef && /%s/.test(aPostDataRef.value))) {
try {
@ -2708,7 +2710,7 @@ function openHomeDialog(aURL)
}
}
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
var bookmarksButtonObserver = {
onDrop: function (aEvent, aXferData, aDragSession)
{
@ -3373,7 +3375,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged)
SetClickAndHoldHandlers();
#endif
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
// fix up the personal toolbar folder
var bt = document.getElementById("bookmarks-ptf");
if (bt) {
@ -3602,7 +3604,7 @@ nsBrowserStatusHandler.prototype =
PageProxySetIcon(aBrowser.mIconURL);
}
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
// Save this favicon in the favicon service
if (aBrowser.mIconURL) {
var faviconService = Components.classes["@mozilla.org/browser/favicon-service;1"]
@ -3666,7 +3668,7 @@ nsBrowserStatusHandler.prototype =
var browser = gBrowser.mCurrentBrowser;
if (!gBrowser.mTabbedMode && !browser.mIconURL)
gBrowser.useDefaultIcon(gBrowser.mCurrentTab);
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
if (browser.mIconURL)
BookmarksUtils.loadFavIcon(browser.currentURI.spec, browser.mIconURL);
#endif
@ -3865,7 +3867,7 @@ nsBrowserStatusHandler.prototype =
asyncUpdateUI : function () {
FeedHandler.updateFeeds();
BrowserSearch.updateSearchButton();
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PlacesCommandHook.updateTagButton();
#endif
},
@ -4417,7 +4419,7 @@ function asyncOpenWebPanel(event)
url: wrapper.href,
bWebPanel: true
}
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
BROWSER_ADD_BM_FEATURES, dialogArgs);
event.preventDefault();
@ -5127,7 +5129,7 @@ function AddKeywordForSearchField()
else
spec += "?" + formData.join("&");
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
var dialogArgs = {
name: "",
url: spec,
@ -5466,7 +5468,7 @@ var FeedHandler = {
return null;
},
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
/**
* Adds a Live Bookmark to a feed
* @param url

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

@ -51,7 +51,7 @@
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
<?xml-stylesheet href="chrome://browser/skin/places/browser-places.css" type="text/css"?>
#endif
@ -128,7 +128,7 @@
#include browser-context.inc
</popup>
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
#include ../../components/places/content/context.inc
#endif
</popupset>
@ -136,7 +136,7 @@
# The hacky hidden tree used by the Go menu to build items.
#include browser-gotreehack.inc
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
<!-- bookmarks context menu -->
<popupset>
<menupopup id="bookmarks-context-menu"
@ -315,7 +315,7 @@
<button id="navigator-throbber" disabled="true"/>
</toolbaritem>
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
<toolbarbutton id="bookmarksBarShowPlaces"
class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&placesToolbarButton.label;"
@ -394,11 +394,11 @@
label="&downloads.label;"
tooltiptext="&downloads.tooltip;"/>
#ifndef MOZ_PLACES
<toolbarbutton id="history-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
observes="viewHistorySidebar" label="&historyButton.label;"
tooltiptext="&historyButton.tooltip;"/>
#ifndef MOZ_PLACES_BOOKMARKS
<toolbarbutton id="bookmarks-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
observes="viewBookmarksSidebar"
tooltiptext="&bookmarksButton.tooltip;"
@ -470,7 +470,7 @@
<toolbarset id="customToolbars" context="toolbar-context-menu"/>
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
<toolbar id="PersonalToolbar" mode="icons" iconsize="small"
class="chromeclass-directories"
context="toolbar-context-menu"
@ -506,7 +506,7 @@
autocompletepopup="PopupAutoComplete"
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
onclick="return contentAreaClick(event, false);"
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
onselect="BrowserController.onEvent(BrowserController.EVENT_TABCHANGE);"
#endif
/>

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

@ -44,7 +44,8 @@
<script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/>
#ifdef MOZ_PLACES
<script type="application/x-javascript" src="chrome://browser/content/places/controller.js"/>
#else
#endif
#ifndef MOZ_PLACES_BOOKMARKS
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarksMenu.js"/>
#endif

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

@ -868,7 +868,7 @@ nsContextMenu.prototype = {
addBookmarkForFrame: function() {
var doc = this.target.ownerDocument;
var uri = doc.location.href;
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
var title = doc.title;
var description = BookmarksUtils.getDescriptionFromDocument(doc);
if (!title)

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

@ -70,7 +70,11 @@ DIRS = \
ifdef MOZ_PLACES
DIRS += places
else
DIRS += history bookmarks
DIRS += history
endif
ifndef MOZ_PLACES_BOOKMARKS
DIRS += bookmarks
endif
ifdef MOZ_SAFE_BROWSING

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

@ -1,52 +0,0 @@
#
# ***** 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):
#
# 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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public
ifndef MOZ_PLACES
DIRS += src
endif
include $(topsrcdir)/config/rules.mk

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

@ -63,7 +63,7 @@ ifneq (,$(filter windows mac cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))
SHARED_LIBRARY_LIBS += ../shell/src/$(LIB_PREFIX)shellservice_s.$(LIB_SUFFIX)
endif
ifndef MOZ_PLACES
ifndef MOZ_PLACES_BOOKMARKS
SHARED_LIBRARY_LIBS += \
../bookmarks/src/$(LIB_PREFIX)bookmarks_s.$(LIB_SUFFIX) \
$(NULL)

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

@ -39,7 +39,7 @@
#include "nsIGenericFactory.h"
#include "nsBrowserCompsCID.h"
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
#include "nsBookmarksService.h"
#include "nsForwardProxyDataSource.h"
#endif
@ -78,7 +78,7 @@
/////////////////////////////////////////////////////////////////////////////
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsBookmarksService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsForwardProxyDataSource, Init)
#endif
@ -130,7 +130,7 @@ static const nsModuleComponentInfo components[] =
#endif
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
{ "Bookmarks",
NS_BOOKMARKS_SERVICE_CID,

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

@ -385,7 +385,7 @@ var FeedResultService = {
Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var topWindow = wm.getMostRecentWindow("navigator:browser");
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
topWindow.PlacesCommandHook.addLiveBookmark(spec, title, subtitle);
#else
topWindow.FeedHandler.addLiveBookmark(spec, title, subtitle);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -66,7 +66,8 @@ REQUIRES = \
ifdef MOZ_PLACES
REQUIRES += places
else
endif
ifndef MOZ_PLACES_BOOKMARKS
REQUIRES += bookmarks
endif

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

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsBrowserProfileMigratorUtils.h"
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsBrowserCompsCID.h"
#include "nsToolkitCompsCID.h"
@ -223,7 +223,7 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile,
{
nsresult rv;
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIBookmarksService> bms =
do_GetService("@mozilla.org/browser/bookmarks-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
@ -256,7 +256,7 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile,
rv = rdfs->GetResource(NS_LITERAL_CSTRING("NC:BookmarksRoot"),
getter_AddRefs(root));
NS_ENSURE_SUCCESS(rv, rv);
#endif // MOZ_PLACES
#endif // MOZ_PLACES_BOOKMARKS
// Look for the localized name of the bookmarks toolbar
nsCOMPtr<nsIStringBundleService> bundleService =
@ -276,7 +276,7 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile,
sourceNameStrings, 1,
getter_Copies(importedBookmarksTitle));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
// Get the bookmarks service
nsCOMPtr<nsINavBookmarksService> bms =
do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv);

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

@ -84,7 +84,7 @@
#include "nsIRDFService.h"
#include "nsIRDFContainer.h"
#include "nsIURL.h"
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsBrowserCompsCID.h"
#else
@ -1177,7 +1177,7 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
// a folder called "Imported IE Favorites" and place all the Bookmarks there.
nsresult rv;
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 root;
@ -1196,7 +1196,7 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
nsAutoString personalToolbarFolderName;
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 folder;
#else
nsCOMPtr<nsIRDFResource> folder;
@ -1217,7 +1217,7 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
bundle->FormatStringFromName(NS_LITERAL_STRING("importedBookmarksFolder").get(),
sourceNameStrings, 1, getter_Copies(importedIEFavsTitle));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
bms->CreateFolder(root, importedIEFavsTitle, -1, &folder);
#else
bms->CreateFolderInContainer(importedIEFavsTitle.get(), root, -1, getter_AddRefs(folder));
@ -1262,7 +1262,7 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
}
nsresult
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsIEProfileMigrator::CopySmartKeywords(PRInt64 aParentFolder)
#else
nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
@ -1276,7 +1276,7 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
NS_SUCCEEDED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
searchUrlKey, nsIWindowsRegKey::ACCESS_READ))) {
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsresult rv;
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
@ -1307,7 +1307,7 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
nsXPIDLString importedIESearchUrlsTitle;
bundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchURLsFolder").get(),
sourceNameStrings, 1, getter_Copies(importedIESearchUrlsTitle));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
bms->CreateFolder(aParentFolder, importedIESearchUrlsTitle, -1, &keywordsFolder);
#else
bms->CreateFolderInContainer(importedIESearchUrlsTitle.get(), aParentFolder, -1,
@ -1328,7 +1328,7 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
childKey->Close();
continue;
}
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
bms->InsertItem(keywordsFolder, uri, -1);
bms->SetItemTitle(uri, keyName);
#else
@ -1399,7 +1399,7 @@ nsIEProfileMigrator::ResolveShortcut(const nsAFlatString &aFileName, char** aOut
nsresult
nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 aParentFolder,
nsINavBookmarksService* aBookmarksService,
#else
@ -1466,7 +1466,7 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
nsCaseInsensitiveStringComparator()))
bookmarkName.Truncate(lnkExtStart);
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIURI> bookmarkURI;
rv = NS_NewFileURI(getter_AddRefs(bookmarkURI), localFile);
NS_ENSURE_SUCCESS(rv, rv);
@ -1499,13 +1499,13 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
if (NS_FAILED(rv)) continue;
}
else if (isDir) {
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 folder;
#else
nsCOMPtr<nsIRDFResource> folder;
#endif
if (bookmarkName.Equals(aPersonalToolbarFolderName)) {
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
aBookmarksService->GetToolbarRoot(&folder);
// If we're here, it means the user's doing a _replace_ import which means
// clear out the content of this folder, and replace it with the new content
@ -1535,7 +1535,7 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
#endif
}
else {
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
rv = aBookmarksService->CreateFolder(aParentFolder,
bookmarkName,
-1,
@ -1570,7 +1570,7 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
nsXPIDLCString resolvedURL;
ResolveShortcut(path, getter_Copies(resolvedURL));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIURI> resolvedURI;
rv = NS_NewURI(getter_AddRefs(resolvedURI), resolvedURL);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -50,7 +50,7 @@
class nsIFile;
class nsICookieManager2;
class nsIRDFResource;
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
class nsINavBookmarksService;
#else
class nsIBookmarksService;
@ -90,7 +90,7 @@ protected:
nsresult CopyFavorites(PRBool aReplace);
void ResolveShortcut(const nsAFlatString &aFileName, char** aOutURL);
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsresult ParseFavoritesFolder(nsIFile* aDirectory,
PRInt64 aParentFolder,
nsINavBookmarksService* aBookmarksService,

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

@ -40,7 +40,7 @@
#include "nsCRT.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDocShellCID.h"
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsBrowserCompsCID.h"
#else
@ -1043,7 +1043,7 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
nsCOMPtr<nsILineInputStream> lineInputStream(do_QueryInterface(fileInputStream));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 root;
@ -1077,7 +1077,7 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
sourceNameStrings, 1,
getter_Copies(importedOperaHotlistTitle));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
bms->CreateFolder(parentFolder, importedOperaHotlistTitle, -1, &parentFolder);
#else
bms->CreateFolderInContainer(importedOperaHotlistTitle.get(),
@ -1093,7 +1093,7 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
printf("*** done copying smart keywords\n");
#endif
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 toolbar;
rv = bms->GetToolbarRoot(&toolbar);
NS_ENSURE_SUCCESS(rv, rv);
@ -1110,7 +1110,7 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
#if defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
nsresult
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsOperaProfileMigrator::CopySmartKeywords(nsINavBookmarksService* aBMS,
nsIStringBundle* aBundle,
PRInt64 aParentFolder)
@ -1145,7 +1145,7 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
sourceNameStrings, 1,
getter_Copies(importedSearchUrlsTitle));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 keywordsFolder;
rv = aBMS->CreateFolder(aParentFolder, importedSearchUrlsTitle, -1, &keywordsFolder);
NS_ENSURE_SUCCESS(rv, rv);
@ -1214,7 +1214,7 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
aBundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchUrlDesc").get(),
descStrings, 2, getter_Copies(keywordDesc));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
rv = aBMS->InsertItem(keywordsFolder, uri, -1);
NS_ENSURE_SUCCESS(rv, rv);
rv = aBMS->SetItemTitle(uri, nameStr);
@ -1244,7 +1244,7 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
}
#endif
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
void
nsOperaProfileMigrator::ClearToolbarFolder(nsIBookmarksService* aBookmarksService, nsIRDFResource* aToolbarFolder)
{
@ -1323,7 +1323,7 @@ typedef enum { EntryType_BOOKMARK, EntryType_FOLDER } EntryType;
nsresult
nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 aParent,
PRInt64 aToolbar,
nsINavBookmarksService* aBMS)
@ -1385,12 +1385,12 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
// Assuming it's in UTF-8 is rather safe because it covers two cases
// (UTF-8 and ASCII) out of three cases (the last is a non-UTF-8
// multibyte encoding).
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIRDFResource> itemRes;
#endif
if (entryType == EntryType_BOOKMARK) {
if (!name.IsEmpty() && !url.IsEmpty()) {
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), url);
if (NS_FAILED(rv))
@ -1424,7 +1424,7 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
}
else if (entryType == EntryType_FOLDER) {
if (!name.IsEmpty()) {
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 newFolder;
rv = aBMS->CreateFolder(onToolbar ? aToolbar : aParent,
name, -1, &newFolder);

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

@ -52,7 +52,7 @@ class nsILocalFile;
class nsINIParser;
class nsIPermissionManager;
class nsIPrefBranch;
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
class nsINavBookmarksService;
#else
class nsIBookmarksService;
@ -108,7 +108,7 @@ protected:
nsresult CopyHistory(PRBool aReplace);
nsresult CopyBookmarks(PRBool aReplace);
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
void ClearToolbarFolder(nsINavBookmarksService * aBookmarksService, PRInt64 aToolbarFolder);
nsresult ParseBookmarksFolder(nsILineInputStream* aStream,
PRInt64 aFolder,
@ -130,7 +130,7 @@ protected:
nsIStringBundle* aBundle,
nsIRDFResource* aParentFolder);
#endif // defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
#endif // MOZ_PLACES
#endif // MOZ_PLACES_BOOKMARKS
void GetOperaProfile(const PRUnichar* aProfile, nsILocalFile** aFile);

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

@ -41,7 +41,7 @@
#include "nsCRT.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDocShellCID.h"
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsBrowserCompsCID.h"
#else
@ -889,7 +889,7 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
// a folder called "Imported IE Favorites" and place all the Bookmarks there.
nsresult rv;
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 root;
@ -926,7 +926,7 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
sourceNameStrings, 1,
getter_Copies(importedSafariBookmarksTitle));
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
bms->CreateFolder(root, importedSafariBookmarksTitle, -1, &folder);
#else
bms->CreateFolderInContainer(importedSafariBookmarksTitle.get(), root, -1,
@ -984,7 +984,7 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
nsresult
nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 aParentFolder,
nsINavBookmarksService * aBookmarksService,
#else
@ -1019,7 +1019,7 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
// Look for the BookmarksBar Bookmarks and add them into the appropriate
// Personal Toolbar Root
if (title.EqualsLiteral("BookmarksBar") && aIsAtRootLevel) {
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 toolbarFolder;
aBookmarksService->GetToolbarRoot(&toolbarFolder);
#else
@ -1035,7 +1035,7 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
// Look for the BookmarksMenu Bookmarks and flatten them into the top level
else if (title.EqualsLiteral("BookmarksMenu") && aIsAtRootLevel) {
rv |= ParseBookmarksFolder(children,
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
aParentFolder,
#else
aParentResource,
@ -1046,7 +1046,7 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
else {
// Encountered a Folder, so create one in our Bookmarks DataSource and then
// parse the contents of the Safari one into it...
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 folder;
rv |= aBookmarksService->CreateFolder(aParentFolder,
title, -1, &folder);
@ -1070,7 +1070,7 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
nsAutoString title, url;
if (GetDictionaryStringValue(URIDictionary, CFSTR("title"), title) &&
GetDictionaryStringValue(entry, CFSTR("URLString"), url)) {
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIURI> uri;
rv |= NS_NewURI(getter_AddRefs(uri), url);
rv |= aBookmarksService->InsertItem(aParentFolder, uri, -1);

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

@ -93,7 +93,7 @@ protected:
nsresult CopyHistory(PRBool aReplace);
nsresult CopyBookmarks(PRBool aReplace);
nsresult ParseBookmarksFolder(CFArrayRef aChildren,
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 aParentFolder,
nsINavBookmarksService * aBookmarksService,
#else

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

@ -48,7 +48,8 @@ const NHRVO = Ci.nsINavHistoryResultViewObserver;
// These need to be kept in sync with the meaning of these roots in
// default_places.html!
const ORGANIZER_ROOT_HISTORY = "place:&beginTime=-2592000000000&beginTimeRef=1&endTime=7200000000&endTimeRef=2&sort=4&type=1";
const ORGANIZER_ROOT_HISTORY_UNSORTED = "place:&beginTime=-2592000000000&beginTimeRef=1&endTime=7200000000&endTimeRef=2&type=1"
const ORGANIZER_ROOT_HISTORY = ORGANIZER_ROOT_HISTORY_UNSORTED + "&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
const ORGANIZER_ROOT_BOOKMARKS = "place:&folder=2&group=3&excludeItems=1";
const ORGANIZER_SUBSCRIPTIONS_QUERY = "place:&annotation=livemark%2FfeedURI";

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

@ -0,0 +1,309 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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):
# Alec Flett <alecf@netscape.com> (original author of history.js)
# Seth Spitzer <sspizer@mozilla.org> (port to Places)
#
# 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 gHistoryTree;
var gSearchBox;
var gHistoryGrouping = "";
const NHQO = Ci.nsINavHistoryQueryOptions;
function HistorySidebarInit()
{
gHistoryTree = document.getElementById("historyTree");
gSearchBox = document.getElementById("search-box");
gHistoryGrouping = document.getElementById("viewButton").
getAttribute("selectedsort");
if (gHistoryGrouping == "site")
document.getElementById("bysite").setAttribute("checked", "true");
else if (gHistoryGrouping == "visited")
document.getElementById("byvisited").setAttribute("checked", "true");
else if (gHistoryGrouping == "lastvisited")
document.getElementById("bylastvisited").setAttribute("checked", "true");
else if (gHistoryGrouping == "dayandsite")
document.getElementById("bydayandsite").setAttribute("checked", "true");
else
document.getElementById("byday").setAttribute("checked", "true");
// XXXBlake we should persist the last search value
// If it's empty, this will do the right thing and
// just group by the old grouping.
// bug #359073 tracks this RFE
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 SetPlace(aSearchString)
{
var placeURI = ORGANIZER_ROOT_HISTORY_UNSORTED;
// if there is a search string, root the places tree into
// the history root (sorted by SORT_BY_TITLE_ASCENDING)
// otherwise, root the tree based on gHistoryGrouping
if (aSearchString)
placeURI += "&sort=" + NHQO.SORT_BY_TITLE_ASCENDING;
else {
switch (gHistoryGrouping) {
case "site":
placeURI += "&sort=" + NHQO.SORT_BY_TITLE_ASCENDING;
break;
case "visited":
placeURI += "&sort=" + NHQO.SORT_BY_VISITCOUNT_DESCENDING;
break;
case "lastvisited":
placeURI += "&sort=" + NHQO.SORT_BY_DATE_DESCENDING;
break;
case "dayandsite":
/* placeURI += "&group=" + NHQO.GROUP_BY_DAY; */
placeURI += "&group=" + NHQO.GROUP_BY_HOST;
placeURI += "&sort=" + NHQO.SORT_BY_TITLE_ASCENDING;
break;
default: /* "day" */
/* placeURI += "&group=" + NHQO.GROUP_BY_DAY; */
placeURI += "&sort=" + NHQO.SORT_BY_TITLE_ASCENDING;
break;
}
}
/* don't re-root if the placeURI has not changed */
if (gHistoryTree.place == placeURI)
return;
gHistoryTree.place = placeURI;
}
function GroupBy(groupingType)
{
gHistoryGrouping = groupingType;
gSearchBox.value = "";
searchHistory(gSearchBox.value);
}
var historyDNDObserver = {
onDragStart: function (aEvent, aXferData, aDragAction)
{
var node = gHistoryTree.selectedURINode;
if (!node)
return false;
var url = node.uri;
var title = node.title;
var htmlString = "<A HREF='" + url + "'>" + title + "</A>";
aXferData.data = new TransferData();
aXferData.data.addDataForFlavour("text/unicode", url);
aXferData.data.addDataForFlavour("text/html", htmlString);
aXferData.data.addDataForFlavour("text/x-moz-url", url + "\n" + title);
return true;
}
};
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()
{
// 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;
#ifdef MOZ_PLACES_BOOKMARKS
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService)
.newURI(node.uri, null, null);
PlacesController.showAddBookmarkUI(uri, node.title);
#else
BookmarksUtils.addBookmark(node.uri, node.title, undefined);
#endif
}
function historyCopyLink()
{
var node = gHistoryTree.selectedURINode;
var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
clipboard.copyString(node.uri);
}
function buildContextMenu(aEvent)
{
var view = gHistoryTree.view;
// if nothing is selected, bail and don't show a context menu
if (view.selection.count != 1) {
aEvent.preventDefault();
return;
}
var openItem = document.getElementById("miOpen");
var openItemInNewWindow = document.getElementById("miOpenInNewWindow");
var openItemInNewTab = document.getElementById("miOpenInNewTab");
var bookmarkItem = document.getElementById("miAddBookmark");
var copyLocationItem = document.getElementById("miCopyLink");
var sep1 = document.getElementById("pre-bookmarks-separator");
var sep2 = document.getElementById("post-bookmarks-separator");
var expandItem = document.getElementById("miExpand");
var collapseItem = document.getElementById("miCollapse");
var currentIndex = gHistoryTree.currentIndex;
if ((gHistoryGrouping == "day" || gHistoryGrouping == "dayandsite")
&& view.isContainer(currentIndex)) {
openItem.hidden = true;
openItemInNewWindow.hidden = true;
openItemInNewTab.hidden = true;
bookmarkItem.hidden = true;
copyLocationItem.hidden = true;
sep1.hidden = true;
sep2.hidden = false;
if (view.isContainerOpen(currentIndex)) {
expandItem.hidden = true;
collapseItem.hidden = false;
} else {
expandItem.hidden = false;
collapseItem.hidden = true;
}
}
else {
openItem.hidden = false;
openItemInNewWindow.hidden = false;
openItemInNewTab.hidden = false;
bookmarkItem.hidden = false;
copyLocationItem.hidden = false;
sep1.hidden = false;
sep2.hidden = false;
expandItem.hidden = true;
collapseItem.hidden = true;
}
}
function searchHistory(aInput)
{
SetPlace(aInput);
if (!aInput)
return;
gHistoryTree.applyFilter(aInput, false /* onlyBookmarks */,
0 /* folderRestrict */, null);
}
#include ../../../../toolkit/content/debug.js

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

@ -0,0 +1,151 @@
<?xml version="1.0"?> <!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
# ***** 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):
# Alec Flett <alecf@netscape.com> (original author of history-panel.xul)
# Seth Spitzer <sspitzer@mozilla.org> (port to Places)
#
# 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 *****
<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<!DOCTYPE page SYSTEM "chrome://browser/locale/history/history.dtd">
<!-- we need to keep id="history-panel" for upgrade and switching
between versions of the browser -->
<page id="history-panel" orient="vertical"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="HistorySidebarInit();">
<script type="application/x-javascript"
src="chrome://browser/content/places/controller.js"/>
<script type="application/x-javascript"
src="chrome://browser/content/places/history-panel.js"/>
<script type="application/x-javascript"
src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript"
src="chrome://browser/content/utilityOverlay.js"/>
#ifndef MOZ_PLACES_BOOKMARKS
<script type="application/x-javascript"
src="chrome://browser/content/bookmarks/bookmarks.js"/>
#endif
<script type="application/x-javascript"
src="chrome://global/content/nsDragAndDrop.js"/>
<commandset id="editMenuCommands"/>
<!-- XXX fix me:
context menu delete and cmd_delete are not working yet. see bug #359462
-->
<keyset id="editMenuKeys">
#ifdef XP_MACOSX
<key id="key_delete2" keycode="VK_BACK" command="cmd_delete"/>
#endif
</keyset>
<popup id="historyContextMenu" onpopupshowing="buildContextMenu(event);">
<menuitem id="miExpand" label="&expand.label;"
accesskey="&expand.accesskey;"
default="true" oncommand="collapseExpand();"/>
<menuitem id="miCollapse" label="&collapse.label;"
accesskey="&collapse.accesskey;"
default="true" oncommand="collapseExpand();"/>
<menuitem id="miOpen" label="&openLinkInWindow.label;"
accesskey="&openLinkInWindow.accesskey;" default="true"
oncommand="openURLIn('current');"/>
<menuitem id="miOpenInNewWindow" label="&openInNewWindow.label;"
accesskey="&openInNewWindow.accesskey;"
oncommand="openURLIn('window');"/>
<menuitem id="miOpenInNewTab" label="&openInNewTab.label;"
accesskey="&openInNewTab.accesskey;"
oncommand="openURLIn('tab');"/>
<menuseparator id="pre-bookmarks-separator"/>
<menuitem id="miAddBookmark" label="&bookmarkLink.label;"
accesskey="&bookmarkLink.accesskey;"
oncommand="historyAddBookmarks();"/>
<menuitem id="miCopyLink" label="&copyLink.label;"
accesskey="&copyLink.accesskey;"
oncommand="historyCopyLink();"/>
<menuseparator id="post-bookmarks-separator"/>
<menuitem id="cMenu_delete"/>
</popup>
<hbox align="center">
<label value="&find.label;" accesskey="&find.accesskey;"
control="search-box"/>
<textbox id="search-box" flex="1" type="timed" timeout="500"
oncommand="searchHistory(this.value);"/>
<button id="viewButton" style="min-width:0px !important;" type="menu"
label="&view.label;" accesskey="&view.accesskey;" selectedsort="day"
persist="selectedsort">
<menupopup>
<menuitem id="bydayandsite" label="&byDayAndSite.label;"
accesskey="&byDayAndSite.accesskey;" type="radio"
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'dayandsite'); GroupBy('dayandsite');"/>
<menuitem id="bysite" label="&bySite.label;"
accesskey="&bySite.accesskey;" type="radio"
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'site'); GroupBy('site');"/>
<menuitem id="byday" label="&byDate.label;"
accesskey="&byDate.accesskey;"
type="radio"
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'day'); GroupBy('day');"/>
<menuitem id="byvisited" label="&byMostVisited.label;"
accesskey="&byMostVisited.accesskey;"
type="radio"
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'visited'); GroupBy('visited');"/>
<menuitem id="bylastvisited" label="&byLastVisited.label;"
accesskey="&byLastVisited.accesskey;"
type="radio"
oncommand="this.parentNode.parentNode.setAttribute('selectedsort', 'lastvisited'); GroupBy('lastvisited');"/>
</menupopup>
</button>
</hbox>
<tree id="historyTree" flex="1" type="places"
context="historyContextMenu"
onkeypress="if (event.keyCode == 13) openURL(event);"
hidecolumnpicker="true"
ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, historyDNDObserver);"
onclick="handleHistoryClick(event);">
<treecols>
<treecol id="title" flex="1" primary="true" hideheader="true"/>
</treecols>
<treechildren flex="1"/>
</tree>
</page>

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

@ -17,3 +17,7 @@ browser.jar:
* content/browser/places/demos/time.html (content/demos/time.html)
* content/browser/places/demos/time.css (content/demos/time.css)
* content/browser/places/demos/time.js (content/demos/time.js)
# keep the Places version of the history sidebar at history/history-panel.xul
# to prevent having to worry about between versions of the browser
* content/browser/history/history-panel.xul (content/history-panel.xul)
* content/browser/places/history-panel.js (content/history-panel.js)

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

@ -37,7 +37,7 @@ browser.jar:
* content/browser/preferences/security.js
* content/browser/preferences/securityWarnings.xul
* content/browser/preferences/securityWarnings.js
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
* content/browser/preferences/selectBookmark.xul
* content/browser/preferences/selectBookmark.js
#endif

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

@ -113,7 +113,7 @@ var gMainPane = {
setHomePageToBookmark: function ()
{
var rv = { urls: null, names: null };
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
document.documentElement.openSubDialog("chrome://browser/content/preferences/selectBookmark.xul",
#else
document.documentElement.openSubDialog("chrome://browser/content/bookmarks/selectBookmark.xul",

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

@ -26,9 +26,11 @@
locale/browser/sessionstore.properties (%chrome/browser/sessionstore.properties)
#ifdef MOZ_PLACES
locale/browser/places/places.dtd (%chrome/browser/places/places.dtd)
locale/browser/places/places.properties (%chrome/browser/places/places.properties)
#endif
#ifdef MOZ_PLACES_BOOKMARKS
locale/browser/places/bookmarkProperties.dtd (%chrome/browser/places/bookmarkProperties.dtd)
locale/browser/places/bookmarkProperties.properties (%chrome/browser/places/bookmarkProperties.properties)
locale/browser/places/places.properties (%chrome/browser/places/places.properties)
locale/browser/places/default_places.html (%chrome/browser/places/default_places.html)
locale/browser/places/placesPopup.dtd (%chrome/browser/places/placesPopup.dtd)
locale/browser/places/placesPopup.properties (%chrome/browser/places/placesPopup.properties)

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

@ -228,7 +228,7 @@ toolbarpaletteitem[place="toolbar"] .bookmarks-toolbar-items {
visibility: hidden;
}
%ifdef MOZ_PLACES
%ifdef MOZ_PLACES_BOOKMARKS
toolbarpaletteitem[place="toolbar"] .places-toolbar-items {
display: none;
}
@ -1209,7 +1209,7 @@ tabpanels.plain {
background-color: #fff !important;
}
%ifdef MOZ_PLACES
%ifdef MOZ_PLACES_BOOKMARKS
#places-bookmark {
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
}

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

@ -40,12 +40,14 @@ classic.jar:
skin/classic/browser/feeds/addFeedReader.css (feeds/addFeedReader.css)
#ifdef MOZ_PLACES
skin/classic/browser/places/places.css (places/places.css)
skin/classic/browser/places/browser-places.css (places/browser-places.css)
skin/classic/browser/places/defaultFavicon.png (places/defaultFavicon.png)
skin/classic/browser/places/query.png (places/query.png)
skin/classic/browser/places/livemarkItem.png (places/livemarkItem.png)
#endif
#ifdef MOZ_PLACES_BOOKMARKS
skin/classic/browser/places/browser-places.css (places/browser-places.css)
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
skin/classic/browser/places/livemarkItem.png (places/livemarkItem.png)
skin/classic/browser/places/placesIcon.png (places/placesIcon.png)
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
skin/classic/browser/places/folderDragOver.png (places/folderDragOver.png)

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

@ -149,7 +149,7 @@ toolbarpaletteitem[place="toolbar"] .bookmarks-toolbar-items {
visibility: hidden;
}
%ifdef MOZ_PLACES
%ifdef MOZ_PLACES_BOOKMARKS
toolbarpaletteitem[place="toolbar"] .places-toolbar-items {
display: none;
}
@ -1333,7 +1333,7 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-text {
list-style-image: url("chrome://global/skin/throbber/Throbber-small.gif");
}
%ifdef MOZ_PLACES
%ifdef MOZ_PLACES_BOOKMARKS
#places-bookmark {
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png");
}

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

@ -51,9 +51,11 @@ classic.jar:
skin/classic/browser/places/places.css (places/places.css)
skin/classic/browser/places/defaultFavicon.png (places/defaultFavicon.png)
skin/classic/browser/places/query.png (places/query.png)
skin/classic/browser/places/livemarkItem.png (places/livemarkItem.png)
#endif
#ifdef MOZ_PLACES_BOOKMARKS
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
skin/classic/browser/places/livemarkItem.png (places/livemarkItem.png)
skin/classic/browser/places/placesIcon.png (places/placesIcon.png)
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
skin/classic/browser/places/folderDragOver.png (places/folderDragOver.png)

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

@ -76,7 +76,8 @@ endif
ifdef MOZ_PLACES
REQUIRES += places toolkitcomps
else
endif
ifndef MOZ_PLACES_BOOKMARKS
REQUIRES += bookmarks
endif

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

@ -54,7 +54,7 @@
#include "nsDirectoryServiceUtils.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsINavHistoryService.h"
#include "nsILivemarkService.h"
@ -130,7 +130,7 @@ class nsProfileCollector::BookmarkCounter
// Fills in |count| with the number of children of each BookmarkType.
// If |deep| is true, then the count will include children of all subfolders.
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
void CountChildren(PRInt64 root, PRBool deep, nsTArray<PRInt32> &count);
#else
void CountChildren(nsIRDFResource *root,
@ -138,7 +138,7 @@ class nsProfileCollector::BookmarkCounter
#endif
private:
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
void CountRecursive(nsINavHistoryContainerResultNode *root, PRBool deep,
nsTArray<PRInt32> &count);
#else
@ -146,7 +146,7 @@ class nsProfileCollector::BookmarkCounter
nsTArray<PRInt32> &count);
#endif
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsILivemarkService> mLivemarkService;
#else
nsCOMPtr<nsIRDFDataSource> mDataSource;
@ -442,7 +442,7 @@ nsProfileCollector::LogBookmarks(nsIMetricsEventItem *profile)
getter_AddRefs(bookmarksItem));
NS_ENSURE_STATE(bookmarksItem);
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsINavBookmarksService> bmSvc =
do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID);
NS_ENSURE_STATE(bmSvc);
@ -515,7 +515,7 @@ void
nsProfileCollector::LogBookmarkLocation(nsIMetricsEventItem *bookmarksItem,
const nsACString &location,
BookmarkCounter *counter,
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 root,
#else
nsIRDFResource *root,
@ -750,7 +750,7 @@ nsProfileCollector::ExtensionEnumerator::CreateExtensionItem(
}
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
nsresult
nsProfileCollector::BookmarkCounter::Init()
{

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

@ -44,7 +44,7 @@
class nsISupports;
class nsIMetricsEventItem;
class nsIPropertyBag;
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
class nsIRDFResource;
#endif
@ -77,7 +77,7 @@ class nsProfileCollector : public nsIMetricsCollector
nsresult LogDisplay(nsIMetricsEventItem *profile);
nsresult LogBookmarks(nsIMetricsEventItem *profile);
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
void LogBookmarkLocation(nsIMetricsEventItem *bookmarksItem,
const nsACString &location,
BookmarkCounter *counter,

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

@ -48,7 +48,7 @@
#include "nsIDOMElement.h"
#include "nsIDOMWindow.h"
#include "nsDataHashtable.h"
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
#include "nsIRDFService.h"
#include "nsIRDFResource.h"
#include "nsIRDFContainer.h"
@ -349,8 +349,9 @@ nsresult
nsUICommandCollector::LogBookmarkInfo(const nsString& id,
nsIMetricsEventItem* parentItem)
{
#ifdef MOZ_PLACES
#ifdef MOZ_PLACES_BOOKMARKS
// TODO: write me!
// see bug #356606
return NS_OK;
#else
@ -437,5 +438,5 @@ nsUICommandCollector::LogBookmarkInfo(const nsString& id,
return nsMetricsUtils::AddChildItem(parentItem,
NS_LITERAL_STRING("bookmark"), bmProps);
#endif // MOZ_PLACES
#endif // MOZ_PLACES_BOOKMARKS
}

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

@ -84,7 +84,7 @@ DIRS += \
$(NULL)
ifdef MOZ_PHOENIX
ifndef MOZ_PLACES
ifndef MOZ_PLACES_BOOKMARKS
DIRS += search
endif
endif

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

@ -74,7 +74,7 @@
#include "nsIHttpChannel.h"
#include "nsIUploadChannel.h"
#include "nsIInputStream.h"
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
#include "nsIBookmarksService.h"
#endif
#include "nsIStringBundle.h"
@ -1713,7 +1713,7 @@ InternetSearchDataSource::GetAllCmds(nsIRDFResource* source,
&isSearchResult);
if (NS_SUCCEEDED(rv) && isSearchResult)
{
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIRDFDataSource> datasource;
if (NS_SUCCEEDED(rv = mRDFService->GetDataSource("rdf:bookmarks", getter_AddRefs(datasource))))
{
@ -1832,7 +1832,7 @@ InternetSearchDataSource::addToBookmarks(nsIRDFResource *src)
}
}
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIRDFDataSource> datasource;
if (NS_SUCCEEDED(rv = mRDFService->GetDataSource("rdf:bookmarks", getter_AddRefs(datasource))))
{
@ -1902,7 +1902,7 @@ InternetSearchDataSource::addQueryToBookmarks(nsIRDFResource *src)
}
}
#ifndef MOZ_PLACES
#ifndef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIRDFDataSource> datasource;
if (NS_SUCCEEDED(rv = mRDFService->GetDataSource("rdf:bookmarks", getter_AddRefs(datasource))))
{