зеркало из https://github.com/mozilla/pjs.git
Bug 404496 - Assert in Organizer Views-show columns. r=dietrich. a=schrep.
This commit is contained in:
Родитель
27b7a30c16
Коммит
5bebb9ba61
|
@ -1404,13 +1404,14 @@ var ViewMenu = {
|
||||||
var column = columns.getColumnAt(i).element;
|
var column = columns.getColumnAt(i).element;
|
||||||
var menuitem = document.createElement("menuitem");
|
var menuitem = document.createElement("menuitem");
|
||||||
menuitem.id = "menucol_" + column.id;
|
menuitem.id = "menucol_" + column.id;
|
||||||
menuitem.setAttribute("column", column.id);
|
menuitem.column = column;
|
||||||
var label = column.getAttribute("label");
|
var label = column.getAttribute("label");
|
||||||
if (propertyPrefix) {
|
if (propertyPrefix) {
|
||||||
var menuitemPrefix = propertyPrefix;
|
var menuitemPrefix = propertyPrefix;
|
||||||
// for string properties, use "name" as the id, instead of "title"
|
// for string properties, use "name" as the id, instead of "title"
|
||||||
// see bug #386287 for details
|
// see bug #386287 for details
|
||||||
menuitemPrefix += (column.id == "title" ? "name" : column.id);
|
var columnId = column.getAttribute("anonid");
|
||||||
|
menuitemPrefix += columnId == "title" ? "name" : columnId;
|
||||||
label = PlacesUtils.getString(menuitemPrefix + ".label");
|
label = PlacesUtils.getString(menuitemPrefix + ".label");
|
||||||
var accesskey = PlacesUtils.getString(menuitemPrefix + ".accesskey");
|
var accesskey = PlacesUtils.getString(menuitemPrefix + ".accesskey");
|
||||||
menuitem.setAttribute("accesskey", accesskey);
|
menuitem.setAttribute("accesskey", accesskey);
|
||||||
|
@ -1477,11 +1478,7 @@ var ViewMenu = {
|
||||||
* The menuitem element for the column
|
* The menuitem element for the column
|
||||||
*/
|
*/
|
||||||
showHideColumn: function VM_showHideColumn(element) {
|
showHideColumn: function VM_showHideColumn(element) {
|
||||||
const PREFIX = "menucol_";
|
var column = element.column;
|
||||||
var columnID = element.id.substr(PREFIX.length, element.id.length);
|
|
||||||
var column = document.getElementById(columnID);
|
|
||||||
NS_ASSERT(column,
|
|
||||||
"menu item for column that doesn't exist?! id = " + element.id);
|
|
||||||
|
|
||||||
var splitter = column.nextSibling;
|
var splitter = column.nextSibling;
|
||||||
if (splitter && splitter.localName != "splitter")
|
if (splitter && splitter.localName != "splitter")
|
||||||
|
@ -1516,35 +1513,41 @@ var ViewMenu = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the view by the specified key.
|
* Sorts the view by the specified column.
|
||||||
* @param aColumnID
|
* @param aColumn
|
||||||
* The ID of the colum that is the sort key. Can be null - the
|
* The colum that is the sort key. Can be null - the
|
||||||
* current sort column id or "title" will be used.
|
* current sort column or the title column will be used.
|
||||||
* @param aDirection
|
* @param aDirection
|
||||||
* The direction to sort - "ascending" or "descending".
|
* The direction to sort - "ascending" or "descending".
|
||||||
* Can be null - the last direction or descending will be used.
|
* Can be null - the last direction or descending will be used.
|
||||||
*
|
*
|
||||||
* If both aColumnID and aDirection are null, the view will be unsorted.
|
* If both aColumnID and aDirection are null, the view will be unsorted.
|
||||||
*/
|
*/
|
||||||
setSortColumn: function VM_setSortColumn(aColumnID, aDirection) {
|
setSortColumn: function VM_setSortColumn(aColumn, aDirection) {
|
||||||
var result = document.getElementById("placeContent").getResult();
|
var result = document.getElementById("placeContent").getResult();
|
||||||
if (!aColumnID && !aDirection) {
|
if (!aColumn && !aDirection) {
|
||||||
result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sortColumn = this._getSortColumn();
|
var columnId;
|
||||||
if (!aDirection) {
|
if (aColumn) {
|
||||||
aDirection = sortColumn ?
|
columnId = aColumn.getAttribute("anonid")
|
||||||
sortColumn.getAttribute("sortDirection") : "descending";
|
if (!aDirection) {
|
||||||
|
var sortColumn = this._getSortColumn();
|
||||||
|
aDirection = sortColumn ?
|
||||||
|
sortColumn.getAttribute("sortDirection") : "descending";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var sortColumn = this._getSortColumn();
|
||||||
|
columnId = sortColumn ? sortColumn.getAttribute("anonid") : "title";
|
||||||
}
|
}
|
||||||
else if (!aColumnID)
|
|
||||||
aColumnID = sortColumn ? sortColumn.id : "title";
|
|
||||||
|
|
||||||
var sortingMode;
|
var sortingMode;
|
||||||
var sortingAnnotation = "";
|
var sortingAnnotation = "";
|
||||||
const NHQO = Ci.nsINavHistoryQueryOptions;
|
const NHQO = Ci.nsINavHistoryQueryOptions;
|
||||||
switch (aColumnID) {
|
switch (columnId) {
|
||||||
case "title":
|
case "title":
|
||||||
sortingMode = aDirection == "descending" ?
|
sortingMode = aDirection == "descending" ?
|
||||||
NHQO.SORT_BY_TITLE_DESCENDING : NHQO.SORT_BY_TITLE_ASCENDING;
|
NHQO.SORT_BY_TITLE_DESCENDING : NHQO.SORT_BY_TITLE_ASCENDING;
|
||||||
|
|
|
@ -265,7 +265,7 @@
|
||||||
<menu id="viewSort" label="&view.sort.label;"
|
<menu id="viewSort" label="&view.sort.label;"
|
||||||
accesskey="&view.sort.accesskey;">
|
accesskey="&view.sort.accesskey;">
|
||||||
<menupopup onpopupshowing="ViewMenu.populateSortMenu(event);"
|
<menupopup onpopupshowing="ViewMenu.populateSortMenu(event);"
|
||||||
oncommand="ViewMenu.setSortColumn(event.target.getAttribute('column'), null);">
|
oncommand="ViewMenu.setSortColumn(event.target.column, null);">
|
||||||
<menuitem id="viewUnsorted" type="radio" name="columns"
|
<menuitem id="viewUnsorted" type="radio" name="columns"
|
||||||
label="&view.unsorted.label;" accesskey="&view.unsorted.accesskey;"
|
label="&view.unsorted.label;" accesskey="&view.unsorted.accesskey;"
|
||||||
oncommand="ViewMenu.setSortColumn(null, null);"/>
|
oncommand="ViewMenu.setSortColumn(null, null);"/>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче