adding initial XUL & js files for window, basic listview/toolbar UI,
controllers etc.
NOT PART OF BUILD!
This commit is contained in:
ben%netscape.com 2001-10-30 11:02:56 +00:00
Родитель a7a955dac5
Коммит 9a364aed7a
12 изменённых файлов: 531 добавлений и 0 удалений

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

@ -0,0 +1,28 @@
#!nmake
#
# 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):
DEPTH=..\..\..
DIRS=resources\content resources\locale resources\locale\win
include <$(DEPTH)\config\rules.mak>

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

@ -0,0 +1,76 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://communicator/skin/"?>
<!DOCTYPE window [
<!ENTITY % platformDTD SYSTEM "chrome://communicator/locale/downloadmanager/platformStrings.ent" >
%platformDTD;
<!ENTITY % itemPropertiesDTD SYSTEM "chrome://communicator/locale/downloadmanager/downloadItemProperties.ent">
%downloadItemProperties;
]>
<dialog id="downloadItemProperties"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
orient="vertical"
style="width: 30em;"
title="&downloadItemProperties.title;"
buttons="accept,cancel" buttonpack="right"
ondialogaccept="return onAccept(event);"
onload="Startup();" onunload="Shutdown();">
<!--
- A large (32x32) icon for the file type
- The files Display or Pretty name.
- The files actual name, if different from above.
- A button to open the file.
- The type of the file
- The remote path from which the file was downloaded
- The local path to which the file was saved
- A button for opening the files containing folder
- The status of the download (KB downloaded from KB total)
-->
<hbox align="center">
<image id="typeIcon"/>
<vbox>
<textbox id="prettyName" class="readonly-label"/>
<textbox id="fileType" class="readonly-label"/>
</vbox>
</hbox>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row>
<text class="label" value="&type.label;"/>
<textbox id="fileType" class="readonly-label"/>
</row>
<row>
<text class="label" value="&remotepath.label;"/>
<textbox id="remotePath" class="readonly-label"/>
</row>
<row>
<text class="label" value="&localPath.label;"/>
<textbox id="localPath" class="readonly-label"/>
<!-- XXX RFE - allow user to change this on the fly -->
</row>
<row>
<text class="label" value="&downloadStatus.label;"/>
<text class="label" id="downloadStatus"/>
</row>
</rows>
</grid>
<hbox align="right">
<button label="&cmd.openfile.label;" accesskey="&cmd.openfile.accesskey;"/>
<button label="&cmd.showinshell.label;" accesskey="&cmd.showinshell.accesskey;"/>
</hbox>
</dialog>

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

@ -0,0 +1,120 @@
var gDownloadView = null;
var gDownloadViewChildren = null;
function Startup()
{
gDownloadView = document.getElementById("downloadView");
gDownloadViewChildren = document.getElementById("downloadViewChildren");
// Select the first item in the view, if any.
if (gDownloadViewChildren.hasChildNodes())
gDownloadView.selectItem(gDownloadViewChildren.firstChild);
gDownloadView.controllers.appendController(downloadViewController);
}
function Shutdown()
{
}
var downloadView = {
onClick: function downloadView_click(aEvent)
{
},
onSelect: function downloadView_select(aEvent)
{
},
};
var downloadViewController = {
supportsCommand: function dVC_supportsCommand (aCommand)
{
switch (aCommand) {
case "cmd_downloadFile":
case "cmd_properties":
case "cmd_pause":
case "cmd_delete":
case "cmd_openfile":
case "cmd_showinshell":
case "cmd_selectAll":
return true;
}
return false;
},
isCommandEnabled: function dVC_isCommandEnabled (aCommand)
{
var cmds = ["cmd_properties", "cmd_pause", "cmd_delete",
"cmd_openfile", "cmd_showinshell"];
var selectionCount = gDownloadView.selectedItems.length;
switch (aCommand) {
case "cmd_downloadFile":
return true;
case "cmd_properties":
case "cmd_openfile":
case "cmd_showinshell":
return selectionCount == 1;
case "cmd_pause":
case "cmd_delete":
return selectionCount > 0;
case "cmd_selectAll":
return gDownloadViewChildren.childNodes.length != selectionCount;
default:
}
},
doCommand: function dVC_doCommand (aCommand)
{
dump("*** command = " + aCommand + "\n");
switch (aCommand) {
case "cmd_downloadFile":
dump("*** show a dialog that lets a user specify a URL to download\n");
break;
case "cmd_properties":
dump("*** show properties for selected item\n");
break;
case "cmd_openfile":
dump("*** launch the file for the selected item\n");
break;
case "cmd_showinshell":
dump("*** show the containing folder for the selected item\n");
break;
case "cmd_pause":
dump("*** pause the transfer for the selected item\n");
break;
case "cmd_delete":
dump("*** delete entries for the selection\n");
// a) Prompt user to confirm end of transfers in progress
// b) End transfers
// c) Delete entries from datasource
break;
case "cmd_selectAll":
gDownloadView.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_delete",
"cmd_openfile", "cmd_showinshell"];
for (var command in cmds)
goUpdateCommand(cmds[command]);
}
};

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

@ -0,0 +1,200 @@
<?xml version="1.0"?>
<!-- <?xml-stylesheet href="chrome://communicator/skin/downloadmanager/downloadmanager.css"?> -->
<?xml-stylesheet href="chrome://communicator/skin/"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % platformDTD SYSTEM "chrome://communicator/locale/downloadmanager/platformStrings.ent" >
%platformDTD;
<!ENTITY % downloadManagerDTD SYSTEM "chrome://communicator/locale/downloadmanager/downloadmanager.ent">
%downloadManagerDTD;
]>
<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#"
windowtype="Download:Manager"
orient="vertical"
width="600" height="400" screenX="10" screenY="10"
persist="width height screenX screenY"
title="&downloadManager.title;"
onload="Startup();" onunload="Shutdown();">
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"></script>
<script type="application/x-javascript" src="chrome://global/content/treePopups.js"></script>
<script type="application/x-javascript" src="chrome://communicator/content/downloadmanager/downloadmanager.js"></script>
<commands id="commands">
<commandset id="commandUpdate_Downloads"
commandupdater="true"
events="focus,tree-select"
oncommandupdate="downloadViewController.onCommandUpdate()"/>
<commandset id="downloadCommands">
<command id="cmd_downloadFile"
label="&cmd.downloadFile.label;" accesskey="&cmd.downloadFile.accesskey;"
oncommand="goDoCommand('cmd_downloadFile');"/>
<command id="cmd_properties"
label="&cmd.properties.label;" accesskey="&cmd.properties.accesskey;"
oncommand="goDoCommand('cmd_properties');"/>
<command id="cmd_pause"
label="&cmd.pause.label;" accesskey="&cmd.pause.accesskey;"
oncommand="goDoCommand('cmd_pause');"/>
<command id="cmd_delete"
label="&cmd.delete.label;" accesskey="&cmd.delete.accesskey;"
oncommand="goDoCommand('cmd_delete');"/>
<command id="cmd_openfile"
label="&cmd.openfile.label;" accesskey="&cmd.openfile.accesskey;"
oncommand="goDoCommand('cmd_openfile');"/>
<command id="cmd_showinshell"
label="&cmd.showinshell.label;" accesskey="&cmd.showinshell.accesskey;"
oncommand="goDoCommand('cmd_showinshell');"/>
</commandset>
<!-- File Menu -->
<command id="cmd_newNavigator"/>
<command id="cmd_close" oncommand="close()"/>
<command id="cmd_quit"/>
</commands>
<keyset id="tasksKeys">
<!-- File Menu -->
<key id="key_newNavigator"/>
<key id="key_close"/>
<key id="key_quit"/>
<!-- 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"/>
<!-- We need to provide our own delete key binding because the key_delete
handler in platformGlobalOverlay.xul maps command to "cmd_delete" which
is NOT what we want! -->
<key id="key_delete" command="cmd_delete"/>
<key id="key_properties" key="&cmd.properties.keybinding;"
command="cmd_properties" modifiers="accel"/>
</keyset>
<toolbar>
<toolbarbutton id="btn_downloadFile" command="cmd_downloadFile"/>
<toolbarseparator/>
<toolbarbutton id="btn_properties" command="cmd_properties"/>
<toolbarbutton id="btn_pause" command="cmd_pause"/>
<toolbarseparator/>
<toolbarbutton id="btn_delete" command="cmd_delete"/>
<toolbarseparator/>
<toolbarbutton id="btn_openfile" command="cmd_openfile"/>
<toolbarbutton id="btn_showinshell" command="cmd_showinshell"/>
</toolbar>
<tree id="downloadView" ref="NC:DownloadsRoot"
datasources="rdf:downloads"
multiple="true" flags="dont-test-empty"
ondragover="nsDragAndDrop.dragOver(event, downloadView);"
ondraggesture="nsDragAndDrop.startDrag(event, downloadView);"
ondragdrop="nsDragAndDrop.drop(event, downloadView);"
onclick="downloadView.onClick(event);"
onselect="downloadView.onSelect(event);"
style="height: 0px; width: 0px;" flex="1">
<treehead>
<treerow id="headRow">
<treecell class="treecell-header sortDirectionIndicator"
label="&view.header.name.label;"
onclick="return TriStateColumnSort('Name');"
observes="Name" />
<treecell class="treecell-header sortDirectionIndicator"
label="&view.header.progress.label;"
onclick="return TriStateColumnSort('Progress');"
observes="Progress" />
<treecell class="treecell-header sortDirectionIndicator"
label="&view.header.timeremaining.label;"
onclick="return TriStateColumnSort('TimeRemaining');"
observes="TimeRemaining" />
<treecell class="treecell-header sortDirectionIndicator"
label="&view.header.transferred.label;"
onclick="return TriStateColumnSort('Transferred');"
observes="Transferred" />
<treecell class="treecell-header sortDirectionIndicator"
label="&view.header.transferrate.label;"
onclick="return TriStateColumnSort('TransferRate');"
observes="TransferRate" />
<treecell class="treecell-header" allowevents="true" id="popupCell">
<menu class="treecell-popupcell-menu" align="center" pack="center">
<menupopup popupanchor="bottomright" popupalign="topright"
onpopupshowing="BuildTreePopup(document.getElementById('theColumns'),
document.getElementById('headRow'), this,
document.getElementById('popupCell'))"/>
</menu>
</treecell>
</treerow>
</treehead>
<template>
<rule>
<treechildren>
<treeitem uri="rdf:*" persist="open" class="download-item"
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
<treerow>
<treecell class="treecell-indent"
label="rdf:http://home.netscape.com/NC-rdf#Name"
src="rdf:http://home.netscape.com/NC-rdf#Icon"
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<treecell>
<progressmeter class="tree-progressmeter" value="rdf:http://home.netscape.com/NC-rdf#Progress"/>
</treecell>
<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#TransferRate"/>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treechildren flex="1" id="downloadViewChildren" context="dlContext"/>
<treecolgroup id="theColumns">
<treecol id="Name"
sortSeparators="true" width="4*" flex="4"
persist="width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol id="Progress"
sortSeparators="true" width="4*" flex="4"
persist="width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#Progress"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol id="TimeRemaining"
sortSeparators="true" width="1*" flex="1"
persist="width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#TimeRemaining"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol id="Transferred"
sortSeparators="true" width="1*" flex="1"
persist="width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#Transferred"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol id="TransferRate"
sortSeparators="true" width="1*" flex="1"
persist="width sortActive sortDirection"
resource="http://home.netscape.com/NC-rdf#TransferRate"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<treecol persist="width" fixed="true" width="14" id="PopupColumn"/>
</treecolgroup>
</tree>
<statusbar id="status-bar">
<statusbarpanel id="statusbar-text" flex="1"/>
</statusbar>
</window>

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

@ -0,0 +1,4 @@
comm.jar:
content/communicator/downloadmanager/downloadmanager.xul
content/communicator/downloadmanager/downloadmanager.js

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

@ -0,0 +1,24 @@
#!nmake
# 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 Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ..\..\..\..\..
include <$(DEPTH)\config\rules.mak>

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

@ -0,0 +1,21 @@
<!ENTITY view.header.name.label "Name">
<!ENTITY view.header.progress.label "Status">
<!ENTITY view.header.timeremaining.label "Time Remaining">
<!ENTITY view.header.transferred.label "Transferred">
<!ENTITY view.header.transferrate.label "Rate">
<!ENTITY downloadManager.title "Download Manager">
<!ENTITY cmd.downloadFile.label "Download File">
<!ENTITY cmd.downloadFile.accesskey "o">
<!ENTITY cmd.properties.label "Properties">
<!ENTITY cmd.properties.accesskey "i">
<!ENTITY cmd.properties.keybinding "i">
<!ENTITY cmd.pause.label "Pause">
<!ENTITY cmd.pause.accesskey "p">
<!ENTITY cmd.delete.label "Delete">
<!ENTITY cmd.delete.accesskey "d">
<!ENTITY cmd.openfile.label "Open File">
<!ENTITY cmd.openfile.accesskey "o">

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

@ -0,0 +1,3 @@
en-US.jar:
locale/en-US/communicator/downloadmanager/downloadmanager.ent

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

@ -0,0 +1,24 @@
#!nmake
# 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 Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ..\..\..\..\..
include <$(DEPTH)\config\rules.mak>

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

@ -0,0 +1,3 @@
en-US.jar:
locale/en-US/communicator/downloadmanager/platformStrings.ent

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

@ -0,0 +1,24 @@
#!nmake
# 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 Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ..\..\..\..\..\..
include <$(DEPTH)\config\rules.mak>

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

@ -0,0 +1,4 @@
<!ENTITY cmd.showinshell.label "Show in Explorer">
<!ENTITY cmd.showinshell.accesskey "e">