зеркало из https://github.com/mozilla/gecko-dev.git
329269 various improvements to view initialization r=annie.sullivan@gmail.com 330736 - bug in query serialization r=brettw@gmail.com
This commit is contained in:
Родитель
0fe291771c
Коммит
3618ce030e
|
@ -441,7 +441,7 @@
|
||||||
label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;"
|
label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;"
|
||||||
ondragover="BookmarksEventHandler.onDragOver(event);">
|
ondragover="BookmarksEventHandler.onDragOver(event);">
|
||||||
<menupopup id="bookmarksMenuPopup"
|
<menupopup id="bookmarksMenuPopup"
|
||||||
type="places"
|
type="places" asyncinit="true"
|
||||||
place="place:&folder=2&group=3&expandQueries=1"
|
place="place:&folder=2&group=3&expandQueries=1"
|
||||||
context="placesContext"
|
context="placesContext"
|
||||||
openInTabs="children"
|
openInTabs="children"
|
||||||
|
|
|
@ -172,8 +172,10 @@
|
||||||
<command id="Tools:Sanitize" oncommand="gBrowserGlue.sanitize(window || null);"/>
|
<command id="Tools:Sanitize" oncommand="gBrowserGlue.sanitize(window || null);"/>
|
||||||
#ifdef MOZ_PLACES
|
#ifdef MOZ_PLACES
|
||||||
#include ../../components/places/content/commands.inc
|
#include ../../components/places/content/commands.inc
|
||||||
<command id="Browser:ShowBookmarks" oncommand="PlacesCommandHook.showPlacesOrganizer('bookmarks');"/>
|
<command id="Browser:ShowBookmarks"
|
||||||
<command id="Browser:ShowHistory" oncommand="PlacesCommandHook.showPlacesOrganizer('history');"/>
|
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:SearchHistory" oncommand="HistoryMenu.showPlacesSearch();"/>
|
||||||
<command id="Browser:ClearHistory" oncommand="HistoryMenu.clearHistory();"/>
|
<command id="Browser:ClearHistory" oncommand="HistoryMenu.clearHistory();"/>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -865,10 +865,6 @@ function delayedStartup()
|
||||||
document.getElementById("PersonalToolbar")
|
document.getElementById("PersonalToolbar")
|
||||||
.controllers.appendController(BookmarksMenuController);
|
.controllers.appendController(BookmarksMenuController);
|
||||||
#else
|
#else
|
||||||
var bookmarksBar = document.getElementById("bookmarksBarContent");
|
|
||||||
bookmarksBar.init();
|
|
||||||
var bookmarksMenuPopup = document.getElementById("bookmarksMenuPopup");
|
|
||||||
bookmarksMenuPopup.init();
|
|
||||||
window.controllers.appendController(PlacesController);
|
window.controllers.appendController(PlacesController);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -6376,13 +6372,24 @@ var PlacesCommandHook = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the Places Organizer.
|
* Opens the Places Organizer.
|
||||||
* @param mode
|
* @param place
|
||||||
* The mode to display the window with ("bookmarks" or "history").
|
* The place to select in the organizer window (a place: URI)
|
||||||
*/
|
*/
|
||||||
showPlacesOrganizer: function PCH_showPlacesOrganizer(mode) {
|
showPlacesOrganizer: function PCH_showPlacesOrganizer(place) {
|
||||||
// TODO: check for an existing one and focus it instead.
|
var wm =
|
||||||
openDialog("chrome://browser/content/places/places.xul",
|
Cc["@mozilla.org/appshell/window-mediator;1"].
|
||||||
"", "dialog=no,resizable", mode);
|
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() {
|
showPlacesSearch: function PHM_showPlacesSearch() {
|
||||||
// XXX The places view needs to be updated before this
|
// XXX The places view needs to be updated before this
|
||||||
// does something different than show history.
|
// 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)
|
* (XXX This might be changed to show the Clear Private Data menu instead)
|
||||||
*/
|
*/
|
||||||
clearHistory: function PHM_clearHistory() {
|
clearHistory: function PHM_clearHistory() {
|
||||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
|
var globalHistory =
|
||||||
.getService(Components.interfaces.nsIBrowserHistory);
|
Cc["@mozilla.org/browser/global-history;2"].
|
||||||
|
getService(Ci.nsIBrowserHistory);
|
||||||
globalHistory.removeAllPages();
|
globalHistory.removeAllPages();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -280,11 +280,11 @@
|
||||||
|
|
||||||
#ifdef MOZ_PLACES
|
#ifdef MOZ_PLACES
|
||||||
<toolbarbutton id="bookmarksBarShowPlaces"
|
<toolbarbutton id="bookmarksBarShowPlaces"
|
||||||
oncommand="PlacesCommandHook.showPlacesOrganizer('history');"/>
|
oncommand="PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_HISTORY);"/>
|
||||||
<toolbaritem flex="1" id="personal-bookmarks" title="&bookmarksItem.title;">
|
<toolbaritem flex="1" id="personal-bookmarks" title="&bookmarksItem.title;">
|
||||||
<hbox id="bookmarksBarContent" flex="1" type="places"
|
<hbox id="bookmarksBarContent" flex="1" type="places"
|
||||||
place="place:&folder=3&group=3&expandQueries=1"
|
place="place:&folder=3&group=3&expandQueries=1"
|
||||||
context="placesContext"
|
context="placesContext" asyncinit="true"
|
||||||
onclick="BookmarksEventHandler.onClick(event);"
|
onclick="BookmarksEventHandler.onClick(event);"
|
||||||
oncommand="BookmarksEventHandler.onCommand(event);"
|
oncommand="BookmarksEventHandler.onCommand(event);"
|
||||||
onpopupshowing="BookmarksEventHandler.onPopupShowing(event);"/>
|
onpopupshowing="BookmarksEventHandler.onPopupShowing(event);"/>
|
||||||
|
|
|
@ -248,11 +248,9 @@ var BookmarkPropertiesPanel = {
|
||||||
this._controller = controller;
|
this._controller = controller;
|
||||||
|
|
||||||
this.folderTree = this._dialogWindow.document.getElementById("folder-tree");
|
this.folderTree = this._dialogWindow.document.getElementById("folder-tree");
|
||||||
this.folderTree.controllers.appendController(this._controller);
|
this.folderTree.peerDropTypes = [];
|
||||||
this.folderTree.init(new ViewConfig([TYPE_X_MOZ_PLACE_CONTAINER],
|
this.folderTree.childDropTypes = [];
|
||||||
ViewConfig.GENERIC_DROP_TYPES,
|
this.folderTree.excludeItems = true;
|
||||||
true, false, 4, true));
|
|
||||||
this.folderTree.loadFolder(this._bms.placesRoot);
|
|
||||||
|
|
||||||
this._initAssignableFolderResult();
|
this._initAssignableFolderResult();
|
||||||
this._populateProperties();
|
this._populateProperties();
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
class="placesTree"
|
class="placesTree"
|
||||||
flex="1"
|
flex="1"
|
||||||
type="places"
|
type="places"
|
||||||
|
place="place:&folder=1&group=3&excludeItems=1"
|
||||||
hidecolumnpicker="true"
|
hidecolumnpicker="true"
|
||||||
seltype="multiple">
|
seltype="multiple">
|
||||||
<treecols>
|
<treecols>
|
||||||
|
|
|
@ -53,6 +53,11 @@ const SELECTION_IS_CHANGEABLE = 0x10;
|
||||||
const SELECTION_IS_REMOVABLE = 0x20;
|
const SELECTION_IS_REMOVABLE = 0x20;
|
||||||
const SELECTION_IS_MOVABLE = 0x40;
|
const SELECTION_IS_MOVABLE = 0x40;
|
||||||
|
|
||||||
|
// 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_BOOKMARKS = "place:&folder=2&group=3&excludeItems=1";
|
||||||
|
|
||||||
// Place entries that are containers, e.g. bookmark folders or queries.
|
// Place entries that are containers, e.g. bookmark folders or queries.
|
||||||
const TYPE_X_MOZ_PLACE_CONTAINER = "text/x-moz-place-container";
|
const TYPE_X_MOZ_PLACE_CONTAINER = "text/x-moz-place-container";
|
||||||
// Place entries that are bookmark separators.
|
// Place entries that are bookmark separators.
|
||||||
|
@ -85,8 +90,6 @@ const NEWLINE= "\n";
|
||||||
const NEWLINE = "\r\n";
|
const NEWLINE = "\r\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const MENU_URI = "chrome://browser/content/places/menu.xml#places-menupopup";
|
|
||||||
|
|
||||||
function STACK(args) {
|
function STACK(args) {
|
||||||
var temp = arguments.callee.caller;
|
var temp = arguments.callee.caller;
|
||||||
while (temp) {
|
while (temp) {
|
||||||
|
@ -115,23 +118,6 @@ function InsertionPoint(folderId, index, orientation) {
|
||||||
this.orientation = orientation;
|
this.orientation = orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialization Configuration for a View
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
function ViewConfig(dropTypes, dropOnTypes, excludeItems,
|
|
||||||
expandQueries, firstDropIndex, filterTransactions) {
|
|
||||||
this.dropTypes = dropTypes;
|
|
||||||
this.dropOnTypes = dropOnTypes;
|
|
||||||
this.excludeItems = excludeItems;
|
|
||||||
this.expandQueries = expandQueries;
|
|
||||||
this.firstDropIndex = firstDropIndex;
|
|
||||||
this.filterTransactions = filterTransactions;
|
|
||||||
}
|
|
||||||
ViewConfig.GENERIC_DROP_TYPES = [TYPE_X_MOZ_PLACE_CONTAINER,
|
|
||||||
TYPE_X_MOZ_PLACE_SEPARATOR, TYPE_X_MOZ_PLACE,
|
|
||||||
TYPE_X_MOZ_URL];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages grouping options for a particular view type.
|
* Manages grouping options for a particular view type.
|
||||||
* @param pref
|
* @param pref
|
||||||
|
@ -223,6 +209,64 @@ function asFullVisit(node){ return QI_node(node, Ci.nsINavHistoryFullVisitResult
|
||||||
function asContainer(node){ return QI_node(node, Ci.nsINavHistoryContainerResultNode);}
|
function asContainer(node){ return QI_node(node, Ci.nsINavHistoryContainerResultNode);}
|
||||||
function asQuery(node) { return QI_node(node, Ci.nsINavHistoryQueryResultNode); }
|
function asQuery(node) { return QI_node(node, Ci.nsINavHistoryQueryResultNode); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A View Configuration
|
||||||
|
*/
|
||||||
|
function ViewConfig(peerDropTypes, childDropTypes, excludeItems, expandQueries,
|
||||||
|
peerDropIndex) {
|
||||||
|
this.peerDropTypes = peerDropTypes;
|
||||||
|
this.childDropTypes = childDropTypes;
|
||||||
|
this.excludeItems = excludeItems;
|
||||||
|
this.expandQueries = expandQueries;
|
||||||
|
this.peerDropIndex = peerDropIndex;
|
||||||
|
}
|
||||||
|
ViewConfig.GENERIC_DROP_TYPES =
|
||||||
|
[TYPE_X_MOZ_PLACE_CONTAINER,
|
||||||
|
TYPE_X_MOZ_PLACE_SEPARATOR,
|
||||||
|
TYPE_X_MOZ_PLACE,
|
||||||
|
TYPE_X_MOZ_URL];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures Views, applying some meta-model rules. These rules are model-like,
|
||||||
|
* e.g. must apply everwhere a model is instantiated, but are not actually stored
|
||||||
|
* in the data model itself. For example, you can't drag leaf items onto the
|
||||||
|
* places root. This needs to be enforced automatically everywhere a view of
|
||||||
|
* that model is instantiated.
|
||||||
|
*/
|
||||||
|
var ViewConfigurator = {
|
||||||
|
rules: {
|
||||||
|
"folder=1": new ViewConfig([TYPE_X_MOZ_PLACE_CONTAINER],
|
||||||
|
ViewConfig.GENERIC_DROP_TYPES,
|
||||||
|
true, false, 4)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies rules to a specific view.
|
||||||
|
*/
|
||||||
|
configure: function PC_configure(view) {
|
||||||
|
// Determine what place the view is showing.
|
||||||
|
var place = view.place;
|
||||||
|
|
||||||
|
// Find a ruleset that matches the current place.
|
||||||
|
var rules = null;
|
||||||
|
for (var test in this.rules) {
|
||||||
|
if (place.indexOf(test) != -1) {
|
||||||
|
rules = this.rules[test];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If rules are found, apply them.
|
||||||
|
if (rules) {
|
||||||
|
view.peerDropTypes = rules.peerDropTypes;
|
||||||
|
view.childDropTypes = rules.childDropTypes;
|
||||||
|
view.excludeItems = rules.excludeItems;
|
||||||
|
view.expandQueries = rules.expandQueries;
|
||||||
|
view.peerDropIndex = rules.peerDropIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Master Places Controller
|
* The Master Places Controller
|
||||||
*/
|
*/
|
||||||
|
@ -292,16 +336,6 @@ var PlacesController = {
|
||||||
return this._annotations;
|
return this._annotations;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** UI Text Strings */
|
|
||||||
|
|
||||||
__strings: null,
|
|
||||||
get _strings() {
|
|
||||||
if (!this.__strings) {
|
|
||||||
this.__strings = document.getElementById("placeBundle");
|
|
||||||
}
|
|
||||||
return this.__strings;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a HistoryResultNode for the contents of a folder.
|
* Generates a HistoryResultNode for the contents of a folder.
|
||||||
* @param folderId
|
* @param folderId
|
||||||
|
@ -328,20 +362,6 @@ var PlacesController = {
|
||||||
return asContainer(result.root);
|
return asContainer(result.root);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a place: URI for the given queries and options.
|
|
||||||
* @param queries
|
|
||||||
* An array of NavHistoryQueries
|
|
||||||
* @param options
|
|
||||||
* A NavHistoryQueryOptions object
|
|
||||||
* @returns A place: URI encoding the parameters.
|
|
||||||
*/
|
|
||||||
getPlaceURI: function PC_getPlaceURI(queries, options) {
|
|
||||||
var queryString = this.history.queriesToQueryString(queries, queries.length,
|
|
||||||
options);
|
|
||||||
return this._uri(queryString);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The currently active Places view.
|
* The currently active Places view.
|
||||||
*/
|
*/
|
||||||
|
@ -367,20 +387,6 @@ var PlacesController = {
|
||||||
return this._tm;
|
return this._tm;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* The current groupable Places view. This is tracked independently of the
|
|
||||||
* |activeView| because the activeView may change to something that isn't
|
|
||||||
* groupable, but clicking the Grouping buttons should still work.
|
|
||||||
*/
|
|
||||||
_groupableView: null,
|
|
||||||
get groupableView() {
|
|
||||||
return this._groupableView;
|
|
||||||
},
|
|
||||||
set groupableView(groupableView) {
|
|
||||||
this._groupableView = groupableView;
|
|
||||||
return this._groupableView;
|
|
||||||
},
|
|
||||||
|
|
||||||
isCommandEnabled: function PC_isCommandEnabled(command) {
|
isCommandEnabled: function PC_isCommandEnabled(command) {
|
||||||
//LOG("isCommandEnabled: " + command);
|
//LOG("isCommandEnabled: " + command);
|
||||||
if (command == "cmd_undo")
|
if (command == "cmd_undo")
|
||||||
|
@ -459,7 +465,7 @@ var PlacesController = {
|
||||||
* view, false otherwise.
|
* view, false otherwise.
|
||||||
*/
|
*/
|
||||||
_hasClipboardData: function PC__hasClipboardData() {
|
_hasClipboardData: function PC__hasClipboardData() {
|
||||||
var types = this._activeView.supportedDropTypes;
|
var types = this._activeView.peerDropTypes;
|
||||||
var flavors =
|
var flavors =
|
||||||
Cc["@mozilla.org/supports-array;1"].
|
Cc["@mozilla.org/supports-array;1"].
|
||||||
createInstance(Ci.nsISupportsArray);
|
createInstance(Ci.nsISupportsArray);
|
||||||
|
@ -977,121 +983,6 @@ var PlacesController = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the contents of a query node into a view with the specified grouping
|
|
||||||
* and sort options.
|
|
||||||
* @param view
|
|
||||||
* The tree view to load the contents of the node into
|
|
||||||
* @param node
|
|
||||||
* The node to load the contents of
|
|
||||||
* @param groupings
|
|
||||||
* Groupings to be applied to the displayed contents, [] for no
|
|
||||||
* grouping
|
|
||||||
* @param sortingMode
|
|
||||||
* The sorting mode to be applied to the displayed contents.
|
|
||||||
*/
|
|
||||||
loadNodeIntoView: function PC_loadQueries(view, node, groupings, sortingMode) {
|
|
||||||
NS_ASSERT(view, "Must have a view to load node contents into!");
|
|
||||||
asQuery(node);
|
|
||||||
var queries = node.getQueries({ });
|
|
||||||
var newQueries = [];
|
|
||||||
for (var i = 0; i < queries.length; ++i) {
|
|
||||||
var query = queries[i].clone();
|
|
||||||
newQueries.push(query);
|
|
||||||
}
|
|
||||||
var newOptions = node.queryOptions.clone();
|
|
||||||
|
|
||||||
// Update the grouping mode only after persisting, so that the URI is not
|
|
||||||
// changed.
|
|
||||||
var e = new Error();
|
|
||||||
newOptions.setGroupingMode(groupings, groupings.length);
|
|
||||||
|
|
||||||
// Set the sort order of the results
|
|
||||||
newOptions.sortingMode = sortingMode;
|
|
||||||
|
|
||||||
// Reload the view
|
|
||||||
view.load(newQueries, newOptions);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A hash of groupers that supply grouping options for queries of a given
|
|
||||||
* type. This is an override of grouping options that might be encoded in
|
|
||||||
* a saved place: URI
|
|
||||||
*/
|
|
||||||
groupers: { },
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rebuilds the view using a new set of grouping options.
|
|
||||||
* @param groupings
|
|
||||||
* An array of grouping options, see nsINavHistoryQueryOptions
|
|
||||||
* for details.
|
|
||||||
* @param sortingMode
|
|
||||||
* The type of sort that should be applied to the results.
|
|
||||||
*/
|
|
||||||
setGroupingMode: function PC_setGroupingMode(groupings, sortingMode) {
|
|
||||||
if (!this._groupableView)
|
|
||||||
return;
|
|
||||||
var node = this._groupableView.getResult().root;
|
|
||||||
this.loadNodeIntoView(this._groupableView, node, groupings, sortingMode);
|
|
||||||
|
|
||||||
// Persist this selection
|
|
||||||
if (this._groupableView.isBookmarks && "bookmark" in this.groupers)
|
|
||||||
this.groupers.bookmark.value = groupings;
|
|
||||||
else if ("generic" in this.groupers)
|
|
||||||
this.groupers.generic.value = groupings;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Group the current content view by domain
|
|
||||||
*/
|
|
||||||
groupBySite: function PC_groupBySite() {
|
|
||||||
var groupings = [Ci.nsINavHistoryQueryOptions.GROUP_BY_DOMAIN];
|
|
||||||
var sortMode = Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING;
|
|
||||||
this.setGroupingMode(groupings, sortMode);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Group the current content view by folder
|
|
||||||
*/
|
|
||||||
groupByFolder: function PC_groupByFolder() {
|
|
||||||
var groupings = [Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER];
|
|
||||||
var sortMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
|
||||||
this.setGroupingMode(groupings, sortMode);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ungroup the current content view (i.e. show individual pages)
|
|
||||||
*/
|
|
||||||
groupByPage: function PC_groupByPage() {
|
|
||||||
this.setGroupingMode([],
|
|
||||||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads all results matching a certain annotation, grouped and sorted as
|
|
||||||
* specified.
|
|
||||||
* @param annotation
|
|
||||||
* The annotation to match
|
|
||||||
* @param groupings
|
|
||||||
* The grouping to apply to the displayed results
|
|
||||||
* @param sortingMode
|
|
||||||
* The sorting to apply to the displayed results
|
|
||||||
*/
|
|
||||||
groupByAnnotation:
|
|
||||||
function PC_groupByAnnotation(annotation, groupings, sortingMode) {
|
|
||||||
NS_ASSERT(this._groupableView, "Need a groupable view to load!");
|
|
||||||
if (!this._groupableView)
|
|
||||||
return;
|
|
||||||
var query = this.history.getNewQuery();
|
|
||||||
var options = this.history.getNewQueryOptions();
|
|
||||||
options.setGroupingMode(groupings, groupings.length);
|
|
||||||
options.sortingMode = sortingMode;
|
|
||||||
query.annotation = annotation;
|
|
||||||
this.groupableView.load([query], options);
|
|
||||||
LOG("CS: " + this.history.queriesToQueryString([query], 1, options));
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Bookmark folder somewhere. Prompts the user for the name
|
* Create a new Bookmark folder somewhere. Prompts the user for the name
|
||||||
* of the folder.
|
* of the folder.
|
||||||
|
@ -1647,9 +1538,9 @@ var PlacesControllerDragHelper = {
|
||||||
var session = this.getSession();
|
var session = this.getSession();
|
||||||
if (session) {
|
if (session) {
|
||||||
if (orientation != NHRVO.DROP_ON)
|
if (orientation != NHRVO.DROP_ON)
|
||||||
var types = view.supportedDropTypes;
|
var types = view.peerDropTypes;
|
||||||
else
|
else
|
||||||
types = view.supportedDropOnTypes;
|
types = view.childDropTypes;
|
||||||
for (var i = 0; i < types.length; ++i) {
|
for (var i = 0; i < types.length; ++i) {
|
||||||
if (session.isDataFlavorSupported(types[i]))
|
if (session.isDataFlavorSupported(types[i]))
|
||||||
return true;
|
return true;
|
||||||
|
@ -1674,9 +1565,9 @@ var PlacesControllerDragHelper = {
|
||||||
Cc["@mozilla.org/widget/transferable;1"].
|
Cc["@mozilla.org/widget/transferable;1"].
|
||||||
createInstance(Ci.nsITransferable);
|
createInstance(Ci.nsITransferable);
|
||||||
if (orientation != NHRVO.DROP_ON)
|
if (orientation != NHRVO.DROP_ON)
|
||||||
var types = view.supportedDropTypes;
|
var types = view.peerDropTypes;
|
||||||
else
|
else
|
||||||
types = view.supportedDropOnTypes;
|
types = view.childDropTypes;
|
||||||
for (var j = 0; j < types.length; ++j)
|
for (var j = 0; j < types.length; ++j)
|
||||||
xferable.addDataFlavor(types[j]);
|
xferable.addDataFlavor(types[j]);
|
||||||
return xferable;
|
return xferable;
|
||||||
|
@ -1738,8 +1629,6 @@ PlacesBaseTransaction.prototype = {
|
||||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
},
|
},
|
||||||
|
|
||||||
pageTransaction: false,
|
|
||||||
|
|
||||||
get isTransient() {
|
get isTransient() {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
@ -1756,8 +1645,6 @@ function PlacesAggregateTransaction(name, transactions) {
|
||||||
this._transactions = transactions;
|
this._transactions = transactions;
|
||||||
this._name = name;
|
this._name = name;
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesAggregateTransaction.prototype = {
|
PlacesAggregateTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -1791,8 +1678,6 @@ function PlacesCreateFolderTransaction(name, container, index) {
|
||||||
this._index = index;
|
this._index = index;
|
||||||
this._id = null;
|
this._id = null;
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesCreateFolderTransaction.prototype = {
|
PlacesCreateFolderTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -1816,8 +1701,6 @@ function PlacesCreateItemTransaction(uri, container, index) {
|
||||||
this._container = container;
|
this._container = container;
|
||||||
this._index = index;
|
this._index = index;
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesCreateItemTransaction.prototype = {
|
PlacesCreateItemTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -1866,8 +1749,6 @@ function PlacesMoveFolderTransaction(id, oldContainer, oldIndex, newContainer, n
|
||||||
this._newContainer = newContainer;
|
this._newContainer = newContainer;
|
||||||
this._newIndex = newIndex;
|
this._newIndex = newIndex;
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesMoveFolderTransaction.prototype = {
|
PlacesMoveFolderTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -1893,8 +1774,6 @@ function PlacesMoveItemTransaction(uri, oldContainer, oldIndex, newContainer, ne
|
||||||
this._newContainer = newContainer;
|
this._newContainer = newContainer;
|
||||||
this._newIndex = newIndex;
|
this._newIndex = newIndex;
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesMoveItemTransaction.prototype = {
|
PlacesMoveItemTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -1951,8 +1830,6 @@ function PlacesRemoveFolderTransaction(id, oldContainer, oldIndex) {
|
||||||
this._oldFolderTitle = null;
|
this._oldFolderTitle = null;
|
||||||
this._contents = null; // The encoded contents of this folder
|
this._contents = null; // The encoded contents of this folder
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesRemoveFolderTransaction.prototype = {
|
PlacesRemoveFolderTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -2030,8 +1907,6 @@ function PlacesRemoveItemTransaction(uri, oldContainer, oldIndex) {
|
||||||
this._oldContainer = oldContainer;
|
this._oldContainer = oldContainer;
|
||||||
this._oldIndex = oldIndex;
|
this._oldIndex = oldIndex;
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesRemoveItemTransaction.prototype = {
|
PlacesRemoveItemTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -2039,13 +1914,11 @@ PlacesRemoveItemTransaction.prototype = {
|
||||||
doTransaction: function PRIT_doTransaction() {
|
doTransaction: function PRIT_doTransaction() {
|
||||||
LOG("Remove Item: " + this._uri.spec + " from: " + this._oldContainer + "," + this._oldIndex);
|
LOG("Remove Item: " + this._uri.spec + " from: " + this._oldContainer + "," + this._oldIndex);
|
||||||
this.bookmarks.removeItem(this._oldContainer, this._uri);
|
this.bookmarks.removeItem(this._oldContainer, this._uri);
|
||||||
LOG("DO: PAGETXN: " + this.pageTransaction);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
undoTransaction: function PRIT_undoTransaction() {
|
undoTransaction: function PRIT_undoTransaction() {
|
||||||
LOG("UNRemove Item: " + this._uri.spec + " from: " + this._oldContainer + "," + this._oldIndex);
|
LOG("UNRemove Item: " + this._uri.spec + " from: " + this._oldContainer + "," + this._oldIndex);
|
||||||
this.bookmarks.insertItem(this._oldContainer, this._uri, this._oldIndex);
|
this.bookmarks.insertItem(this._oldContainer, this._uri, this._oldIndex);
|
||||||
LOG("UNDO: PAGETXN: " + this.pageTransaction);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2078,8 +1951,6 @@ function PlacesEditFolderTransaction(id, oldAttributes, newAttributes) {
|
||||||
this._oldAttributes = oldAttributes;
|
this._oldAttributes = oldAttributes;
|
||||||
this._newAttributes = newAttributes;
|
this._newAttributes = newAttributes;
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesEditFolderTransaction.prototype = {
|
PlacesEditFolderTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -2103,8 +1974,6 @@ function PlacesEditItemTransaction(uri, newAttributes) {
|
||||||
this._newAttributes = newAttributes;
|
this._newAttributes = newAttributes;
|
||||||
this._oldAttributes = { };
|
this._oldAttributes = { };
|
||||||
this.redoTransaction = this.doTransaction;
|
this.redoTransaction = this.doTransaction;
|
||||||
this.pageTransaction = PlacesController.activeView.filterTransactions;
|
|
||||||
NS_ASSERT(this.pageTransaction !== undefined, "Don't know if this transaction must be filtered");
|
|
||||||
}
|
}
|
||||||
PlacesEditItemTransaction.prototype = {
|
PlacesEditItemTransaction.prototype = {
|
||||||
__proto__: PlacesBaseTransaction.prototype,
|
__proto__: PlacesBaseTransaction.prototype,
|
||||||
|
@ -2133,31 +2002,4 @@ PlacesEditItemTransaction.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
|
|
||||||
AVI rules:
|
|
||||||
|
|
||||||
readonly attribute boolean hasSelection;
|
|
||||||
readonly attribute boolean hasSingleSelection;
|
|
||||||
readonly attribute boolean selectionIsContainer;
|
|
||||||
readonly attribute boolean containerIsOpen;
|
|
||||||
void getSelectedNodes([retval, array, size_is(nodeCount)] out nodes, out nodeCount);
|
|
||||||
|
|
||||||
selection flags
|
|
||||||
|
|
||||||
flags:
|
|
||||||
SELECTION_CONTAINS_URI
|
|
||||||
SELECTION_CONTAINS_CONTAINER_OPEN
|
|
||||||
SELECTION_CONTAINS_CONTAINER_CLOSED
|
|
||||||
SELECTION_CONTAINS_CHANGEABLE
|
|
||||||
SELECTION_CONTAINS_REMOVABLE
|
|
||||||
SELECTION_CONTAINS_MOVABLE
|
|
||||||
|
|
||||||
Given a:
|
|
||||||
- view, via AVI
|
|
||||||
- query
|
|
||||||
- query options
|
|
||||||
|
|
||||||
Determine the state of commands!
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
|
@ -10,39 +10,42 @@
|
||||||
extends="chrome://global/content/bindings/popup.xml#popup">
|
extends="chrome://global/content/bindings/popup.xml#popup">
|
||||||
<implementation>
|
<implementation>
|
||||||
<constructor><![CDATA[
|
<constructor><![CDATA[
|
||||||
// this.init(); -- causes Ts regression on windows
|
// Support an asyncinit attribute that causes the view to populate
|
||||||
|
// itself only after the window has been shown. This is to ensure we
|
||||||
|
// do not regress browser window show time (Ts/Txul)
|
||||||
|
if (this.hasAttribute("asyncinit")) {
|
||||||
|
var self = this;
|
||||||
|
setTimeout(function() { self._init(); }, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this._init();
|
||||||
|
|
||||||
|
this.history = PlacesController.history;
|
||||||
]]></constructor>
|
]]></constructor>
|
||||||
|
|
||||||
<destructor><![CDATA[
|
<destructor><![CDATA[
|
||||||
]]></destructor>
|
]]></destructor>
|
||||||
|
|
||||||
<method name="init">
|
<field name="history">null</field>
|
||||||
|
|
||||||
|
<method name="_init">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (!this.hasAttribute("place"))
|
if (!this.hasAttribute("place"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// This function should only be called for top-level menus like the bookmarks menu.
|
// This function should only be called for top-level menus like the bookmarks menu.
|
||||||
// Submenus get their _result and _resultNode from their parents.
|
// Submenus get their _result and _resultNode from their parents.
|
||||||
var hist =
|
if (this.hasAttribute("place")) {
|
||||||
Cc["@mozilla.org/browser/nav-history-service;1"].
|
// Do the initial build.
|
||||||
getService(Ci.nsINavHistoryService);
|
this.place = this.place;
|
||||||
|
}
|
||||||
var queryString = this.getAttribute("place");
|
|
||||||
var queries = { }, options = { };
|
|
||||||
hist.queryStringToQueries(queryString, queries, { }, options);
|
|
||||||
if (!queries.value.length)
|
|
||||||
queries.value = [hist.getNewQuery()];
|
|
||||||
this._result = hist.executeQueries(queries.value, queries.value.length, options.value);
|
|
||||||
this._result.root.containerOpen = true;
|
|
||||||
this._resultNode = this._result.root;
|
|
||||||
this._rebuild();
|
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<method name="onPopupShowing">
|
<method name="onPopupShowing">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (!this._resultNode)
|
if (!this._resultNode)
|
||||||
this.init();
|
this._init();
|
||||||
if (PlacesController.nodeIsContainer(this._resultNode)) {
|
if (PlacesController.nodeIsContainer(this._resultNode)) {
|
||||||
this._resultNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
this._resultNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||||
this._resultNode.containerOpen = true;
|
this._resultNode.containerOpen = true;
|
||||||
|
@ -64,6 +67,8 @@
|
||||||
this._rebuild();
|
this._rebuild();
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getResult">
|
<method name="getResult">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return this._result;
|
return this._result;
|
||||||
|
@ -196,8 +201,10 @@
|
||||||
// If this is a child of the bookmarks menubar, we have to manually attach
|
// If this is a child of the bookmarks menubar, we have to manually attach
|
||||||
// its xbl binding, because it's not a dom node and the style rules don't
|
// its xbl binding, because it's not a dom node and the style rules don't
|
||||||
// get applied correctly.
|
// get applied correctly.
|
||||||
if (needsBindingAttachment)
|
if (needsBindingAttachment) {
|
||||||
|
const MENU_URI = "chrome://browser/content/places/menu.xml#places-menupopup";
|
||||||
document.addBinding(popup, MENU_URI);
|
document.addBinding(popup, MENU_URI);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// else if (nodeIsQuery) ... add menu to build kids
|
// else if (nodeIsQuery) ... add menu to build kids
|
||||||
|
@ -249,42 +256,63 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<property name="isBookmarks">
|
<!-- nsIPlacesView -->
|
||||||
<getter><![CDATA[
|
<property name="place">
|
||||||
return PlacesController.nodeIsFolder(this.getResult());
|
<getter><![CDATA[
|
||||||
|
return this.getAttribute("place");
|
||||||
]]></getter>
|
]]></getter>
|
||||||
|
<setter><![CDATA[
|
||||||
|
this.setAttribute("place", val);
|
||||||
|
var queries = { }, options = { };
|
||||||
|
this.history.queryStringToQueries(val, queries, { }, options);
|
||||||
|
if (!queries.value.length)
|
||||||
|
queries.value = [this.history.getNewQuery()];
|
||||||
|
this._result =
|
||||||
|
this.history.executeQueries(queries.value, queries.value.length,
|
||||||
|
options.value);
|
||||||
|
this._resultNode = this._result.root;
|
||||||
|
if (this._resultNode.containerOpen)
|
||||||
|
this._rebuild();
|
||||||
|
return val;
|
||||||
|
]]></setter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="hasSelection">
|
<property name="hasSelection">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
return this._selection != null;
|
return this._selection != null;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="hasSingleSelection">
|
<property name="hasSingleSelection">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
return this.hasSelection;
|
return this.hasSelection;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getSelectionNodes">
|
<method name="getSelectionNodes">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return this.hasSelection ? [this.selectedNode] : [];
|
return this.hasSelection ? [this.selectedNode] : [];
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getRemovableSelectionRanges">
|
<method name="getRemovableSelectionRanges">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return [this.getSelectionNodes()];
|
return [this.getSelectionNodes()];
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getCopyableSelection">
|
<method name="getCopyableSelection">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return this.getSelectionNodes();
|
return this.getSelectionNodes();
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getDragableSelection">
|
<method name="getDragableSelection">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (PlacesController.nodeIsReadOnly(this._resultNode))
|
if (PlacesController.nodeIsReadOnly(this._resultNode))
|
||||||
|
@ -293,12 +321,14 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="selectedNode">
|
<property name="selectedNode">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
return this.hasSelection ? this._selection : null;
|
return this.hasSelection ? this._selection : null;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="selectedURINode">
|
<property name="selectedURINode">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
var node = this.selectedNode;
|
var node = this.selectedNode;
|
||||||
|
@ -306,6 +336,7 @@
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="insertionPoint">
|
<property name="insertionPoint">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
// By default, the insertion point is at the top level, at the end.
|
// By default, the insertion point is at the top level, at the end.
|
||||||
|
@ -329,16 +360,22 @@
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<field name="filterTransactions">false</field>
|
<!-- nsIPlacesView -->
|
||||||
|
<field name="peerDropIndex">0</field>
|
||||||
|
|
||||||
<field name="supportedDropTypes">
|
<!-- nsIPlacesView -->
|
||||||
[TYPE_X_MOZ_PLACE_CONTAINER, TYPE_X_MOZ_PLACE_SEPARATOR, TYPE_X_MOZ_PLACE, TYPE_X_MOZ_URL]
|
<field name="peerDropTypes">ViewConfig.GENERIC_DROP_TYPES</field>
|
||||||
</field>
|
|
||||||
|
|
||||||
<field name="supportedDropOnTypes">
|
|
||||||
[TYPE_X_MOZ_PLACE_CONTAINER, TYPE_X_MOZ_PLACE_SEPARATOR, TYPE_X_MOZ_PLACE, TYPE_X_MOZ_URL]
|
|
||||||
</field>
|
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
|
<field name="childDropTypes">ViewConfig.GENERIC_DROP_TYPES</field>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
|
<field name="excludeItems">false</field>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
|
<field name="expandQueries">false</field>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="selectAll">
|
<method name="selectAll">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
// Nothing
|
// Nothing
|
||||||
|
|
|
@ -14,3 +14,8 @@ button {
|
||||||
.filterList {
|
.filterList {
|
||||||
-moz-binding: url("chrome://browser/content/places/places.xml#filter-button");
|
-moz-binding: url("chrome://browser/content/places/places.xml#filter-button");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#contentTitle {
|
||||||
|
width: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
* for the specific language governing rights and limitations under the
|
* for the specific language governing rights and limitations under the
|
||||||
* License.
|
* License.
|
||||||
*
|
*
|
||||||
* The Original Code is Mozilla Places System.
|
* The Original Code is Mozilla Places Organizer.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Google Inc.
|
* The Initial Developer of the Original Code is Google Inc.
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
* Portions created by the Initial Developer are Copyright (C) 2005-2006
|
||||||
* the Initial Developer. All Rights Reserved.
|
* the Initial Developer. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
|
@ -35,60 +35,37 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include ../../../../toolkit/content/debug.js
|
|
||||||
|
|
||||||
const PREF_PLACES_GROUPING_GENERIC = "browser.places.grouping.generic";
|
const PREF_PLACES_GROUPING_GENERIC = "browser.places.grouping.generic";
|
||||||
const PREF_PLACES_GROUPING_BOOKMARK = "browser.places.grouping.bookmark";
|
const PREF_PLACES_GROUPING_BOOKMARK = "browser.places.grouping.bookmark";
|
||||||
|
|
||||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
|
|
||||||
// Default Search Queries
|
/**
|
||||||
const INDEX_HISTORY = 0;
|
* Selects a place URI in the places list.
|
||||||
const INDEX_BOOKMARKS = 1;
|
* This function is global so it can be easily accessed by openers.
|
||||||
|
* @param placeURI
|
||||||
function GroupingConfig(substr, onLabel, onAccesskey, offLabel, offAccesskey,
|
* A place: URI string to select
|
||||||
onOncommand, offOncommand) {
|
*/
|
||||||
this.substr = substr;
|
function selectPlaceURI(placeURI) {
|
||||||
this.onLabel = onLabel;
|
PlacesOrganizer._places.selectPlaceURI(placeURI);
|
||||||
this.onAccesskey = onAccesskey;
|
|
||||||
this.offLabel = offLabel;
|
|
||||||
this.offAccesskey = offAccesskey;
|
|
||||||
this.onOncommand = onOncommand;
|
|
||||||
this.offOncommand = offOncommand;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var PlacesOrganizer = {
|
var PlacesOrganizer = {
|
||||||
_content: null,
|
|
||||||
_places: null,
|
_places: null,
|
||||||
|
_content: null,
|
||||||
|
|
||||||
init: function PP_init() {
|
init: function PP_init() {
|
||||||
// Attach the Command Controller to the Places Views.
|
|
||||||
this._places = document.getElementById("placesList");
|
this._places = document.getElementById("placesList");
|
||||||
this._content = document.getElementById("placeContent");
|
this._content = document.getElementById("placeContent");
|
||||||
this._places.controllers.appendController(PlacesController);
|
|
||||||
this._content.controllers.appendController(PlacesController);
|
|
||||||
|
|
||||||
this._places.init(new ViewConfig([TYPE_X_MOZ_PLACE_CONTAINER],
|
|
||||||
ViewConfig.GENERIC_DROP_TYPES,
|
|
||||||
true, false, 4, true));
|
|
||||||
this._content.init(new ViewConfig(ViewConfig.GENERIC_DROP_TYPES,
|
|
||||||
ViewConfig.GENERIC_DROP_TYPES,
|
|
||||||
false, false, 0, true));
|
|
||||||
|
|
||||||
PlacesController.groupableView = this._content;
|
|
||||||
|
|
||||||
Groupers.init();
|
Groupers.init();
|
||||||
|
|
||||||
// Attach the Places model to the Place View
|
// Select the specified place in the places list.
|
||||||
// XXXben - move this to an attribute/property on the tree view
|
var placeURI = "place:";
|
||||||
this._places.loadFolder(PlacesController.bookmarks.placesRoot);
|
if ("arguments" in window)
|
||||||
|
placeURI = window.arguments[0];
|
||||||
// Now load the appropriate folder in the Content View, and select the
|
selectPlaceURI(placeURI);
|
||||||
// corresponding entry in the Places View. This is a little fragile.
|
|
||||||
var params = "arguments" in window ? window.arguments[0] : "history";
|
|
||||||
var index = params == "history" ? INDEX_HISTORY : INDEX_BOOKMARKS;
|
|
||||||
this._places.view.selection.select(index);
|
|
||||||
|
|
||||||
// Set up the search UI.
|
// Set up the search UI.
|
||||||
PlacesSearchBox.init();
|
PlacesSearchBox.init();
|
||||||
|
|
||||||
|
@ -96,43 +73,11 @@ var PlacesOrganizer = {
|
||||||
PlacesQueryBuilder.init();
|
PlacesQueryBuilder.init();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* A range has been selected from the calendar picker. Update the view
|
|
||||||
* to show only those results within the selected range.
|
|
||||||
*/
|
|
||||||
rangeSelected: function PP_rangeSelected() {
|
|
||||||
var result = this._content.getResult();
|
|
||||||
var queries = this.getCurrentQueries();
|
|
||||||
|
|
||||||
var calendar = document.getElementById("historyCalendar");
|
|
||||||
var begin = calendar.beginrange.getTime();
|
|
||||||
var end = calendar.endrange.getTime();
|
|
||||||
|
|
||||||
// The calendar restuns values in terms of whole days at midnight, inclusive.
|
|
||||||
// The end time range therefor must be moved to the evening of the end
|
|
||||||
// include that day in the query.
|
|
||||||
const DAY_MSEC = 86400000;
|
|
||||||
end += DAY_MSEC;
|
|
||||||
|
|
||||||
var newQueries = [];
|
|
||||||
for (var i = 0; i < queries.length; ++i) {
|
|
||||||
var query = queries[i].clone();
|
|
||||||
query.beginTimeReference = Ci.nsINavHistoryQuery.TIME_RELATIVE_EPOCH;
|
|
||||||
query.beginTime = begin * 1000;
|
|
||||||
query.endTimeReference = Ci.nsINavHistoryQuery.TIME_RELATIVE_EPOCH;
|
|
||||||
query.endTime = end * 1000;
|
|
||||||
newQueries.push(query);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._content.load(newQueries, this.getCurrentOptions());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill the header with information about what view is being displayed.
|
* Fill the header with information about what view is being displayed.
|
||||||
*/
|
*/
|
||||||
_setHeader: function(type, text) {
|
_setHeader: function PP__setHeader(type, text) {
|
||||||
var bundle = document.getElementById("placeBundle");
|
var bundle = document.getElementById("placeBundle");
|
||||||
var key = null;
|
var key = null;
|
||||||
var isSearch = false;
|
var isSearch = false;
|
||||||
|
@ -187,13 +132,9 @@ var PlacesOrganizer = {
|
||||||
var node = asQuery(this._places.selectedNode);
|
var node = asQuery(this._places.selectedNode);
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
LOG("NODEURI: " + node.uri);
|
||||||
var sortingMode = node.queryOptions.sortingMode;
|
|
||||||
var groupings = [Ci.nsINavHistoryQueryOptions.GROUP_BY_DOMAIN];
|
this._content.place = node.uri;
|
||||||
if (PlacesController.nodeIsFolder(node))
|
|
||||||
groupings = [Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER];
|
|
||||||
PlacesController.loadNodeIntoView(this._content, node, groupings,
|
|
||||||
sortingMode);
|
|
||||||
|
|
||||||
Groupers.setGroupingOptions(this._content.getResult(), true);
|
Groupers.setGroupingOptions(this._content.getResult(), true);
|
||||||
|
|
||||||
|
@ -219,92 +160,6 @@ var PlacesOrganizer = {
|
||||||
PlacesController.groupByAnnotation("livemark/bookmarkFeedURI", [], 0);
|
PlacesController.groupByAnnotation("livemark/bookmarkFeedURI", [], 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the calendar widget to show the range of dates selected in the
|
|
||||||
* current result.
|
|
||||||
*/
|
|
||||||
_updateCalendar: function PP__updateCalendar() {
|
|
||||||
var calendar = document.getElementById("historyCalendar");
|
|
||||||
|
|
||||||
var result = this._content.getResult();
|
|
||||||
if (result.root.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY)
|
|
||||||
result.root.QueryInterface(Ci.nsINavHistoryQueryResultNode);
|
|
||||||
else if (result.root.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER)
|
|
||||||
result.root.QueryInterface(Ci.nsINavHistoryFolderResultNode);
|
|
||||||
else {
|
|
||||||
calendar.selectNothing = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var queries = this.getCurrentQueries();
|
|
||||||
|
|
||||||
// if there is more than one query, make sure that they all specify the
|
|
||||||
// same date range. If there isn't a unique date range, don't display
|
|
||||||
// anything.
|
|
||||||
if (queries.length < 1) {
|
|
||||||
calendar.selectNothing = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var absBegin = queries[0].absoluteBeginTime;
|
|
||||||
var absEnd = queries[0].absoluteEndTime;
|
|
||||||
for (var i = 1; i < queries.length; i ++) {
|
|
||||||
if (queries[i].absoluteBeginTime != absBegin ||
|
|
||||||
queries[i].absoluteEndTime != absEnd) {
|
|
||||||
calendar.selectNothing = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var query = queries[0];
|
|
||||||
|
|
||||||
// Make sure that by updating the calendar widget we don't fire selection
|
|
||||||
// events and cause the UI to infinitely reload.
|
|
||||||
calendar.suppressRangeEvents = true;
|
|
||||||
|
|
||||||
// begin
|
|
||||||
var beginRange = null;
|
|
||||||
if (query.hasBeginTime)
|
|
||||||
beginRange = new Date(query.absoluteBeginTime / 1000);
|
|
||||||
|
|
||||||
// end
|
|
||||||
var endRange = null;
|
|
||||||
if (query.hasEndTime) {
|
|
||||||
endRange = new Date(query.absoluteEndTime / 1000);
|
|
||||||
|
|
||||||
// here, we have to do a little work. Normally a day query will start
|
|
||||||
// at midnight and end exactly 24 hours later. However, this spans two
|
|
||||||
// actual days, and will show up as such in the calendar. Therefore, if
|
|
||||||
// the end day is exactly midnight, we will bump it back a day.
|
|
||||||
if (endRange.getHours() == 0 && endRange.getMinutes() == 0 &&
|
|
||||||
endRange.getSeconds() == 0 && endRange.getMilliseconds() == 0) {
|
|
||||||
// Here, we have to be careful to not set the end range to before the
|
|
||||||
// beginning. Somebody stupid might set them to be the same, and we
|
|
||||||
// don't want to suddenly make an invalid range.
|
|
||||||
if (! beginRange ||
|
|
||||||
(beginRange && beginRange.getTime() != endRange.getTime()))
|
|
||||||
endRange.setTime(endRange.getTime() - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
calendar.setRange(beginRange, endRange, true);
|
|
||||||
|
|
||||||
// Allow user selection events once again.
|
|
||||||
calendar.suppressRangeEvents = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the Places UI when the content of the right tree changes.
|
|
||||||
*/
|
|
||||||
onContentChanged: function PP_onContentChanged() {
|
|
||||||
var isBookmarks = this._content.isBookmarks;
|
|
||||||
// Hide the Calendar for Bookmark queries.
|
|
||||||
document.getElementById("historyCalendar").setAttribute("hidden", isBookmarks);
|
|
||||||
|
|
||||||
// Update the calendar with the current date range, if applicable.
|
|
||||||
if (!isBookmarks) {
|
|
||||||
this._updateCalendar();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the query array associated with the query currently loaded in
|
* Returns the query array associated with the query currently loaded in
|
||||||
* the main places pane.
|
* the main places pane.
|
||||||
|
@ -775,7 +630,8 @@ var PlacesQueryBuilder = {
|
||||||
var options = PlacesOrganizer.getCurrentOptions();
|
var options = PlacesOrganizer.getCurrentOptions();
|
||||||
options.resultType = options.RESULT_TYPE_URI;
|
options.resultType = options.RESULT_TYPE_URI;
|
||||||
|
|
||||||
PlacesOrganizer._content.load(queries, options);
|
// XXXben - find some public way of doing this!
|
||||||
|
PlacesOrganizer._content._load(queries, options);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1015,10 +871,27 @@ var ViewMenu = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function GroupingConfig(substr, onLabel, onAccesskey, offLabel, offAccesskey,
|
||||||
|
onOncommand, offOncommand) {
|
||||||
|
this.substr = substr;
|
||||||
|
this.onLabel = onLabel;
|
||||||
|
this.onAccesskey = onAccesskey;
|
||||||
|
this.offLabel = offLabel;
|
||||||
|
this.offAccesskey = offAccesskey;
|
||||||
|
this.onOncommand = onOncommand;
|
||||||
|
this.offOncommand = offOncommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles Grouping within the Content View, and the commands that support it.
|
||||||
|
*/
|
||||||
var Groupers = {
|
var Groupers = {
|
||||||
defaultGrouper: null,
|
defaultGrouper: null,
|
||||||
annotationGroupers: [],
|
annotationGroupers: [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes groupings for various vie types.
|
||||||
|
*/
|
||||||
init: function G_init() {
|
init: function G_init() {
|
||||||
var placeBundle = document.getElementById("placeBundle");
|
var placeBundle = document.getElementById("placeBundle");
|
||||||
this.defaultGrouper =
|
this.defaultGrouper =
|
||||||
|
@ -1037,7 +910,14 @@ var Groupers = {
|
||||||
"PlacesOrganizer.groupByPost()");
|
"PlacesOrganizer.groupByPost()");
|
||||||
this.annotationGroupers.push(subscriptionConfig);
|
this.annotationGroupers.push(subscriptionConfig);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the grouping broadcasters for the given result.
|
||||||
|
* @param result
|
||||||
|
*
|
||||||
|
* @param on
|
||||||
|
*
|
||||||
|
*/
|
||||||
setGroupingOptions: function G_setGroupingOptions(result, on) {
|
setGroupingOptions: function G_setGroupingOptions(result, on) {
|
||||||
var node = asQuery(result.root);
|
var node = asQuery(result.root);
|
||||||
|
|
||||||
|
@ -1091,3 +971,5 @@ var Groupers = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include ../../../../toolkit/content/debug.js
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<!DOCTYPE window SYSTEM "chrome://browser/locale/places/places.dtd">
|
<!DOCTYPE window SYSTEM "chrome://browser/locale/places/places.dtd">
|
||||||
|
|
||||||
<window id="places" title="&places.title;"
|
<window id="places" title="&places.title;"
|
||||||
windowtype="Places"
|
windowtype="Places:Organizer"
|
||||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
onload="PlacesOrganizer.init();"
|
onload="PlacesOrganizer.init();"
|
||||||
width="700" height="500" screenX="10" screenY="10"
|
width="700" height="500" screenX="10" screenY="10"
|
||||||
|
@ -30,10 +30,15 @@
|
||||||
<stringbundle id="placeBundle" src="chrome://browser/locale/places/places.properties"/>
|
<stringbundle id="placeBundle" src="chrome://browser/locale/places/places.properties"/>
|
||||||
<stringbundle id="brandBundle" src="chrome://branding/locale/brand.properties"/>
|
<stringbundle id="brandBundle" src="chrome://branding/locale/brand.properties"/>
|
||||||
</stringbundleset>
|
</stringbundleset>
|
||||||
|
|
||||||
#include commands.inc
|
#include commands.inc
|
||||||
|
|
||||||
<keyset id="placesKeyset">
|
<keyset id="placesOrganizerKeyset">
|
||||||
|
<!-- Instantiation Keys -->
|
||||||
|
<key id="placesKey_close" key="&cmd.close.key;" modifiers="accel"
|
||||||
|
oncommand="close();"/>
|
||||||
|
|
||||||
|
<!-- Command Keys -->
|
||||||
<key id="placesKey_find" command="placesCmd_find" key="&cmd.find.key;" modifiers="accel"/>
|
<key id="placesKey_find" command="placesCmd_find" key="&cmd.find.key;" modifiers="accel"/>
|
||||||
<key id="placesKey_select:all" command="placesCmd_select:all" key="&cmd.select_all.key;" modifiers="accel"/>
|
<key id="placesKey_select:all" command="placesCmd_select:all" key="&cmd.select_all.key;" modifiers="accel"/>
|
||||||
<key id="placesKey_edit:cut" command="placesCmd_edit:cut" key="&cmd.edit_cut.key;" modifiers="accel"/>
|
<key id="placesKey_edit:cut" command="placesCmd_edit:cut" key="&cmd.edit_cut.key;" modifiers="accel"/>
|
||||||
|
@ -42,10 +47,10 @@
|
||||||
<key id="placesKey_edit:delete" command="placesCmd_edit:delete" keycode="VK_DELETE"/>
|
<key id="placesKey_edit:delete" command="placesCmd_edit:delete" keycode="VK_DELETE"/>
|
||||||
<key id="placesKey_open" command="placesCmd_open" keycode="VK_ENTER"/>
|
<key id="placesKey_open" command="placesCmd_open" keycode="VK_ENTER"/>
|
||||||
<key id="placesKey_open:window" command="placesCmd_open:window" keycode="VK_ENTER" modifiers="shift"/>
|
<key id="placesKey_open:window" command="placesCmd_open:window" keycode="VK_ENTER" modifiers="shift"/>
|
||||||
<key id="placesKey_open:tab" oncommand="placesCmd_open:tab" keycode="VK_ENTER" modifiers="accel"/>
|
<key id="placesKey_open:tab" command="placesCmd_open:tab" keycode="VK_ENTER" modifiers="accel"/>
|
||||||
<key id="placesKey_show:info" oncommand="placesCmd_show:info" key="&cmd.show_info.key;" modifiers="accel"/>
|
<key id="placesKey_show:info" command="placesCmd_show:info" key="&cmd.show_info.key;" modifiers="accel"/>
|
||||||
<key id="placesKey_rename" oncommand="placesCmd_rename" keycode="VK_F2"/>
|
<key id="placesKey_rename" command="placesCmd_rename" keycode="VK_F2"/>
|
||||||
<key id="placesKey_reload" oncommand="placesCmd_reload" key="&cmd.reload.key;" modifiers="accel"/>
|
<key id="placesKey_reload" command="placesCmd_reload" key="&cmd.reload.key;" modifiers="accel"/>
|
||||||
</keyset>
|
</keyset>
|
||||||
|
|
||||||
<popupset id="placesPopupset">
|
<popupset id="placesPopupset">
|
||||||
|
@ -157,25 +162,19 @@
|
||||||
</toolbar>
|
</toolbar>
|
||||||
</toolbox>
|
</toolbox>
|
||||||
<hbox flex="1" id="placesView">
|
<hbox flex="1" id="placesView">
|
||||||
<vbox>
|
<tree id="placesList" class="placesTree" flex="1" type="places"
|
||||||
<vbox id="placesListContainer" flex="1">
|
place="place:&folder=1&group=3&excludeItems=1"
|
||||||
<tree id="placesList" class="placesTree" flex="1" type="places"
|
hidecolumnpicker="true" context="placesContext"
|
||||||
hidecolumnpicker="true" context="placesContext"
|
onselect="PlacesOrganizer.onPlaceSelected(event);"
|
||||||
onselect="PlacesOrganizer.onPlaceSelected(event);"
|
seltype="single">
|
||||||
seltype="single">
|
<treecols>
|
||||||
<treecols>
|
<treecol id="title" flex="1" primary="true" hideheader="true"/>
|
||||||
<treecol id="title" flex="1" primary="true" hideheader="true"/>
|
</treecols>
|
||||||
</treecols>
|
<treechildren id="placesListChildren" view="placesList" flex="1"/>
|
||||||
<treechildren id="placesListChildren" view="placesList" flex="1"/>
|
</tree>
|
||||||
</tree>
|
|
||||||
</vbox>
|
|
||||||
<vbox id="historyCalendar"
|
|
||||||
class="history-calendar"
|
|
||||||
onselectionchanged="return PlacesOrganizer.rangeSelected()"/>
|
|
||||||
</vbox>
|
|
||||||
<splitter id="splitter"/>
|
<splitter id="splitter"/>
|
||||||
<vbox flex="4">
|
<vbox id="contentView" flex="4">
|
||||||
<deck id="content" flex="1">
|
<deck id="contentDeck" flex="1">
|
||||||
<vbox flex="1">
|
<vbox flex="1">
|
||||||
<hbox id="titlebar" align="center">
|
<hbox id="titlebar" align="center">
|
||||||
<label id="showingPrefix"/>
|
<label id="showingPrefix"/>
|
||||||
|
@ -204,9 +203,8 @@
|
||||||
</hbox>
|
</hbox>
|
||||||
#include advancedSearch.inc
|
#include advancedSearch.inc
|
||||||
<tree id="placeContent" class="placesTree" context="placesContext"
|
<tree id="placeContent" class="placesTree" context="placesContext"
|
||||||
flex="1" query="" type="places"
|
flex="1" type="places"
|
||||||
ondblclick="PlacesController.mouseLoadURI(event);"
|
ondblclick="PlacesController.mouseLoadURI(event);">
|
||||||
onplacestreereloaded="PlacesOrganizer.onContentChanged();">
|
|
||||||
<treecols id="placeContentColumns">
|
<treecols id="placeContentColumns">
|
||||||
<treecol label="&col.title.label;" id="title" flex="5" primary="true"
|
<treecol label="&col.title.label;" id="title" flex="5" primary="true"
|
||||||
persist="width hidden ordinal sortActive sortDirection"/>
|
persist="width hidden ordinal sortActive sortDirection"/>
|
||||||
|
|
|
@ -48,14 +48,22 @@
|
||||||
|
|
||||||
<implementation>
|
<implementation>
|
||||||
<constructor><![CDATA[
|
<constructor><![CDATA[
|
||||||
// this.init(); -- causes Ts regression on windows
|
// Support an asyncinit attribute that causes the view to populate
|
||||||
|
// itself only after the window has been shown. This is to ensure we
|
||||||
|
// do not regress browser window show time (Ts/Txul)
|
||||||
|
if (this.hasAttribute("asyncinit")) {
|
||||||
|
var self = this;
|
||||||
|
setTimeout(function() { self._init(); }, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this._init();
|
||||||
]]></constructor>
|
]]></constructor>
|
||||||
|
|
||||||
<destructor><![CDATA[
|
<destructor><![CDATA[
|
||||||
this._bms.removeObserver(this._observer);
|
this._bms.removeObserver(this._observer);
|
||||||
]]></destructor>
|
]]></destructor>
|
||||||
|
|
||||||
<method name="init">
|
<method name="_init">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
this._places =
|
this._places =
|
||||||
Cc["@mozilla.org/browser/nav-history-service;1"].
|
Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||||
|
@ -69,15 +77,11 @@
|
||||||
window.addEventListener("resize",
|
window.addEventListener("resize",
|
||||||
function f(e) { t.updateChevron(e); },
|
function f(e) { t.updateChevron(e); },
|
||||||
false);
|
false);
|
||||||
|
|
||||||
var queryString = this.getAttribute("place");
|
if (this.hasAttribute("place")) {
|
||||||
var queries = { }, options = { };
|
// Do the initial build.
|
||||||
this._places.queryStringToQueries(queryString, queries, { }, options);
|
this.place = this.place;
|
||||||
if (!queries.value.length)
|
}
|
||||||
queries.value = [this._places.getNewQuery()];
|
|
||||||
this._result = this._places.executeQueries(queries.value, queries.value.length, options.value);
|
|
||||||
this._result.root.containerOpen = true;
|
|
||||||
this._rebuild();
|
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
@ -89,6 +93,8 @@
|
||||||
<field name="_openedMenuButton">null</field>
|
<field name="_openedMenuButton">null</field>
|
||||||
|
|
||||||
<field name="_result">null</field>
|
<field name="_result">null</field>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getResult">
|
<method name="getResult">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return this._result;
|
return this._result;
|
||||||
|
@ -207,53 +213,63 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<method name="load">
|
<!-- nsIPlacesView -->
|
||||||
<parameter name="queries"/>
|
<property name="place">
|
||||||
<parameter name="options"/>
|
<getter><![CDATA[
|
||||||
<body><![CDATA[
|
return this.getAttribute("place");
|
||||||
this._result = this._places.executeQueries(queries, queries.length,
|
]]></getter>
|
||||||
options);
|
<setter><![CDATA[
|
||||||
|
this.setAttribute("place", val);
|
||||||
|
|
||||||
|
var queries = { }, options = { };
|
||||||
|
this._places.queryStringToQueries(val, queries, { }, options);
|
||||||
|
if (!queries.value.length)
|
||||||
|
queries.value = [this._places.getNewQuery()];
|
||||||
|
this._result =
|
||||||
|
this._places.executeQueries(queries.value, queries.value.length,
|
||||||
|
options.value);
|
||||||
this._result.root.containerOpen = true;
|
this._result.root.containerOpen = true;
|
||||||
this._rebuild();
|
this._rebuild();
|
||||||
]]></body>
|
return val;
|
||||||
</method>
|
]]></setter>
|
||||||
|
|
||||||
<property name="isBookmarks">
|
|
||||||
<getter><![CDATA[
|
|
||||||
return PlacesController.nodeIsFolder(this.getResult());
|
|
||||||
]]></getter>
|
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="hasSelection">
|
<property name="hasSelection">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
return this._selection != null;
|
return this._selection != null;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="hasSingleSelection">
|
<property name="hasSingleSelection">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
return this.hasSelection;
|
return this.hasSelection;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getSelectionNodes">
|
<method name="getSelectionNodes">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return this.hasSelection ? [this.selectedNode] : [];
|
return this.hasSelection ? [this.selectedNode] : [];
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getRemovableSelectionRanges">
|
<method name="getRemovableSelectionRanges">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return [this.getSelectionNodes()];
|
return [this.getSelectionNodes()];
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getCopyableSelection">
|
<method name="getCopyableSelection">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return this.getSelectionNodes();
|
return this.getSelectionNodes();
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getDragableSelection">
|
<method name="getDragableSelection">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (PlacesController.nodeIsReadOnly(this._result.root))
|
if (PlacesController.nodeIsReadOnly(this._result.root))
|
||||||
|
@ -262,12 +278,14 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="selectedNode">
|
<property name="selectedNode">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
return this.hasSelection ? this._selection : null;
|
return this.hasSelection ? this._selection : null;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="selectedURINode">
|
<property name="selectedURINode">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
var node = this.selectedNode;
|
var node = this.selectedNode;
|
||||||
|
@ -275,6 +293,7 @@
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<property name="insertionPoint">
|
<property name="insertionPoint">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
// By default, the insertion point is at the top level, at the end.
|
// By default, the insertion point is at the top level, at the end.
|
||||||
|
@ -296,16 +315,22 @@
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<field name="filterTransactions">false</field>
|
<!-- nsIPlacesView -->
|
||||||
|
<field name="peerDropIndex">0</field>
|
||||||
|
|
||||||
<field name="supportedDropTypes">
|
<!-- nsIPlacesView -->
|
||||||
[TYPE_X_MOZ_PLACE_CONTAINER, TYPE_X_MOZ_PLACE_SEPARATOR, TYPE_X_MOZ_PLACE, TYPE_X_MOZ_URL]
|
<field name="peerDropTypes">ViewConfig.GENERIC_DROP_TYPES</field>
|
||||||
</field>
|
|
||||||
|
|
||||||
<field name="supportedDropOnTypes">
|
|
||||||
[TYPE_X_MOZ_PLACE_CONTAINER, TYPE_X_MOZ_PLACE_SEPARATOR, TYPE_X_MOZ_PLACE, TYPE_X_MOZ_URL]
|
|
||||||
</field>
|
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
|
<field name="childDropTypes">ViewConfig.GENERIC_DROP_TYPES</field>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
|
<field name="excludeItems">false</field>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
|
<field name="expandQueries">false</field>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="selectAll">
|
<method name="selectAll">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
// Nothing
|
// Nothing
|
||||||
|
@ -340,7 +365,7 @@
|
||||||
this._numBatches ? this._batchedOperation = true : this.doRebuild();
|
this._numBatches ? this._batchedOperation = true : this.doRebuild();
|
||||||
},
|
},
|
||||||
onItemVisited: function TB_0_onItemVisited(bookmark, visitId, time) {
|
onItemVisited: function TB_0_onItemVisited(bookmark, visitId, time) {
|
||||||
//this._self.init();
|
//this._self._init();
|
||||||
},
|
},
|
||||||
onItemReplaced: function TB_0_onItemReplaced(folder, item, newItem) {
|
onItemReplaced: function TB_0_onItemReplaced(folder, item, newItem) {
|
||||||
if (folder == this._self._bms.toolbarRoot)
|
if (folder == this._self._bms.toolbarRoot)
|
||||||
|
|
|
@ -9,51 +9,17 @@
|
||||||
<binding id="places-tree" extends="chrome://global/content/bindings/tree.xml#tree">
|
<binding id="places-tree" extends="chrome://global/content/bindings/tree.xml#tree">
|
||||||
<implementation implements="nsINavHistoryResultViewObserver">
|
<implementation implements="nsINavHistoryResultViewObserver">
|
||||||
<constructor><![CDATA[
|
<constructor><![CDATA[
|
||||||
this._places =
|
// Apply meta-model rules to this view.
|
||||||
Cc["@mozilla.org/browser/nav-history-service;1"].
|
ViewConfigurator.configure(this);
|
||||||
getService(Ci.nsINavHistoryService);
|
|
||||||
|
this.history = PlacesController.history;
|
||||||
|
this.controllers.appendController(PlacesController);
|
||||||
|
|
||||||
|
// Force an initial build.
|
||||||
|
this.place = this.place;
|
||||||
]]></constructor>
|
]]></constructor>
|
||||||
|
|
||||||
<method name="init">
|
<field name="history">null</field>
|
||||||
<parameter name="viewConfig"/>
|
|
||||||
<body><![CDATA[
|
|
||||||
this.supportedDropTypes = viewConfig.dropTypes;
|
|
||||||
this.supportedDropOnTypes = viewConfig.dropOnTypes;
|
|
||||||
this.excludeItems = viewConfig.excludeItems;
|
|
||||||
this.firstDropIndex = viewConfig.firstDropIndex;
|
|
||||||
this.filterTransactions = viewConfig.filterTransactions;
|
|
||||||
]]></body>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<method name="_fireEvent">
|
|
||||||
<parameter name="name"/>
|
|
||||||
<body><![CDATA[
|
|
||||||
var event = document.createEvent("events");
|
|
||||||
event.initEvent("placestree-" + name, false, true);
|
|
||||||
|
|
||||||
var canceled = !this.dispatchEvent(event);
|
|
||||||
|
|
||||||
var handler = this.getAttribute("onplacestree" + name);
|
|
||||||
if (handler != "") {
|
|
||||||
var fn = new Function("event", handler);
|
|
||||||
if (!fn(event))
|
|
||||||
canceled = true;
|
|
||||||
}
|
|
||||||
return !canceled;
|
|
||||||
]]></body>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- AVI Method -->
|
|
||||||
<method name="getResult">
|
|
||||||
<body><![CDATA[
|
|
||||||
try {
|
|
||||||
return this.view.QueryInterface(Ci.nsINavHistoryResult);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
]]></body>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<!-- overriding -->
|
<!-- overriding -->
|
||||||
<property name="view">
|
<property name="view">
|
||||||
|
@ -76,7 +42,7 @@
|
||||||
// existing ones or create new ones.
|
// existing ones or create new ones.
|
||||||
var options = this.getResult().queryOptions;
|
var options = this.getResult().queryOptions;
|
||||||
if (!options)
|
if (!options)
|
||||||
options = this._places.getNewQueryOptions();
|
options = this.history.getNewQueryOptions();
|
||||||
return options;
|
return options;
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -89,10 +55,10 @@
|
||||||
return null;
|
return null;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
<setter><![CDATA[
|
<setter><![CDATA[
|
||||||
var query = this._places.getNewQuery();
|
var query = this.history.getNewQuery();
|
||||||
query.searchTerms = val;
|
query.searchTerms = val;
|
||||||
|
|
||||||
this.load([query], this.getBestOptions());
|
this._load([query], this.getBestOptions());
|
||||||
return val;
|
return val;
|
||||||
]]></setter>
|
]]></setter>
|
||||||
</property>
|
</property>
|
||||||
|
@ -105,90 +71,160 @@
|
||||||
// preserve grouping
|
// preserve grouping
|
||||||
var options = this.getResult().queryOptions;
|
var options = this.getResult().queryOptions;
|
||||||
if (!options)
|
if (!options)
|
||||||
options = this._places.getNewQueryOptions();
|
options = this.history.getNewQueryOptions();
|
||||||
|
|
||||||
var query = this._places.getNewQuery();
|
var query = this.history.getNewQuery();
|
||||||
query.searchTerms = filterString;
|
query.searchTerms = filterString;
|
||||||
query.onlyBookmarked = onlyBookmarks;
|
query.onlyBookmarked = onlyBookmarks;
|
||||||
//if (onlyBookmarks)
|
//if (onlyBookmarks)
|
||||||
// query.setFolders(folderRestrict, folderRestrict.length);
|
// query.setFolders(folderRestrict, folderRestrict.length);
|
||||||
this.load([query], this.getBestOptions());
|
this._load([query], this.getBestOptions());
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<property name="queryString">
|
<!-- XXXben I would like to remove this method from the "public" interface -->
|
||||||
<getter><![CDATA[
|
<method name="_load">
|
||||||
var result = this.getResult();
|
|
||||||
var queries = result.root.getQueries({ });
|
|
||||||
var options = result.root.queryOptions;
|
|
||||||
|
|
||||||
const NH = Ci.nsINavHistoryService;
|
|
||||||
return this._places.queriesToQueryString(queries, queries.length,
|
|
||||||
options);
|
|
||||||
]]></getter>
|
|
||||||
<setter><![CDATA[
|
|
||||||
var queries = { }, options = { };
|
|
||||||
this._places.queryStringToQueries(val, queries, { }, options);
|
|
||||||
if (!queries.value.length)
|
|
||||||
queries.value = [this._places.getNewQuery()];
|
|
||||||
this.load(queries.value, options.value);
|
|
||||||
return val;
|
|
||||||
]]></setter>
|
|
||||||
</property>
|
|
||||||
|
|
||||||
<method name="loadFolder">
|
|
||||||
<parameter name="folderId"/>
|
|
||||||
<body><![CDATA[
|
|
||||||
var query = this._places.getNewQuery();
|
|
||||||
query.setFolders([folderId], 1);
|
|
||||||
|
|
||||||
var options = this._places.getNewQueryOptions();
|
|
||||||
options.setGroupingMode([Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER], 1);
|
|
||||||
options.excludeItems = this.excludeItems;
|
|
||||||
options.expandQueries = false;
|
|
||||||
var result = this._places.executeQuery(query, options);
|
|
||||||
result.QueryInterface(Ci.nsITreeView);
|
|
||||||
this.view = result;
|
|
||||||
this._fireEvent("reloaded");
|
|
||||||
]]></body>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<method name="load">
|
|
||||||
<parameter name="queries"/>
|
<parameter name="queries"/>
|
||||||
<parameter name="options"/>
|
<parameter name="options"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
// override with our local options
|
// override with our local options
|
||||||
options.excludeItems = this.excludeItems;
|
options.excludeItems = this.excludeItems;
|
||||||
options.expandQueries = false;
|
options.expandQueries = this.expandQueries;
|
||||||
var result = this._places.executeQueries(queries, queries.length,
|
var result = this.history.executeQueries(queries, queries.length,
|
||||||
options);
|
options);
|
||||||
result.QueryInterface(Ci.nsITreeView);
|
this.view = result.QueryInterface(Ci.nsITreeView);
|
||||||
this.view = result;
|
|
||||||
this._fireEvent("reloaded");
|
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<property name="isBookmarks">
|
<!--
|
||||||
<getter><![CDATA[
|
Causes a particular node represented by the specified placeURI to be
|
||||||
return PlacesController.nodeIsFolder(this.getResult().root);
|
selected in the tree. All containers above the node in the hierarchy
|
||||||
|
will be opened, so that the node is visible.
|
||||||
|
-->
|
||||||
|
<method name="selectPlaceURI">
|
||||||
|
<parameter name="placeURI"/>
|
||||||
|
<body><![CDATA[
|
||||||
|
function findNode(container, placeURI) {
|
||||||
|
container.containerOpen = true;
|
||||||
|
for (var i = 0; i < container.childCount; ++i) {
|
||||||
|
var child = container.getChild(i);
|
||||||
|
if (child.uri == placeURI)
|
||||||
|
return child;
|
||||||
|
else if (PlacesController.nodeIsContainer(child)) {
|
||||||
|
var nested = findNode(asContainer(child), placeURI);
|
||||||
|
if (nested)
|
||||||
|
return nested;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
container.containerOpen = false;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = this.getResult();
|
||||||
|
NS_ASSERT(result, "no result, cannot select place URI!");
|
||||||
|
if (!result)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var container = asContainer(result.root);
|
||||||
|
var child = findNode(container, placeURI);
|
||||||
|
container.containerOpen = true;
|
||||||
|
if (child)
|
||||||
|
this.selectNode(child);
|
||||||
|
else {
|
||||||
|
// If the specified child could not be located, just select the first
|
||||||
|
// item in the list.
|
||||||
|
if (this.view.rowCount)
|
||||||
|
this.view.selection.select(0);
|
||||||
|
}
|
||||||
|
]]></body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Causes a particular node to be selected in the tree, resulting in all
|
||||||
|
containers above the node in the hierarchy to be opened, so that the
|
||||||
|
node is visible.
|
||||||
|
-->
|
||||||
|
<method name="selectNode">
|
||||||
|
<parameter name="node"/>
|
||||||
|
<body><![CDATA[
|
||||||
|
var parent = node.parent;
|
||||||
|
|
||||||
|
// Build a list of all of the nodes that are the parent of this one
|
||||||
|
// in the result.
|
||||||
|
var parents = [];
|
||||||
|
var result = this.getResult();
|
||||||
|
while (parent && parent != asContainer(result.root)) {
|
||||||
|
parents.push(parent);
|
||||||
|
parent = parent.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Walk the list backwards (opening from the root of the hierarchy)
|
||||||
|
// opening each folder as we go.
|
||||||
|
var result = this.getResult();
|
||||||
|
var view = this.view;
|
||||||
|
for (var i = parents.length - 1; i >= 0; --i) {
|
||||||
|
var index = result.treeIndexForNode(parents[i]);
|
||||||
|
if (view.isContainer(index) && !view.isContainerOpen(index))
|
||||||
|
view.toggleOpenState(index);
|
||||||
|
}
|
||||||
|
// Select the specified node...
|
||||||
|
index = result.treeIndexForNode(node);
|
||||||
|
view.selection.select(index);
|
||||||
|
// ... and ensure it's visible, not scrolled off somewhere.
|
||||||
|
this.treeBoxObject.ensureRowIsVisible(index);
|
||||||
|
]]></body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
|
<method name="getResult">
|
||||||
|
<body><![CDATA[
|
||||||
|
try {
|
||||||
|
return this.view.QueryInterface(Ci.nsINavHistoryResult);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
]]></body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
|
<property name="place">
|
||||||
|
<getter><![CDATA[
|
||||||
|
return this.getAttribute("place");
|
||||||
]]></getter>
|
]]></getter>
|
||||||
|
<setter><![CDATA[
|
||||||
|
this.setAttribute("place", val);
|
||||||
|
|
||||||
|
var queriesRef = { };
|
||||||
|
var queryCountRef = { };
|
||||||
|
var optionsRef = { };
|
||||||
|
this.history.queryStringToQueries(val, queriesRef, queryCountRef, optionsRef);
|
||||||
|
if (queryCountRef.value == 0)
|
||||||
|
queriesRef.value = [this.history.getNewQuery()];
|
||||||
|
if (!optionsRef.value)
|
||||||
|
optionsRef.value = this.history.getNewQueryOptions();
|
||||||
|
|
||||||
|
this._load(queriesRef.value, optionsRef.value);
|
||||||
|
|
||||||
|
return val;
|
||||||
|
]]></setter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<property name="hasSelection">
|
<property name="hasSelection">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
return this.view.selection.count >= 1;
|
return this.view.selection.count >= 1;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<property name="hasSingleSelection">
|
<property name="hasSingleSelection">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
return this.view.selection.count == 1;
|
return this.view.selection.count == 1;
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<method name="getSelectionNodes">
|
<method name="getSelectionNodes">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
var selection = this.view.selection;
|
var selection = this.view.selection;
|
||||||
|
@ -206,6 +242,7 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getRemovableSelectionRanges">
|
<method name="getRemovableSelectionRanges">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
// This function exists in addition to getSelectionNodes because it
|
// This function exists in addition to getSelectionNodes because it
|
||||||
|
@ -257,13 +294,15 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<method name="getCopyableSelection">
|
<method name="getCopyableSelection">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
// XXXben implement me!
|
// XXXben implement me!
|
||||||
return this.getSelectionNodes();
|
return this.getSelectionNodes();
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- nsIPlacesView -->
|
||||||
<method name="getDragableSelection">
|
<method name="getDragableSelection">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
var nodes = this.getSelectionNodes();
|
var nodes = this.getSelectionNodes();
|
||||||
|
@ -275,7 +314,7 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<property name="selectedNode">
|
<property name="selectedNode">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
var view = this.view;
|
var view = this.view;
|
||||||
|
@ -290,7 +329,7 @@
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<property name="selectedURINode">
|
<property name="selectedURINode">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
var view = this.view;
|
var view = this.view;
|
||||||
|
@ -309,7 +348,7 @@
|
||||||
]]></getter>
|
]]></getter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<property name="insertionPoint">
|
<property name="insertionPoint">
|
||||||
<getter><![CDATA[
|
<getter><![CDATA[
|
||||||
var selection = this.view.selection;
|
var selection = this.view.selection;
|
||||||
|
@ -331,8 +370,8 @@
|
||||||
var cc = container.childCount;
|
var cc = container.childCount;
|
||||||
for (var i = 0; i < cc; ++i) {
|
for (var i = 0; i < cc; ++i) {
|
||||||
if (container.getChild(i) == node &&
|
if (container.getChild(i) == node &&
|
||||||
i < this.firstDropIndex) {
|
i < this.peerDropIndex) {
|
||||||
max.value = this.firstDropIndex;
|
max.value = this.peerDropIndex;
|
||||||
orientation = NHRVO.DROP_BEFORE;
|
orientation = NHRVO.DROP_BEFORE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -372,25 +411,22 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<property name="filterTransactions">true</property>
|
<field name="peerDropIndex">0</field>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<field name="firstDropIndex">0</field>
|
<field name="peerDropTypes">ViewConfig.GENERIC_DROP_TYPES</field>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<field name="supportedDropTypes">null</field>
|
<field name="childDropTypes">ViewConfig.GENERIC_DROP_TYPES</field>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<field name="supportedDropOnTypes">null</field>
|
<field name="excludeItems">false</field>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<field name="excludeQueries">null</field>
|
<field name="expandQueries">false</field>
|
||||||
|
|
||||||
<!-- AVI Method -->
|
|
||||||
<field name="dropOnFilterOptions">null</field>
|
|
||||||
|
|
||||||
<!-- AVI Method -->
|
<!-- nsIPlacesView -->
|
||||||
<method name="selectAll">
|
<method name="selectAll">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
this.view.selection.selectAll();
|
this.view.selection.selectAll();
|
||||||
|
@ -430,7 +466,7 @@
|
||||||
var treeIndex = this.getResult().treeIndexForNode(nodes[i]);
|
var treeIndex = this.getResult().treeIndexForNode(nodes[i]);
|
||||||
if (this.view.getLevel(treeIndex) == 0) {
|
if (this.view.getLevel(treeIndex) == 0) {
|
||||||
var index = PlacesController.getIndexOfNode(nodes[i]);
|
var index = PlacesController.getIndexOfNode(nodes[i]);
|
||||||
if (index < this.firstDropIndex)
|
if (index < this.peerDropIndex)
|
||||||
throw Cr.NS_OK;
|
throw Cr.NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,8 +513,8 @@
|
||||||
<method name="getSupportedFlavours">
|
<method name="getSupportedFlavours">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
var flavorSet = new FlavourSet();
|
var flavorSet = new FlavourSet();
|
||||||
for (var i = 0; i < this.supportedDropTypes.length; ++i)
|
for (var i = 0; i < this.peerDropTypes.length; ++i)
|
||||||
flavorSet.appendFlavour(this.supportedDropTypes[i]);
|
flavorSet.appendFlavour(this.peerDropTypes[i]);
|
||||||
return flavorSet;
|
return flavorSet;
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -544,7 +580,7 @@
|
||||||
var node = index != -1 ? result.nodeForTreeIndex(index) : result.root;
|
var node = index != -1 ? result.nodeForTreeIndex(index) : result.root;
|
||||||
// Cannot drop before fixed items in the list.
|
// Cannot drop before fixed items in the list.
|
||||||
if (node.parent == result.root &&
|
if (node.parent == result.root &&
|
||||||
PlacesController.getIndexOfNode(node) < this._self.firstDropIndex &&
|
PlacesController.getIndexOfNode(node) < this._self.peerDropIndex &&
|
||||||
orientation != NHRVO.DROP_ON)
|
orientation != NHRVO.DROP_ON)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -1234,8 +1234,8 @@ AppendInt64KeyValueIfNonzero(nsACString& aString,
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Failure getting value");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Failure getting value");
|
||||||
if (value) {
|
if (value) {
|
||||||
AppendAmpersandIfNonempty(aString);
|
AppendAmpersandIfNonempty(aString);
|
||||||
nsCAutoString appendMe(aName);
|
aString += aName;
|
||||||
appendMe.Append(aName);
|
nsCAutoString appendMe("=");
|
||||||
appendMe.AppendInt(value);
|
appendMe.AppendInt(value);
|
||||||
aString.Append(appendMe);
|
aString.Append(appendMe);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<TITLE>Bookmarks and History</TITLE>
|
<TITLE>Bookmarks and History</TITLE>
|
||||||
<H1 PLACES_ROOT="true">Bookmarks and History</H1>
|
<H1 PLACES_ROOT="true">Bookmarks and History</H1>
|
||||||
<DL><p>
|
<DL><p>
|
||||||
<DT><A HREF="place:beginTime=0&beginTimeRef=1&endTime=0&endTimeRef=2&sort=4&type=1">History</A>
|
<DT><A HREF="place:&beginTime=-2592000000000&beginTimeRef=1&endTime=7200000000&endTimeRef=2&sort=4&type=1">History</A>
|
||||||
<DD>Shows all browsing history
|
<DD>Shows all browsing history
|
||||||
<DT><H3 BOOKMARKS_MENU="true">Bookmarks Menu</H3>
|
<DT><H3 BOOKMARKS_MENU="true">Bookmarks Menu</H3>
|
||||||
<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Menu
|
<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Menu
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
"Close">
|
"Close">
|
||||||
<!ENTITY file.close.accesskey
|
<!ENTITY file.close.accesskey
|
||||||
"C">
|
"C">
|
||||||
|
<!ENTITY cmd.close.key
|
||||||
|
"w">
|
||||||
<!ENTITY edit.label
|
<!ENTITY edit.label
|
||||||
"Edit">
|
"Edit">
|
||||||
<!ENTITY edit.accesskey
|
<!ENTITY edit.accesskey
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<TITLE>Bookmarks and History</TITLE>
|
<TITLE>Bookmarks and History</TITLE>
|
||||||
<H1 PLACES_ROOT="true">Bookmarks and History</H1>
|
<H1 PLACES_ROOT="true">Bookmarks and History</H1>
|
||||||
<DL><p>
|
<DL><p>
|
||||||
<DT><A HREF="place:beginTime=0&beginTimeRef=1&endTime=0&endTimeRef=2&sort=4&type=1">History</A>
|
<DT><A HREF="place:&beginTime=-2592000000000&beginTimeRef=1&endTime=7200000000&endTimeRef=2&sort=4&type=1">History</A>
|
||||||
<DD>Shows all browsing history
|
<DD>Shows all browsing history
|
||||||
<DT><H3 BOOKMARKS_MENU="true">Bookmarks Menu</H3>
|
<DT><H3 BOOKMARKS_MENU="true">Bookmarks Menu</H3>
|
||||||
<DL><p>
|
<DL><p>
|
||||||
|
|
|
@ -15,15 +15,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#placesList {
|
#placesList {
|
||||||
-moz-appearance: none;
|
|
||||||
width: 160px;
|
|
||||||
margin: 0px;
|
|
||||||
border: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#placesListContainer {
|
|
||||||
-moz-appearance: listbox;
|
-moz-appearance: listbox;
|
||||||
margin: 6px 0px 7px 6px;
|
margin: 6px 0px 7px 6px;
|
||||||
|
width: 160px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#placeContent {
|
#placeContent {
|
||||||
|
@ -31,14 +25,17 @@
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#contentView {
|
||||||
margin: 6px 6px 7px 0px;
|
margin: 6px 6px 7px 0px;
|
||||||
-moz-appearance: listbox;
|
-moz-appearance: listbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
treechildren::-moz-tree-image(title, container) {
|
treechildren::-moz-tree-image {
|
||||||
padding-right: 2px;
|
padding-right: 2px;
|
||||||
margin: 0px 2px;
|
margin: 0px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
treechildren::-moz-tree-image(title, container) {
|
||||||
list-style-image: url("chrome://global/skin/icons/folder-item.png") !important;
|
list-style-image: url("chrome://global/skin/icons/folder-item.png") !important;
|
||||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче