329367 -cannot return to bookmarks after a search r=annie.sullivan@gmail.com and 334401 - assorted places organizer fixes including new debug panel r=brettw@gmail.com
git-svn-id: svn://10.0.0.236/trunk@194665 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1611,7 +1611,7 @@ var PlacesController = {
|
||||
else
|
||||
wrapped += "0" + NEWLINE;
|
||||
|
||||
if (this.nodeIsURI(node))
|
||||
if (this.nodeIsURI(node) || this.nodeIsQuery(node))
|
||||
wrapped += node.uri + NEWLINE;
|
||||
else
|
||||
wrapped += NEWLINE;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
-moz-binding: url("chrome://browser/content/places/places.xml#textbox-timed-arbitrary");
|
||||
}
|
||||
|
||||
button {
|
||||
button.commandButton {
|
||||
-moz-binding: url("chrome://browser/content/places/places.xml#command-button");
|
||||
}
|
||||
|
||||
@@ -19,3 +19,11 @@ button {
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
.textbox-input-closebutton {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#searchFilter[filtered="true"] .textbox-input-closebutton {
|
||||
display: -moz-box;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,33 +78,6 @@ var PlacesOrganizer = {
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Run a search for the specified text, over the collection specified by
|
||||
* the dropdown arrow. The default is all bookmarks and history, but can be
|
||||
* localized to the active collection.
|
||||
* @param filterString
|
||||
* The text to search for.
|
||||
*/
|
||||
search: function PO_search(filterString) {
|
||||
// Do not search for "" since it will match all history. Assume if the user
|
||||
// deleted everything that they want to type something else and don't
|
||||
// update the view.
|
||||
if (filterString == "")
|
||||
return;
|
||||
|
||||
switch (PlacesSearchBox.filterCollection) {
|
||||
case "collection":
|
||||
var folderId = asFolder(this._content.getResult().root).folderId;
|
||||
this._content.applyFilter(filterString, true, folderId, OptionsFilter);
|
||||
this.setHeaderText(this.HEADER_TYPE_SEARCH, filterString);
|
||||
break;
|
||||
case "all":
|
||||
this._content.applyFilter(filterString, false, 0, OptionsFilter);
|
||||
this.setHeaderText(this.HEADER_TYPE_SEARCH, filterString);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
HEADER_TYPE_SHOWING: 1,
|
||||
HEADER_TYPE_SEARCH: 2,
|
||||
HEADER_TYPE_ADVANCED_SEARCH: 3,
|
||||
@@ -132,10 +105,70 @@ var PlacesOrganizer = {
|
||||
searchModifiers.hidden = type == this.HEADER_TYPE_SHOWING;
|
||||
},
|
||||
|
||||
onPlaceURIKeypress: function PO_onPlaceURIKeypress(event) {
|
||||
if (event.keyCode == 13)
|
||||
this.loadPlaceURI();
|
||||
else if (event.keyCode == 27) {
|
||||
event.target.value = "";
|
||||
this.onPlaceSelected(true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows or hides the debug panel.
|
||||
*/
|
||||
toggleDebugPanel: function PO_toggleDebugPanel() {
|
||||
var dp = document.getElementById("debugPanel");
|
||||
dp.hidden = !dp.hidden;
|
||||
if (!dp.hidden)
|
||||
document.getElementById("placeURI").focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the place URI entered in the debug
|
||||
*/
|
||||
loadPlaceURI: function PO_loadPlaceURI() {
|
||||
var placeURI = document.getElementById("placeURI");
|
||||
var queriesRef = { }, optionsRef = { };
|
||||
PlacesController.history.queryStringToQueries(placeURI.value,
|
||||
queriesRef, { }, optionsRef);
|
||||
|
||||
var autoFilterResults = document.getElementById("autoFilterResults");
|
||||
if (autoFilterResults.checked) {
|
||||
var options =
|
||||
OptionsFilter.filter(queriesRef.value, optionsRef.value, null);
|
||||
}
|
||||
else
|
||||
options = optionsRef.value;
|
||||
this._content.load(queriesRef.value, options);
|
||||
|
||||
this.setHeaderText(this.HEADER_TYPE_SHOWING, "Debug results for: " + placeURI.value);
|
||||
|
||||
this.updateLoadedURI();
|
||||
|
||||
placeURI.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the URI displayed in the debug panel.
|
||||
*/
|
||||
updateLoadedURI: function PO_updateLoadedURI() {
|
||||
var queryNode = asQuery(this._content.getResult().root);
|
||||
var queries = queryNode.getQueries({});
|
||||
var options = queryNode.queryOptions;
|
||||
var loadedURI = document.getElementById("loadedURI");
|
||||
loadedURI.value =
|
||||
PlacesController.history.queriesToQueryString(queries, queries.length,
|
||||
options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when a place folder is selected in the left pane.
|
||||
* @param resetSearchBox
|
||||
* true if the search box should also be reset, false if it should
|
||||
* be left alone.
|
||||
*/
|
||||
onPlaceSelected: function PO_onPlaceSelected() {
|
||||
onPlaceSelected: function PO_onPlaceSelected(resetSearchBox) {
|
||||
if (!this._places.hasSelection)
|
||||
return;
|
||||
var node = asQuery(this._places.selectedNode);
|
||||
@@ -146,9 +179,26 @@ var PlacesOrganizer = {
|
||||
|
||||
// Make sure the query builder is hidden.
|
||||
PlacesQueryBuilder.hide();
|
||||
PlacesSearchBox.reset();
|
||||
if (resetSearchBox) {
|
||||
var searchFilter = document.getElementById("searchFilter");
|
||||
searchFilter.reset();
|
||||
}
|
||||
|
||||
this.setHeaderText(this.HEADER_TYPE_SHOWING, node.title);
|
||||
|
||||
this.updateLoadedURI();
|
||||
|
||||
// Update the "Find in <current collection>" command and the gray text in
|
||||
// the search box in the toolbar if the active collection is the current
|
||||
// collection.
|
||||
var strings = document.getElementById("placeBundle");
|
||||
var findCommand = document.getElementById("placesCmd_find:current");
|
||||
var findLabel = strings.getFormattedString("findInPrefix", [node.title]);
|
||||
findCommand.setAttribute("label", findLabel);
|
||||
if (PlacesSearchBox.filterCollection == "collection") {
|
||||
PlacesSearchBox.updateCollectionTitle(node.title);
|
||||
PlacesSearchBox.syncGrayText();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -200,16 +250,96 @@ var PlacesOrganizer = {
|
||||
* A set of utilities relating to search within Bookmarks and History.
|
||||
*/
|
||||
var PlacesSearchBox = {
|
||||
|
||||
/**
|
||||
* The Search text field
|
||||
*/
|
||||
get searchFilter() {
|
||||
return document.getElementById("searchFilter");
|
||||
},
|
||||
|
||||
/**
|
||||
* Run a search for the specified text, over the collection specified by
|
||||
* the dropdown arrow. The default is all bookmarks and history, but can be
|
||||
* localized to the active collection.
|
||||
* @param filterString
|
||||
* The text to search for.
|
||||
*/
|
||||
search: function PSB_search(filterString) {
|
||||
// Do not search for "" since it will match all history. Assume if the user
|
||||
// deleted everything that they want to type something else and don't
|
||||
// update the view.
|
||||
if (filterString == "" || this.searchFilter.hasAttribute("empty"))
|
||||
return;
|
||||
|
||||
var content = PlacesOrganizer._content;
|
||||
var PO = PlacesOrganizer;
|
||||
|
||||
switch (PlacesSearchBox.filterCollection) {
|
||||
case "collection":
|
||||
var folderId = asFolder(content.getResult().root).folderId;
|
||||
content.applyFilter(filterString, true, folderId, OptionsFilter);
|
||||
PO.setHeaderText(PO.HEADER_TYPE_SEARCH, filterString);
|
||||
break;
|
||||
case "all":
|
||||
content.applyFilter(filterString, false, 0, OptionsFilter);
|
||||
PO.setHeaderText(PO.HEADER_TYPE_SEARCH, filterString);
|
||||
break;
|
||||
}
|
||||
|
||||
this.searchFilter.setAttribute("filtered", "true");
|
||||
},
|
||||
|
||||
/**
|
||||
* Finds across all bookmarks and history.
|
||||
*/
|
||||
findAll: function PSB_findAll() {
|
||||
this.filterCollection = "all";
|
||||
this.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Finds in the currently selected Place.
|
||||
*/
|
||||
findCurrent: function PSB_findCurrent() {
|
||||
this.filterCollection = "collection";
|
||||
this.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the display with the title of the current collection.
|
||||
* @param title
|
||||
* The title of the current collection.
|
||||
*/
|
||||
updateCollectionTitle: function PSB_updateCollectionTitle(title) {
|
||||
var strings = document.getElementById("placeBundle");
|
||||
if (title) {
|
||||
this.searchFilter.grayText =
|
||||
strings.getFormattedString("searchCurrentDefault", [title]);
|
||||
}
|
||||
else
|
||||
this.searchFilter.grayText = strings.getString("searchDefault");
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the display with the current gray text.
|
||||
*/
|
||||
syncGrayText: function PSB_syncGrayText() {
|
||||
this.searchFilter.value = this.searchFilter.grayText;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets/sets the active collection from the dropdown menu.
|
||||
*/
|
||||
get filterCollection() {
|
||||
var searchFilter = document.getElementById("searchFilter");
|
||||
return searchFilter.getAttribute("collection");
|
||||
return this.searchFilter.getAttribute("collection");
|
||||
},
|
||||
set filterCollection(collectionName) {
|
||||
var searchFilter = document.getElementById("searchFilter");
|
||||
searchFilter.setAttribute("collection", collectionName);
|
||||
this.searchFilter.setAttribute("collection", collectionName);
|
||||
var newGrayText = null;
|
||||
if (collectionName == "collection")
|
||||
newGrayText = PlacesOrganizer._places.selectedNode.title;
|
||||
this.updateCollectionTitle(newGrayText);
|
||||
return collectionName;
|
||||
},
|
||||
|
||||
@@ -217,50 +347,7 @@ var PlacesSearchBox = {
|
||||
* Focus the search box
|
||||
*/
|
||||
focus: function PSB_focus() {
|
||||
var searchFilter = document.getElementById("searchFilter");
|
||||
searchFilter.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* When the field is activated, if the contents are the gray text, clear
|
||||
* the field, otherwise select the contents.
|
||||
*/
|
||||
onFocus: function PSB_onFocus() {
|
||||
var searchFilter = document.getElementById("searchFilter");
|
||||
var placeBundle = document.getElementById("placeBundle");
|
||||
|
||||
var searchDefault = placeBundle.getString("searchDefault");
|
||||
if (searchFilter.value == searchDefault) {
|
||||
searchFilter.removeAttribute("empty");
|
||||
searchFilter.value = "";
|
||||
}
|
||||
else
|
||||
searchFilter.select();
|
||||
},
|
||||
|
||||
/**
|
||||
* When the field is deactivated, reset the gray text if the value is
|
||||
* empty or has the gray text value.
|
||||
*/
|
||||
onBlur: function PSB_onBlur() {
|
||||
var placeBundle = document.getElementById("placeBundle");
|
||||
var searchDefault = placeBundle.getString("searchDefault");
|
||||
var searchFilter = document.getElementById("searchFilter");
|
||||
|
||||
if (searchFilter.value == searchDefault || !searchFilter.value)
|
||||
this.reset();
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the search box to its default state (showing "Search" grey
|
||||
* text.
|
||||
*/
|
||||
reset: function PSB_reset() {
|
||||
var placeBundle = document.getElementById("placeBundle");
|
||||
var searchDefault = placeBundle.getString("searchDefault");
|
||||
var searchFilter = document.getElementById("searchFilter");
|
||||
searchFilter.setAttribute("empty", "true");
|
||||
searchFilter.value = searchDefault;
|
||||
this.searchFilter.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -268,9 +355,9 @@ var PlacesSearchBox = {
|
||||
*/
|
||||
init: function PSB_init() {
|
||||
var placeBundle = document.getElementById("placeBundle");
|
||||
var searchDefault = placeBundle.getString("searchDefault");
|
||||
var searchFilter = document.getElementById("searchFilter");
|
||||
this.reset();
|
||||
var searchFilter = this.searchFilter;
|
||||
searchFilter.grayText = placeBundle.getString("searchDefault");
|
||||
searchFilter.reset();
|
||||
searchFilter.focus();
|
||||
},
|
||||
|
||||
@@ -278,11 +365,10 @@ var PlacesSearchBox = {
|
||||
* Gets or sets the text shown in the Places Search Box
|
||||
*/
|
||||
get value() {
|
||||
return document.getElementById("searchFilter").value;
|
||||
return this.searchFilter.value;
|
||||
},
|
||||
set value(value) {
|
||||
document.getElementById("searchFilter").value = value;
|
||||
return value;
|
||||
return this.searchFilter.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -489,10 +575,7 @@ var PlacesQueryBuilder = {
|
||||
// Re-do the original toolbar-search-box search that the user used to
|
||||
// spawn the advanced UI... this effectively "reverts" the UI to the
|
||||
// point it was in before they began monkeying with advanced search.
|
||||
const sType = PlacesOrganizer.HEADER_TYPE_SEARCH;
|
||||
PlacesOrganizer.setHeaderText(sType, PlacesSearchBox.value);
|
||||
|
||||
PlacesOrganizer.search(PlacesSearchBox.value);
|
||||
PlacesSearchBox.search(PlacesSearchBox.value);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -753,6 +836,7 @@ var PlacesQueryBuilder = {
|
||||
// XXXben - find some public way of doing this!
|
||||
PlacesOrganizer._content.load(queries,
|
||||
OptionsFilter.filter(queries, options, null));
|
||||
PlacesOrganizer.updateLoadedURI();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -999,84 +1083,6 @@ var ViewMenu = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Manages options for a particular view type.
|
||||
* @param pref
|
||||
* The preference that stores these options.
|
||||
* @param defaultValue
|
||||
* The default value to be used for views of this type.
|
||||
* @param serializable
|
||||
* An object bearing a serialize and deserialize method that
|
||||
* read and write the object's string representation from/to
|
||||
* preferences.
|
||||
* @constructor
|
||||
*/
|
||||
function PrefHandler(pref, defaultValue, serializable) {
|
||||
this._pref = pref;
|
||||
this._defaultValue = defaultValue;
|
||||
this._serializable = serializable;
|
||||
|
||||
this._pb =
|
||||
Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch2);
|
||||
this._pb.addObserver(this._pref, this, false);
|
||||
}
|
||||
PrefHandler.prototype = {
|
||||
/**
|
||||
* Clean up when the window is going away to avoid leaks.
|
||||
*/
|
||||
destroy: function PC_PH_destroy() {
|
||||
this._pb.removeObserver(this._pref, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Observes changes to the preferences.
|
||||
* @param subject
|
||||
* @param topic
|
||||
* The preference changed notification
|
||||
* @param data
|
||||
* The preference that changed
|
||||
*/
|
||||
observe: function PC_PH_observe(subject, topic, data) {
|
||||
if (topic == "nsPref:changed" && data == this._pref)
|
||||
this._value = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* The cached value, null if it needs to be rebuilt from preferences.
|
||||
*/
|
||||
_value: null,
|
||||
|
||||
/**
|
||||
* Get the preference value, reading from preferences if necessary.
|
||||
*/
|
||||
get value() {
|
||||
if (!this._value) {
|
||||
if (this._pb.prefHasUserValue(this._pref)) {
|
||||
var valueString = this._pb.getCharPref(this._pref);
|
||||
this._value = this._serializable.deserialize(valueString);
|
||||
}
|
||||
else
|
||||
this._value = this._defaultValue;
|
||||
}
|
||||
return this._value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Stores a value in preferences.
|
||||
* @param value
|
||||
* The data to be stored.
|
||||
*/
|
||||
set value(value) {
|
||||
if (value != this._value) {
|
||||
this._pb.setCharPref(this._pref, this._serializable.serialize(value));
|
||||
var ps = this._pb.QueryInterface(Ci.nsIPrefService);
|
||||
ps.savePrefFile(null);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A "Configuration" set for a class of history query results. Some results
|
||||
* will require that the grouping UI be labeled differently from the standard
|
||||
@@ -1245,6 +1251,7 @@ var Groupers = {
|
||||
newOptions.setGroupingMode([NHQO.GROUP_BY_DOMAIN], 1);
|
||||
var content = PlacesOrganizer._content;
|
||||
content.load(queries, newOptions);
|
||||
PlacesOrganizer.updateLoadedURI();
|
||||
this._updateBroadcasters(true);
|
||||
OptionsFilter.update(content.getResult());
|
||||
},
|
||||
@@ -1260,6 +1267,7 @@ var Groupers = {
|
||||
newOptions.setGroupingMode([], 0);
|
||||
var content = PlacesOrganizer._content;
|
||||
content.load(queries, newOptions);
|
||||
PlacesOrganizer.updateLoadedURI();
|
||||
this._updateBroadcasters(false);
|
||||
OptionsFilter.update(content.getResult());
|
||||
},
|
||||
@@ -1269,18 +1277,32 @@ var Groupers = {
|
||||
* feed.
|
||||
*/
|
||||
groupByFeed: function G_groupByFeed() {
|
||||
var groupings = [Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER];
|
||||
var sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
|
||||
PlacesController.groupByAnnotation("livemark/feedURI", [], 0);
|
||||
var content = PlacesOrganizer._content;
|
||||
var query = asQuery(content.getResult().root);
|
||||
var queries = query.getQueries({ });
|
||||
var newOptions = query.queryOptions.clone();
|
||||
var newQuery = queries[0].clone();
|
||||
newQuery.annotation = "livemark/feedURI";
|
||||
content.load([newQuery], newOptions);
|
||||
PlacesOrganizer.updateLoadedURI();
|
||||
this._updateBroadcasters(false);
|
||||
OptionsFilter.update(content.getResult());
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows all subscribed feed (Live Bookmarks) content in a flat list
|
||||
*/
|
||||
groupByPost: function G_groupByPost() {
|
||||
var groupings = [Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER];
|
||||
var sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
|
||||
PlacesController.groupByAnnotation("livemark/bookmarkFeedURI", [], 0);
|
||||
var content = PlacesOrganizer._content;
|
||||
var query = asQuery(content.getResult().root);
|
||||
var queries = query.getQueries({ });
|
||||
var newOptions = query.queryOptions.clone();
|
||||
var newQuery = queries[0].clone();
|
||||
newQuery.annotation = "livemark/bookmarkFeedURI";
|
||||
content.load([newQuery], newOptions);
|
||||
PlacesOrganizer.updateLoadedURI();
|
||||
this._updateBroadcasters(false);
|
||||
OptionsFilter.update(content.getResult());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -11,13 +11,102 @@
|
||||
<children/> -->
|
||||
<binding id="textbox-timed-arbitrary"
|
||||
extends="chrome://global/content/bindings/textbox.xml#timed-textbox">
|
||||
<resources>
|
||||
<stylesheet src="chrome://browser/skin/places/places.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<children/>
|
||||
<xul:hbox class="textbox-input-box" flex="1" xbl:inherits="context">
|
||||
<html:input class="textbox-input" flex="1" anonid="input"
|
||||
xbl:inherits="onfocus,onblur,value,type,maxlength,disabled,size,readonly,tabindex,accesskey"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox>
|
||||
<xul:button class="textbox-input-closebutton"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<property name="grayText"
|
||||
onget="return this.getAttribute('grayText');"
|
||||
onset="this.setAttribute('grayText', val); return val;"/>
|
||||
<method name="reset">
|
||||
<body><![CDATA[
|
||||
this.setAttribute("empty", "true");
|
||||
this.removeAttribute("filtered");
|
||||
this.value = this.grayText;
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="_resetInternal">
|
||||
<body><![CDATA[
|
||||
this.value = "";
|
||||
this.removeAttribute("empty");
|
||||
this.removeAttribute("filtered");
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="_fireEvent">
|
||||
<parameter name="type"/>
|
||||
<body><![CDATA[
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent(type, true, true);
|
||||
|
||||
var cancel = !this.dispatchEvent(event);
|
||||
var handler = this.getAttribute("on" + type);
|
||||
if (handler) {
|
||||
var handlerFunction = new Function("event", handler);
|
||||
var handlerCanceled = handlerFunction(event) === false;
|
||||
if (handlerCanceled)
|
||||
cancel = handlerCanceled;
|
||||
}
|
||||
return !cancel;
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="_clearReliably">
|
||||
<body><![CDATA[
|
||||
// This method exists to clear the field's text. The reason this does
|
||||
// not work reliably is unknown... appears to be some kind of event
|
||||
// handling synchronization issue. We need to clear the field
|
||||
// asynchronously.
|
||||
var field = this;
|
||||
setTimeout(function() {
|
||||
field.value = "";
|
||||
field.removeAttribute("empty");
|
||||
}, 0);
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="onFocus">
|
||||
<body><![CDATA[
|
||||
if (this.hasAttribute("empty"))
|
||||
this._clearReliably();
|
||||
else
|
||||
this.select();
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="onBlur">
|
||||
<body><![CDATA[
|
||||
if (this.hasAttribute("empty") || !this.value)
|
||||
this.reset();
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="focus" phase="capturing"><![CDATA[
|
||||
if (event.originalTarget.className != "textbox-input-closebutton")
|
||||
this.onFocus();
|
||||
]]></handler>
|
||||
<handler event="blur" phase="capturing"><![CDATA[
|
||||
if (event.originalTarget.className != "textbox-input-closebutton")
|
||||
this.onBlur();
|
||||
]]></handler>
|
||||
<handler event="click"><![CDATA[
|
||||
if (event.originalTarget.className == "textbox-input-closebutton") {
|
||||
this._resetInternal();
|
||||
this._fireEvent("reset");
|
||||
}
|
||||
]]></handler>
|
||||
<handler event="keypress" keycode="VK_ESCAPE"><![CDATA[
|
||||
this._resetInternal();
|
||||
this._fireEvent("reset");
|
||||
]]></handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="command-button" extends="chrome://global/content/bindings/button.xml#button">
|
||||
|
||||
@@ -73,16 +73,21 @@
|
||||
<commandset id="TMCommandSet"
|
||||
commandupdater="true" events="*"
|
||||
oncommandupdate="PlacesController.updateTMCommands()">
|
||||
<command id="cmd_undo" label="&cmd.edit_undo.label;" accesskey="&cmd.edit_undo.accesskey;"
|
||||
<command id="cmd_undo"
|
||||
label="&cmd.edit_undo.label;" accesskey="&cmd.edit_undo.accesskey;"
|
||||
oncommand="PlacesController.doCommand(this.id);" disabled="true"/>
|
||||
<command id="cmd_redo" label="&cmd.edit_redo.label;" accesskey="&cmd.edit_redo.accesskey;"
|
||||
<command id="cmd_redo"
|
||||
label="&cmd.edit_redo.label;" accesskey="&cmd.edit_redo.accesskey;"
|
||||
oncommand="PlacesController.doCommand(this.id);" disabled="true"/>
|
||||
</commandset>
|
||||
#include commands.inc
|
||||
<commandset id="organizerCommandSet">
|
||||
<command id="placesCmd_find"
|
||||
<command id="placesCmd_find:all"
|
||||
label="&cmd.find.label;" accesskey="&cmd.find.accesskey;"
|
||||
oncommand="PlacesSearchBox.focus();"/>
|
||||
oncommand="PlacesSearchBox.findAll();"/>
|
||||
<command id="placesCmd_find:current"
|
||||
label="&cmd.findCurrent.label;" accesskey="&cmd.findCurrent.accesskey;"
|
||||
oncommand="PlacesSearchBox.findCurrent();"/>
|
||||
<command id="placesCmd_export"
|
||||
label="&cmd.export.label;" accesskey="&cmd.export.accesskey;"
|
||||
disabled="true"/>
|
||||
@@ -109,23 +114,44 @@
|
||||
command="cmd_undo"/>
|
||||
<key id="placesKey_edit:redo" key="&cmd.edit_redo.key;" modifiers="accel"
|
||||
command="cmd_redo"/>
|
||||
|
||||
<key id="placesKey_show:debug"
|
||||
key="d" modifiers="accel,shift"
|
||||
oncommand="PlacesOrganizer.toggleDebugPanel();"/>
|
||||
|
||||
<!-- Command Keys -->
|
||||
<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_edit:cut" command="placesCmd_edit:cut" key="&cmd.edit_cut.key;" modifiers="accel"/>
|
||||
<key id="placesKey_edit:copy" command="placesCmd_edit:copy" key="&cmd.edit_copy.key;" modifiers="accel"/>
|
||||
<key id="placesKey_edit:paste" command="placesCmd_edit:paste" key="&cmd.edit_paste.key;" modifiers="accel"/>
|
||||
<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_RETURN"/>
|
||||
<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_RETURN" modifiers="shift"/>
|
||||
<key id="placesKey_open:tab" command="placesCmd_open:tab" keycode="VK_ENTER" modifiers="accel"/>
|
||||
<key id="placesKey_open:tab" command="placesCmd_open:tab" keycode="VK_RETURN" modifiers="accel"/>
|
||||
<key id="placesKey_show:info" command="placesCmd_show:info" key="&cmd.show_info.key;" modifiers="accel"/>
|
||||
<key id="placesKey_rename" command="placesCmd_rename" keycode="VK_F2"/>
|
||||
<key id="placesKey_reload" command="placesCmd_reload" key="&cmd.reload.key;" modifiers="accel"/>
|
||||
<key id="placesKey_find:all" command="placesCmd_find:all"
|
||||
key="&cmd.find.key;" modifiers="accel"/>
|
||||
<key id="placesKey_find:current" command="placesCmd_find:current"
|
||||
key="&cmd.find.key;" modifiers="accel,shift"/>
|
||||
<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:copy" command="placesCmd_edit:copy"
|
||||
key="&cmd.edit_copy.key;" modifiers="accel"/>
|
||||
<key id="placesKey_edit:paste" command="placesCmd_edit:paste"
|
||||
key="&cmd.edit_paste.key;" modifiers="accel"/>
|
||||
<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_RETURN"/>
|
||||
<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_RETURN" modifiers="shift"/>
|
||||
<key id="placesKey_open:tab" command="placesCmd_open:tab"
|
||||
keycode="VK_ENTER" modifiers="accel"/>
|
||||
<key id="placesKey_open:tab" command="placesCmd_open:tab"
|
||||
keycode="VK_RETURN" modifiers="accel"/>
|
||||
<key id="placesKey_show:info" command="placesCmd_show:info"
|
||||
key="&cmd.show_info.key;" modifiers="accel"/>
|
||||
<key id="placesKey_rename" command="placesCmd_rename"
|
||||
keycode="VK_F2"/>
|
||||
<key id="placesKey_reload" command="placesCmd_reload"
|
||||
key="&cmd.reload.key;" modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<popupset id="placesPopupset">
|
||||
@@ -172,8 +198,10 @@
|
||||
<menuitem id="editSortByName" command="placesCmd_sortby:name"
|
||||
accesskey="&cmd.sortby_name.accesskey;"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="editFind" command="placesCmd_find"
|
||||
key="placesKey_find"/>
|
||||
<menuitem id="editFindAll" command="placesCmd_find:all"
|
||||
key="placesKey_find:all"/>
|
||||
<menuitem id="editFindCurrent" command="placesCmd_find:current"
|
||||
key="placesKey_find:current"/>
|
||||
#ifdef XP_MACOSX
|
||||
<menuseparator/>
|
||||
<menuitem id="properties" command="placesCmd_show:info"
|
||||
@@ -226,9 +254,9 @@
|
||||
</menubar>
|
||||
<toolbar class="chromeclass-toolbar">
|
||||
<textbox id="searchFilter" style="width: 23em;" timeout="500"
|
||||
oncommand="PlacesOrganizer.search(this.value);"
|
||||
collection="all" persist="collection"
|
||||
onfocus="PlacesSearchBox.onFocus();" onblur="PlacesSearchBox.onBlur();">
|
||||
oncommand="PlacesSearchBox.search(this.value);"
|
||||
onreset="PlacesOrganizer.onPlaceSelected(false); return true;"
|
||||
collection="all">
|
||||
<button type="menu" class="filterList" id="filterList_history">
|
||||
<menupopup>
|
||||
<menuitem label="&search.all.label;" accesskey="&search.all.accesskey;"
|
||||
@@ -252,7 +280,7 @@
|
||||
<tree id="placesList" class="placesTree" type="places"
|
||||
place="place:&folder=1&group=3&excludeItems=1"
|
||||
hidecolumnpicker="true" context="placesContext"
|
||||
onselect="PlacesOrganizer.onPlaceSelected(event);"
|
||||
onselect="PlacesOrganizer.onPlaceSelected(true);"
|
||||
onclick="PlacesOrganizer.onTreeClick(event);"
|
||||
seltype="single">
|
||||
<treecols>
|
||||
@@ -310,6 +338,39 @@
|
||||
</treecols>
|
||||
<treechildren id="placeContentChildren" view="placeContent" flex="1"/>
|
||||
</tree>
|
||||
<vbox id="debugPanel" hidden="true">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row align="center">
|
||||
<label value="Debug:"/>
|
||||
<textbox id="placeURI" flex="1"
|
||||
onkeypress="PlacesOrganizer.onPlaceURIKeypress(event);"/>
|
||||
<button label="Load" oncommand="PlacesOrganizer.loadPlaceURI();"/>
|
||||
</row>
|
||||
<row>
|
||||
<spacer/>
|
||||
<hbox>
|
||||
<checkbox id="autoFilterResults"
|
||||
label="Apply user filtering of results"
|
||||
checked="true"/>
|
||||
</hbox>
|
||||
<spacer/>
|
||||
</row>
|
||||
<separator class="thin"/>
|
||||
<row align="center">
|
||||
<label value="Loaded:"/>
|
||||
<textbox id="loadedURI" flex="1" readonly="true"/>
|
||||
<spacer/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator class="thin"/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</deck>
|
||||
</vbox>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
return options;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
||||
<method name="applyFilter">
|
||||
<parameter name="filterString"/>
|
||||
<parameter name="onlyBookmarks"/>
|
||||
|
||||
@@ -35,6 +35,84 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Manages options for a particular view type.
|
||||
* @param pref
|
||||
* The preference that stores these options.
|
||||
* @param defaultValue
|
||||
* The default value to be used for views of this type.
|
||||
* @param serializable
|
||||
* An object bearing a serialize and deserialize method that
|
||||
* read and write the object's string representation from/to
|
||||
* preferences.
|
||||
* @constructor
|
||||
*/
|
||||
function PrefHandler(pref, defaultValue, serializable) {
|
||||
this._pref = pref;
|
||||
this._defaultValue = defaultValue;
|
||||
this._serializable = serializable;
|
||||
|
||||
this._pb =
|
||||
Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch2);
|
||||
this._pb.addObserver(this._pref, this, false);
|
||||
}
|
||||
PrefHandler.prototype = {
|
||||
/**
|
||||
* Clean up when the window is going away to avoid leaks.
|
||||
*/
|
||||
destroy: function PC_PH_destroy() {
|
||||
this._pb.removeObserver(this._pref, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Observes changes to the preferences.
|
||||
* @param subject
|
||||
* @param topic
|
||||
* The preference changed notification
|
||||
* @param data
|
||||
* The preference that changed
|
||||
*/
|
||||
observe: function PC_PH_observe(subject, topic, data) {
|
||||
if (topic == "nsPref:changed" && data == this._pref)
|
||||
this._value = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* The cached value, null if it needs to be rebuilt from preferences.
|
||||
*/
|
||||
_value: null,
|
||||
|
||||
/**
|
||||
* Get the preference value, reading from preferences if necessary.
|
||||
*/
|
||||
get value() {
|
||||
if (!this._value) {
|
||||
if (this._pb.prefHasUserValue(this._pref)) {
|
||||
var valueString = this._pb.getCharPref(this._pref);
|
||||
this._value = this._serializable.deserialize(valueString);
|
||||
}
|
||||
else
|
||||
this._value = this._defaultValue;
|
||||
}
|
||||
return this._value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Stores a value in preferences.
|
||||
* @param value
|
||||
* The data to be stored.
|
||||
*/
|
||||
set value(value) {
|
||||
if (value != this._value) {
|
||||
this._pb.setCharPref(this._pref, this._serializable.serialize(value));
|
||||
var ps = this._pb.QueryInterface(Ci.nsIPrefService);
|
||||
ps.savePrefFile(null);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
// The preferences where the OptionsFilter stores user settings for different
|
||||
// view types:
|
||||
const PREF_PLACES_ORGANIZER_OPTIONS_HISTORY =
|
||||
@@ -129,7 +207,6 @@ var OptionsFilter = {
|
||||
var defaultBookmarksOptions = history.getNewQueryOptions();
|
||||
defaultBookmarksOptions.setGroupingMode([NHQO.GROUP_BY_FOLDER], 1);
|
||||
var defaultSubscriptionsOptions = history.getNewQueryOptions();
|
||||
defaultSubscriptionsOptions.setGroupingMode([NHQO.GROUP_BY_FOLDER], 1);
|
||||
|
||||
this.historyHandler =
|
||||
new PrefHandler(PREF_PLACES_ORGANIZER_OPTIONS_HISTORY,
|
||||
@@ -181,16 +258,7 @@ var OptionsFilter = {
|
||||
|
||||
var overrideGroupings = overrideOptions.getGroupingMode({});
|
||||
options.setGroupingMode(overrideGroupings, overrideGroupings.length);
|
||||
|
||||
options.sortingMode = overrideOptions.sortingMode;
|
||||
options.resultType = overrideOptions.resultType;
|
||||
options.excludeItems = overrideOptions.excludeItems;
|
||||
options.excludeQueries = overrideOptions.excludeQueries;
|
||||
options.excludeReadOnlyFolders = overrideOptions.excludeReadOnlyFolders;
|
||||
options.expandQueries = overrideOptions.expandQueries;
|
||||
options.forceOriginalTitle = overrideOptions.forceOriginalTitle;
|
||||
options.includeHidden = overrideOptions.includeHidden;
|
||||
options.maxResults = overrideOptions.maxResults;
|
||||
|
||||
this._grouper.updateGroupingUI(queries, options, handler);
|
||||
|
||||
|
||||
@@ -52,9 +52,13 @@
|
||||
"T">
|
||||
|
||||
<!ENTITY cmd.find.label
|
||||
"Find in Bookmarks/History...">
|
||||
"Find in Bookmarks & History...">
|
||||
<!ENTITY cmd.find.accesskey
|
||||
"F">
|
||||
<!ENTITY cmd.findCurrent.label
|
||||
"Find in Current Collection...">
|
||||
<!ENTITY cmd.findCurrent.accesskey
|
||||
"i">
|
||||
<!ENTITY cmd.export.label
|
||||
"Export...">
|
||||
<!ENTITY cmd.export.accesskey
|
||||
|
||||
@@ -31,8 +31,6 @@ headerTextPrefix1=Showing
|
||||
headerTextPrefix2=Search Results for
|
||||
headerTextPrefix3=Advanced Search
|
||||
|
||||
searchDefault=Search
|
||||
|
||||
lessCriteria.label=-
|
||||
moreCriteria.label=+
|
||||
|
||||
@@ -62,3 +60,6 @@ sortByName=Sort '%S' by Name
|
||||
sortByNameGeneric=Sort by Name
|
||||
sortByPrefix=Sort by %S
|
||||
|
||||
searchDefault=Search in Bookmarks & History
|
||||
searchCurrentDefault=Search in '%S'
|
||||
findInPrefix=Find in '%S'...
|
||||
|
||||
@@ -35,7 +35,7 @@ treechildren::-moz-tree-image {
|
||||
margin: 0px 2px;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title, container) {
|
||||
treechildren::-moz-tree-image(title) {
|
||||
list-style-image: url("chrome://global/skin/icons/folder-item.png") !important;
|
||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||
}
|
||||
@@ -44,18 +44,22 @@ treechildren::-moz-tree-image(title, container) {
|
||||
-moz-image-region: rect(0px, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title, livemark\/bookmarkFeedURI) {
|
||||
list-style-image: url("chrome://browser/skin/livemark-item.png") !important;
|
||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title, open) {
|
||||
-moz-image-region: rect(16px, 32px, 32px, 16px);
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-row(session-start) {
|
||||
border-top:1px dotted ThreeDShadow;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* FIXME this should make the date field invisible, but only does it for
|
||||
unselected items and maybe won't work for different color schemes. */
|
||||
treechildren::-moz-tree-cell-text(date, session-continue) {
|
||||
color:white;
|
||||
color: -moz-Field;
|
||||
}
|
||||
|
||||
treechildren::-moz-tree-image(title, separator) {
|
||||
@@ -115,6 +119,34 @@ treechildren::-moz-tree-cell-text(title, separator, selected, focus) {
|
||||
margin: 6px -4px 0px 2px;
|
||||
}
|
||||
|
||||
.textbox-input-closebutton {
|
||||
-moz-appearance: none;
|
||||
margin: 1px 2px 1px 1px;
|
||||
min-width: 0;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
padding: 0 !important;
|
||||
list-style-image: url("chrome://global/skin/icons/close.png");
|
||||
-moz-image-region: rect(0px 16px 16px 0px);
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.textbox-input-closebutton > .button-box {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.textbox-input-closebutton:hover {
|
||||
-moz-image-region: rect(0px 32px 16px 16px);
|
||||
}
|
||||
|
||||
.textbox-input-closebutton:hover:active {
|
||||
-moz-image-region: rect(0px 48px 16px 32px);
|
||||
}
|
||||
|
||||
.small, .small[disabled="true"] {
|
||||
font-size: x-small;
|
||||
min-width: 0px;
|
||||
@@ -233,3 +265,10 @@ treechildren::-moz-tree-cell-text(title, separator, selected, focus) {
|
||||
#searchModifiers {
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
#debugPanel {
|
||||
background-color: ThreeDFace;
|
||||
border-top: 2px solid;
|
||||
-moz-border-top-colors: ThreeDShadow ThreeDHighlight;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user