mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 479348 - Choosing Properties on a Special Folder changes its title to (no title), r=dietrich
This commit is contained in:
parent
0c75fabad2
commit
75581db858
@ -87,6 +87,7 @@
|
||||
* - "feedLocation"
|
||||
* - "siteLocation"
|
||||
* - "folderPicker" - hides both the tree and the menu.
|
||||
* @ readOnly (Boolean) - optional, states if the panel should be read-only
|
||||
*
|
||||
* window.arguments[0].performed is set to true if any transaction has
|
||||
* been performed by the dialog.
|
||||
@ -127,6 +128,7 @@ var BookmarkPropertiesPanel = {
|
||||
_defaultInsertionPoint: null,
|
||||
_hiddenRows: [],
|
||||
_batching: false,
|
||||
_readOnly: false,
|
||||
|
||||
/**
|
||||
* This method returns the correct label for the dialog's "accept"
|
||||
@ -263,6 +265,7 @@ var BookmarkPropertiesPanel = {
|
||||
this._title = PlacesUtils.bookmarks.getItemTitle(this._itemId);
|
||||
// Don't show folderPicker when editing
|
||||
this._hiddenRows.push("folderPicker");
|
||||
this._readOnly = !!dialogInfo.readOnly;
|
||||
|
||||
switch (dialogInfo.type) {
|
||||
case "bookmark":
|
||||
@ -333,6 +336,7 @@ var BookmarkPropertiesPanel = {
|
||||
switch (this._action) {
|
||||
case ACTION_EDIT:
|
||||
this._fillEditProperties();
|
||||
acceptButton.disabled = this._readOnly;
|
||||
break;
|
||||
case ACTION_ADD:
|
||||
this._fillAddProperties();
|
||||
@ -358,21 +362,23 @@ var BookmarkPropertiesPanel = {
|
||||
.addEventListener("DOMAttrModified", this, false);
|
||||
}
|
||||
|
||||
// Listen on uri fields to enable accept button if input is valid
|
||||
if (this._itemType == BOOKMARK_ITEM) {
|
||||
this._element("locationField")
|
||||
.addEventListener("input", this, false);
|
||||
}
|
||||
else if (this._itemType == LIVEMARK_CONTAINER) {
|
||||
this._element("feedLocationField")
|
||||
.addEventListener("input", this, false);
|
||||
this._element("siteLocationField")
|
||||
.addEventListener("input", this, false);
|
||||
}
|
||||
if (!this._readOnly) {
|
||||
// Listen on uri fields to enable accept button if input is valid
|
||||
if (this._itemType == BOOKMARK_ITEM) {
|
||||
this._element("locationField")
|
||||
.addEventListener("input", this, false);
|
||||
}
|
||||
else if (this._itemType == LIVEMARK_CONTAINER) {
|
||||
this._element("feedLocationField")
|
||||
.addEventListener("input", this, false);
|
||||
this._element("siteLocationField")
|
||||
.addEventListener("input", this, false);
|
||||
}
|
||||
|
||||
// Set on document to get the event before an autocomplete popup could
|
||||
// be hidden on Enter.
|
||||
document.addEventListener("keypress", this, true);
|
||||
// Set on document to get the event before an autocomplete popup could
|
||||
// be hidden on Enter.
|
||||
document.addEventListener("keypress", this, true);
|
||||
}
|
||||
|
||||
window.sizeToContent();
|
||||
},
|
||||
@ -464,7 +470,8 @@ var BookmarkPropertiesPanel = {
|
||||
|
||||
_fillEditProperties: function BPP__fillEditProperties() {
|
||||
gEditItemOverlay.initPanel(this._itemId,
|
||||
{ hiddenRows: this._hiddenRows });
|
||||
{ hiddenRows: this._hiddenRows,
|
||||
forceReadOnly: this._readOnly });
|
||||
},
|
||||
|
||||
_fillAddProperties: function BPP__fillAddProperties() {
|
||||
|
@ -164,14 +164,10 @@ PlacesController.prototype = {
|
||||
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
||||
case "placesCmd_show:info":
|
||||
var selectedNode = this._view.selectedNode;
|
||||
if (selectedNode) {
|
||||
if (PlacesUtils.nodeIsFolder(selectedNode) ||
|
||||
(PlacesUtils.nodeIsQuery(selectedNode) &&
|
||||
selectedNode.itemId != -1) ||
|
||||
(PlacesUtils.nodeIsBookmark(selectedNode) &&
|
||||
!PlacesUtils.nodeIsLivemarkItem(selectedNode)))
|
||||
return true;
|
||||
}
|
||||
if (selectedNode &&
|
||||
PlacesUtils.getConcreteItemId(selectedNode) != -1 &&
|
||||
!PlacesUtils.nodeIsLivemarkItem(selectedNode))
|
||||
return true;
|
||||
return false;
|
||||
case "placesCmd_reloadMicrosummary":
|
||||
var selectedNode = this._view.selectedNode;
|
||||
@ -662,11 +658,19 @@ PlacesController.prototype = {
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (PlacesUtils.nodeIsFolder(node))
|
||||
PlacesUIUtils.showItemProperties(node.itemId, "folder");
|
||||
else if (PlacesUtils.nodeIsBookmark(node) ||
|
||||
PlacesUtils.nodeIsQuery(node))
|
||||
PlacesUIUtils.showItemProperties(node.itemId, "bookmark");
|
||||
var itemType = PlacesUtils.nodeIsFolder(node) ||
|
||||
PlacesUtils.nodeIsTagQuery(node) ? "folder" : "bookmark";
|
||||
var concreteId = PlacesUtils.getConcreteItemId(node);
|
||||
var isRootItem = PlacesUtils.isRootItem(concreteId);
|
||||
var itemId = node.itemId;
|
||||
if (isRootItem || PlacesUtils.nodeIsTagQuery(node)) {
|
||||
// If this is a root or the Tags query we use the concrete itemId to catch
|
||||
// the correct title for the node.
|
||||
itemId = concreteId;
|
||||
}
|
||||
|
||||
PlacesUIUtils.showItemProperties(itemId, itemType,
|
||||
isRootItem /* read only */);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -667,23 +667,27 @@ var PlacesOrganizer = {
|
||||
|
||||
if (aSelectedNode && !PlacesUtils.nodeIsSeparator(aSelectedNode)) {
|
||||
detailsDeck.selectedIndex = 1;
|
||||
// Using the concrete itemId is arguably wrong. The bookmarks API
|
||||
// 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 (aSelectedNode.type ==
|
||||
Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) {
|
||||
gEditItemOverlay.initPanel(asQuery(aSelectedNode).folderItemId,
|
||||
{ hiddenRows: ["folderPicker"],
|
||||
forceReadOnly: true });
|
||||
// the concrete item properties for shortcuts to root nodes.
|
||||
var concreteId = PlacesUtils.getConcreteItemId(aSelectedNode);
|
||||
var isRootItem = concreteId != -1 && PlacesUtils.isRootItem(concreteId);
|
||||
var readOnly = isRootItem ||
|
||||
aSelectedNode.parent.itemId == PlacesUIUtils.leftPaneFolderId;
|
||||
var useConcreteId = isRootItem ||
|
||||
PlacesUtils.nodeIsTagQuery(aSelectedNode);
|
||||
var itemId = -1;
|
||||
if (concreteId != -1 && useConcreteId)
|
||||
itemId = concreteId;
|
||||
else if (aSelectedNode.itemId != -1)
|
||||
itemId = aSelectedNode.itemId;
|
||||
else
|
||||
itemId = PlacesUtils._uri(aSelectedNode.uri);
|
||||
|
||||
gEditItemOverlay.initPanel(itemId, { hiddenRows: ["folderPicker"],
|
||||
forceReadOnly: readOnly });
|
||||
|
||||
}
|
||||
else {
|
||||
var itemId = PlacesUtils.getConcreteItemId(aSelectedNode);
|
||||
gEditItemOverlay.initPanel(itemId != -1 ? itemId :
|
||||
PlacesUtils._uri(aSelectedNode.uri),
|
||||
{ hiddenRows: ["folderPicker"] });
|
||||
}
|
||||
this._detectAndSetDetailsPaneMinimalState(aSelectedNode);
|
||||
}
|
||||
else if (!aSelectedNode && aNodeList[0]) {
|
||||
|
@ -661,13 +661,16 @@ var PlacesUIUtils = {
|
||||
* item identifier for which the properties are to be shown
|
||||
* @param aType
|
||||
* item type, either "bookmark" or "folder"
|
||||
* @param [optional] aReadOnly
|
||||
* states if properties dialog should be readonly
|
||||
* @return true if any transaction has been performed.
|
||||
*/
|
||||
showItemProperties: function PU_showItemProperties(aItemId, aType) {
|
||||
showItemProperties: function PU_showItemProperties(aItemId, aType, aReadOnly) {
|
||||
var info = {
|
||||
action: "edit",
|
||||
type: aType,
|
||||
itemId: aItemId
|
||||
itemId: aItemId,
|
||||
readOnly: aReadOnly
|
||||
};
|
||||
return this._showBookmarkDialog(info);
|
||||
},
|
||||
|
@ -810,6 +810,21 @@ var PlacesUtils = {
|
||||
return this.unfiledBookmarksFolderId = this.bookmarks.unfiledBookmarksFolder;
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if aItemId is a root.
|
||||
*
|
||||
* @param aItemId
|
||||
* item id to look for.
|
||||
* @returns true if aItemId is a root, false otherwise.
|
||||
*/
|
||||
isRootItem: function PU_isRootItem(aItemId) {
|
||||
return aItemId == PlacesUtils.bookmarksMenuFolderId ||
|
||||
aItemId == PlacesUtils.toolbarFolderId ||
|
||||
aItemId == PlacesUtils.unfiledBookmarksFolderId ||
|
||||
aItemId == PlacesUtils.tagsFolderId ||
|
||||
aItemId == PlacesUtils.placesRootId;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the POST data associated with a bookmark, if any.
|
||||
* Used by POST keywords.
|
||||
|
Loading…
Reference in New Issue
Block a user