Bug 411549 - place:folder=x shows next to Location line in Library. r=dietrich.

This commit is contained in:
mozilla.mano@sent.com 2008-03-13 11:20:49 -07:00
parent 177108e9ae
commit 7432d22729
2 changed files with 31 additions and 7 deletions

View File

@ -62,6 +62,8 @@ var gEditItemOverlay = {
this._hiddenRows = aInfo.hiddenRows;
else
this._hiddenRows.splice(0);
// force-read-only
this._readOnly = aInfo && aInfo.forceReadOnly;
},
_showHideRows: function EIO__showHideRows() {
@ -89,6 +91,17 @@ var gEditItemOverlay = {
/**
* Initialize the panel
* @param aItemId
* a places-itemId of a bookmark, folder or a live bookmark.
* @param [optional] aInfo
* JS object which stores additional info for the panel
* initialization. The following properties may bet set:
* * hiddenRows (Strings array): list of rows to be hidden regardless
* of the item edited. Possible values: "title", "location",
* "description", "keyword", "loadInSidebar", "feedLocation",
* "siteLocation", folderPicker"
* * forceReadOnly - set this flag to initialize the panel to its
* read-only (view) mode even if the given item is editable.
*/
initPanel: function EIO_initPanel(aItemId, aInfo) {
const bms = PlacesUtils.bookmarks;
@ -103,10 +116,8 @@ var gEditItemOverlay = {
if (this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) {
this._uri = bms.getBookmarkURI(this._itemId);
this._isLivemark = false;
if (PlacesUtils.livemarks.isLivemark(container))
this._readOnly = true;
else
this._readOnly = false;
if (!this._readOnly) // If readOnly wasn't forced through aInfo
this._readOnly = PlacesUtils.livemarks.isLivemark(container);
this._initTextField("locationField", this._uri.spec);
this._initTextField("tagsField",
@ -126,7 +137,8 @@ var gEditItemOverlay = {
LOAD_IN_SIDEBAR_ANNO);
}
else {
this._readOnly = false;
if (!this._readOnly) // If readOnly wasn't forced through aInfo
this._readOnly = false;
this._isLivemark = PlacesUtils.livemarks.isLivemark(this._itemId);
if (this._isLivemark) {
var feedURI = PlacesUtils.livemarks.getFeedURI(this._itemId);

View File

@ -541,8 +541,20 @@ var PlacesOrganizer = {
this._paneDisabled = false;
}
gEditItemOverlay.initPanel(selectedNode.itemId,
{ hiddenRows: ["folderPicker"] });
// Using the concrete itemId is arguably wrong. The bookmarks API
// does allow setting properties for folder shortcuts as well, but since
// the UI does not distinct between the couple, we better just show
// the concrete item properties.
if (selectedNode.type ==
Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) {
gEditItemOverlay.initPanel(asQuery(selectedNode).folderItemId,
{ hiddenRows: ["folderPicker"],
forceReadOnly: true });
}
else {
gEditItemOverlay.initPanel(selectedNode.itemId,
{ hiddenRows: ["folderPicker"] });
}
this._detectAndSetDetailsPaneMinimalState(selectedNode);
return;