This commit is contained in:
blakeross%telocity.com 2002-09-30 03:22:13 +00:00
Родитель 15aec4686f
Коммит 679d8a9d24
14 изменённых файлов: 609 добавлений и 262 удалений

Просмотреть файл

@ -2521,23 +2521,6 @@ function toNavigator()
OpenBrowserWindow();
}
function toDownloadManager()
{
var dlmgr = Components.classes['@mozilla.org/download-manager;1'].getService();
dlmgr = dlmgr.QueryInterface(Components.interfaces.nsIDownloadManager);
var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
windowMediator = windowMediator.QueryInterface(nsIWindowMediator);
var dlmgrWindow = windowMediator.getMostRecentWindow("Download:Manager");
if (dlmgrWindow) {
dlmgrWindow.focus();
}
else {
window.openDialog("chrome://browser/content/downloads/downloadmanager.xul", "Downloads", "chrome,extrachrome,resizable,scrollbars,toolbar,dialog=no");
}
}
function toJavaScriptConsole()
{
toOpenWindowByType("global:console", "chrome://browser/content/console/console.xul");

Просмотреть файл

@ -171,6 +171,7 @@ Contributor(s):
<command id="Browser:OpenLocation" oncommand="openLocation();"/>
<broadcaster id="viewDownloadsSidebar" autoCheck="false" label="&downloadsButton.label;"
type="checkbox" group="sidebar" sidebarurl="chrome://browser/content/downloads/downloadPanel.xul"
sidebartitle="&currentDownloads.label;"
oncommand="toggleSidebar('viewDownloadsSidebar');"/>
<broadcaster id="viewBookmarksSidebar" autoCheck="false" label="&bookmarksButton.label;"
@ -702,7 +703,6 @@ Contributor(s):
<menu label="&tasksMenu.label;" accesskey="&tasksMenu.accesskey;" onpopupshowing="javaItemEnabling();">
<menupopup>
<menuitem label="&historyCmd.label;" accesskey="&historyCmd.accesskey;" oncommand="toHistory()" key="key_gotoHistory"/>
<menuitem label="&downloadManagerCmd.label;" accesskey="&downloadManagerCmd.accesskey;" oncommand="toDownloadManager();"/>
<menuseparator/>
<menuitem id="java" label="&javaConsoleCmd.label;" accesskey="&javaConsoleCmd.accesskey;" oncommand="toJavaConsole()"/>
<menuitem label="&javaScriptConsoleCmd.label;" accesskey="&javaScriptConsoleCmd.accesskey;" oncommand="toJavaScriptConsole();"/>
@ -883,9 +883,9 @@ Contributor(s):
<hbox flex="1">
<vbox id="sidebar-box" hidden="true">
<hbox id="sidebar-header" align="center" pack="start">
<sidebarheader align="center">
<label id="sidebar-title"/>
</hbox>
</sidebarheader>
<browser id="sidebar" flex="1"
style="min-width: 150px; width: 200px; max-width: 400px;"/>
</vbox>

Просмотреть файл

@ -253,3 +253,4 @@
<!ENTITY newWindowButton.tooltip "Opens a new tab">
<!ENTITY findOnSearchBarCmd.label "Find in this Page">
<!ENTITY currentDownloads.label "Current Downloads">

Просмотреть файл

@ -704,23 +704,11 @@ toolbar[iconsize="small"] #history-button[disabled="true"] {
-moz-image-region: rect(0px 53px 27px 27px) !important;
}
#sidebar-header {
height: 23px;
background-color: -moz-Dialog;
-moz-appearance: toolbox;
border-bottom: 1px solid ThreeDShadow;
border-top: 1px solid ThreeDHighlight;
}
#sidebar {
border-bottom: 1px solid ThreeDShadow;
background-color: white;
}
#sidebar-title {
padding-left: 4px;
}
#go-button[disabled="true"] {
-moz-image-region: rect(0px 80px 27px 54px) !important;
}

Просмотреть файл

@ -1,13 +1,16 @@
const kObserverServiceProgID = "@mozilla.org/observer-service;1";
var gDownloadView, gDownloadManager;
var gDownloadView;
var gDownloadManager;
var gDownloadHistoryView;
var gRDFService;
const dlObserver = {
observe: function(subject, topic, state) {
var subject = subject.QueryInterface(Components.interfaces.nsIDownload);
var elt = document.getElementById(subject.target.path);
var dl = subject.QueryInterface(Components.interfaces.nsIDownload);
var elt = document.getElementById(dl.target.path);
switch (topic) {
case "dl-progress":
elt.setAttribute("progress", subject.percentComplete);
elt.setAttribute("progress", dl.percentComplete);
break;
default:
elt.onEnd(topic);
@ -18,12 +21,19 @@ const dlObserver = {
function Startup() {
gDownloadView = document.getElementById("downloadView");
gDownloadHistoryView = document.getElementById("downloadHistoryView");
const dlmgrContractID = "@mozilla.org/download-manager;1";
const dlmgrIID = Components.interfaces.nsIDownloadManager;
gDownloadManager = Components.classes[dlmgrContractID].getService(dlmgrIID);
var ds = gDownloadManager.datasource;
gDownloadView.database.AddDataSource(ds);
gDownloadView.builder.rebuild();
gDownloadHistoryView.database.AddDataSource(ds);
gDownloadHistoryView.builder.rebuild();
const rdfSvcContractID = "@mozilla.org/rdf/rdf-service;1";
const rdfSvcIID = Components.interfaces.nsIRDFService;
gRDFService = Components.classes[rdfSvcContractID].getService(rdfSvcIID);
var observerService = Components.classes[kObserverServiceProgID]
.getService(Components.interfaces.nsIObserverService);
@ -32,6 +42,11 @@ function Startup() {
observerService.addObserver(dlObserver, "dl-cancel", false);
observerService.addObserver(dlObserver, "dl-failed", false);
window.setTimeout(onRebuild, 0);
}
function onRebuild() {
gDownloadHistoryView.controllers.appendController(downloadViewController);
}
function Shutdown() {
@ -68,3 +83,137 @@ var downloadDNDObserver =
return this._flavourSet;
}
}
function onSelect(aEvent) {
window.updateCommands("tree-select");
}
var downloadViewController = {
supportsCommand: function dVC_supportsCommand (aCommand)
{
switch (aCommand) {
case "cmd_properties":
case "cmd_remove":
case "cmd_openfile":
case "cmd_showinshell":
case "cmd_selectAll":
return true;
}
return false;
},
isCommandEnabled: function dVC_isCommandEnabled (aCommand)
{
var selectionCount = gDownloadHistoryView.selectedCount;
if (!selectionCount) return false;
var selectedItem = gDownloadHistoryView.selectedItem;
switch (aCommand) {
case "cmd_openfile":
return selectionCount == 1;
case "cmd_showinshell":
return selectionCount == 1;
case "cmd_remove":
return selectionCount;
case "cmd_selectAll":
return gDownloadHistoryView.getRowCount() != selectionCount;
default:
return false;
}
},
doCommand: function dVC_doCommand (aCommand)
{
var selectedItem, selectedItems;
var file, i;
switch (aCommand) {
case "cmd_openfile":
selectedItem = gDownloadHistoryView.selectedItem;
file = getFileForItem(selectedItem);
file.launch();
break;
case "cmd_showinshell":
selectedItem = gDownloadHistoryView.selectedItem;
file = getFileForItem(selectedItem);
// on unix, open a browser window rooted at the parent
if (navigator.platform.indexOf("Win") == -1 && navigator.platform.indexOf("Mac") == -1) {
file = file.QueryInterface(Components.interfaces.nsIFile);
var parent = file.parent;
if (parent) {
//XXXBlake use chromeUrlForTask pref here
const browserURL = "chrome://browser/content/browser.xul";
window.openDialog(browserURL, "_blank", "chrome,all,dialog=no", parent.path);
}
}
else {
file.reveal();
}
break;
case "cmd_remove":
selectedItems = gDownloadHistoryView.selectedItems;
var selectedIndex = gDownloadHistoryView.selectedIndex;
gDownloadManager.startBatchUpdate();
// Notify the datasource that we're about to begin a batch operation
var observer = gDownloadHistoryView.builder.QueryInterface(Components.interfaces.nsIRDFObserver);
var ds = gDownloadHistoryView.database;
observer.beginUpdateBatch(ds);
for (i = 0; i <= selectedItems.length - 1; ++i) {
gDownloadManager.removeDownload(selectedItems[i].id);
}
gDownloadManager.endBatchUpdate();
observer.endUpdateBatch(ds);
var remote = gDownloadManager.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
remote.Flush();
gDownloadHistoryView.builder.rebuild();
var rowCount = gDownloadHistoryView.getRowCount();
if (selectedIndex > ( rowCount- 1))
selectedIndex = rowCount - 1;
gDownloadHistoryView.selectedIndex = selectedIndex;
break;
case "cmd_selectAll":
gDownloadHistoryView.selectAll();
break;
default:
}
},
onEvent: function dVC_onEvent (aEvent)
{
switch (aEvent) {
case "tree-select":
this.onCommandUpdate();
}
},
onCommandUpdate: function dVC_onCommandUpdate ()
{
var cmds = ["cmd_properties", "cmd_pause", "cmd_cancel", "cmd_remove",
"cmd_openfile", "cmd_showinshell"];
for (var command in cmds)
goUpdateCommand(cmds[command]);
}
};
function getFileForItem(aElement)
{
var itemResource = gRDFService.GetResource(aElement.id);
var NC_File = gRDFService.GetResource(NC_NS + "File");
var fileResource = gDownloadHistoryView.database.GetTarget(itemResource, NC_File, true);
fileResource = fileResource.QueryInterface(Components.interfaces.nsIRDFResource);
return createLocalFile(fileResource.Value);
}
function createLocalFile(aFilePath)
{
var lfContractID = "@mozilla.org/file/local;1";
var lfIID = Components.interfaces.nsILocalFile;
var lf = Components.classes[lfContractID].createInstance(lfIID);
lf.initWithPath(aFilePath);
return lf;
}

Просмотреть файл

@ -2,6 +2,11 @@
<?xml-stylesheet href="chrome://browser/content/downloads/downloadmanager.css"?>
<?xml-stylesheet href="chrome://browser/skin/downloads/downloadmanager.css"?>
<!DOCTYPE window [
<!ENTITY % downloadManagerDTD SYSTEM "chrome://browser/locale/downloads/downloadmanager.dtd">
%downloadManagerDTD;
]>
<page xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
@ -11,8 +16,28 @@
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<vbox id="downloadView" flex="1" style="overflow: auto;"
<commandset id="commandUpdate_Downloads"
commandupdater="true"
events="focus,list-select"
oncommandupdate="downloadViewController.onCommandUpdate()"/>
<command id="cmd_properties"
oncommand="goDoCommand('cmd_properties');"/>
<command id="cmd_remove"
oncommand="goDoCommand('cmd_remove');"/>
<command id="cmd_openfile"
oncommand="goDoCommand('cmd_openfile');"/>
<command id="cmd_showinshell"
oncommand="goDoCommand('cmd_showinshell');"/>
<keyset>
<key id="key_remove" keycode="VK_DELETE" command="cmd_remove"/>
</keyset>
<vbox flex="1">
<vbox id="downloadView" flex="3" style="overflow: auto;"
datasources="rdf:null" ref="NC:DownloadsRoot"
ondragdrop="nsDragAndDrop.drop(event, downloadDNDObserver);">
<template>
@ -24,4 +49,63 @@
</rule>
</template>
</vbox>
<splitter style="min-height: 3px; height: 3px; border-right: 0px"/>
<vbox flex="1">
<sidebarheader align="center">
<label value="&finishedDownloads.label;"/>
</sidebarheader>
<toolbox id="toolbox">
<toolbar id="download-toolbar" tbalign="stretch" class="chromeclass-toolbar" persist="collapsed">
<toolbarbutton label="&cmd.remove.label;" accesskey="&cmd.remove.accesskey;"
command="cmd_remove"/>
<toolbarseparator/>
<toolbarbutton id="btn_openfile" label="&cmd.openfile.label;" accesskey="&cmd.openfile.accesskey;"
command="cmd_openfile"/>
<toolbarbutton id="btn_showinshell" label="&cmd.show.label;"
accesskey="&cmd.show.accesskey;" command="cmd_showinshell"/>
</toolbar>
</toolbox>
<listbox id="downloadHistoryView" flex="1" class="plain" seltype="multiple"
datasources="rdf:null" ref="NC:DownloadsRoot" flags="dont-test-empty"
enableColumnDrag="true"
onselect="onSelect(event);">
<listcols>
<listcol id="Name" primary="true"
label="&name.label;"
class="sortDirectionIndicator" width="3*" flex="3"
sort="http://home.netscape.com/NC-rdf#Name"
persist="width sortActive sortDirection"/>
</listcols>
<template>
<rule nc:DownloadState="1" parsetype="Integer">
<listitem uri="rdf:*">
<listrow>
<listcell>
<image src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"/>
<label value="rdf:http://home.netscape.com/NC-rdf#Name"/>
</listcell>
</listrow>
</listitem>
</rule>
<rule nc:DownloadState="2" parsetype="Integer">
<listitem uri="rdf:*">
<listrow>
<listcell src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</listrow>
</listitem>
</rule>
<rule nc:DownloadState="3" parsetype="Integer">
<listitem uri="rdf:*">
<listrow>
<listcell src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</listrow>
</listitem>
</rule>
</template>
</listbox>
</vbox>
</vbox>
</page>

Просмотреть файл

@ -1,202 +0,0 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape 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/NPL/
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 mozilla.org code.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s):
Ben Goodger <ben@netscape.com> (Original Author)
Blake Ross <blaker@netscape.com>
Jan Varga <varga@utcru.sk>
-->
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/skin/downloads/downloadmanager.css"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % downloadManagerDTD SYSTEM "chrome://browser/locale/downloads/downloadmanager.dtd">
%downloadManagerDTD;
<!ENTITY % downloadProgressDTD SYSTEM "chrome://global/locale/nsProgressDialog.dtd" >
%downloadProgressDTD;
]>
<window id="downloadManager"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
windowtype="Download:Manager"
width="500" height="300" screenX="10" screenY="10"
persist="width height screenX screenY"
title="&downloadManager.title;"
onload="Startup();">
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://browser/content/downloads/downloadmanager.js"/>
<stringbundle id="dlMgrBundle"
src="chrome://browser/locale/downloads/downloadmanager.properties"/>
<stringbundle id="dlProgressDlgBundle"
src="chrome://global/locale/nsProgressDialog.properties"/>
<data id="strings.confirmCancel">&confirmCancel;</data>
<data id="strings.progressMsgNoRate">&progressMsgNoRate;</data>
<data id="strings.rateMsg">&rateMsg;</data>
<data id="strings.completeMsg">&completeMsg;</data>
<data id="strings.percentMsg">&percentMsg;</data>
<data id="strings.shortTimeFormat">&shortTimeFormat;</data>
<data id="strings.longTimeFormat">&longTimeFormat;</data>
<data id="strings.unknownTime">&unknownTime;</data>
<data id="strings.pausedMsg">&pausedMsg;</data>
<commandset id="commandUpdate_Downloads"
commandupdater="true"
events="focus,tree-select"
oncommandupdate="downloadViewController.onCommandUpdate()"/>
<commandset id="downloadCommands">
<command id="cmd_properties"
oncommand="goDoCommand('cmd_properties');"/>
<command id="cmd_remove"
oncommand="goDoCommand('cmd_remove');"/>
<command id="cmd_openfile"
oncommand="goDoCommand('cmd_openfile');"/>
<command id="cmd_showinshell"
oncommand="goDoCommand('cmd_showinshell');"/>
</commandset>
<!-- File Menu -->
<command id="cmd_close" oncommand="close()"/>
<keyset>
<key id="key_close"/>
<!-- These keybindings do not have a command specified in the overlay,
which is good, but we need to specify it ourselves here -->
<key id="key_selectAll" command="cmd_selectAll"/>
<key id="key_remove" keycode="VK_DELETE" command="cmd_remove"/>
</keyset>
<toolbox id="toolbox">
<toolbar id="download-toolbar" tbalign="stretch" class="chromeclass-toolbar" persist="collapsed">
<toolbarbutton label="&cmd.remove.label;" accesskey="&cmd.remove.accesskey;"
command="cmd_remove"/>
<toolbarseparator/>
<toolbarbutton id="btn_openfile" label="&cmd.openfile.label;" accesskey="&cmd.openfile.accesskey;"
command="cmd_openfile"/>
<toolbarbutton id="btn_showinshell" command="cmd_showinshell"/>
</toolbar>
</toolbox>
<tree id="downloadView" flex="1" class="plain"
datasources="rdf:null" ref="NC:DownloadsRoot" flags="dont-test-empty"
enableColumnDrag="true"
onselect="this.treeBoxObject.view.selectionChanged(); onSelect(event);">
<treecols>
<treecol id="Name" primary="true"
label="&name.label;"
class="sortDirectionIndicator" width="3*" flex="3"
sort="http://home.netscape.com/NC-rdf#Name"
persist="width sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol id="StatusText"
label="&status.label;"
class="sortDirectionIndicator" width="1*" flex="1"
sort="http://home.netscape.com/NC-rdf#StatusText"
persist="width hidden sortActive sortDirection"/>
<!--
<splitter class="tree-splitter"/>
<treecol id="TimeRemaining"
label="&timeremaining.label;"
class="sortDirectionIndicator" width="1*" flex="1"
sort="http://home.netscape.com/NC-rdf#TimeRemaining"
persist="width hidden sortActive sortDirection"/>
-->
<splitter class="tree-splitter"/>
<treecol id="Transferred"
label="&transferred.label;"
class="sortDirectionIndicator" width="1*" flex="1"
sort="http://home.netscape.com/NC-rdf#Transferred"
persist="width hidden sortActive sortDirection"/>
<!--
<splitter class="tree-splitter"/>
<treecol id="TimeElapsed" hidden="true"
label="&timeelapsed.label;"
class="sortDirectionIndicator" width="1*" flex="1"
sort="http://home.netscape.com/NC-rdf#TimeElapsed"
persist="width hidden sortActive sortDirection"/>
-->
<splitter class="tree-splitter"/>
<treecol id="Source"
label="&source.label;"
class="sortDirectionIndicator" width="1*" flex="1"
sort="http://home.netscape.com/NC-rdf#URL"
persist="width hidden sortActive sortDirection"/>
</treecols>
<template>
<rule nc:DownloadState="1" parsetype="Integer">
<treechildren>
<treeitem uri="rdf:*">
<treerow>
<treecell src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
<treecell label="rdf:http://home.netscape.com/NC-rdf#StatusText"/>
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeRemaining"/> -->
<treecell label="rdf:http://home.netscape.com/NC-rdf#Transferred"/>
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeElapsed"/> -->
<treecell label="rdf:http://home.netscape.com/NC-rdf#URL"/>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule nc:DownloadState="2" parsetype="Integer">
<treechildren>
<treeitem uri="rdf:*">
<treerow>
<treecell src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
<treecell label="rdf:http://home.netscape.com/NC-rdf#StatusText"/>
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeRemaining"/> -->
<treecell label="rdf:http://home.netscape.com/NC-rdf#Transferred"/>
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeElapsed"/> -->
<treecell label="rdf:http://home.netscape.com/NC-rdf#URL"/>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule nc:DownloadState="3" parsetype="Integer">
<treechildren>
<treeitem uri="rdf:*">
<treerow>
<treecell src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
<treecell label="rdf:http://home.netscape.com/NC-rdf#StatusText"/>
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeRemaining"/> -->
<treecell label="rdf:http://home.netscape.com/NC-rdf#Transferred"/>
<!-- <treecell label="rdf:http://home.netscape.com/NC-rdf#TimeElapsed"/> -->
<treecell label="rdf:http://home.netscape.com/NC-rdf#URL"/>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
</tree>
</window>

Просмотреть файл

@ -16,6 +16,7 @@
<!ENTITY divider.label "-">
<!ENTITY show.label "Show">
<!ENTITY failed.label "Failed">
<!ENTITY finishedDownloads.label "Finished Downloads">
<!ENTITY downloadManager.title "Download Manager">
@ -24,12 +25,14 @@
<!ENTITY cmd.properties.keybinding "i">
<!ENTITY cmd.pause.label "Pause">
<!ENTITY cmd.pause.accesskey "p">
<!ENTITY cmd.remove.label "Remove from List">
<!ENTITY cmd.remove.label "Remove">
<!ENTITY cmd.remove.accesskey "r">
<!ENTITY cmd.cancel.label "Cancel">
<!ENTITY cmd.cancel.accesskey "c">
<!ENTITY cmd.openfile.label "Launch File">
<!ENTITY cmd.openfile.label "Launch">
<!ENTITY cmd.openfile.accesskey "L">
<!ENTITY cmd.show.label "Show">
<!ENTITY cmd.show.accesskey "S">
<!ENTITY confirmCancel "Are you sure you want to cancel the saving of this file?">
<!ENTITY progressMsgNoRate "#1KB of #2KB">
<!ENTITY rateMsg "#1KB/sec">

Просмотреть файл

@ -0,0 +1,250 @@
<?xml version="1.0"?>
<bindings id="buttonBindings"
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="button-base" extends="chrome://global/content/bindings/general.xml#basetext">
<implementation implements="nsIDOMXULButtonElement, nsIAccessibleProvider">
<property name="accessible">
<getter>
<![CDATA[
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
return accService.createXULButtonAccessible(this);
]]>
</getter>
</property>
<property name="type"
onget="return this.getAttribute('type');"
onset="this.setAttribute('type', val); return val;"/>
<property name="dlgType"
onget="return this.getAttribute('dlgType');"
onset="this.setAttribute('dlgType', val); return val;"/>
<property name="group"
onget="return this.getAttribute('group');"
onset="this.setAttribute('group', val); return val;"/>
<property name="open"
onget="return this.hasAttribute('open');"
onset="if (val) this.setAttribute('open', 'true');
else this.removeAttribute('open'); return val;"/>
<property name="checked" onget="return this.hasAttribute('checked');">
<setter><![CDATA[
if (this.type == "checkbox") {
this.checkState = val ? 1 : 0;
} else if (this.type == "radio" && val) {
var sibs = this.parentNode.getElementsByAttribute("group", this.group);
for (var i = 0; i < sibs.length; ++i)
sibs[i].removeAttribute("checked");
}
if (val)
this.setAttribute("checked", "true");
else
this.removeAttribute("checked");
return val;
]]></setter>
</property>
<property name="checkState">
<getter><![CDATA[
var state = this.getAttribute("checkState");
if (state == "")
return this.checked ? 1 : 0;
else
return state == "0" ? 0 : (state == "2" ? 2 : 1);
]]></getter>
<setter><![CDATA[
this.setAttribute("checkState", val);
return val;
]]></setter>
</property>
<property name="autoCheck"
onget="return this.getAttribute('autoCheck') == 'true';"
onset="this.setAttribute('autoCheck', val); return val;"/>
</implementation>
<handlers>
<handler event="command">
<![CDATA[
if (this.autoCheck || !this.hasAttribute("autoCheck")) {
if (this.type == "checkbox") {
this.checked = !this.checked;
} else if (this.type == "radio") {
this.checked = true;
}
}
]]>
</handler>
</handlers>
</binding>
<binding id="button" display="xul:button"
extends="chrome://global/content/widgets/button.xml#button-base">
<resources>
<stylesheet src="chrome://global/skin/button.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:hbox class="box-inherit button-box" xbl:inherits="align,dir,pack,orient"
align="center" pack="center" flex="1">
<children>
<xul:image class="button-icon" xbl:inherits="src=image"/>
<xul:label class="button-text" xbl:inherits="value=label,accesskey,crop" flex="1"/>
</children>
</xul:hbox>
</content>
</binding>
<binding id="menu" display="xul:menu"
extends="chrome://global/content/widgets/button.xml#button">
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:hbox class="box-inherit button-box" xbl:inherits="align,dir,pack,orient"
align="center" pack="center" flex="1">
<children>
<xul:image class="button-icon" xbl:inherits="src=image"/>
<xul:label class="button-text" xbl:inherits="value=label,accesskey,crop" flex="1"/>
<xul:dropmarker class="button-menu-dropmarker" xbl:inherits="open,disabled"/>
</children>
</xul:hbox>
</content>
</binding>
<binding id="menu-button-base"
extends="chrome://global/content/widgets/button.xml#button-base">
<implementation>
<constructor>
this.init();
</constructor>
<method name="init">
<body>
<![CDATA[
var btn = document.getAnonymousElementByAttribute(this, "anonid", "button");
if (!btn)
throw "XBL binding for <button type=\"menu-button\"/> binding must contain an element with anonid=\"button\"";
btn._menubuttonParent = this;
btn.addEventListener("mouseover", function() {
if (!this.disabled)
this._menubuttonParent.buttonover = true;
}, true);
btn.addEventListener("mouseout", function() {
this._menubuttonParent.buttonover = false;
}, true);
btn.addEventListener("mousedown", function() {
if (!this.disabled) {
this._menubuttonParent.buttondown = true;
this._menubuttonParent._captureMouseUp();
}
}, true);
]]>
</body>
</method>
<property name="buttonover" onget="return this.getAttribute('buttonover');">
<setter>
<![CDATA[
var v = val || val == "true";
if (!v && this.buttondown) {
this.buttondown = false;
this._pendingActive = true;
}
else {
if (this._pendingActive) {
this.buttondown = true;
this._pendingActive = false;
}
}
if (v)
this.setAttribute("buttonover", "true");
else
this.removeAttribute("buttonover");
return val;
]]>
</setter>
</property>
<property name="buttondown" onget="return this.getAttribute('buttondown') == 'true';">
<setter>
<![CDATA[
if (val || val == "true")
this.setAttribute("buttondown", "true");
else
this.removeAttribute("buttondown");
return val;
]]>
</setter>
</property>
<field name="_pendingActive">false</field>
<method name="_captureMouseUp">
<body>
<![CDATA[
document.__ButtonMenuMouseDown__ = this;
document.addEventListener("mouseup", this._onGlobalMouseUp, true);
]]>
</body>
</method>
<method name="_onGlobalMouseUp" readonly="true">
<body>
<![CDATA[
var btn = document.__ButtonMenuMouseDown__;
btn._onMouseReallyUp();
document.removeEventListener("mouseup", btn._onGlobalMouseUp, true);
delete document.__ButtonMenuMouseDown__;
]]>
</body>
</method>
<method name="_onMouseReallyUp">
<body>
<![CDATA[
this._pendingActive = false;
this.buttondown = false;
]]>
</body>
</method>
</implementation>
</binding>
<binding id="menu-button" display="xul:menu"
extends="chrome://global/content/widgets/button.xml#menu-button-base">
<resources>
<stylesheet src="chrome://global/skin/button.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:button class="box-inherit button-menubutton-button"
anonid="button" flex="1" allowevents="true"
xbl:inherits="disabled,crop,image,label,accessKey,command,
buttonover,buttondown,align,dir,pack,orient">
<children/>
</xul:button>
<xul:dropmarker class="button-menubutton-dropmarker" xbl:inherits="open,disabled"/>
</content>
</binding>
<binding id="button-image" display="xul:button"
extends="chrome://global/content/widgets/button.xml#button">
<content>
<xul:image class="button-image-icon" xbl:inherits="src=image"/>
</content>
</binding>
</bindings>

Просмотреть файл

@ -0,0 +1,75 @@
<?xml version="1.0"?>
<bindings id="toolbarbuttonBindings"
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="toolbarbutton" display="xul:button"
extends="chrome://global/content/widgets/button.xml#button-base">
<resources>
<stylesheet src="chrome://global/skin/toolbarbutton.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,toolbarmode,buttonstyle"/>
<xul:label class="toolbarbutton-text" crop="right" flex="1"
xbl:inherits="value=label,accesskey,crop,toolbarmode,buttonstyle"/>
</content>
</binding>
<binding id="menu" display="xul:menu"
extends="chrome://global/content/widgets/toolbarbutton.xml#toolbarbutton">
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,toolbarmode,buttonstyle"/>
<xul:label class="toolbarbutton-text" crop="right" flex="1"
xbl:inherits="value=label,accesskey,crop,dragover-top,toolbarmode,buttonstyle"/>
<xul:dropmarker type="menu" class="toolbarbutton-menu-dropmarker" xbl:inherits="disabled"/>
</content>
</binding>
<binding id="menu-button" display="xul:menu"
extends="chrome://global/content/widgets/button.xml#menu-button-base">
<resources>
<stylesheet src="chrome://global/skin/toolbarbutton.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:toolbarbutton class="box-inherit toolbarbutton-menubutton-button"
anonid="button" flex="1" allowevents="true"
xbl:inherits="disabled,crop,image,label,accessKey,command,
align,dir,pack,orient,toolbarmode,buttonstyle"/>
<xul:dropmarker type="menu-button" class="toolbarbutton-menubutton-dropmarker"
xbl:inherits="align,dir,pack,orient,disabled,toolbarmode,buttonstyle"/>
</content>
</binding>
<binding id="toolbarbutton-image"
extends="chrome://global/content/widgets/toolbarbutton.xml#toolbarbutton">
<content>
<xul:image class="toolbarbutton-icon" xbl:inherits="src=image"/>
</content>
</binding>
<binding id="dropmarker">
<content>
<xul:image class="menubutton-dropmarker-icon"/>
</content>
<implementation implements="nsIAccessibleProvider">
<property name="accessible">
<getter>
<![CDATA[
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
return accService.createXULDropmarkerAccessible(this);
]]>
</getter>
</property>
</implementation>
</binding>
</bindings>

Просмотреть файл

@ -99,33 +99,33 @@ vbox {
/********** button **********/
button {
-moz-binding: url("chrome://global/content/bindings/button.xml#button");
-moz-binding: url("chrome://global/content/widgets/button.xml#button");
}
button[type="menu"] {
-moz-binding: url("chrome://global/content/bindings/button.xml#menu");
-moz-binding: url("chrome://global/content/widgets/button.xml#menu");
}
button[type="menu-button"] {
-moz-binding: url("chrome://global/content/bindings/button.xml#menu-button");
-moz-binding: url("chrome://global/content/widgets/button.xml#menu-button");
}
/********** toolbarbutton **********/
toolbarbutton {
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton");
-moz-binding: url("chrome://global/content/widgets/toolbarbutton.xml#toolbarbutton");
}
toolbarbutton[type="menu"] {
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#menu");
-moz-binding: url("chrome://global/content/widgets/toolbarbutton.xml#menu");
}
toolbarbutton[type="menu-button"] {
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#menu-button");
-moz-binding: url("chrome://global/content/widgets/toolbarbutton.xml#menu-button");
}
dropmarker[type="menu-button"] {
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#dropmarker");
-moz-binding: url("chrome://global/content/widgets/toolbarbutton.xml#dropmarker");
}
/******** browser, editor, iframe ********/

Просмотреть файл

@ -17,6 +17,8 @@ toolkit.jar:
content/global/widgets/textbox.xml (content/widgets/textbox.xml)
content/global/widgets/radio.xml (content/widgets/radio.xml)
content/global/widgets/checkbox.xml (content/widgets/checkbox.xml)
content/global/widgets/button.xml (content/widgets/button.xml)
content/global/widgets/toolbarbutton.xml (content/widgets/toolbarbutton.xml)
en-US.jar:
+ locale/en-US/global/charset.dtd (locale/charset.dtd)

Просмотреть файл

@ -136,3 +136,17 @@ statusbarpanel {
.statusbarpanel-iconic {
padding: 0px;
}
/* XXXBlake yeah, shoot me -- these don't belong here. I'll move them later. */
sidebarheader {
height: 23px;
background-color: -moz-Dialog;
-moz-appearance: toolbox;
border-bottom: 1px solid ThreeDShadow;
border-top: 1px solid ThreeDHighlight;
}
sidebarheader > label {
padding-left: 4px;
}

Просмотреть файл

@ -13,9 +13,9 @@
<xul:image class="radio-check" xbl:inherits="selected,checked,disabled"/>
</xul:hbox>
</xul:hbox>
<xul:hbox class="radio-label-box">
<xul:hbox class="radio-label-box" xbl:inherits="flex">
<xul:image class="radio-icon" xbl:inherits="src"/>
<xul:label class="radio-label" xbl:inherits="xbl:text=label,accesskey,crop"/>
<xul:label class="radio-label" xbl:inherits="xbl:text=label,flex,accesskey,crop"/>
</xul:hbox>
</content>
</binding>