329269 various improvements to view initialization r=annie.sullivan@gmail.com 330736 - bug in query serialization r=brettw@gmail.com

git-svn-id: svn://10.0.0.236/trunk@192511 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beng%bengoodger.com
2006-03-17 02:02:36 +00:00
parent 579fb6e99b
commit dfde20d73e
18 changed files with 476 additions and 643 deletions

View File

@@ -441,7 +441,7 @@
label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;"
ondragover="BookmarksEventHandler.onDragOver(event);">
<menupopup id="bookmarksMenuPopup"
type="places"
type="places" asyncinit="true"
place="place:&amp;folder=2&amp;group=3&amp;expandQueries=1"
context="placesContext"
openInTabs="children"

View File

@@ -172,8 +172,10 @@
<command id="Tools:Sanitize" oncommand="gBrowserGlue.sanitize(window || null);"/>
#ifdef MOZ_PLACES
#include ../../components/places/content/commands.inc
<command id="Browser:ShowBookmarks" oncommand="PlacesCommandHook.showPlacesOrganizer('bookmarks');"/>
<command id="Browser:ShowHistory" oncommand="PlacesCommandHook.showPlacesOrganizer('history');"/>
<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();"/>
<command id="Browser:ClearHistory" oncommand="HistoryMenu.clearHistory();"/>
#endif

View File

@@ -865,10 +865,6 @@ function delayedStartup()
document.getElementById("PersonalToolbar")
.controllers.appendController(BookmarksMenuController);
#else
var bookmarksBar = document.getElementById("bookmarksBarContent");
bookmarksBar.init();
var bookmarksMenuPopup = document.getElementById("bookmarksMenuPopup");
bookmarksMenuPopup.init();
window.controllers.appendController(PlacesController);
#endif
@@ -6376,13 +6372,24 @@ var PlacesCommandHook = {
/**
* Opens the Places Organizer.
* @param mode
* The mode to display the window with ("bookmarks" or "history").
* @param place
* The place to select in the organizer window (a place: URI)
*/
showPlacesOrganizer: function PCH_showPlacesOrganizer(mode) {
// TODO: check for an existing one and focus it instead.
openDialog("chrome://browser/content/places/places.xul",
"", "dialog=no,resizable", mode);
showPlacesOrganizer: function PCH_showPlacesOrganizer(place) {
var wm =
Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var organizer = wm.getMostRecentWindow("Places:Organizer");
if (!organizer) {
// No currently open places window, so open one with the specified mode.
openDialog("chrome://browser/content/places/places.xul",
"", "dialog=no,resizable", place);
}
else {
// Set the mode on an existing places window.
organizer.selectPlaceURI(place);
organizer.focus();
}
},
/**
@@ -6434,7 +6441,7 @@ var HistoryMenu = {
showPlacesSearch: function PHM_showPlacesSearch() {
// XXX The places view needs to be updated before this
// does something different than show history.
PlacesCommandHook.showPlacesOrganizer("history");
PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_HISTORY);
},
/**
@@ -6442,8 +6449,9 @@ var HistoryMenu = {
* (XXX This might be changed to show the Clear Private Data menu instead)
*/
clearHistory: function PHM_clearHistory() {
var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
.getService(Components.interfaces.nsIBrowserHistory);
var globalHistory =
Cc["@mozilla.org/browser/global-history;2"].
getService(Ci.nsIBrowserHistory);
globalHistory.removeAllPages();
}
};

View File

@@ -280,11 +280,11 @@
#ifdef MOZ_PLACES
<toolbarbutton id="bookmarksBarShowPlaces"
oncommand="PlacesCommandHook.showPlacesOrganizer('history');"/>
oncommand="PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_HISTORY);"/>
<toolbaritem flex="1" id="personal-bookmarks" title="&bookmarksItem.title;">
<hbox id="bookmarksBarContent" flex="1" type="places"
place="place:&amp;folder=3&amp;group=3&amp;expandQueries=1"
context="placesContext"
context="placesContext" asyncinit="true"
onclick="BookmarksEventHandler.onClick(event);"
oncommand="BookmarksEventHandler.onCommand(event);"
onpopupshowing="BookmarksEventHandler.onPopupShowing(event);"/>