2005-11-27 06:47:54 +00:00
|
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
2006-04-13 22:49:02 +00:00
|
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
|
#
|
|
|
|
|
# The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
|
# http://www.mozilla.org/MPL/
|
|
|
|
|
#
|
|
|
|
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
# for the specific language governing rights and limitations under the
|
|
|
|
|
# License.
|
|
|
|
|
#
|
|
|
|
|
# The Original Code is the Places Toolbar View.
|
|
|
|
|
#
|
|
|
|
|
# The Initial Developer of the Original Code is Google Inc.
|
|
|
|
|
# Portions created by the Initial Developer are Copyright (C) 2005-2006
|
|
|
|
|
# the Initial Developer. All Rights Reserved.
|
|
|
|
|
#
|
|
|
|
|
# Contributor(s):
|
|
|
|
|
# Annie Sullivan <annie.sullivan@gmail.com>
|
|
|
|
|
# Ben Goodger <beng@google.com>
|
2006-05-05 22:45:37 +00:00
|
|
|
|
# Myk Melez <myk@mozilla.org>
|
2006-04-13 22:49:02 +00:00
|
|
|
|
#
|
|
|
|
|
# Alternatively, the contents of this file may be used under the terms of
|
|
|
|
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
|
# of those above. If you wish to allow use of your version of this file only
|
|
|
|
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
|
# use your version of this file under the terms of the MPL, indicate your
|
|
|
|
|
# decision by deleting the provisions above and replace them with the notice
|
|
|
|
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
|
# the provisions above, a recipient may use your version of this file under
|
|
|
|
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
|
#
|
|
|
|
|
# ***** END LICENSE BLOCK *****
|
|
|
|
|
|
|
|
|
|
|
2006-03-01 19:44:37 +00:00
|
|
|
|
<!DOCTYPE bindings [
|
|
|
|
|
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd" >
|
|
|
|
|
%browserDTD;
|
|
|
|
|
]>
|
|
|
|
|
|
2005-11-28 23:24:56 +00:00
|
|
|
|
<bindings id="placesToolbarBindings"
|
2005-11-27 06:47:54 +00:00
|
|
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
|
|
|
xmlns:xbl="http://www.mozilla.org/xbl"
|
|
|
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
|
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
|
|
|
|
|
<binding id="places-bar">
|
2006-02-17 18:31:06 +00:00
|
|
|
|
<resources>
|
|
|
|
|
<stylesheet src="chrome://browser/skin/places/places.css"/>
|
|
|
|
|
</resources>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
<content>
|
|
|
|
|
<xul:vbox>
|
|
|
|
|
<xul:hbox class="toolbar-drop-indicator-bar">
|
|
|
|
|
<xul:hbox class="toolbar-drop-indicator"/>
|
|
|
|
|
</xul:hbox>
|
|
|
|
|
<xul:hbox flex="1">
|
2006-03-01 19:44:37 +00:00
|
|
|
|
<xul:hbox class="bookmarks-toolbar-items places-toolbar-items" flex="1">
|
|
|
|
|
<children/>
|
|
|
|
|
</xul:hbox>
|
|
|
|
|
<xul:toolbarbutton class="bookmark-item bookmarks-toolbar-customize"
|
|
|
|
|
mousethrough="never"
|
|
|
|
|
label="&bookmarksToolbarItem.label;"/>
|
2006-02-17 18:31:06 +00:00
|
|
|
|
</xul:hbox>
|
|
|
|
|
</xul:vbox>
|
2007-07-11 19:59:14 +00:00
|
|
|
|
<xul:hbox mousethrough="always"
|
|
|
|
|
flex="1"
|
|
|
|
|
pack="end">
|
|
|
|
|
<xul:toolbarbutton type="menu"
|
|
|
|
|
class="chevron"
|
|
|
|
|
mousethrough="never"
|
2007-10-25 02:02:28 +00:00
|
|
|
|
collapsed="true"
|
|
|
|
|
onpopupshowing="chevronPopupShowing(event);">
|
|
|
|
|
<xul:menupopup anonid="chevronPopup"
|
2007-07-11 19:59:14 +00:00
|
|
|
|
#ifndef XP_MACOSX
|
|
|
|
|
context="placesContext"
|
|
|
|
|
#endif
|
|
|
|
|
/>
|
|
|
|
|
</xul:toolbarbutton>
|
|
|
|
|
</xul:hbox>
|
2006-02-17 18:31:06 +00:00
|
|
|
|
</content>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2006-12-28 22:56:59 +00:00
|
|
|
|
<implementation>
|
2006-03-07 16:10:37 +00:00
|
|
|
|
<constructor><![CDATA[
|
2007-10-25 02:02:28 +00:00
|
|
|
|
this._init();
|
2006-02-16 05:24:26 +00:00
|
|
|
|
]]></constructor>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
|
|
|
|
<destructor><![CDATA[
|
|
|
|
|
if (this._result) {
|
|
|
|
|
this._result.viewer = null;
|
|
|
|
|
this._result = null;
|
|
|
|
|
}
|
2006-02-16 05:24:26 +00:00
|
|
|
|
]]></destructor>
|
2006-12-22 00:00:21 +00:00
|
|
|
|
|
|
|
|
|
<property name="controller"
|
|
|
|
|
readonly="true"
|
|
|
|
|
onget="return this._controller;"/>
|
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<method name="_init">
|
2006-02-16 05:24:26 +00:00
|
|
|
|
<body><![CDATA[
|
2006-12-22 00:00:21 +00:00
|
|
|
|
this._controller = new PlacesController(this);
|
2006-12-28 22:56:59 +00:00
|
|
|
|
this.controllers.appendController(this._controller);
|
2006-12-22 00:00:21 +00:00
|
|
|
|
|
2005-12-01 22:56:45 +00:00
|
|
|
|
var t = this;
|
|
|
|
|
window.addEventListener("resize",
|
|
|
|
|
function f(e) { t.updateChevron(e); },
|
|
|
|
|
false);
|
2006-04-10 20:56:25 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
if (this.hasAttribute("place")) {
|
|
|
|
|
// Do the initial build.
|
|
|
|
|
this.place = this.place;
|
|
|
|
|
}
|
2005-11-27 21:25:13 +00:00
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2006-02-17 18:31:06 +00:00
|
|
|
|
|
2006-03-01 19:44:37 +00:00
|
|
|
|
<field name="_dropIndicatorBar">document.getAnonymousElementByAttribute(this, "class", "toolbar-drop-indicator-bar")</field>
|
|
|
|
|
<field name="_chevron">document.getAnonymousElementByAttribute(this, "class", "chevron")</field>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2005-12-02 17:10:51 +00:00
|
|
|
|
<field name="_openedMenuButton">null</field>
|
2007-10-11 06:42:38 +00:00
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
<field name="_result">null</field>
|
2007-10-11 06:42:38 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
2005-11-27 06:47:54 +00:00
|
|
|
|
<method name="getResult">
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
return this._result;
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2007-01-09 22:48:50 +00:00
|
|
|
|
|
|
|
|
|
<!-- nsIPlacesView -->
|
|
|
|
|
<method name="getResultNode">
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
return this._result.root;
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
|
|
|
|
|
2005-11-27 06:47:54 +00:00
|
|
|
|
<method name="_rebuild">
|
2006-02-01 02:13:34 +00:00
|
|
|
|
<body><![CDATA[
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// Clear out references to existing nodes, since we'll be deleting and re-adding.
|
|
|
|
|
if (this._DNDObserver._overFolder.node)
|
|
|
|
|
this._DNDObserver._clearOverFolder();
|
|
|
|
|
this._openedMenuButton = null;
|
2007-05-03 12:26:27 +00:00
|
|
|
|
|
2005-11-27 06:47:54 +00:00
|
|
|
|
while (this.hasChildNodes())
|
|
|
|
|
this.removeChild(this.firstChild);
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
|
|
|
|
var rootNode = this._result.root;
|
|
|
|
|
var cc = rootNode.childCount;
|
2007-05-03 12:26:27 +00:00
|
|
|
|
for (var i = 0; i < cc; ++i)
|
2007-10-25 02:02:28 +00:00
|
|
|
|
this.insertNewItem(rootNode.getChild(i), null);
|
2007-05-03 12:26:27 +00:00
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var chevronPopup = this._chevron.lastChild;
|
|
|
|
|
if (chevronPopup.hasAttribute("type")) {
|
|
|
|
|
// Otherwise we'll set it when the chevron is enabled (see updateChevron)
|
|
|
|
|
chevronPopup.place = this.place;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (chevronPopup.hasChildNodes())
|
|
|
|
|
chevronPopup.removeChild(chevronPopup.lastChild);
|
2005-12-01 22:56:45 +00:00
|
|
|
|
|
2007-02-13 13:52:03 +00:00
|
|
|
|
// This needs to be in a timeout to make sure our boxObject has time
|
|
|
|
|
// to get its proper size
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var t = this;
|
2007-06-16 01:53:06 +00:00
|
|
|
|
setTimeout(function() { t.updateChevron(); }, 0);
|
2005-12-01 22:56:45 +00:00
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2007-05-03 12:26:27 +00:00
|
|
|
|
|
|
|
|
|
<method name="insertNewItem">
|
2007-10-25 02:02:28 +00:00
|
|
|
|
<parameter name="aChild"/>
|
|
|
|
|
<parameter name="aBefore"/>
|
2007-05-03 12:26:27 +00:00
|
|
|
|
<body><![CDATA[
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var type = aChild.type;
|
|
|
|
|
var button;
|
|
|
|
|
if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
|
|
|
|
|
button = document.createElement("toolbarseparator");
|
|
|
|
|
else {
|
|
|
|
|
button = document.createElement("toolbarbutton");
|
|
|
|
|
button.className = "bookmark-item";
|
|
|
|
|
button.setAttribute("label", aChild.title);
|
|
|
|
|
var iconURI = aChild.icon;
|
|
|
|
|
var iconURISpec = "";
|
|
|
|
|
if (iconURI) {
|
|
|
|
|
iconURISpec = iconURI.spec;
|
|
|
|
|
button.setAttribute("image", iconURISpec);
|
2007-05-03 12:26:27 +00:00
|
|
|
|
}
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
|
|
|
|
if (PlacesUtils.containerTypes.indexOf(type) != -1) {
|
|
|
|
|
button.setAttribute("type", "menu");
|
|
|
|
|
button.setAttribute("container", "true");
|
2007-11-20 02:01:53 +00:00
|
|
|
|
if (PlacesUtils.nodeIsLivemarkContainer(aChild))
|
2007-10-25 02:02:28 +00:00
|
|
|
|
button.setAttribute("livemark", "true");
|
|
|
|
|
|
|
|
|
|
var popup = document.createElement("menupopup");
|
2008-02-21 02:17:52 +00:00
|
|
|
|
popup.setAttribute("placespopup", "true");
|
2007-10-25 02:02:28 +00:00
|
|
|
|
button.appendChild(popup);
|
|
|
|
|
popup._result = this._result;
|
|
|
|
|
popup._resultNode = asContainer(aChild);
|
2007-05-03 12:26:27 +00:00
|
|
|
|
#ifndef XP_MACOSX
|
2007-10-25 02:02:28 +00:00
|
|
|
|
popup.setAttribute("context", "placesContext");
|
2007-05-03 12:26:27 +00:00
|
|
|
|
#endif
|
2007-10-25 02:02:28 +00:00
|
|
|
|
this._containerNodesMap.push({ resultNode: aChild,
|
|
|
|
|
domNode: popup });
|
|
|
|
|
}
|
2007-05-03 12:26:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
button.node = aChild;
|
2007-09-22 22:54:42 +00:00
|
|
|
|
button.node.viewIndex = 0;
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (aBefore)
|
|
|
|
|
this.insertBefore(button, aBefore);
|
2007-05-03 12:26:27 +00:00
|
|
|
|
else
|
|
|
|
|
this.appendChild(button);
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
|
|
|
|
|
|
|
|
|
<method name="removeItem">
|
|
|
|
|
<parameter name="child"/>
|
|
|
|
|
<body><![CDATA[
|
2007-06-16 01:53:06 +00:00
|
|
|
|
if (PlacesUtils.nodeIsContainer(child.node)) {
|
|
|
|
|
for (var i=0; i < this._containerNodesMap.length; i++) {
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (this._containerNodesMap[i].resultNode == child.node) {
|
2007-06-16 01:53:06 +00:00
|
|
|
|
this._containerNodesMap.splice(i, 1);
|
2007-10-25 02:02:28 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2007-06-16 01:53:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-25 21:45:22 +00:00
|
|
|
|
// if document.popupNode pointed to this child, null it out,
|
|
|
|
|
// otherwise controller's command-updating may rely on the removed
|
|
|
|
|
// item still being "selected".
|
|
|
|
|
if (document.popupNode == child)
|
|
|
|
|
document.popupNode = null;
|
2007-10-25 02:02:28 +00:00
|
|
|
|
child.parentNode.removeChild(child);
|
2007-05-03 12:26:27 +00:00
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
|
|
|
|
|
2005-12-01 22:56:45 +00:00
|
|
|
|
<method name="chevronPopupShowing">
|
2007-10-25 02:02:28 +00:00
|
|
|
|
<parameter name="aEvent"/>
|
2005-12-01 22:56:45 +00:00
|
|
|
|
<body><![CDATA[
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var popup = aEvent.target;
|
|
|
|
|
if (popup != this._chevron.firstChild)
|
|
|
|
|
return;
|
|
|
|
|
|
2007-06-16 01:53:06 +00:00
|
|
|
|
for (var i = 0; i < popup.childNodes.length; i++)
|
|
|
|
|
popup.childNodes[i].hidden = !this.childNodes[i].collapsed;
|
2005-12-01 22:56:45 +00:00
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2007-05-03 12:26:27 +00:00
|
|
|
|
|
2005-12-01 22:56:45 +00:00
|
|
|
|
<method name="getElementWidth">
|
|
|
|
|
<parameter name="element"/>
|
|
|
|
|
<body><![CDATA[
|
2006-02-17 18:31:06 +00:00
|
|
|
|
var style = document.defaultView.getComputedStyle(element, "");
|
2005-12-01 22:56:45 +00:00
|
|
|
|
var leftMargin = style.getPropertyValue("margin-left");
|
|
|
|
|
leftMargin = leftMargin ? Math.round(parseFloat(leftMargin)) : 0;
|
|
|
|
|
var rightMargin = style.getPropertyValue("margin-right");
|
|
|
|
|
rightMargin = rightMargin ? Math.round(parseFloat(rightMargin)) : 0;
|
|
|
|
|
return element.boxObject.width + leftMargin + rightMargin;
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2005-12-01 22:56:45 +00:00
|
|
|
|
<method name="updateChevron">
|
|
|
|
|
<parameter name="event"/>
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
// Ignore events that aren't on the document or the window
|
|
|
|
|
// (html document, tooltips, etc)
|
2007-03-06 19:41:15 +00:00
|
|
|
|
// Do not ignore content window resizes, because they may
|
|
|
|
|
// be the result of the toolbar being shown/hidden
|
|
|
|
|
if (event && event.target != document && event.target != window &&
|
|
|
|
|
event.target != content)
|
2005-12-01 22:56:45 +00:00
|
|
|
|
return;
|
2007-03-06 19:41:15 +00:00
|
|
|
|
|
2007-06-27 01:13:28 +00:00
|
|
|
|
if (this.childNodes.length == 0) {
|
|
|
|
|
this._chevron.collapsed = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-25 06:11:02 +00:00
|
|
|
|
var spaceLeft = this.boxObject.width;
|
2007-03-06 19:41:15 +00:00
|
|
|
|
this._chevron.collapsed = false;
|
|
|
|
|
var chevronWidth = this._chevron.boxObject.width;
|
2005-12-01 22:56:45 +00:00
|
|
|
|
var overflowed = false;
|
2006-02-17 18:31:06 +00:00
|
|
|
|
for (var i = 0; i < this.childNodes.length; i++) {
|
2005-12-01 22:56:45 +00:00
|
|
|
|
var child = this.childNodes[i];
|
|
|
|
|
child.collapsed = false;
|
|
|
|
|
spaceLeft -= this.getElementWidth(child);
|
2006-02-17 18:31:06 +00:00
|
|
|
|
var spaceNeeded = (i == this.childNodes.length - 1) ? 0 : chevronWidth;
|
2005-12-01 22:56:45 +00:00
|
|
|
|
if (spaceLeft < spaceNeeded) {
|
|
|
|
|
overflowed = true;
|
|
|
|
|
child.collapsed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (!(this._chevron.collapsed = !overflowed)) {
|
|
|
|
|
// Attach the popup binding to the chevron popup
|
|
|
|
|
var popup = this._chevron.firstChild;
|
|
|
|
|
if (!popup.hasAttribute("type")) {
|
|
|
|
|
popup.setAttribute("place", this.place);
|
|
|
|
|
popup.setAttribute("type", "places");
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-11-27 06:47:54 +00:00
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
|
|
|
|
<property name="place">
|
|
|
|
|
<getter><![CDATA[
|
|
|
|
|
return this.getAttribute("place");
|
|
|
|
|
]]></getter>
|
|
|
|
|
<setter><![CDATA[
|
|
|
|
|
this.setAttribute("place", val);
|
2006-12-22 00:00:21 +00:00
|
|
|
|
|
|
|
|
|
var history = PlacesUtils.history;
|
2006-03-17 02:01:06 +00:00
|
|
|
|
var queries = { }, options = { };
|
2006-12-22 00:00:21 +00:00
|
|
|
|
history.queryStringToQueries(val, queries, { }, options);
|
2006-03-17 02:01:06 +00:00
|
|
|
|
if (!queries.value.length)
|
2006-12-22 00:00:21 +00:00
|
|
|
|
queries.value = [history.getNewQuery()];
|
2007-03-07 21:22:54 +00:00
|
|
|
|
try {
|
2008-01-29 20:04:43 +00:00
|
|
|
|
var result =
|
2007-03-07 21:22:54 +00:00
|
|
|
|
history.executeQueries(queries.value, queries.value.length,
|
|
|
|
|
options.value);
|
2008-01-29 20:04:43 +00:00
|
|
|
|
result.viewer = this._viewer;
|
2007-03-07 21:22:54 +00:00
|
|
|
|
}
|
|
|
|
|
catch(ex) {
|
|
|
|
|
// Invalid query, or had no results.
|
|
|
|
|
// This is valid, eg: user deletes their bookmarks toolbar folder.
|
|
|
|
|
}
|
2006-03-17 02:01:06 +00:00
|
|
|
|
return val;
|
|
|
|
|
]]></setter>
|
2006-01-20 17:03:45 +00:00
|
|
|
|
</property>
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
2005-11-27 06:47:54 +00:00
|
|
|
|
<property name="hasSelection">
|
|
|
|
|
<getter><![CDATA[
|
2008-02-25 21:45:22 +00:00
|
|
|
|
return this.selectedNode != null;
|
2005-11-27 06:47:54 +00:00
|
|
|
|
]]></getter>
|
|
|
|
|
</property>
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
2005-11-27 06:47:54 +00:00
|
|
|
|
<method name="getSelectionNodes">
|
|
|
|
|
<body><![CDATA[
|
2008-02-25 21:45:22 +00:00
|
|
|
|
var selectedNode = this.selectedNode;
|
|
|
|
|
return selectedNode ? [selectedNode] : [];
|
2005-11-27 06:47:54 +00:00
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
2006-01-31 18:00:06 +00:00
|
|
|
|
<method name="getRemovableSelectionRanges">
|
2008-02-25 21:45:22 +00:00
|
|
|
|
<body><![CDATA[
|
2006-01-31 18:00:06 +00:00
|
|
|
|
return [this.getSelectionNodes()];
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
2006-02-17 18:31:06 +00:00
|
|
|
|
<method name="getDragableSelection">
|
|
|
|
|
<body><![CDATA[
|
2008-02-25 21:45:22 +00:00
|
|
|
|
return [this._draggedNode];
|
2006-02-17 18:31:06 +00:00
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
2005-11-27 06:47:54 +00:00
|
|
|
|
<property name="selectedNode">
|
|
|
|
|
<getter><![CDATA[
|
2008-02-25 21:45:22 +00:00
|
|
|
|
if (this._contextMenuShown) {
|
|
|
|
|
var popupNode = document.popupNode;
|
|
|
|
|
return popupNode.node || popupNode.parentNode._resultNode || null;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
2005-11-27 06:47:54 +00:00
|
|
|
|
]]></getter>
|
|
|
|
|
</property>
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
2005-11-27 06:47:54 +00:00
|
|
|
|
<property name="insertionPoint">
|
2005-12-01 00:58:03 +00:00
|
|
|
|
<getter><![CDATA[
|
|
|
|
|
// By default, the insertion point is at the top level, at the end.
|
|
|
|
|
var index = -1;
|
2008-01-25 19:01:18 +00:00
|
|
|
|
var folderId = PlacesUtils.getConcreteItemId(this._result.root);
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2008-02-25 21:45:22 +00:00
|
|
|
|
var selectedNode = this.selectedNode;
|
|
|
|
|
if (selectedNode) {
|
|
|
|
|
if (PlacesUtils.nodeIsFolder(selectedNode)) {
|
2005-12-01 00:58:03 +00:00
|
|
|
|
// If there is a folder selected, the insertion point is the
|
|
|
|
|
// end of the folder.
|
2008-02-25 21:45:22 +00:00
|
|
|
|
folderId = PlacesUtils.getConcreteItemId(selectedNode);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2005-12-01 00:58:03 +00:00
|
|
|
|
// If there is another type of node selected, the insertion point
|
|
|
|
|
// is after that node.
|
2008-02-25 21:45:22 +00:00
|
|
|
|
folderId = PlacesUtils.getConcreteItemId(selectedNode.parent);
|
|
|
|
|
index = PlacesUtils.getIndexOfNode(selectedNode);
|
2006-01-27 18:30:51 +00:00
|
|
|
|
}
|
2005-12-01 00:58:03 +00:00
|
|
|
|
}
|
2008-02-25 21:45:22 +00:00
|
|
|
|
return new InsertionPoint(folderId, index, 1);
|
2005-11-27 06:47:54 +00:00
|
|
|
|
]]></getter>
|
|
|
|
|
</property>
|
2007-03-22 23:43:56 +00:00
|
|
|
|
|
2006-03-17 02:01:06 +00:00
|
|
|
|
<!-- nsIPlacesView -->
|
2005-11-27 06:47:54 +00:00
|
|
|
|
<method name="selectAll">
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
// Nothing
|
|
|
|
|
]]></body>
|
2008-02-21 19:50:22 +00:00
|
|
|
|
</method>
|
|
|
|
|
|
|
|
|
|
<method name="selectItems">
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
// Nothing
|
|
|
|
|
]]></body>
|
2005-11-27 06:47:54 +00:00
|
|
|
|
</method>
|
2007-05-30 16:17:34 +00:00
|
|
|
|
|
2007-05-03 12:26:27 +00:00
|
|
|
|
<!-- nsINavHistoryResultViewer -->
|
|
|
|
|
<field name="_viewer"><![CDATA[({
|
2005-11-27 21:25:13 +00:00
|
|
|
|
_self: this,
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
_getPopupForContainer:
|
|
|
|
|
function PMV__getPopupForContainer(aNode) {
|
|
|
|
|
if (this._self._resultNode == aNode)
|
|
|
|
|
return this._self;
|
|
|
|
|
|
2007-06-16 01:53:06 +00:00
|
|
|
|
for (var i=0; i < this._self._containerNodesMap.length; i++) {
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (this._self._containerNodesMap[i].resultNode == aNode)
|
|
|
|
|
return this._self._containerNodesMap[i].domNode;
|
2007-06-16 01:53:06 +00:00
|
|
|
|
}
|
2007-06-20 07:27:41 +00:00
|
|
|
|
throw("Container view not found");
|
2007-06-16 01:53:06 +00:00
|
|
|
|
},
|
|
|
|
|
|
2008-01-29 20:04:43 +00:00
|
|
|
|
get result() {
|
|
|
|
|
return this._self._result;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
set result(val) {
|
2008-02-20 02:08:25 +00:00
|
|
|
|
// some methods (e.g. getURLsFromContainer) temporarily null out the
|
|
|
|
|
// viewer when they do temporary changes to the view, this does _not_
|
|
|
|
|
// call setResult(null), but then, we're called again with the result
|
|
|
|
|
// object which is already set for this viewer. At that point,
|
|
|
|
|
// we should do nothing.
|
|
|
|
|
if (this._self._result != val) {
|
|
|
|
|
this._self._containerNodesMap = [];
|
|
|
|
|
this._self._result = val;
|
|
|
|
|
if (val) // this calls _rebuild through invalidateContainer
|
|
|
|
|
val.root.containerOpen = true;
|
|
|
|
|
}
|
2008-01-29 20:04:43 +00:00
|
|
|
|
return val;
|
|
|
|
|
},
|
|
|
|
|
|
2007-06-16 01:53:06 +00:00
|
|
|
|
itemInserted: function TV_V_itemInserted(aParentNode, aNode, aIndex) {
|
2007-05-27 19:28:40 +00:00
|
|
|
|
// don't insert new items into the toolbar
|
|
|
|
|
// if the parent is not the root
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (aParentNode == this._self.getResultNode()) {
|
2007-05-27 19:28:40 +00:00
|
|
|
|
var children = this._self.childNodes;
|
|
|
|
|
this._self.insertNewItem(aNode,
|
|
|
|
|
aIndex < children.length ? children[aIndex] : null);
|
|
|
|
|
this._self.updateChevron();
|
|
|
|
|
}
|
2007-06-16 01:53:06 +00:00
|
|
|
|
else {
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var popup = this._getPopupForContainer(aParentNode);
|
|
|
|
|
if (!popup._built)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var before = popup.childNodes[aIndex] || null;
|
|
|
|
|
this._self.insertNewItemToPopup(aNode, popup, before);
|
|
|
|
|
if (popup._emptyMenuItem)
|
|
|
|
|
popup._emptyMenuItem.hidden = true;
|
2007-06-16 01:53:06 +00:00
|
|
|
|
}
|
2005-11-27 21:25:13 +00:00
|
|
|
|
},
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
|
|
|
|
itemRemoved: function TV_V_itemRemoved(aParentNode, aNode, aIndex) {
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (aParentNode == this._self.getResultNode()) {
|
2007-06-16 01:53:06 +00:00
|
|
|
|
var children = this._self.childNodes;
|
|
|
|
|
for (var i = 0; i < children.length; i++) {
|
|
|
|
|
if (children[i].node == aNode) {
|
|
|
|
|
this._self.removeItem(children[i]);
|
|
|
|
|
this._self.updateChevron();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-05-25 06:11:02 +00:00
|
|
|
|
}
|
2006-05-05 22:45:37 +00:00
|
|
|
|
}
|
2007-10-25 02:02:28 +00:00
|
|
|
|
else {
|
|
|
|
|
var popup = this._getPopupForContainer(aParentNode);
|
|
|
|
|
if (!popup._built)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var children = popup.childNodes;
|
|
|
|
|
for (var i = 0; i < children.length; i++) {
|
|
|
|
|
if (children[i].node == aNode) {
|
|
|
|
|
this._self.removeItem(children[i]);
|
|
|
|
|
if (!popup.hasChildNodes() ||
|
|
|
|
|
(popup.childNodes.length == 1 &&
|
|
|
|
|
popup.firstChild == popup._emptyMenuItem)) {
|
|
|
|
|
this._self._showEmptyMenuItem(popup);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-11-27 21:25:13 +00:00
|
|
|
|
},
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2007-12-29 02:59:22 +00:00
|
|
|
|
itemMoved:
|
|
|
|
|
function TV_V_itemMoved(aItem, aOldParent, aOldIndex, aNewParent,
|
|
|
|
|
aNewIndex) {
|
|
|
|
|
// This cannot actually happen yet (see IDL)
|
2008-01-09 06:19:23 +00:00
|
|
|
|
if (aNewParent != aOldParent)
|
2007-12-29 02:59:22 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (aNewParent == this._self.getResultNode()) {
|
|
|
|
|
var children = this._self.childNodes;
|
|
|
|
|
for (var i = 0; i < children.length; i++) {
|
|
|
|
|
var button = children[i];
|
|
|
|
|
if (button.node == aItem) {
|
|
|
|
|
this._self.removeChild(button);
|
|
|
|
|
this._self.insertBefore(button, children[aNewIndex]);
|
|
|
|
|
this._self.updateChevron();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var popup = this._getPopupForContainer(aNewParent);
|
|
|
|
|
var children = popup.childNodes;
|
|
|
|
|
for (var i = 0; i < children.length; i++) {
|
|
|
|
|
var menuItem = children[i];
|
|
|
|
|
if (menuItem.node == aItem) {
|
|
|
|
|
popup.removeChild(menuItem);
|
|
|
|
|
popup.insertBefore(menuItem, children[aNewIndex]);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2007-06-16 01:53:06 +00:00
|
|
|
|
itemChanged: function TV_V_itemChanged(aNode) {
|
2007-05-30 16:17:34 +00:00
|
|
|
|
// this check can be removed once we fix bug #382397
|
2007-06-16 01:53:06 +00:00
|
|
|
|
var parentNode = aNode.parent;
|
|
|
|
|
if (!parentNode)
|
2007-05-30 16:17:34 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var element;
|
|
|
|
|
var onToolbar = false;
|
|
|
|
|
if (parentNode == this._self.getResultNode()) {
|
|
|
|
|
onToolbar = true;
|
|
|
|
|
var children = this._self.childNodes;
|
|
|
|
|
for (var i = 0; i < children.length; i++) {
|
|
|
|
|
if (children[i].node == aNode) {
|
|
|
|
|
element = children[i];
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-05-30 16:17:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-10-25 02:02:28 +00:00
|
|
|
|
else {
|
|
|
|
|
var popup = this._getPopupForContainer(parentNode);
|
|
|
|
|
if (!popup._built)
|
|
|
|
|
return;
|
2007-05-30 16:17:34 +00:00
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var children = popup.childNodes;
|
|
|
|
|
for (var i = 0; i < children.length; i++) {
|
|
|
|
|
if (children[i].node == aNode) {
|
|
|
|
|
element = children[i];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-05-30 16:17:34 +00:00
|
|
|
|
|
2007-07-26 03:31:40 +00:00
|
|
|
|
if (PlacesUtils.nodeIsSeparator(aNode)) {
|
2007-05-30 16:17:34 +00:00
|
|
|
|
// nothing to do when a separator changes
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var iconURI = aNode.icon;
|
2007-10-31 00:15:55 +00:00
|
|
|
|
if (iconURI) {
|
|
|
|
|
var spec = iconURI.spec;
|
|
|
|
|
if (element.getAttribute("image") != spec)
|
|
|
|
|
element.setAttribute("image", spec);
|
|
|
|
|
}
|
2007-05-30 16:17:34 +00:00
|
|
|
|
else
|
2007-10-25 02:02:28 +00:00
|
|
|
|
element.removeAttribute("image");
|
|
|
|
|
|
|
|
|
|
var title = aNode.title;
|
|
|
|
|
if (element.getAttribute("label") != title) {
|
|
|
|
|
element.setAttribute("label", title);
|
|
|
|
|
if (onToolbar)
|
|
|
|
|
this._self.updateChevron();
|
2007-05-30 16:17:34 +00:00
|
|
|
|
}
|
2007-11-20 02:01:53 +00:00
|
|
|
|
|
|
|
|
|
if (!element.hasAttribute("livemark") &&
|
|
|
|
|
PlacesUtils.nodeIsLivemarkContainer(aNode))
|
|
|
|
|
element.setAttribute("livemark", "true");
|
2005-12-21 01:00:39 +00:00
|
|
|
|
},
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
|
|
|
|
itemReplaced:
|
|
|
|
|
function TV_V_itemReplaced(aParentNode, aOldNode, aNewNode, aIndex) {
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (aParentNode == this._self.getResultNode()) {
|
2007-06-16 01:53:06 +00:00
|
|
|
|
var children = this._self.childNodes;
|
|
|
|
|
for (var i = 0; i < children.length; i++) {
|
|
|
|
|
if (children[i].node == aOldNode) {
|
|
|
|
|
var next = children[i].nextSibling;
|
|
|
|
|
this._self.removeItem(children[i]);
|
2007-05-03 12:26:27 +00:00
|
|
|
|
this._self.insertNewItem(aNewNode, next);
|
2007-05-25 06:11:02 +00:00
|
|
|
|
this._self.updateChevron();
|
2007-06-16 01:53:06 +00:00
|
|
|
|
return;
|
2007-05-25 06:11:02 +00:00
|
|
|
|
}
|
2007-05-03 12:26:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-06-16 01:53:06 +00:00
|
|
|
|
else
|
|
|
|
|
this._forwardToChildView(aParentNode, "itemReplaced", arguments);
|
2005-11-27 21:25:13 +00:00
|
|
|
|
},
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
|
|
|
|
containerOpened: function TV_V_containerOpened(aNode) {
|
2007-06-28 06:50:46 +00:00
|
|
|
|
this.invalidateContainer(aNode);
|
2005-11-27 21:25:13 +00:00
|
|
|
|
},
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
|
|
|
|
containerClosed: function TV_V_containerClosed(aNode) {
|
2007-06-28 06:50:46 +00:00
|
|
|
|
this.invalidateContainer(aNode);
|
2005-11-27 21:25:13 +00:00
|
|
|
|
},
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
2007-06-28 06:50:46 +00:00
|
|
|
|
invalidateContainer: function TV_V_invalidateContainer(aContainer) {
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (aContainer == this._self.getResultNode()) {
|
|
|
|
|
this._self._containerNodesMap.splice(0);
|
|
|
|
|
this._self._rebuild();
|
2007-10-11 06:42:38 +00:00
|
|
|
|
return;
|
2007-10-25 02:02:28 +00:00
|
|
|
|
}
|
2007-10-11 06:42:38 +00:00
|
|
|
|
|
2007-06-28 06:50:46 +00:00
|
|
|
|
function isChildOf(node, container) {
|
|
|
|
|
var parent = node.parent;
|
|
|
|
|
while (parent) {
|
|
|
|
|
if (parent == container)
|
|
|
|
|
return true;
|
|
|
|
|
parent = parent.parent;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var popupToRebuild = null;
|
2007-06-28 06:50:46 +00:00
|
|
|
|
for (var i=0; i < this._self._containerNodesMap.length; i++) {
|
|
|
|
|
var node = this._self._containerNodesMap[i].resultNode;
|
|
|
|
|
|
|
|
|
|
if (node == aContainer)
|
2007-10-25 02:02:28 +00:00
|
|
|
|
popupToRebuild = this._self._containerNodesMap[i].domNode;
|
|
|
|
|
if (isChildOf(node, aContainer)) {
|
2007-06-28 06:50:46 +00:00
|
|
|
|
this._self._containerNodesMap.splice(i,1);
|
2007-10-25 02:02:28 +00:00
|
|
|
|
i--;
|
|
|
|
|
}
|
2007-06-28 06:50:46 +00:00
|
|
|
|
}
|
2007-06-28 20:33:21 +00:00
|
|
|
|
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (popupToRebuild)
|
|
|
|
|
popupToRebuild._built = false;
|
2006-02-01 02:13:34 +00:00
|
|
|
|
},
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
|
|
|
|
invalidateAll: function TV_V_invalidateAll() {
|
2007-06-28 06:50:46 +00:00
|
|
|
|
this._self._containerNodesMap.splice(0);
|
2007-05-25 06:11:02 +00:00
|
|
|
|
this._self._rebuild();
|
2005-11-27 21:25:13 +00:00
|
|
|
|
},
|
2007-06-16 01:53:06 +00:00
|
|
|
|
|
|
|
|
|
sortingChanged: function TV_V_sortingChanged(aSortingMode) {
|
2006-02-08 01:10:57 +00:00
|
|
|
|
}
|
2005-11-27 21:25:13 +00:00
|
|
|
|
})]]></field>
|
2007-05-03 12:26:27 +00:00
|
|
|
|
|
2005-11-28 06:55:16 +00:00
|
|
|
|
<field name="_DNDObserver"><![CDATA[({
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// Inside the _DNDObserver object's functions, this points to
|
|
|
|
|
// the _DNDObserver object. _self points to the toolbar xbl object.
|
2005-11-28 06:55:16 +00:00
|
|
|
|
_self: this,
|
2006-02-17 18:31:06 +00:00
|
|
|
|
|
|
|
|
|
// Menu buttons should be opened when the mouse drags over them, and closed
|
|
|
|
|
// when the mouse drags off. The overFolder object manages opening and closing
|
|
|
|
|
// of folders when the mouse hovers.
|
|
|
|
|
_overFolder: {node: null, openTimer: null, hoverTime: 350, closeTimer: null},
|
|
|
|
|
|
|
|
|
|
// timer for turning of indicator bar, to get rid of flicker
|
|
|
|
|
_ibTimer: null,
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
_setTimer: function TBV_DO_setTimer(time) {
|
|
|
|
|
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
|
|
|
|
timer.initWithCallback(this, time, timer.TYPE_ONE_SHOT);
|
|
|
|
|
return timer;
|
|
|
|
|
},
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// Function to process all timer notifications.
|
|
|
|
|
notify: function TBV_DO_notify(timer) {
|
|
|
|
|
// Timer to turn off indicator bar.
|
|
|
|
|
if (timer == this._ibTimer) {
|
|
|
|
|
ib = this._self._dropIndicatorBar.removeAttribute('dragging');
|
|
|
|
|
this._ibTimer = null;
|
|
|
|
|
}
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// Timer to open a menubutton that's being dragged over.
|
|
|
|
|
if (timer == this._overFolder.openTimer) {
|
|
|
|
|
// Set the autoopen attribute on the folder's menupopup so that
|
|
|
|
|
// the menu will automatically close when the mouse drags off of it.
|
|
|
|
|
this._overFolder.node.lastChild.setAttribute("autoopened", "true");
|
|
|
|
|
this._overFolder.node.open = true;
|
|
|
|
|
this._overFolder.openTimer = null;
|
|
|
|
|
}
|
2008-02-25 21:45:22 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// Timer to close a menubutton that's been dragged off of.
|
|
|
|
|
if (timer == this._overFolder.closeTimer) {
|
|
|
|
|
// Only close the menubutton if the drag session isn't currently over
|
|
|
|
|
// it or one of its children. (The autoopened attribute will let the menu
|
|
|
|
|
// know to close later if the menu is still being dragged over.)
|
|
|
|
|
var currentNode = PlacesControllerDragHelper.currentDropTarget;
|
|
|
|
|
var inHierarchy = false;
|
|
|
|
|
while (currentNode) {
|
|
|
|
|
if (currentNode == this._self) {
|
|
|
|
|
inHierarchy = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
currentNode = currentNode.parentNode;
|
|
|
|
|
}
|
|
|
|
|
// The _clearOverFolder() function will close the menu for _overFolder.node.
|
|
|
|
|
// So null it out if we don't want to close it.
|
|
|
|
|
if (inHierarchy)
|
|
|
|
|
this._overFolder.node = null;
|
|
|
|
|
|
|
|
|
|
// Clear out the folder and all associated timers.
|
|
|
|
|
this._clearOverFolder();
|
|
|
|
|
}
|
|
|
|
|
},
|
2008-02-25 21:45:22 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// The mouse is no longer dragging over the stored menubutton.
|
|
|
|
|
// Close the menubutton, clear out drag styles, and clear all
|
|
|
|
|
// timers for opening/closing it.
|
|
|
|
|
_clearOverFolder: function TBV_DO_clearOverFolder() {
|
|
|
|
|
if (this._overFolder.node && this._overFolder.node.lastChild) {
|
|
|
|
|
if (!this._overFolder.node.lastChild.hasAttribute("dragover")) {
|
2007-10-25 02:02:28 +00:00
|
|
|
|
this._overFolder.node.lastChild.hidePopup();
|
2006-02-17 18:31:06 +00:00
|
|
|
|
}
|
|
|
|
|
this._overFolder.node.removeAttribute("dragover");
|
|
|
|
|
this._overFolder.node = null;
|
|
|
|
|
}
|
|
|
|
|
if (this._overFolder.openTimer) {
|
|
|
|
|
this._overFolder.openTimer.cancel();
|
|
|
|
|
this._overFolder.openTimer = null;
|
|
|
|
|
}
|
|
|
|
|
if (this._overFolder.closeTimer) {
|
|
|
|
|
this._overFolder.closeTimer.cancel();
|
|
|
|
|
this._overFolder.closeTimer = null;
|
|
|
|
|
}
|
|
|
|
|
},
|
2008-02-25 21:45:22 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// This function returns information about where to drop when
|
|
|
|
|
// dragging over this menu--insertion point, child index to drop
|
|
|
|
|
// before, and folder to drop into.
|
|
|
|
|
_getDropPoint: function TBV_DO_getDropPoint(event) {
|
|
|
|
|
// Can't drop if the toolbar isn't a folder.
|
|
|
|
|
var result = this._self.getResult();
|
2006-12-22 00:00:21 +00:00
|
|
|
|
if (!PlacesUtils.nodeIsFolder(result.root))
|
2006-02-17 18:31:06 +00:00
|
|
|
|
return null;
|
2008-02-25 21:45:22 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
var dropPoint = { ip: null, beforeIndex: null, folderNode: null };
|
|
|
|
|
// Loop through all the nodes to see which one this should
|
|
|
|
|
// get dropped in/next to
|
|
|
|
|
for (var i = 0; i < this._self.childNodes.length; i++) {
|
|
|
|
|
var xulNode = this._self.childNodes[i];
|
2006-12-22 00:00:21 +00:00
|
|
|
|
if (PlacesUtils.nodeIsFolder(xulNode.node) &&
|
|
|
|
|
!PlacesUtils.nodeIsReadOnly(xulNode.node)) {
|
2006-03-14 22:58:59 +00:00
|
|
|
|
NS_ASSERT(xulNode.getAttribute("type") == "menu");
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// This is a folder. If the mouse is in the left 25% of the
|
|
|
|
|
// node, drop to the left of the folder. If it's in the middle
|
|
|
|
|
// 50%, drop into the folder. If it's past that, drop to the right.
|
|
|
|
|
if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width * 0.25)) {
|
|
|
|
|
// Drop to the left of this folder.
|
2008-01-25 19:01:18 +00:00
|
|
|
|
dropPoint.ip =
|
2008-01-29 20:04:43 +00:00
|
|
|
|
new InsertionPoint(PlacesUtils.getConcreteItemId(result.root),
|
|
|
|
|
i, -1);
|
2006-02-17 18:31:06 +00:00
|
|
|
|
dropPoint.beforeIndex = i;
|
|
|
|
|
return dropPoint;
|
|
|
|
|
}
|
|
|
|
|
else if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width * 0.75)) {
|
|
|
|
|
// Drop inside this folder.
|
2008-01-25 19:01:18 +00:00
|
|
|
|
dropPoint.ip =
|
2008-01-29 20:04:43 +00:00
|
|
|
|
new InsertionPoint(PlacesUtils.getConcreteItemId(xulNode.node),
|
|
|
|
|
-1, 1);
|
2006-02-17 18:31:06 +00:00
|
|
|
|
dropPoint.beforeIndex = i;
|
|
|
|
|
dropPoint.folderNode = xulNode;
|
|
|
|
|
return dropPoint;
|
|
|
|
|
}
|
2008-02-25 21:45:22 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// This is a non-folder node. If the mouse is left of the middle,
|
|
|
|
|
// drop to the left of the folder. If it's right, drop to the right.
|
|
|
|
|
if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width / 2)) {
|
|
|
|
|
// Drop to the left of this bookmark.
|
2008-01-25 19:01:18 +00:00
|
|
|
|
dropPoint.ip =
|
|
|
|
|
new InsertionPoint(PlacesUtils.getConcreteItemId(result.root),
|
|
|
|
|
i, -1);
|
2006-02-17 18:31:06 +00:00
|
|
|
|
dropPoint.beforeIndex = i;
|
|
|
|
|
return dropPoint;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Should drop to the right of the last node.
|
2008-01-25 19:01:18 +00:00
|
|
|
|
dropPoint.ip =
|
|
|
|
|
new InsertionPoint(PlacesUtils.getConcreteItemId(result.root),
|
|
|
|
|
-1, 1);
|
2006-02-17 18:31:06 +00:00
|
|
|
|
dropPoint.beforeIndex = -1;
|
|
|
|
|
return dropPoint;
|
|
|
|
|
},
|
|
|
|
|
|
2005-11-28 07:30:30 +00:00
|
|
|
|
onDragStart: function TBV_DO_onDragStart(event, xferData, dragAction) {
|
2008-02-25 21:45:22 +00:00
|
|
|
|
// sub menus have their own d&d handlers
|
|
|
|
|
if (event.target.parentNode != this._self)
|
|
|
|
|
return false;
|
|
|
|
|
|
2006-04-10 19:26:01 +00:00
|
|
|
|
if (event.target.localName == "toolbarbutton" &&
|
|
|
|
|
event.target.getAttribute("type") == "menu") {
|
2007-07-07 01:12:37 +00:00
|
|
|
|
#ifdef XP_WIN
|
|
|
|
|
// Support folder dragging on the personal toolbar when the user
|
|
|
|
|
// holds the "alt" key while they drag (Ctrl+drag has another
|
|
|
|
|
// meaning - Copy). This does not appear to work at all on Linux.
|
2006-04-10 19:26:01 +00:00
|
|
|
|
if (!event.shiftKey && !event.altKey && !event.ctrlKey)
|
|
|
|
|
return false;
|
|
|
|
|
event.target.firstChild.hidePopup();
|
2007-07-07 01:12:37 +00:00
|
|
|
|
#else
|
|
|
|
|
return;
|
|
|
|
|
#endif
|
2006-04-10 19:26:01 +00:00
|
|
|
|
}
|
2007-07-07 01:12:37 +00:00
|
|
|
|
|
2008-02-25 21:45:22 +00:00
|
|
|
|
if (event.ctrlKey)
|
2007-07-07 01:12:37 +00:00
|
|
|
|
dragAction.action = Ci.nsIDragService.DRAGDROP_ACTION_COPY;
|
2008-02-25 21:45:22 +00:00
|
|
|
|
|
|
|
|
|
// activate the view and cache the dragged node
|
|
|
|
|
this._self._draggedNode = event.target.node;
|
|
|
|
|
this._self.focus();
|
2007-07-07 01:12:37 +00:00
|
|
|
|
xferData.data = this._self._controller.getTransferData(dragAction.action);
|
|
|
|
|
#ifdef XP_WIN
|
2006-10-23 00:19:52 +00:00
|
|
|
|
return true;
|
2006-04-10 19:26:01 +00:00
|
|
|
|
#endif
|
2005-11-28 06:55:16 +00:00
|
|
|
|
},
|
2008-02-25 21:45:22 +00:00
|
|
|
|
|
2005-11-28 07:30:30 +00:00
|
|
|
|
canDrop: function TBV_DO_canDrop(event, session) {
|
2008-02-17 06:17:34 +00:00
|
|
|
|
return PlacesControllerDragHelper.canDrop();
|
2005-11-28 07:30:30 +00:00
|
|
|
|
},
|
2008-02-25 21:45:22 +00:00
|
|
|
|
|
2005-11-28 07:30:30 +00:00
|
|
|
|
onDragOver: function TBV_DO_onDragOver(event, flavor, session) {
|
2006-02-17 18:31:06 +00:00
|
|
|
|
PlacesControllerDragHelper.currentDropTarget = event.target;
|
|
|
|
|
var dropPoint = this._getDropPoint(event);
|
|
|
|
|
var ib = this._self._dropIndicatorBar;
|
|
|
|
|
if (this._ibTimer) {
|
|
|
|
|
this._ibTimer.cancel();
|
|
|
|
|
this._ibTimer = null;
|
|
|
|
|
}
|
|
|
|
|
if (dropPoint.folderNode) {
|
|
|
|
|
// Dropping over a menubutton, set styles and timer to open folder.
|
|
|
|
|
if (this._overFolder.node != dropPoint.folderNode) {
|
|
|
|
|
this._clearOverFolder();
|
|
|
|
|
this._overFolder.node = dropPoint.folderNode;
|
|
|
|
|
this._overFolder.openTimer = this._setTimer(this._overFolder.hoverTime);
|
2005-11-28 07:30:30 +00:00
|
|
|
|
}
|
2006-02-17 18:31:06 +00:00
|
|
|
|
if (!this._overFolder.node.hasAttribute("dragover"))
|
|
|
|
|
this._overFolder.node.setAttribute("dragover", "true");
|
|
|
|
|
|
|
|
|
|
ib.removeAttribute("dragging");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Dragging over a normal toolbarbutton,
|
|
|
|
|
// show indicator bar and move it to the appropriate drop point.
|
|
|
|
|
if (!ib.hasAttribute("dragging"))
|
|
|
|
|
ib.setAttribute("dragging", "true");
|
|
|
|
|
var ind = ib.firstChild;
|
2008-01-05 06:29:08 +00:00
|
|
|
|
var halfInd = ind.boxObject.width / 2;
|
2006-02-17 18:31:06 +00:00
|
|
|
|
var direction = document.defaultView.getComputedStyle(this._self.parentNode, "").direction;
|
|
|
|
|
if (direction == "ltr") {
|
2008-01-05 06:29:08 +00:00
|
|
|
|
halfInd = Math.ceil(halfInd);
|
2007-09-07 23:16:18 +00:00
|
|
|
|
if (!this._self.childNodes.length)
|
2008-01-05 06:29:08 +00:00
|
|
|
|
ind.style.marginLeft = 0 - this._self.boxObject.x - halfInd + 'px'
|
2007-09-07 23:16:18 +00:00
|
|
|
|
else if (dropPoint.beforeIndex == -1)
|
2006-02-17 18:31:06 +00:00
|
|
|
|
ind.style.marginLeft = this._self.lastChild.boxObject.x +
|
2008-01-05 06:29:08 +00:00
|
|
|
|
this._self.lastChild.boxObject.width - this._self.boxObject.x - halfInd + 'px';
|
2006-02-17 18:31:06 +00:00
|
|
|
|
else
|
|
|
|
|
ind.style.marginLeft = this._self.childNodes[dropPoint.beforeIndex].boxObject.x -
|
2008-01-05 06:29:08 +00:00
|
|
|
|
this._self.boxObject.x - halfInd + 'px';
|
2008-02-25 21:45:22 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2008-01-05 06:29:08 +00:00
|
|
|
|
halfInd = Math.floor(halfInd);
|
2007-09-07 23:16:18 +00:00
|
|
|
|
if (dropPoint.beforeIndex == -1 || !this._self.childNodes.length)
|
2006-02-17 18:31:06 +00:00
|
|
|
|
ind.style.marginRight = '0px';
|
|
|
|
|
else
|
|
|
|
|
ind.style.marginRight = (this._self.childNodes[this._self.childNodes.length - 1].boxObject.x +
|
|
|
|
|
this._self.childNodes[this._self.childNodes.length - 1].boxObject.width) -
|
2008-01-05 06:29:08 +00:00
|
|
|
|
(this._self.childNodes[dropPoint.beforeIndex].boxObject.x) - halfInd + 'px';
|
2005-11-28 07:30:30 +00:00
|
|
|
|
}
|
2006-02-17 18:31:06 +00:00
|
|
|
|
// Clear out old folder information
|
|
|
|
|
this._clearOverFolder();
|
2005-11-28 07:30:30 +00:00
|
|
|
|
}
|
2006-02-17 18:31:06 +00:00
|
|
|
|
},
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
onDrop: function TBV_DO_onDrop(event, dropData, session) {
|
|
|
|
|
var dropPoint = this._getDropPoint(event);
|
|
|
|
|
if (dropPoint == null)
|
|
|
|
|
return;
|
2008-01-29 20:04:43 +00:00
|
|
|
|
PlacesControllerDragHelper.onDrop(dropPoint.ip);
|
2005-11-28 07:30:30 +00:00
|
|
|
|
},
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
onDragExit: function TBV_DO_onDragExit(event, session) {
|
|
|
|
|
// Set timer to turn off indicator bar (if we turn it off
|
|
|
|
|
// here, dragenter might be called immediately after, creating
|
|
|
|
|
// flicker.)
|
|
|
|
|
if (this._ibTimer)
|
|
|
|
|
this._ibTimer.cancel();
|
|
|
|
|
this._ibTimer = this._setTimer(10);
|
|
|
|
|
// Close any folder being hovered over
|
|
|
|
|
if (this._overFolder.node)
|
|
|
|
|
this._overFolder.closeTimer = this._setTimer(this._overFolder.hoverTime);
|
|
|
|
|
PlacesControllerDragHelper.currentDropTarget = null;
|
|
|
|
|
},
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2005-11-28 07:30:30 +00:00
|
|
|
|
getSupportedFlavours: function TBV_DO_getSupportedFlavours() {
|
|
|
|
|
var flavorSet = new FlavourSet();
|
2008-03-04 22:12:27 +00:00
|
|
|
|
var types = PlacesUtils.GENERIC_VIEW_DROP_TYPES;
|
2008-01-29 20:04:43 +00:00
|
|
|
|
for (var i = 0; i < types.length; ++i)
|
|
|
|
|
flavorSet.appendFlavour(types[i]);
|
2005-11-28 07:30:30 +00:00
|
|
|
|
return flavorSet;
|
2006-03-07 18:41:38 +00:00
|
|
|
|
}
|
2005-11-28 06:55:16 +00:00
|
|
|
|
})]]></field>
|
2006-04-10 20:56:25 +00:00
|
|
|
|
|
2006-02-17 18:31:06 +00:00
|
|
|
|
<method name="checkForMenuEvent">
|
|
|
|
|
<parameter name="event"/>
|
|
|
|
|
<parameter name="action"/>
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
// It seems that even if the menu drag/drop event
|
|
|
|
|
// handlers set their phase to capturing, toolbarbutton
|
|
|
|
|
// menu events come to the toolbar first, and don't bubble.
|
|
|
|
|
// So if this is a menu/menuitem, try to send the event to its
|
|
|
|
|
// xbl handler.
|
|
|
|
|
if (event.target.localName.indexOf("menu") == 0) {
|
|
|
|
|
var parent = event.target.parentNode;
|
|
|
|
|
// XULDocument has no getAttribute() function, so check for it before calling.
|
|
|
|
|
while (parent && parent.getAttribute) {
|
|
|
|
|
if (parent.getAttribute("type") == "places") {
|
|
|
|
|
nsDragAndDrop[action](event, parent._DNDObserver);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
parent = parent.parentNode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
2006-01-18 00:11:25 +00:00
|
|
|
|
|
2006-03-10 23:48:40 +00:00
|
|
|
|
<property name="selType" onget="return 'single';"/>
|
2006-12-22 00:00:21 +00:00
|
|
|
|
|
|
|
|
|
<method name="buildContextMenu">
|
|
|
|
|
<parameter name="aPopup"/>
|
|
|
|
|
<body><![CDATA[
|
2008-02-25 21:45:22 +00:00
|
|
|
|
this._contextMenuShown = true;
|
2006-12-28 22:56:59 +00:00
|
|
|
|
this.focus();
|
2007-02-09 22:17:37 +00:00
|
|
|
|
return this.controller.buildContextMenu(aPopup);
|
2006-12-22 00:00:21 +00:00
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
|
|
|
|
|
2006-12-28 22:56:59 +00:00
|
|
|
|
<method name="destroyContextMenu">
|
|
|
|
|
<parameter name="aPopup"/>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
<body><![CDATA[
|
2008-02-25 21:45:22 +00:00
|
|
|
|
this._contextMenuShown = false;
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (window.content)
|
|
|
|
|
window.content.focus();
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
|
|
|
|
|
|
|
|
|
<method name="_showEmptyMenuItem">
|
|
|
|
|
<parameter name="aPopup"/>
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
if (aPopup._emptyMenuItem) {
|
|
|
|
|
aPopup._emptyMenuItem.hidden = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-04 22:12:27 +00:00
|
|
|
|
var label = PlacesUtils.getString("bookmarksMenuEmptyFolder");
|
2007-10-25 02:02:28 +00:00
|
|
|
|
aPopup._emptyMenuItem = document.createElement("menuitem");
|
|
|
|
|
aPopup._emptyMenuItem.setAttribute("label", label);
|
|
|
|
|
aPopup._emptyMenuItem.setAttribute("disabled", true);
|
|
|
|
|
aPopup.appendChild(aPopup._emptyMenuItem);
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
|
|
|
|
|
|
|
|
|
<method name="insertNewItemToPopup">
|
|
|
|
|
<parameter name="aChild"/>
|
|
|
|
|
<parameter name="aParentPopup"/>
|
|
|
|
|
<parameter name="aBefore"/>
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
var element =
|
2008-03-04 22:12:27 +00:00
|
|
|
|
PlacesUtils.createMenuItemForNode(aChild, this._containerNodesMap);
|
2007-10-25 02:02:28 +00:00
|
|
|
|
if (aBefore)
|
|
|
|
|
aParentPopup.insertBefore(element, aBefore);
|
|
|
|
|
else
|
|
|
|
|
aParentPopup.appendChild(element);
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
|
|
|
|
|
|
|
|
|
<method name="_containerPopupShowing">
|
|
|
|
|
<parameter name="aPopup"/>
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
if (aPopup._built)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// remove previous menu items
|
|
|
|
|
while (aPopup.hasChildNodes())
|
|
|
|
|
aPopup.removeChild(aPopup.firstChild);
|
2007-10-27 21:57:23 +00:00
|
|
|
|
// restore the empty-menu item if has been created already
|
|
|
|
|
if (aPopup._emptyMenuItem)
|
|
|
|
|
aPopup.appendChild(aPopup._emptyMenuItem);
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
|
|
|
|
var resultNode = aPopup._resultNode;
|
|
|
|
|
if (!resultNode.containerOpen)
|
|
|
|
|
resultNode.containerOpen = true;
|
|
|
|
|
|
|
|
|
|
var cc = resultNode.childCount;
|
|
|
|
|
if (cc > 0) {
|
|
|
|
|
if (aPopup._emptyMenuItem)
|
|
|
|
|
aPopup._emptyMenuItem.hidden = true;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < cc; ++i) {
|
|
|
|
|
var child = resultNode.getChild(i);
|
|
|
|
|
this.insertNewItemToPopup(child, aPopup, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// add element to show it is empty.
|
|
|
|
|
this._showEmptyMenuItem(aPopup);
|
|
|
|
|
}
|
|
|
|
|
aPopup._built = true;
|
|
|
|
|
]]></body>
|
|
|
|
|
</method>
|
|
|
|
|
|
|
|
|
|
<method name="_isChevronChild">
|
|
|
|
|
<parameter name="aChild"/>
|
|
|
|
|
<body><![CDATA[
|
|
|
|
|
if (!this._chevron.firstChild.hasAttribute("type"))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
var parent = aChild.parentNode;
|
|
|
|
|
while (parent != this) {
|
|
|
|
|
if (parent == this._chevron)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
parent = parent.parentNode;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
]]></body>
|
2006-12-22 00:00:21 +00:00
|
|
|
|
</method>
|
2005-11-27 06:47:54 +00:00
|
|
|
|
</implementation>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2005-11-27 06:47:54 +00:00
|
|
|
|
<handlers>
|
2008-02-06 21:20:23 +00:00
|
|
|
|
<handler event="mouseover"><![CDATA[
|
|
|
|
|
var button = event.target;
|
|
|
|
|
if (button.parentNode == this && button.node &&
|
|
|
|
|
PlacesUtils.nodeIsURI(button.node))
|
|
|
|
|
window.XULBrowserWindow.setOverLink(event.target.node.uri, null);
|
|
|
|
|
]]></handler>
|
|
|
|
|
<handler event="mouseout"><![CDATA[
|
|
|
|
|
window.XULBrowserWindow.setOverLink("", null);
|
|
|
|
|
]]></handler>
|
2005-11-28 06:55:16 +00:00
|
|
|
|
<handler event="draggesture"><![CDATA[
|
2008-02-21 19:54:00 +00:00
|
|
|
|
if (event.target.localName == "toolbarbutton" ||
|
|
|
|
|
event.target.localName == "toolbarseparator")
|
2005-11-28 06:55:16 +00:00
|
|
|
|
nsDragAndDrop.startDrag(event, this._DNDObserver);
|
|
|
|
|
]]></handler>
|
2005-11-28 07:30:30 +00:00
|
|
|
|
<handler event="dragover"><![CDATA[
|
2006-02-17 18:31:06 +00:00
|
|
|
|
if (!this.checkForMenuEvent(event, "dragOver"))
|
|
|
|
|
nsDragAndDrop.dragOver(event, this._DNDObserver);
|
2005-11-28 07:30:30 +00:00
|
|
|
|
]]></handler>
|
|
|
|
|
<handler event="dragdrop"><![CDATA[
|
2006-02-17 18:31:06 +00:00
|
|
|
|
if (!this.checkForMenuEvent(event, "drop"))
|
|
|
|
|
nsDragAndDrop.drop(event, this._DNDObserver);
|
|
|
|
|
]]></handler>
|
|
|
|
|
<handler event="dragexit"><![CDATA[
|
|
|
|
|
if (!this.checkForMenuEvent(event, "dragExit"))
|
|
|
|
|
nsDragAndDrop.dragExit(event, this._DNDObserver);
|
2005-11-28 07:30:30 +00:00
|
|
|
|
]]></handler>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
<handler event="popupshowing" phase="capturing"><![CDATA[
|
|
|
|
|
var target = event.originalTarget;
|
|
|
|
|
|
|
|
|
|
// the chevron has its own view
|
|
|
|
|
if (this._isChevronChild(target))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (target._resultNode)
|
|
|
|
|
this._containerPopupShowing(target);
|
|
|
|
|
|
|
|
|
|
var targetParent = target.parentNode;
|
2007-06-12 05:28:20 +00:00
|
|
|
|
if (targetParent.localName == "toolbarbutton" &&
|
2006-02-17 18:31:06 +00:00
|
|
|
|
!PlacesControllerDragHelper.getSession())
|
2007-06-12 05:28:20 +00:00
|
|
|
|
this._openedMenuButton = targetParent;
|
2005-12-02 17:10:51 +00:00
|
|
|
|
]]></handler>
|
|
|
|
|
<handler event="popuphidden"><![CDATA[
|
2007-10-25 02:02:28 +00:00
|
|
|
|
var target = event.originalTarget;
|
|
|
|
|
if (!target._resultNode)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// the chevron has its own view
|
|
|
|
|
if (this._isChevronChild(target))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// UI performance: folder queries are cheap, keep the resultnode open
|
|
|
|
|
// so we don't rebuild its contents whenever the popup is reopened.
|
|
|
|
|
if (!PlacesUtils.nodeIsFolder(target._resultNode))
|
|
|
|
|
target._resultNode.containerOpen = false;
|
|
|
|
|
|
|
|
|
|
var targetParent = target.parentNode;
|
2007-06-12 05:28:20 +00:00
|
|
|
|
if (targetParent.localName == "toolbarbutton" &&
|
2006-02-17 18:31:06 +00:00
|
|
|
|
!PlacesControllerDragHelper.getSession())
|
2005-12-02 17:10:51 +00:00
|
|
|
|
this._openedMenuButton = null;
|
|
|
|
|
]]></handler>
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2005-12-02 17:10:51 +00:00
|
|
|
|
<handler event="mousemove"><![CDATA[
|
2006-02-17 18:31:06 +00:00
|
|
|
|
if (this._openedMenuButton == null || PlacesControllerDragHelper.getSession())
|
2005-12-02 17:10:51 +00:00
|
|
|
|
return;
|
2007-10-25 02:02:28 +00:00
|
|
|
|
|
2007-06-12 05:28:20 +00:00
|
|
|
|
var target = event.originalTarget;
|
2005-12-02 17:10:51 +00:00
|
|
|
|
if (this._openedMenuButton != target &&
|
2007-06-12 05:28:20 +00:00
|
|
|
|
target.localName == "toolbarbutton" &&
|
2005-12-02 17:10:51 +00:00
|
|
|
|
target.type == "menu") {
|
|
|
|
|
this._openedMenuButton.open = false;
|
|
|
|
|
target.open = true;
|
|
|
|
|
}
|
|
|
|
|
]]></handler>
|
2005-11-27 06:47:54 +00:00
|
|
|
|
</handlers>
|
|
|
|
|
</binding>
|
|
|
|
|
|
|
|
|
|
</bindings>
|