зеркало из https://github.com/mozilla/pjs.git
Bug 285584 - Make download & extension manager use accessible XBL widget. r=mconnor,a=bsmedberg
This commit is contained in:
Родитель
1fe6f3e2c8
Коммит
eeff828418
|
@ -51,6 +51,7 @@ toolkit.jar:
|
|||
*+ content/global/bindings/preferences.xml (widgets/preferences.xml)
|
||||
*+ content/global/bindings/progressmeter.xml (widgets/progressmeter.xml)
|
||||
*+ content/global/bindings/radio.xml (widgets/radio.xml)
|
||||
*+ content/global/bindings/richlistbox.xml (widgets/richlistbox.xml)
|
||||
*+ content/global/bindings/scrollbar.xml (widgets/scrollbar.xml)
|
||||
*+ content/global/bindings/scrollbox.xml (widgets/scrollbox.xml)
|
||||
*+ content/global/bindings/splitter.xml (widgets/splitter.xml)
|
||||
|
|
|
@ -0,0 +1,216 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** 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 Richlistbox code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- IBM Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2005
|
||||
- IBM Corporation. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Doron Rosenberg <doronr@us.ibm.com> (Original Author)
|
||||
-
|
||||
- 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 ***** -->
|
||||
|
||||
<bindings id="richlistboxBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="richlistbox">
|
||||
<content>
|
||||
<xul:scrollbox allowevents="true" orient="vertical" anonid="main-box"
|
||||
flex="1" style="overflow: auto;">
|
||||
<children />
|
||||
</xul:scrollbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<field name="scrollBoxObject">null</field>
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
var x = document.getAnonymousElementByAttribute(this, "anonid", "main-box");
|
||||
this.scrollBoxObject = x.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<property name="children">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var childNodes = [];
|
||||
for (var i = 0; i < this.childNodes.length; ++i) {
|
||||
if ("fireEvent" in this.childNodes[i])
|
||||
childNodes.push(this.childNodes[i]);
|
||||
}
|
||||
return childNodes;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="_selectedItem">null</field>
|
||||
<property name="selectedItem">
|
||||
<getter>
|
||||
return this._selectedItem;
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this._selectedItem)
|
||||
this._selectedItem.selected = false;
|
||||
|
||||
this._selectedItem = val;
|
||||
|
||||
if (val) {
|
||||
val.selected = true;
|
||||
this.scrollBoxObject.ensureElementIsVisible(val);
|
||||
}
|
||||
|
||||
this.fireEvent("select");
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("DOMMenuItemActive", true, true);
|
||||
this.dispatchEvent(event);
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="clearSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.selectedItem = null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="goUp">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// if nothing selected, we go from the bottom
|
||||
for (var i = this.selectedItem ? this.selectedItem.previousSibling : this.lastChild; i; i = i.previousSibling) {
|
||||
if ("fireEvent" in i) {
|
||||
this.selectedItem = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="goDown">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// if nothing selected, we go from the top
|
||||
for (var i = this.selectedItem ? this.selectedItem.nextSibling : this.firstChild; i; i = i.nextSibling) {
|
||||
if ("fireEvent" in i) {
|
||||
this.selectedItem = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="fireEvent">
|
||||
<parameter name="aEventType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var e = document.createEvent("Events");
|
||||
var eventType = "richview-" + aEventType;
|
||||
e.initEvent(eventType, false, true);
|
||||
this.dispatchEvent(e);
|
||||
|
||||
var handler = this.getAttribute("onrichview-" + aEventType);
|
||||
if (handler != "") {
|
||||
var fn = new Function("event", handler);
|
||||
fn(e);
|
||||
}
|
||||
document.commandDispatcher.updateCommands(eventType);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_UP" action="goUp(); event.preventDefault();"/>
|
||||
<handler event="keypress" keycode="VK_DOWN" action="goDown(); event.preventDefault();"/>
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
// clicking into nothing should unselect
|
||||
if (event.originalTarget.getAttribute("anonid") == "main-box")
|
||||
this.clearSelection();
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="contextmenu">
|
||||
<![CDATA[
|
||||
// if the context menu was opened via the keyboard, display it in the
|
||||
// right location.
|
||||
if (event.button != 2) {
|
||||
var popup = document.getElementById(this.getAttribute("context"));
|
||||
if (popup)
|
||||
popup.showPopup(this.selectedItem, -1, -1, "context", "bottomleft", "topleft");
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="richlistitem">
|
||||
<content>
|
||||
<children />
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="selected"
|
||||
onget="return this.getAttribute('selected');"
|
||||
onset="return this.setAttribute('selected',val);"/>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
if ((event.target == this) && event.ctrlKey && (this.parentNode.selectedItem == this)) {
|
||||
this.parentNode.clearSelection();
|
||||
} else {
|
||||
this.parentNode.selectedItem = this;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="contextmenu" phase="capturing">
|
||||
<![CDATA[
|
||||
// This needed to be called before the contextmenu gets shown to handle
|
||||
// someone rightclicking on an unselected item
|
||||
if (event.target == this) {
|
||||
this.parentNode.selectedItem = this;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
@ -1010,3 +1010,11 @@ expander {
|
|||
-moz-binding: url("chrome://global/content/bindings/expander.xml#expander");
|
||||
-moz-box-orient: vertical;
|
||||
}
|
||||
|
||||
|
||||
/********** Rich Listbox ********/
|
||||
|
||||
richlistbox {
|
||||
-moz-binding: url('chrome://global/content/bindings/richlistbox.xml#richlistbox');
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
|
||||
<binding id="download-base">
|
||||
<binding id="download-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/downloads/downloads.css"/>
|
||||
</resources>
|
||||
|
@ -126,6 +126,15 @@
|
|||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_RETURN">
|
||||
<![CDATA[
|
||||
if (event.originalTarget.className == "link")
|
||||
event.originalTarget.click();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="download-starting" extends="chrome://mozapps/content/downloads/download.xml#download-base">
|
||||
|
@ -306,14 +315,12 @@
|
|||
</xul:vbox>
|
||||
<xul:vbox pack="start">
|
||||
<xul:label value="&cmd.cancel.label;" class="link"
|
||||
onclick="this.parentNode.parentNode.parentNode.parentNode.parentNode.fireEvent('cancel');"
|
||||
onkeypress="if (event.keyCode == 13) this.onclick();"/>
|
||||
onclick="this.parentNode.parentNode.parentNode.parentNode.parentNode.fireEvent('cancel');"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
<xul:hbox align="center">
|
||||
<xul:label value="&cmd.resume.label;" class="link"
|
||||
onclick="this.parentNode.parentNode.parentNode.parentNode.fireEvent('resume');"
|
||||
onkeypress="if (event.keyCode == 13) this.onclick();"/>
|
||||
onclick="this.parentNode.parentNode.parentNode.parentNode.fireEvent('resume');"/>
|
||||
<xul:label xbl:inherits="value=status" flex="1" crop="right"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
|
@ -344,11 +351,9 @@
|
|||
</xul:vbox>
|
||||
<xul:vbox pack="start">
|
||||
<xul:label value="&cmd.open.label;" class="link"
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('open');"
|
||||
onkeypress="if (event.keyCode == 13) this.onclick();"/>
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('open');"/>
|
||||
<xul:label value="&cmd.remove.label;" class="link"
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('remove');"
|
||||
onkeypress="if (event.keyCode == 13) this.onclick();"/>
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('remove');"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
@ -368,11 +373,9 @@
|
|||
</xul:vbox>
|
||||
<xul:vbox pack="start">
|
||||
<xul:label value="&cmd.retry.label;" class="link"
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('retry');"
|
||||
onkeypress="if (event.keyCode == 13) this.onclick();"/>
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('retry');"/>
|
||||
<xul:label value="&cmd.remove.label;" class="link"
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('remove');"
|
||||
onkeypress="if (event.keyCode == 13) this.onclick();"/>
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('remove');"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
@ -392,11 +395,9 @@
|
|||
</xul:vbox>
|
||||
<xul:vbox pack="start">
|
||||
<xul:label value="&cmd.retry.label;" class="link"
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('retry');"
|
||||
onkeypress="if (event.keyCode == 13) this.onclick();"/>
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('retry');"/>
|
||||
<xul:label value="&cmd.remove.label;" class="link"
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('remove');"
|
||||
onkeypress="if (event.keyCode == 13) this.onclick();"/>
|
||||
onclick="this.parentNode.parentNode.parentNode.fireEvent('remove');"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
|
|
@ -39,7 +39,8 @@ download[state="7"] {
|
|||
-moz-binding: url('chrome://mozapps/content/downloads/download.xml#install-done');
|
||||
}
|
||||
|
||||
#downloadView {
|
||||
-moz-binding: url('chrome://mozapps/content/downloads/download.xml#download-view');
|
||||
/* Only focus links in the selected item*/
|
||||
download[selected="true"] .link {
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ function onDownloadRemove(aEvent)
|
|||
{
|
||||
if (aEvent.target.removable) {
|
||||
gDownloadManager.removeDownload(aEvent.target.id);
|
||||
|
||||
|
||||
gDownloadViewController.onCommandUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -637,8 +637,8 @@ function buildContextMenu(aEvent)
|
|||
while (popup.hasChildNodes())
|
||||
popup.removeChild(popup.firstChild);
|
||||
|
||||
if (gDownloadsView.selected) {
|
||||
var idx = parseInt(gDownloadsView.selected.getAttribute("state"));
|
||||
if (gDownloadsView.selectedItem) {
|
||||
var idx = parseInt(gDownloadsView.selectedItem.getAttribute("state"));
|
||||
if (idx < 0)
|
||||
idx = 0;
|
||||
|
||||
|
@ -731,8 +731,8 @@ function onDownloadShowOptions()
|
|||
|
||||
function onDownloadShowInfo()
|
||||
{
|
||||
if (gDownloadsView.selected)
|
||||
fireEventForElement(gDownloadsView.selected, "properties");
|
||||
if (gDownloadsView.selectedItem)
|
||||
fireEventForElement(gDownloadsView.selectedItem, "properties");
|
||||
}
|
||||
|
||||
function initAutoDownloadDisplay()
|
||||
|
|
|
@ -96,41 +96,41 @@
|
|||
<vbox id="contextMenuPalette" hidden="true">
|
||||
<menuitem id="menuitem_pause"
|
||||
label="&cmd.pause.label;" accesskey="&cmd.pause.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'pause');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'pause');"/>
|
||||
<menuitem id="menuitem_resume"
|
||||
label="&cmd.resume.label;" accesskey="&cmd.resume.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'resume');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'resume');"/>
|
||||
<menuitem id="menuitem_cancel"
|
||||
label="&cmd.cancel.label;" accesskey="&cmd.cancel.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'cancel');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'cancel');"/>
|
||||
|
||||
<menuitem id="menuitem_open" default="true"
|
||||
label="&cmd.open.label;" accesskey="&cmd.open.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'open');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'open');"/>
|
||||
<menuitem id="menuitem_openWith"
|
||||
label="&cmd.openWith.label;" accesskey="&cmd.openWith.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'openWith');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'openWith');"/>
|
||||
<menuitem id="menuitem_show"
|
||||
label="&cmd.show.label;" accesskey="&cmd.show.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'show');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'show');"/>
|
||||
|
||||
<menuitem id="menuitem_retry" default="true"
|
||||
label="&cmd.retry.label;" accesskey="&cmd.retry.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'retry');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'retry');"/>
|
||||
|
||||
<menuitem id="menuitem_remove"
|
||||
label="&cmd.remove.label;" accesskey="&cmd.remove.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'remove');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'remove');"/>
|
||||
|
||||
<menuseparator id="menuseparator_properties"/>
|
||||
<menuitem id="menuitem_properties"
|
||||
label="&cmd.properties.label;" accesskey="&cmd.properties.accesskey;"
|
||||
oncommand="fireEventForElement(gDownloadsView.selected, 'properties');"/>
|
||||
oncommand="fireEventForElement(gDownloadsView.selectedItem, 'properties');"/>
|
||||
</vbox>
|
||||
|
||||
<popup id="downloadContextMenu" onpopupshowing="return buildContextMenu(event);"/>
|
||||
|
||||
<vbox id="downloadView" flex="1" style="overflow: auto;"
|
||||
<richlistbox id="downloadView" flex="1" context="downloadContextMenu"
|
||||
datasources="rdf:null" ref="NC:DownloadsRoot"
|
||||
ondragover="nsDragAndDrop.dragOver(event, gDownloadDNDObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, gDownloadDNDObserver);">
|
||||
|
@ -164,13 +164,13 @@
|
|||
object="?icon"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<download uri="?download" context="downloadContextMenu"
|
||||
<download uri="?download"
|
||||
image="?icon" file="?file" target="?target" state="?state"
|
||||
animated="?animated" status="?status" progress="?progress-percent"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
</richlistbox>
|
||||
|
||||
<hbox>
|
||||
<hbox id="commandBar" flex="1">
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
view {
|
||||
-moz-binding: url("chrome://mozapps/skin/shared/richview.xml#richview");
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
extension {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension");
|
||||
-moz-box-orient: vertical;
|
||||
|
|
|
@ -130,8 +130,8 @@ function setRestartMessage(aItem)
|
|||
// Event Handlers
|
||||
function onExtensionSelect(aEvent)
|
||||
{
|
||||
if (aEvent.target.selected)
|
||||
aEvent.target.setAttribute("last-selected", aEvent.target.selected.id);
|
||||
if (aEvent.target.selectedItem)
|
||||
aEvent.target.setAttribute("last-selected", aEvent.target.selectedItem.id);
|
||||
else
|
||||
aEvent.target.removeAttribute("last-selected");
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ function Startup()
|
|||
if (!lastSelected)
|
||||
gExtensionsView.selectionForward();
|
||||
else
|
||||
gExtensionsView.selected = lastSelected;
|
||||
gExtensionsView.selectedItem = lastSelected;
|
||||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
document.title = extensionsStrings.getString(gWindowState + "Title");
|
||||
|
@ -500,11 +500,11 @@ function onThemeSelect(aEvent)
|
|||
return;
|
||||
|
||||
var previewImageDeck = document.getElementById("previewImageDeck");
|
||||
if (!gExtensionsView.selected) {
|
||||
if (!gExtensionsView.selectedItem) {
|
||||
previewImageDeck.setAttribute("selectedIndex", "0");
|
||||
return;
|
||||
}
|
||||
var url = gExtensionsView.selected.getAttribute("previewImage");
|
||||
var url = gExtensionsView.selectedItem.getAttribute("previewImage");
|
||||
if (url) {
|
||||
previewImageDeck.setAttribute("selectedIndex", "2");
|
||||
var previewImage = document.getElementById("previewImage");
|
||||
|
@ -545,7 +545,7 @@ function buildContextMenu(aEvent)
|
|||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
var menuitem_about = document.getElementById("menuitem_about_clone");
|
||||
var selectedItem = gExtensionsView.selected;
|
||||
var selectedItem = gExtensionsView.selectedItem;
|
||||
var name = selectedItem ? selectedItem.getAttribute("name") : "";
|
||||
menuitem_about.setAttribute("label", extensionsStrings.getFormattedString("aboutExtension", [name]));
|
||||
|
||||
|
@ -565,8 +565,8 @@ function buildContextMenu(aEvent)
|
|||
}
|
||||
else {
|
||||
var enableMenu = document.getElementById("menuitem_enable_clone");
|
||||
if (gExtensionsView.selected.getAttribute("compatible") == "false" ||
|
||||
gExtensionsView.selected.disabled)
|
||||
if (gExtensionsView.selectedItem.getAttribute("compatible") == "false" ||
|
||||
gExtensionsView.selectedItem.disabled)
|
||||
// don't let the user activate incompatible themes, but show a (disabled) Enable
|
||||
// menuitem to give visual feedback; it's disabled because cmd_enable returns false
|
||||
enableMenu.hidden = false;
|
||||
|
@ -719,10 +719,10 @@ var gExtensionsViewController = {
|
|||
var commandNode = document.getElementById(aCommand);
|
||||
return commandNode && (commandNode.parentNode == document.getElementById("extensionsCommands"));
|
||||
},
|
||||
|
||||
|
||||
isCommandEnabled: function (aCommand)
|
||||
{
|
||||
var selectedItem = gExtensionsView.selected;
|
||||
var selectedItem = gExtensionsView.selectedItem;
|
||||
if (selectedItem) {
|
||||
if (selectedItem.getAttribute("downloadURL") != "")
|
||||
return false;
|
||||
|
@ -807,7 +807,7 @@ var gExtensionsViewController = {
|
|||
doCommand: function (aCommand)
|
||||
{
|
||||
if (this.isCommandEnabled(aCommand))
|
||||
this.commands[aCommand](gExtensionsView.selected);
|
||||
this.commands[aCommand](gExtensionsView.selectedItem);
|
||||
},
|
||||
|
||||
onCommandUpdate: function ()
|
||||
|
@ -895,7 +895,7 @@ var gExtensionsViewController = {
|
|||
var movingID = aSelectedItem.id;
|
||||
var moveTopID = gExtensionsView.children[0].id;
|
||||
gExtensionManager.moveToIndexOf(movingID, moveTopID);
|
||||
gExtensionsView.selected = document.getElementById(movingID);
|
||||
gExtensionsView.selectedItem = document.getElementById(movingID);
|
||||
},
|
||||
|
||||
cmd_moveup: function (aSelectedItem)
|
||||
|
@ -903,7 +903,7 @@ var gExtensionsViewController = {
|
|||
var movingID = aSelectedItem.id;
|
||||
var moveAboveID = aSelectedItem.previousSibling.id;
|
||||
gExtensionManager.moveToIndexOf(movingID, moveAboveID);
|
||||
gExtensionsView.selected = document.getElementById(movingID);
|
||||
gExtensionsView.selectedItem = document.getElementById(movingID);
|
||||
},
|
||||
|
||||
cmd_movedn: function (aSelectedItem)
|
||||
|
@ -911,7 +911,7 @@ var gExtensionsViewController = {
|
|||
var movingID = aSelectedItem.id;
|
||||
var moveBelowID = aSelectedItem.nextSibling.id;
|
||||
gExtensionManager.moveToIndexOf(movingID, moveBelowID);
|
||||
gExtensionsView.selected = document.getElementById(movingID);
|
||||
gExtensionsView.selectedItem = document.getElementById(movingID);
|
||||
},
|
||||
|
||||
cmd_update: function (aSelectedItem)
|
||||
|
@ -961,12 +961,10 @@ var gExtensionsViewController = {
|
|||
return;
|
||||
|
||||
var selectedID = aSelectedItem.id;
|
||||
var selectedElement = document.getElementById(selectedID);
|
||||
var nextElement = selectedElement.nextSibling;
|
||||
if (!nextElement)
|
||||
nextElement = selectedElement.previousSibling;
|
||||
nextElement = nextElement.id;
|
||||
|
||||
// if no next item, go to the previous one
|
||||
if (!gExtensionsView.goDown())
|
||||
gExtensionsView.goUp();
|
||||
|
||||
if (gWindowState == "themes") {
|
||||
// If the theme being uninstalled is the current theme, we need to reselect
|
||||
// the default.
|
||||
|
@ -977,10 +975,9 @@ var gExtensionsViewController = {
|
|||
this.cmd_useTheme(document.getElementById(PREFIX_ITEM_URI + "{972ce4c6-7e08-4474-a285-3208198ce6fd}"));
|
||||
}
|
||||
gExtensionManager.uninstallItem(getIDFromResourceURI(selectedID));
|
||||
|
||||
gExtensionsView.selected = document.getElementById(nextElement);
|
||||
|
||||
},
|
||||
|
||||
|
||||
cmd_showFolder: function (aSelectedItem)
|
||||
{
|
||||
var id = getIDFromResourceURI(aSelectedItem.id);
|
||||
|
@ -993,13 +990,13 @@ var gExtensionsViewController = {
|
|||
cmd_disable: function (aSelectedItem)
|
||||
{
|
||||
gExtensionManager.disableItem(getIDFromResourceURI(aSelectedItem.id));
|
||||
gExtensionsView.selected = document.getElementById(aSelectedItem.id);
|
||||
gExtensionsView.selectedItem = document.getElementById(aSelectedItem.id);
|
||||
},
|
||||
|
||||
cmd_enable: function (aSelectedItem)
|
||||
{
|
||||
gExtensionManager.enableItem(getIDFromResourceURI(aSelectedItem.id));
|
||||
gExtensionsView.selected = document.getElementById(aSelectedItem.id);
|
||||
gExtensionsView.selectedItem = document.getElementById(aSelectedItem.id);
|
||||
#ifdef MOZ_PHOENIX
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
# Doron Rosenberg <doronr@us.ibm.com>
|
||||
#
|
||||
# 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
|
||||
|
@ -50,11 +51,26 @@
|
|||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="extension" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
|
||||
<binding id="extension-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<implementation>
|
||||
<method name="fireEvent">
|
||||
<parameter name="aEventType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var e = document.createEvent("Events");
|
||||
e.initEvent(this.eventPrefix + aEventType, false, true);
|
||||
this.dispatchEvent(e);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension" extends="chrome://mozapps/content/extensions/extensions.xml#extension-base">
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
|
@ -69,13 +85,10 @@
|
|||
<xul:label class="extension-item-description" xbl:inherits="value=description" crop="right"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-downloading" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
|
||||
<binding id="extension-downloading" extends="chrome://mozapps/content/extensions/extensions.xml#extension-base">
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
|
|
|
@ -57,18 +57,18 @@
|
|||
persist="width height screenX screenY sizeMode"
|
||||
onload="Startup();" onunload="Shutdown();"
|
||||
onclose="return closeWindow(false);">
|
||||
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/extensions/extensions.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
|
||||
|
||||
<stringbundleset id="extensionsSet">
|
||||
<stringbundle id="brandStrings" src="chrome://branding/locale/brand.properties"/>
|
||||
<stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/>
|
||||
<stringbundle id="xpinstallStrings" src="chrome://global/locale/xpinstall/xpinstall.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
|
||||
<keyset id="extensionsKeys">
|
||||
<key id="key_close" key="&cmd.close.commandKey;" modifiers="accel" command="cmd_close"
|
||||
oncommand="gExtensionsViewController.doCommand('cmd_close');"/>
|
||||
|
@ -79,9 +79,9 @@
|
|||
<key id="key_options" key="&cmd.options.commandKey;" modifiers="accel" command="cmd_options"
|
||||
oncommand="gExtensionsViewController.doCommand('cmd_options');"/>
|
||||
</keyset>
|
||||
|
||||
|
||||
<commandset id="extensionsCommands"
|
||||
events="richview-select,focus"
|
||||
events="richview-select"
|
||||
commandupdater="true"
|
||||
oncommandupdate="gExtensionsViewController.onCommandUpdate();"
|
||||
oncommand="gExtensionsViewController.doCommand(event.target.id);">
|
||||
|
@ -136,17 +136,16 @@
|
|||
<menuitem id="menuitem_showFolder" command="cmd_showFolder"
|
||||
label="&cmd.showFolder.label;" accesskey="&cmd.showFolder.accesskey;"/>
|
||||
</vbox>
|
||||
|
||||
|
||||
<popup id="extensionContextMenu" onpopupshowing="return buildContextMenu(event);"/>
|
||||
|
||||
<hbox flex="1">
|
||||
<view id="extensionsView" flex="3" style="overflow: auto;"
|
||||
context="extensionContextMenu"
|
||||
datasources="rdf:null" persist="last-selected"
|
||||
ondragenter="nsDragAndDrop.dragEnter(event, gExtensionsDNDObserver);"
|
||||
ondragover="nsDragAndDrop.dragOver(event, gExtensionsDNDObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, gExtensionsDNDObserver);"
|
||||
ondblclick="onViewDoubleClick(event);">
|
||||
<richlistbox id="extensionsView" flex="3" context="extensionContextMenu"
|
||||
datasources="rdf:null" persist="last-selected"
|
||||
ondragenter="nsDragAndDrop.dragEnter(event, gExtensionsDNDObserver);"
|
||||
ondragover="nsDragAndDrop.dragOver(event, gExtensionsDNDObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, gExtensionsDNDObserver);"
|
||||
ondblclick="onViewDoubleClick(event);">
|
||||
<template>
|
||||
<rule>
|
||||
<conditions>
|
||||
|
@ -238,7 +237,7 @@
|
|||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</view>
|
||||
</richlistbox>
|
||||
<vbox flex="5" id="themePreviewArea" class="themePreviewArea" hidden="true">
|
||||
<deck id="previewImageDeck" flex="1">
|
||||
<vbox id="noThemeSelected" pack="center" align="center">
|
||||
|
@ -267,11 +266,11 @@
|
|||
<button id="uninstallButton"
|
||||
label="&cmd.uninstall.label;" accesskey="&cmd.uninstall.accesskey;" tooltiptext="&cmd.uninstall.tooltip;"
|
||||
command="cmd_uninstall"/>
|
||||
<separator class="commandBarSeparator"/>
|
||||
<separator class="commandBarSeparator"/>
|
||||
<button id="updateButton"
|
||||
label="&cmd.update.label;" accesskey="&cmd.update.accesskey;" tooltiptext="&cmd.update.tooltip;"
|
||||
command="cmd_update"/>
|
||||
<separator class="commandBarSeparator"/>
|
||||
<separator class="commandBarSeparator"/>
|
||||
<button id="optionsButton" command="cmd_options"
|
||||
#ifdef XP_WIN
|
||||
label="&cmd.options.label;" accesskey="&cmd.options.accesskey;" tooltiptext="&cmd.options.tooltip;"/>
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
/* Download View */
|
||||
#downloadView {
|
||||
-moz-binding: url("chrome://mozapps/skin/downloads/downloads.xml#download-view");
|
||||
margin: 0px;
|
||||
-moz-user-focus: normal;
|
||||
border-bottom: 1px solid #8E8E8E;
|
||||
|
||||
}
|
||||
|
||||
.downloadViewInner2 {
|
||||
|
@ -86,7 +83,6 @@ label:last-child {
|
|||
text-decoration: underline;
|
||||
color: blue !important;
|
||||
cursor: pointer;
|
||||
-moz-user-focus: normal;
|
||||
font-size: 100% !important;
|
||||
margin-left: 6px;
|
||||
padding: 0px;
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
|
||||
/* Download View */
|
||||
#downloadView {
|
||||
-moz-binding: url("chrome://mozapps/skin/downloads/downloads.xml#download-view");
|
||||
margin: 10px 10px 5px 10px;
|
||||
-moz-appearance: listbox;
|
||||
-moz-user-focus: normal;
|
||||
background-color: Window;
|
||||
}
|
||||
|
||||
|
@ -49,7 +47,6 @@ download {
|
|||
-moz-padding-end: 10px;
|
||||
min-height: 25px;
|
||||
border-bottom: 1px dotted #C0C0C0;
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
||||
download[selected="true"] {
|
||||
|
@ -80,7 +77,6 @@ download[state="5"], download[state="6"] {
|
|||
text-decoration: underline;
|
||||
color: blue;
|
||||
cursor: pointer;
|
||||
-moz-user-focus: normal;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,12 @@
|
|||
outline: 1px dotted invert ! important;
|
||||
}
|
||||
|
||||
richlistbox {
|
||||
margin: 10px 10px 5px 10px;
|
||||
-moz-appearance: listbox;
|
||||
background-color: Window;
|
||||
}
|
||||
|
||||
/* Extension List Items */
|
||||
extension[selected="true"] {
|
||||
background-image: url("chrome://mozapps/skin/shared/itemSelected.png");
|
||||
|
|
Загрузка…
Ссылка в новой задаче