mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset dd398fdba56f due to permaorange
This commit is contained in:
parent
7581f75759
commit
309ce70e5b
@ -429,8 +429,8 @@
|
||||
#endif
|
||||
context="placesContext"
|
||||
openInTabs="children"
|
||||
oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
|
||||
onclick="BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
|
||||
oncommand="BookmarksEventHandler.onCommand(event);"
|
||||
onclick="BookmarksEventHandler.onClick(event);"
|
||||
onpopupshowing="if (!this.parentNode._placesView)
|
||||
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
|
||||
tooltip="bhTooltip" popupsinherittooltip="true">
|
||||
|
@ -712,10 +712,8 @@ var BookmarksEventHandler = {
|
||||
* If the click came through a menu, close the menu.
|
||||
* @param aEvent
|
||||
* DOMEvent for the click
|
||||
* @param aView
|
||||
* The places view which aEvent should be associated with.
|
||||
*/
|
||||
onClick: function BEH_onClick(aEvent, aView) {
|
||||
onClick: function BEH_onClick(aEvent) {
|
||||
// Only handle middle-click or left-click with modifiers.
|
||||
#ifdef XP_MACOSX
|
||||
var modifKey = aEvent.metaKey || aEvent.shiftKey;
|
||||
@ -745,11 +743,11 @@ var BookmarksEventHandler = {
|
||||
// is middle-clicked or when a non-bookmark item except for Open in Tabs)
|
||||
// in a bookmarks menupopup is middle-clicked.
|
||||
if (target.localName == "menu" || target.localName == "toolbarbutton")
|
||||
PlacesUIUtils.openContainerNodeInTabs(target._placesNode, aEvent, aView);
|
||||
PlacesUIUtils.openContainerNodeInTabs(target._placesNode, aEvent);
|
||||
}
|
||||
else if (aEvent.button == 1) {
|
||||
// left-clicks with modifier are already served by onCommand
|
||||
this.onCommand(aEvent, aView);
|
||||
this.onCommand(aEvent);
|
||||
}
|
||||
},
|
||||
|
||||
@ -759,13 +757,11 @@ var BookmarksEventHandler = {
|
||||
* Opens the item.
|
||||
* @param aEvent
|
||||
* DOMEvent for the command
|
||||
* @param aView
|
||||
* The places view which aEvent should be associated with.
|
||||
*/
|
||||
onCommand: function BEH_onCommand(aEvent, aView) {
|
||||
onCommand: function BEH_onCommand(aEvent) {
|
||||
var target = aEvent.originalTarget;
|
||||
if (target._placesNode)
|
||||
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
|
||||
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent);
|
||||
},
|
||||
|
||||
fillInBHTooltip: function BEH_fillInBHTooltip(aDocument, aEvent) {
|
||||
|
@ -192,16 +192,14 @@ splitmenu {
|
||||
-moz-binding: url(chrome://browser/content/urlbarBindings.xml#urlbar);
|
||||
}
|
||||
|
||||
.uri-element-right-align:-moz-locale-dir(rtl),
|
||||
html|input.uri-element-right-align:-moz-locale-dir(rtl),
|
||||
.ac-url-text:-moz-locale-dir(rtl),
|
||||
.ac-title:-moz-locale-dir(rtl) > description {
|
||||
direction: ltr !important;
|
||||
text-align: right !important;
|
||||
/* Some child nodes want to be ordered based on the locale's direction, while
|
||||
everything else should be ltr. */
|
||||
.urlbar-input-box:-moz-locale-dir(rtl) {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.urlbar-over-link-box:-moz-locale-dir(rtl) {
|
||||
-moz-box-direction: reverse;
|
||||
html|*.urlbar-input {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
/* over-link in location bar */
|
||||
|
@ -647,8 +647,8 @@
|
||||
placespopup="true"
|
||||
context="placesContext"
|
||||
openInTabs="children"
|
||||
oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
|
||||
onclick="BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
|
||||
oncommand="BookmarksEventHandler.onCommand(event);"
|
||||
onclick="BookmarksEventHandler.onClick(event);"
|
||||
onpopupshowing="BookmarksMenuButton.onPopupShowing(event);
|
||||
if (!this.parentNode._placesView)
|
||||
new PlacesMenu(event, 'place:folder=BOOKMARKS_MENU');"
|
||||
@ -747,8 +747,8 @@
|
||||
<hbox flex="1"
|
||||
id="PlacesToolbar"
|
||||
context="placesContext"
|
||||
onclick="BookmarksEventHandler.onClick(event, this._placesView);"
|
||||
oncommand="BookmarksEventHandler.onCommand(event, this._placesView);"
|
||||
onclick="BookmarksEventHandler.onClick(event);"
|
||||
oncommand="BookmarksEventHandler.onCommand(event);"
|
||||
tooltip="bhTooltip"
|
||||
popupsinherittooltip="true">
|
||||
<toolbarbutton class="bookmark-item bookmarks-toolbar-customize"
|
||||
|
@ -264,13 +264,13 @@ PlacesController.prototype = {
|
||||
this.selectAll();
|
||||
break;
|
||||
case "placesCmd_open":
|
||||
PlacesUIUtils.openNodeIn(this._view.selectedNode, "current", this._view);
|
||||
PlacesUIUtils.openNodeIn(this._view.selectedNode, "current");
|
||||
break;
|
||||
case "placesCmd_open:window":
|
||||
PlacesUIUtils.openNodeIn(this._view.selectedNode, "window", this._view);
|
||||
PlacesUIUtils.openNodeIn(this._view.selectedNode, "window");
|
||||
break;
|
||||
case "placesCmd_open:tab":
|
||||
PlacesUIUtils.openNodeIn(this._view.selectedNode, "tab", this._view);
|
||||
PlacesUIUtils.openNodeIn(this._view.selectedNode, "tab");
|
||||
break;
|
||||
case "placesCmd_new:folder":
|
||||
this.newItem("folder");
|
||||
@ -300,16 +300,8 @@ PlacesController.prototype = {
|
||||
this.sortFolderByName();
|
||||
break;
|
||||
case "placesCmd_createBookmark":
|
||||
let node = this._view.selectedNode;
|
||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
||||
, type: "bookmark"
|
||||
, hiddenRows: [ "description"
|
||||
, "keyword"
|
||||
, "location"
|
||||
, "loadInSidebar" ]
|
||||
, uri: PlacesUtils._uri(node.uri)
|
||||
, title: node.title
|
||||
}, window);
|
||||
var node = this._view.selectedNode;
|
||||
PlacesUIUtils.showMinimalAddBookmarkUI(PlacesUtils._uri(node.uri), node.title);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -716,11 +708,8 @@ PlacesController.prototype = {
|
||||
itemId = concreteId;
|
||||
}
|
||||
|
||||
PlacesUIUtils.showBookmarkDialog({ action: "edit"
|
||||
, type: itemType
|
||||
, itemId: itemId
|
||||
, readOnly: isRootItem
|
||||
}, window);
|
||||
PlacesUIUtils.showItemProperties(itemId, itemType,
|
||||
isRootItem /* read only */);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -751,15 +740,61 @@ PlacesController.prototype = {
|
||||
mss.refreshMicrosummary(selectedNode.itemId);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gives the user a chance to cancel loading lots of tabs at once
|
||||
*/
|
||||
_confirmOpenTabs: function(numTabsToOpen) {
|
||||
var pref = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
|
||||
const kWarnOnOpenPref = "browser.tabs.warnOnOpen";
|
||||
var reallyOpen = true;
|
||||
if (pref.getBoolPref(kWarnOnOpenPref)) {
|
||||
if (numTabsToOpen >= pref.getIntPref("browser.tabs.maxOpenBeforeWarn")) {
|
||||
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
||||
getService(Ci.nsIPromptService);
|
||||
|
||||
// default to true: if it were false, we wouldn't get this far
|
||||
var warnOnOpen = { value: true };
|
||||
|
||||
var messageKey = "tabs.openWarningMultipleBranded";
|
||||
var openKey = "tabs.openButtonMultiple";
|
||||
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
|
||||
var brandShortName = Cc["@mozilla.org/intl/stringbundle;1"].
|
||||
getService(Ci.nsIStringBundleService).
|
||||
createBundle(BRANDING_BUNDLE_URI).
|
||||
GetStringFromName("brandShortName");
|
||||
|
||||
var buttonPressed = promptService.confirmEx(window,
|
||||
PlacesUIUtils.getString("tabs.openWarningTitle"),
|
||||
PlacesUIUtils.getFormattedString(messageKey,
|
||||
[numTabsToOpen, brandShortName]),
|
||||
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0)
|
||||
+ (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
|
||||
PlacesUIUtils.getString(openKey),
|
||||
null, null,
|
||||
PlacesUIUtils.getFormattedString("tabs.openWarningPromptMeBranded",
|
||||
[brandShortName]),
|
||||
warnOnOpen);
|
||||
|
||||
reallyOpen = (buttonPressed == 0);
|
||||
// don't set the pref unless they press OK and it's false
|
||||
if (reallyOpen && !warnOnOpen.value)
|
||||
pref.setBoolPref(kWarnOnOpenPref, false);
|
||||
}
|
||||
}
|
||||
return reallyOpen;
|
||||
},
|
||||
|
||||
/**
|
||||
* Opens the links in the selected folder, or the selected links in new tabs.
|
||||
*/
|
||||
openSelectionInTabs: function PC_openLinksInTabs(aEvent) {
|
||||
var node = this._view.selectedNode;
|
||||
if (node && PlacesUtils.nodeIsContainer(node))
|
||||
PlacesUIUtils.openContainerNodeInTabs(this._view.selectedNode, aEvent, this._view);
|
||||
PlacesUIUtils.openContainerNodeInTabs(this._view.selectedNode, aEvent);
|
||||
else
|
||||
PlacesUIUtils.openURINodesInTabs(this._view.selectedNodes, aEvent, this._view);
|
||||
PlacesUIUtils.openURINodesInTabs(this._view.selectedNodes, aEvent);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -769,19 +804,21 @@ PlacesController.prototype = {
|
||||
* the type of the new item (bookmark/livemark/folder)
|
||||
*/
|
||||
newItem: function PC_newItem(aType) {
|
||||
let ip = this._view.insertionPoint;
|
||||
var ip = this._view.insertionPoint;
|
||||
if (!ip)
|
||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
let performed =
|
||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
||||
, type: aType
|
||||
, defaultInsertionPoint: ip
|
||||
, hiddenRows: [ "folderPicker" ]
|
||||
}, window);
|
||||
var performed = false;
|
||||
if (aType == "bookmark")
|
||||
performed = PlacesUIUtils.showAddBookmarkUI(null, null, null, ip);
|
||||
else if (aType == "livemark")
|
||||
performed = PlacesUIUtils.showAddLivemarkUI(null, null, null, null, ip);
|
||||
else // folder
|
||||
performed = PlacesUIUtils.showAddFolderUI(null, ip);
|
||||
|
||||
if (performed) {
|
||||
// Select the new item.
|
||||
let insertedNodeId = PlacesUtils.bookmarks
|
||||
// select the new item
|
||||
var insertedNodeId = PlacesUtils.bookmarks
|
||||
.getIdForItemAt(ip.itemId, ip.index);
|
||||
this._view.selectItems([insertedNodeId], false);
|
||||
}
|
||||
@ -793,9 +830,18 @@ PlacesController.prototype = {
|
||||
* of the folder.
|
||||
*/
|
||||
newFolder: function PC_newFolder() {
|
||||
Cu.reportError("PlacesController.newFolder is deprecated and will be \
|
||||
removed in a future release. Use newItem instead.");
|
||||
this.newItem("folder");
|
||||
var ip = this._view.insertionPoint;
|
||||
if (!ip)
|
||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
var performed = false;
|
||||
performed = PlacesUIUtils.showAddFolderUI(null, ip);
|
||||
if (performed) {
|
||||
// select the new item
|
||||
var insertedNodeId = PlacesUtils.bookmarks
|
||||
.getIdForItemAt(ip.itemId, ip.index);
|
||||
this._view.selectItems([insertedNodeId], false);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -343,8 +343,7 @@ var PlacesOrganizer = {
|
||||
},
|
||||
|
||||
openSelectedNode: function PO_openSelectedNode(aEvent) {
|
||||
PlacesUIUtils.openNodeWithEvent(this._content.selectedNode, aEvent,
|
||||
this._content.treeBoxObject.view);
|
||||
PlacesUIUtils.openNodeWithEvent(this._content.selectedNode, aEvent);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -86,7 +86,7 @@ var SidebarUtils = {
|
||||
else if (!mouseInGutter && openInTabs &&
|
||||
aEvent.originalTarget.localName == "treechildren") {
|
||||
tbo.view.selection.select(row.value);
|
||||
PlacesUIUtils.openContainerNodeInTabs(aTree.selectedNode, aEvent, tbo.view);
|
||||
PlacesUIUtils.openContainerNodeInTabs(aTree.selectedNode, aEvent);
|
||||
}
|
||||
else if (!mouseInGutter && !isContainer &&
|
||||
aEvent.originalTarget.localName == "treechildren") {
|
||||
@ -94,16 +94,13 @@ var SidebarUtils = {
|
||||
// do this *before* attempting to load the link since openURL uses
|
||||
// selection as an indication of which link to load.
|
||||
tbo.view.selection.select(row.value);
|
||||
PlacesUIUtils.openNodeWithEvent(aTree.selectedNode, aEvent, tbo.view);
|
||||
PlacesUIUtils.openNodeWithEvent(aTree.selectedNode, aEvent);
|
||||
}
|
||||
},
|
||||
|
||||
handleTreeKeyPress: function SU_handleTreeKeyPress(aEvent) {
|
||||
// XXX Bug 627901: Post Fx4, this method should take a tree parameter.
|
||||
let node = aEvent.target.selectedNode;
|
||||
let view = PlacesUIUtils.getViewForNode(node);
|
||||
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
|
||||
PlacesUIUtils.openNodeWithEvent(node, aEvent, view);
|
||||
PlacesUIUtils.openNodeWithEvent(aEvent.target.selectedNode, aEvent);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -316,21 +316,59 @@ var PlacesUIUtils = {
|
||||
return null;
|
||||
},
|
||||
|
||||
_reportDeprecatedAddBookmarkMethod:
|
||||
function PUIU__reportDeprecatedAddBookmarkMethod() {
|
||||
let oldFuncName = arugments.callee.caller.name.slice(5); // remove PUIU_
|
||||
Cu.reportError(oldFuncName + " is deprecated and will be removed in a \
|
||||
future release. Use showBookmarkDialog instead");
|
||||
},
|
||||
/**
|
||||
* Methods to show the bookmarkProperties dialog in its various modes.
|
||||
*
|
||||
* The showMinimalAdd* methods open the dialog by its alternative URI. Thus
|
||||
* they persist the dialog dimensions separately from the showAdd* methods.
|
||||
* Note these variants also do not return the dialog "performed" state since
|
||||
* they may not open the dialog modally.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
|
||||
* Shows the "Add Bookmark" dialog.
|
||||
*
|
||||
* @param [optional] aURI
|
||||
* An nsIURI object for which the "add bookmark" dialog is
|
||||
* to be shown.
|
||||
* @param [optional] aTitle
|
||||
* The default title for the new bookmark.
|
||||
* @param [optional] aDescription
|
||||
The default description for the new bookmark
|
||||
* @param [optional] aDefaultInsertionPoint
|
||||
* The default insertion point for the new item. If set, the folder
|
||||
* picker would be hidden unless aShowPicker is set to true, in which
|
||||
* case the dialog only uses the folder identifier from the insertion
|
||||
* point as the initially selected item in the folder picker.
|
||||
* @param [optional] aShowPicker
|
||||
* see above
|
||||
* @param [optional] aLoadInSidebar
|
||||
* If true, the dialog will default to load the new item in the
|
||||
* sidebar (as a web panel).
|
||||
* @param [optional] aKeyword
|
||||
* The default keyword for the new bookmark. The keyword field
|
||||
* will be shown in the dialog if this is used.
|
||||
* @param [optional] aPostData
|
||||
* POST data for POST-style keywords.
|
||||
* @param [optional] aCharSet
|
||||
* The character set for the bookmarked page.
|
||||
* @return true if any transaction has been performed.
|
||||
*
|
||||
* Notes:
|
||||
* - the location, description and "loadInSidebar" fields are
|
||||
* visible only if there is no initial URI (aURI is null).
|
||||
* - When aDefaultInsertionPoint is not set, the dialog defaults to the
|
||||
* bookmarks root folder.
|
||||
*/
|
||||
showAddBookmarkUI: function PUIU_showAddBookmarkUI(
|
||||
aURI, aTitle, aDescription, aDefaultInsertionPoint, aShowPicker,
|
||||
aLoadInSidebar, aKeyword, aPostData, aCharSet) {
|
||||
this._reportDeprecatedAddBookmarkMethod();
|
||||
|
||||
showAddBookmarkUI: function PUIU_showAddBookmarkUI(aURI,
|
||||
aTitle,
|
||||
aDescription,
|
||||
aDefaultInsertionPoint,
|
||||
aShowPicker,
|
||||
aLoadInSidebar,
|
||||
aKeyword,
|
||||
aPostData,
|
||||
aCharSet) {
|
||||
var info = {
|
||||
action: "add",
|
||||
type: "bookmark"
|
||||
@ -363,18 +401,25 @@ var PlacesUIUtils = {
|
||||
info.charSet = aCharSet;
|
||||
}
|
||||
|
||||
return this.showBookmarkDialog(info);
|
||||
return this._showBookmarkDialog(info);
|
||||
},
|
||||
|
||||
/**
|
||||
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
|
||||
* @see showAddBookmarkUI
|
||||
* This opens the dialog with only the name and folder pickers visible by
|
||||
* default.
|
||||
*
|
||||
* You can still pass in the various paramaters as the default properties
|
||||
* for the new bookmark.
|
||||
*
|
||||
* The keyword field will be visible only if the aKeyword parameter
|
||||
* was used.
|
||||
*/
|
||||
showMinimalAddBookmarkUI:
|
||||
function PUIU_showMinimalAddBookmarkUI(
|
||||
aURI, aTitle, aDescription, aDefaultInsertionPoint, aShowPicker,
|
||||
aLoadInSidebar, aKeyword, aPostData, aCharSet) {
|
||||
this._reportDeprecatedAddBookmarkMethod();
|
||||
|
||||
function PUIU_showMinimalAddBookmarkUI(aURI, aTitle, aDescription,
|
||||
aDefaultInsertionPoint, aShowPicker,
|
||||
aLoadInSidebar, aKeyword, aPostData,
|
||||
aCharSet) {
|
||||
var info = {
|
||||
action: "add",
|
||||
type: "bookmark",
|
||||
@ -414,11 +459,30 @@ var PlacesUIUtils = {
|
||||
else
|
||||
info.hiddenRows.push("keyword");
|
||||
|
||||
return this.showBookmarkDialog(info);
|
||||
return this._showBookmarkDialog(info, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
|
||||
* Shows the "Add Live Bookmark" dialog.
|
||||
*
|
||||
* @param [optional] aFeedURI
|
||||
* The feed URI for which the dialog is to be shown (nsIURI).
|
||||
* @param [optional] aSiteURI
|
||||
* The site URI for the new live-bookmark (nsIURI).
|
||||
* @param [optional] aDefaultInsertionPoint
|
||||
* The default insertion point for the new item. If set, the folder
|
||||
* picker would be hidden unless aShowPicker is set to true, in which
|
||||
* case the dialog only uses the folder identifier from the insertion
|
||||
* point as the initially selected item in the folder picker.
|
||||
* @param [optional] aShowPicker
|
||||
* see above
|
||||
* @return true if any transaction has been performed.
|
||||
*
|
||||
* Notes:
|
||||
* - the feedURI and description fields are visible only if there is no
|
||||
* initial feed URI (aFeedURI is null).
|
||||
* - When aDefaultInsertionPoint is not set, the dialog defaults to the
|
||||
* bookmarks root folder.
|
||||
*/
|
||||
showAddLivemarkUI: function PUIU_showAddLivemarkURI(aFeedURI,
|
||||
aSiteURI,
|
||||
@ -426,8 +490,6 @@ var PlacesUIUtils = {
|
||||
aDescription,
|
||||
aDefaultInsertionPoint,
|
||||
aShowPicker) {
|
||||
this._reportDeprecatedAddBookmarkMethod();
|
||||
|
||||
var info = {
|
||||
action: "add",
|
||||
type: "livemark"
|
||||
@ -450,19 +512,21 @@ var PlacesUIUtils = {
|
||||
if (!aShowPicker)
|
||||
info.hiddenRows = ["folderPicker"];
|
||||
}
|
||||
return this.showBookmarkDialog(info);
|
||||
return this._showBookmarkDialog(info);
|
||||
},
|
||||
|
||||
/**
|
||||
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
|
||||
* @see showAddLivemarkUI
|
||||
* This opens the dialog with only the name and folder pickers visible by
|
||||
* default.
|
||||
*
|
||||
* You can still pass in the various paramaters as the default properties
|
||||
* for the new live-bookmark.
|
||||
*/
|
||||
showMinimalAddLivemarkUI:
|
||||
function PUIU_showMinimalAddLivemarkURI(
|
||||
aFeedURI, aSiteURI, aTitle, aDescription, aDefaultInsertionPoint,
|
||||
aShowPicker) {
|
||||
|
||||
this._reportDeprecatedAddBookmarkMethod();
|
||||
|
||||
function PUIU_showMinimalAddLivemarkURI(aFeedURI, aSiteURI, aTitle,
|
||||
aDescription, aDefaultInsertionPoint,
|
||||
aShowPicker) {
|
||||
var info = {
|
||||
action: "add",
|
||||
type: "livemark",
|
||||
@ -486,15 +550,19 @@ var PlacesUIUtils = {
|
||||
if (!aShowPicker)
|
||||
info.hiddenRows.push("folderPicker");
|
||||
}
|
||||
return this.showBookmarkDialog(info);
|
||||
return this._showBookmarkDialog(info, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
|
||||
* Show an "Add Bookmarks" dialog to allow the adding of a folder full
|
||||
* of bookmarks corresponding to the objects in the uriList. This will
|
||||
* be called most often as the result of a "Bookmark All Tabs..." command.
|
||||
*
|
||||
* @param aURIList List of nsIURI objects representing the locations
|
||||
* to be bookmarked.
|
||||
* @return true if any transaction has been performed.
|
||||
*/
|
||||
showMinimalAddMultiBookmarkUI: function PUIU_showAddMultiBookmarkUI(aURIList) {
|
||||
this._reportDeprecatedAddBookmarkMethod();
|
||||
|
||||
if (aURIList.length == 0)
|
||||
throw("showAddMultiBookmarkUI expects a list of nsIURI objects");
|
||||
var info = {
|
||||
@ -503,31 +571,46 @@ var PlacesUIUtils = {
|
||||
hiddenRows: ["description"],
|
||||
URIList: aURIList
|
||||
};
|
||||
return this.showBookmarkDialog(info);
|
||||
return this._showBookmarkDialog(info, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
|
||||
* Opens the properties dialog for a given item identifier.
|
||||
*
|
||||
* @param aItemId
|
||||
* 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 PUIU_showItemProperties(aItemId, aType, aReadOnly) {
|
||||
this._reportDeprecatedAddBookmarkMethod();
|
||||
|
||||
var info = {
|
||||
action: "edit",
|
||||
type: aType,
|
||||
itemId: aItemId,
|
||||
readOnly: aReadOnly
|
||||
};
|
||||
return this.showBookmarkDialog(info);
|
||||
return this._showBookmarkDialog(info);
|
||||
},
|
||||
|
||||
/**
|
||||
* This is here for compatibility reasons, use ShowBookmarkDialog instead.
|
||||
* Shows the "New Folder" dialog.
|
||||
*
|
||||
* @param [optional] aTitle
|
||||
* The default title for the new bookmark.
|
||||
* @param [optional] aDefaultInsertionPoint
|
||||
* The default insertion point for the new item. If set, the folder
|
||||
* picker would be hidden unless aShowPicker is set to true, in which
|
||||
* case the dialog only uses the folder identifier from the insertion
|
||||
* point as the initially selected item in the folder picker.
|
||||
* @param [optional] aShowPicker
|
||||
* see above
|
||||
* @return true if any transaction has been performed.
|
||||
*/
|
||||
showAddFolderUI:
|
||||
function PUIU_showAddFolderUI(aTitle, aDefaultInsertionPoint, aShowPicker) {
|
||||
this._reportDeprecatedAddBookmarkMethod();
|
||||
|
||||
var info = {
|
||||
action: "add",
|
||||
type: "folder",
|
||||
@ -543,40 +626,32 @@ var PlacesUIUtils = {
|
||||
if (!aShowPicker)
|
||||
info.hiddenRows.push("folderPicker");
|
||||
}
|
||||
return this.showBookmarkDialog(info);
|
||||
return this._showBookmarkDialog(info);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Shows the bookmark dialog corresponding to the specified info.
|
||||
* Shows the bookmark dialog corresponding to the specified info
|
||||
*
|
||||
* @param aInfo
|
||||
* Describes the item to be edited/added in the dialog.
|
||||
* See documentation at the top of bookmarkProperties.js
|
||||
* @param aWindow
|
||||
* Owner window for the new dialog.
|
||||
* @param aMinimalUI
|
||||
* [optional] if true, the dialog is opened by its alternative
|
||||
* chrome: uri.
|
||||
*
|
||||
* @see documentation at the top of bookmarkProperties.js
|
||||
* @return true if any transaction has been performed, false otherwise.
|
||||
*/
|
||||
showBookmarkDialog:
|
||||
function PUIU_showBookmarkDialog(aInfo, aParentWindow) {
|
||||
if (!aParentWindow) {
|
||||
aParentWindow = this._getWindow(null);
|
||||
}
|
||||
|
||||
// Preserve size attributes differently based on the fact the dialog has
|
||||
// a folder picker or not.
|
||||
let minimalUI = "hiddenRows" in aInfo &&
|
||||
aInfo.hiddenRows.indexOf("folderPicker") != -1;
|
||||
let dialogURL = minimalUI ?
|
||||
_showBookmarkDialog: function PUIU__showBookmarkDialog(aInfo, aMinimalUI) {
|
||||
var dialogURL = aMinimalUI ?
|
||||
"chrome://browser/content/places/bookmarkProperties2.xul" :
|
||||
"chrome://browser/content/places/bookmarkProperties.xul";
|
||||
|
||||
let features =
|
||||
"centerscreen,chrome,modal,resizable=" + (minimalUI ? "yes" : "no");
|
||||
|
||||
aParentWindow.openDialog(dialogURL, "", features, aInfo);
|
||||
var features;
|
||||
if (aMinimalUI)
|
||||
features = "centerscreen,chrome,modal,resizable=yes";
|
||||
else
|
||||
features = "centerscreen,chrome,modal,resizable=no";
|
||||
this._getCurrentActiveWin().openDialog(dialogURL, "", features, aInfo);
|
||||
return ("performed" in aInfo && aInfo.performed);
|
||||
},
|
||||
|
||||
@ -584,6 +659,10 @@ var PlacesUIUtils = {
|
||||
return Services.wm.getMostRecentWindow("navigator:browser");
|
||||
},
|
||||
|
||||
_getCurrentActiveWin: function PUIU__getCurrentActiveWin() {
|
||||
return focusManager.activeWindow;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the closet ancestor places view for the given DOM node
|
||||
* @param aNode
|
||||
@ -710,8 +789,7 @@ var PlacesUIUtils = {
|
||||
/**
|
||||
* Gives the user a chance to cancel loading lots of tabs at once
|
||||
*/
|
||||
_confirmOpenInTabs:
|
||||
function PUIU__confirmOpenInTabs(numTabsToOpen, aWindow) {
|
||||
_confirmOpenInTabs: function PUIU__confirmOpenInTabs(numTabsToOpen) {
|
||||
const WARN_ON_OPEN_PREF = "browser.tabs.warnOnOpen";
|
||||
var reallyOpen = true;
|
||||
|
||||
@ -729,7 +807,7 @@ var PlacesUIUtils = {
|
||||
GetStringFromName("brandShortName");
|
||||
|
||||
var buttonPressed = Services.prompt.confirmEx(
|
||||
aWindow,
|
||||
this._getCurrentActiveWin(),
|
||||
this.getString("tabs.openWarningTitle"),
|
||||
this.getFormattedString(messageKey, [numTabsToOpen, brandShortName]),
|
||||
(Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
|
||||
@ -753,7 +831,7 @@ var PlacesUIUtils = {
|
||||
/** aItemsToOpen needs to be an array of objects of the form:
|
||||
* {uri: string, isBookmark: boolean}
|
||||
*/
|
||||
_openTabset: function PUIU__openTabset(aItemsToOpen, aEvent, aWindow) {
|
||||
_openTabset: function PUIU__openTabset(aItemsToOpen, aEvent) {
|
||||
if (!aItemsToOpen.length)
|
||||
return;
|
||||
|
||||
@ -768,75 +846,37 @@ var PlacesUIUtils = {
|
||||
urls.push(item.uri);
|
||||
}
|
||||
|
||||
var where = aWindow.whereToOpenLink(aEvent, false, true);
|
||||
var browserWindow = this._getTopBrowserWin();
|
||||
var where = browserWindow ?
|
||||
browserWindow.whereToOpenLink(aEvent, false, true) : "window";
|
||||
if (where == "window") {
|
||||
aWindow.openDialog(win.getBrowserURL(), "_blank",
|
||||
"chrome,all,dialog=no", urls.join("|"));
|
||||
let win = this._getCurrentActiveWin();
|
||||
win.openDialog(win.getBrowserURL(), "_blank",
|
||||
"chrome,all,dialog=no", urls.join("|"));
|
||||
return;
|
||||
}
|
||||
|
||||
var loadInBackground = where == "tabshifted" ? true : false;
|
||||
var replaceCurrentTab = where == "tab" ? false : true;
|
||||
var browserWindow = this._getTopBrowserWin();
|
||||
browserWindow.gBrowser.loadTabs(urls, loadInBackground, replaceCurrentTab);
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper method for methods which are forced to take a view/window
|
||||
* parameter as an optional parameter. It will be removed post Fx4.
|
||||
*/
|
||||
_getWindow: function PUIU__getWindow(aView) {
|
||||
if (aView) {
|
||||
// Pratically, this is the case for places trees.
|
||||
if (aView instanceof Components.interfaces.nsIDOMNode)
|
||||
return aView.ownerDocument.defaultView;
|
||||
|
||||
return Cu.getGlobalForObject(aView);
|
||||
}
|
||||
|
||||
let caller = arguments.callee.caller;
|
||||
|
||||
// If a view wasn't expected, the method should have got a window.
|
||||
if (aView === null) {
|
||||
Components.utils.reportError("The api has changed. A window should be \
|
||||
passed to " + caller.name + ". Not \
|
||||
passing a window will throw in a future \
|
||||
release.");
|
||||
}
|
||||
else {
|
||||
Components.utils.reportError("The api has changed. A places view \
|
||||
should be passed to " + caller.name + ". \
|
||||
Not passing a view will throw in a future \
|
||||
release.");
|
||||
}
|
||||
|
||||
// This could certainly break in some edge cases (like bug 562998), but
|
||||
// that's the best we should do for those extreme backwards-compatibility cases.
|
||||
let topBrowserWin = this._getTopBrowserWin();
|
||||
return topBrowserWin ? topBrowserWin : focusManager.focusedWindow;
|
||||
},
|
||||
|
||||
openContainerNodeInTabs:
|
||||
function PUIU_openContainerInTabs(aNode, aEvent, aView) {
|
||||
let window = this._getWindow(aView);
|
||||
|
||||
let urlsToOpen = PlacesUtils.getURLsForContainerNode(aNode);
|
||||
if (!this._confirmOpenInTabs(urlsToOpen.length, window))
|
||||
openContainerNodeInTabs: function PUIU_openContainerInTabs(aNode, aEvent) {
|
||||
var urlsToOpen = PlacesUtils.getURLsForContainerNode(aNode);
|
||||
if (!this._confirmOpenInTabs(urlsToOpen.length))
|
||||
return;
|
||||
|
||||
this._openTabset(urlsToOpen, aEvent, window);
|
||||
this._openTabset(urlsToOpen, aEvent);
|
||||
},
|
||||
|
||||
openURINodesInTabs: function PUIU_openURINodesInTabs(aNodes, aEvent, aView) {
|
||||
let window = this._getWindow(aView);
|
||||
|
||||
let urlsToOpen = [];
|
||||
openURINodesInTabs: function PUIU_openURINodesInTabs(aNodes, aEvent) {
|
||||
var urlsToOpen = [];
|
||||
for (var i=0; i < aNodes.length; i++) {
|
||||
// Skip over separators and folders.
|
||||
// skip over separators and folders
|
||||
if (PlacesUtils.nodeIsURI(aNodes[i]))
|
||||
urlsToOpen.push({uri: aNodes[i].uri, isBookmark: PlacesUtils.nodeIsBookmark(aNodes[i])});
|
||||
}
|
||||
this._openTabset(urlsToOpen, aEvent, window);
|
||||
this._openTabset(urlsToOpen, aEvent);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -848,13 +888,9 @@ var PlacesUIUtils = {
|
||||
* @param aEvent
|
||||
* The DOM mouse/key event with modifier keys set that track the
|
||||
* user's preferred destination window or tab.
|
||||
* @param aView
|
||||
* The controller associated with aNode.
|
||||
*/
|
||||
openNodeWithEvent:
|
||||
function PUIU_openNodeWithEvent(aNode, aEvent, aView) {
|
||||
let window = this._getWindow(aView);
|
||||
this._openNodeIn(aNode, window.whereToOpenLink(aEvent), window);
|
||||
openNodeWithEvent: function PUIU_openNodeWithEvent(aNode, aEvent) {
|
||||
this.openNodeIn(aNode, this._getCurrentActiveWin().whereToOpenLink(aEvent));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -862,15 +898,10 @@ var PlacesUIUtils = {
|
||||
* web panel.
|
||||
* see also openUILinkIn
|
||||
*/
|
||||
openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aView) {
|
||||
let window = this._getWindow(aView);
|
||||
this._openNodeIn(aNode, aWhere, window);
|
||||
},
|
||||
|
||||
_openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aWindow) {
|
||||
openNodeIn: function PUIU_openNodeIn(aNode, aWhere) {
|
||||
if (aNode && PlacesUtils.nodeIsURI(aNode) &&
|
||||
this.checkURLSecurity(aNode, aWindow)) {
|
||||
let isBookmark = PlacesUtils.nodeIsBookmark(aNode);
|
||||
this.checkURLSecurity(aNode, this._getCurrentActiveWin())) {
|
||||
var isBookmark = PlacesUtils.nodeIsBookmark(aNode);
|
||||
|
||||
if (isBookmark)
|
||||
this.markPageAsFollowedBookmark(aNode.uri);
|
||||
@ -882,14 +913,14 @@ var PlacesUIUtils = {
|
||||
if (aWhere == "current" && isBookmark) {
|
||||
if (PlacesUtils.annotations
|
||||
.itemHasAnnotation(aNode.itemId, this.LOAD_IN_SIDEBAR_ANNO)) {
|
||||
let browserWin = this._getTopBrowserWin();
|
||||
var browserWin = this._getTopBrowserWin();
|
||||
if (browserWin) {
|
||||
browserWin.openWebPanel(aNode.title, aNode.uri);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
aWindow.openUILinkIn(aNode.uri, aWhere);
|
||||
this._getCurrentActiveWin().openUILinkIn(aNode.uri, aWhere);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -104,10 +104,8 @@ function (aTitle, aContentURL, aCustomizeURL, aPersist)
|
||||
{
|
||||
var WINMEDSVC = Components.classes['@mozilla.org/appshell/window-mediator;1']
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
|
||||
// XXX Bug 620418: We shouldn't do this anymore. Instead, we should find the
|
||||
// global object for our caller and use it.
|
||||
var win = WINMEDSVC.getMostRecentWindow( "navigator:browser" );
|
||||
|
||||
if (!sidebarURLSecurityCheck(aContentURL))
|
||||
return;
|
||||
|
||||
@ -119,16 +117,7 @@ function (aTitle, aContentURL, aCustomizeURL, aPersist)
|
||||
}
|
||||
catch(ex) { return; }
|
||||
|
||||
win.PlacesUIUtils.showBookmarkDialog({ action: "add"
|
||||
, type: "bookmark"
|
||||
, hiddenRows: [ "description"
|
||||
, "keyword"
|
||||
, "location"
|
||||
, "loadInSidebar" ]
|
||||
, uri: uri
|
||||
, title: aTitle
|
||||
, loadBookmarkInSidebar: true
|
||||
}, win);
|
||||
win.PlacesUIUtils.showMinimalAddBookmarkUI(uri, aTitle, null, null, true, true);
|
||||
}
|
||||
|
||||
nsSidebar.prototype.validateSearchEngine =
|
||||
|
Loading…
Reference in New Issue
Block a user