131762 - can open multiple occurrences of download manager. reversal. r=hewitt sr=ben a=asa

This commit is contained in:
blakeross%telocity.com 2002-03-20 21:49:18 +00:00
Родитель 5114cb001c
Коммит dbac7895c6
13 изменённых файлов: 120 добавлений и 87 удалений

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

@ -61,12 +61,6 @@ interface nsIProgressDialog : nsIDownload {
* open yet, or has been closed.
*/
attribute nsIDOMWindow dialog;
/**
* Whether or not to cancel the download when the progress dialog is closed.
* If set, the Cancel button will also be hidden.
*/
attribute boolean cancelOnClose;
};

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

@ -52,7 +52,6 @@ function nsProgressDialog() {
// Initialize data properties.
this.mParent = null;
this.mOperation = null;
this.mCancelOnClose = null;
this.mStartTime = ( new Date() ).getTime();
this.observer = null;
this.mLastUpdate = Number.MIN_VALUE; // To ensure first onProgress causes update.
@ -91,8 +90,6 @@ nsProgressDialog.prototype = {
set parent(newval) { return this.mParent = newval; },
get operation() { return this.mOperation; },
set operation(newval) { return this.mOperation = newval; },
get cancelOnClose() { return this.mCancelOnClose; },
set cancelOnClose(newval) { return this.mCancelOnClose = newval; },
get observer() { return this.mObserver; },
set observer(newval) { return this.mObserver = newval; },
get startTime() { return this.mStartTime; },
@ -407,10 +404,6 @@ nsProgressDialog.prototype = {
this.dialogElement( "keep" ).checked = prefs.getBoolPref( "browser.download.progressDnldDialog.keepAlive" );
}
}
if ( !this.cancelOnClose ) {
this.hide( "cancel" );
}
// Initialize title.
this.setTitle();
@ -450,9 +443,7 @@ nsProgressDialog.prototype = {
}
}
this.dialog = null; // The dialog is history.
if ( this.cancelOnClose ) {
this.onCancel();
}
this.onCancel();
},
// onpause event means the user pressed the pause/resume button
@ -759,11 +750,8 @@ nsProgressDialog.prototype = {
// Hide a given dialog field.
hide: function( field ) {
this.dialogElement( field ).setAttribute( "style", "display: none;" );
// Hide the associated separator, too, if one exists.
var separator = this.dialogElement( field+"Separator" );
if ( separator ) {
separator.setAttribute( "style", "display: none;" );
}
// Hide the associated separator, too.
this.dialogElement( field+"Separator" ).setAttribute( "style", "display: none;" );
},
// Return input in hex, prepended with "0x" and leading zeros (to 8 digits).

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

@ -156,12 +156,10 @@
</hbox>
<separator id="keepSeparator"/>
<hbox>
<spacer/>
<button id="cancel" label="&cancel;" oncommand="notifyObserver( 'oncancel' )"/>
<button id="pauseResume" label="&pause;" oncommand="window.notifyObserver( 'onpause' )"/>
<spacer flex="1"/>
<button id="launch" label="&launch;" disabled="true" oncommand="window.notifyObserver( 'onlaunch' )"/>
<button id="reveal" label="&reveal;" disabled="true" oncommand="window.notifyObserver( 'onreveal' )"/>
<spacer/>
</hbox>
</window>

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

@ -666,5 +666,3 @@ pref("capability.policy.default.SOAPCall.invokeVerifySourceHeader", "allAccess")
pref("update_notifications.enabled", true);
pref("update_notifications.provider.0.frequency", 7); // number of days
pref("update_notifications.provider.0.datasource", "chrome://communicator-region/locale/region.properties");
pref("browser.downloadmanager.behavior", 0);

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

@ -39,7 +39,6 @@ REQUIRES = xpcom \
intl \
windowwatcher \
webbrowserpersist \
appshell \
dom \
$(NULL)
CPPSRCS = \

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

@ -30,7 +30,6 @@ REQUIRES = xpcom \
intl \
windowwatcher \
webbrowserpersist \
appshell \
dom \
$(NULL)

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

@ -54,7 +54,6 @@
#include "nsIWebBrowserPersist.h"
#include "nsIWindowWatcher.h"
#include "nsIStringBundle.h"
#include "nsIWindowMediator.h"
/* Outstanding issues/todo:
* 1. Implement pause/resume.
@ -564,8 +563,8 @@ nsDownloadManager::CancelDownload(const char* aPath)
if (NS_FAILED(rv)) return rv;
}
DownloadEnded(aPath, nsnull);
DownloadEnded(aPath, nsnull);
// if there's a progress dialog open for the item,
// we have to notify it that we're cancelling
nsCOMPtr<nsIProgressDialog> dialog;
@ -619,18 +618,9 @@ nsDownloadManager::Open(nsIDOMWindow* aParent)
// if this fails, it fails -- continue.
AssertProgressInfo();
//check for an existing manager window and focus it
nsresult rv;
nsCOMPtr<nsIWindowMediator> wm = do_GetService("@mozilla.org/rdf/datasource;1?name=window-mediator", &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMWindowInternal> recentWindow;
wm->GetMostRecentWindow(NS_LITERAL_STRING("Download:Manager").get(), getter_AddRefs(recentWindow));
if (recentWindow)
return recentWindow->Focus();
// if we ever have the capability to display the UI of third party dl managers,
// we'll open their UI here instead.
nsresult rv;
nsCOMPtr<nsIWindowWatcher> ww = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
if (NS_FAILED(rv)) return rv;
@ -713,8 +703,6 @@ nsDownloadManager::OpenProgressDialogFor(const char* aPath, nsIDOMWindow* aParen
nsXPIDLString openingWith;
download->GetOpeningWith(getter_Copies(openingWith));
dialog->SetCancelOnClose(PR_FALSE);
dl->Init(source, target, nsnull, openingWith, startTime, nsnull);
dl->SetObserver(this);

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

@ -41,10 +41,6 @@
#include "nsIDownload.h"
#include "nsIDownloadManager.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#define DOWNLOAD_MANAGER_BEHAVIOR_PREF "browser.downloadmanager.behavior"
class nsDownloadProxy : public nsIDownload,
public nsIWebProgressListener
@ -68,21 +64,12 @@ public:
rv = dm->AddDownload(aSource, aTarget, aDisplayName, aOpeningWith, aStartTime, aPersist, getter_AddRefs(mInner));
if (NS_FAILED(rv)) return rv;
PRInt32 behavior = 0;
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
char* path;
rv = aTarget->GetPath(&path);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
branch->GetIntPref(DOWNLOAD_MANAGER_BEHAVIOR_PREF, &behavior);
if (behavior == 0)
return dm->Open(nsnull);
if (behavior == 1) {
char* path;
aTarget->GetPath(&path);
return dm->OpenProgressDialogFor(path, nsnull);
}
return rv;
return dm->OpenProgressDialogFor(path, nsnull);
}
@ -91,7 +78,6 @@ public:
return mInner->GetDisplayName(aDisplayName);
}
NS_IMETHODIMP SetDisplayName(const PRUnichar* aDisplayName)
{
return mInner->SetDisplayName(aDisplayName);

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

@ -22,7 +22,6 @@ comm.jar:
content/communicator/pref/pref-cache.xul (prefwindow/resources/content/pref-cache.xul)
content/communicator/pref/pref-colors.js (prefwindow/resources/content/pref-colors.js)
content/communicator/pref/pref-colors.xul (prefwindow/resources/content/pref-colors.xul)
content/communicator/pref/pref-download.xul (prefwindow/resources/content/pref-download.xul)
content/communicator/pref/pref-help.js (prefwindow/resources/content/pref-help.js)
content/communicator/pref/pref-themes.xul (prefwindow/resources/content/pref-themes.xul)
content/communicator/pref/pref-themes.js (prefwindow/resources/content/pref-themes.js)
@ -116,7 +115,6 @@ en-US.jar:
locale/en-US/communicator/pref/pref-debug.dtd (prefwindow/resources/locale/en-US/pref-debug.dtd)
locale/en-US/communicator/pref/pref-debug1.dtd (prefwindow/resources/locale/en-US/pref-debug1.dtd)
locale/en-US/communicator/pref/pref-debug2.dtd (prefwindow/resources/locale/en-US/pref-debug2.dtd)
locale/en-US/communicator/pref/pref-download.dtd (prefwindow/resources/locale/en-US/pref-download.dtd)
locale/en-US/communicator/pref/pref-fonts.dtd (prefwindow/resources/locale/en-US/pref-fonts.dtd)
locale/en-US/communicator/pref/pref-history.dtd (prefwindow/resources/locale/en-US/pref-history.dtd)
locale/en-US/communicator/pref/pref-languages.dtd (prefwindow/resources/locale/en-US/pref-languages.dtd)

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

@ -21,30 +21,121 @@
Contributor(s):
-->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xul-overlay href="chrome://communicator/content/communicatorOverlay.xul"?>
<?xml-stylesheet href="chrome://pref/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://communicator/locale/pref/pref-download.dtd" >
<!DOCTYPE window SYSTEM "chrome://pref/locale/pref-download.dtd" >
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="parent.initPanel('chrome://communicator/content/pref/pref-download.xul');"
headertitle="&lHeader;">
<page xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
headertitle="&lHeader;"
onload="if( parent.handle ) parent.handle.onpageload( 'pref-download' ); else parent.queuedTag = 'pref-download';">
<script type="application/x-javascript">
<![CDATA[
var _elementIDs = ["downloadBehavior"];
]]>
</script>browser.downloadmanager.behavior
<groupbox>
<caption label="&downloadBehavior.label;"/>
<radiogroup id="downloadBehavior" prefstring="browser.downloadmanager.behavior">
<radio value="0" label="&openDM.label;" accesskey="&openDM.accesskey;"/>
<radio value="1" label="&openProgressDialog.label;" accesskey="&openProgressDialog.accesskey;"/>
<radio value="2" label="&doNothing.label;" accesskey="&doNothing.accesskey;"/>
</radiogroup>
// startup function called by the prefs architecture.
function Startup()
{
DoEnabling();
}
</groupbox>
function DoEnabling()
{
var increments = document.getElementById("offlineNewsDownloadIncrements");
var textbox = document.getElementById("offlineNewsDownloadDays");
var radio0 = document.getElementById("offlineNewsDownloadUseDays0");
var radio1 = document.getElementById("offlineNewsDownloadUseDays1");
var downloadByDate = document.getElementById("offlineNewsDownloadByDate");
if( !downloadByDate.checked ) {
increments.setAttribute( "disabled", "true" );
textbox.setAttribute( "disabled", "true" );
radio0.setAttribute( "disabled", "true" );
radio1.setAttribute( "disabled", "true" );
}
else {
radio0.removeAttribute("disabled");
radio1.removeAttribute("disabled");
if( radio0.checked ) {
increments.removeAttribute( "disabled" );
textbox.setAttribute( "disabled", "true" );
}
else if( radio1.checked ) {
textbox.removeAttribute( "disabled" );
increments.setAttribute( "disabled", "true" );
}
}
}
</script>
<html:fieldset>
<html:legend align="left">&newmes;</html:legend>
<html:div class="hspace-both">
<html:input type="checkbox" id="offlineNewsDownloadUnreadOnly"
pref="true" preftype="bool" prefstring="offline.news.download.unread_only"/>
<html:label for="offlineNewsDownloadUnreadOnly" accesskey="offlineNewsDownloadUnreadOnly.accesskey" tabindex="0">
&downOnlyCheck;
</html:label>
</html:div>
<html:div class="hspace-both">
<html:input type="checkbox" id="offlineNewsDownloadByDate"
onclick="DoEnabling();"
pref="true" preftype="bool" prefstring="offline.news.download.by_date"/>
<html:label for="offlineNewsDownloadByDate" accesskey="offlineNewsDownloadByDate.accesskey" tabindex="0">
&downDateCheck;
</html:label>
</html:div>
<html:div class="hspace-both" style="padding-left: 35px;">
<html:table cellpadding="0" cellspacing="0">
<html:tr>
<html:td valign="middle">
<html:input type="radio" name="offline" id="offlineNewsDownloadUseDays0"
onclick="DoEnabling()" style="margin-bottom: 5px;"
pref="true" preftype="int" prefindex="0" prefstring="offline.news.download.use_days"/>
<html:label for="offlineNewsDownloadUseDays0" accesskey="offlineNewsDownloadUseDays0.accesskey" tabindex="0">
&fromRadio.label;
</html:label>
</html:td>
<html:td valign="middle">
<html:select id="offlineNewsDownloadIncrements"
pref="true" preftype="int" prefstring="offline.news.download.increments">
<html:option value="0">&yesterday.select;</html:option>
<html:option value="1">&oneW.select;</html:option>
<html:option value="2">&twoW.select;</html:option>
<html:option value="3">&oneM.select;</html:option>
<html:option value="4">&sixM.select;</html:option>
<html:option value="5">&oneY.select;</html:option>
</html:select>
</html:td>
</html:tr>
<html:tr>
<html:td valign="middle">
<html:input type="radio" name="offline" id="offlineNewsDownloadUseDays1"
onclick="DoEnabling()" style="margin-bottom: 5px;"
pref="true" preftype="int" prefindex="1" prefstring="offline.news.download.use_days"/>
<html:label for="offlineNewsDownloadUseDays1" accesskey="offlineNewsDownloadUseDays1.accesskey" tabindex="0">
&sinceRadio.label;
</html:label>
</html:td>
<html:td valign="middle">
<html:input type="text" size="5" id="offlineNewsDownloadDays"
style="margin-right: 5px; margin-left: 0px;"
pref="true" preftype="int" prefstring="offline.news.download.days"/>
<html:label>&daysAgo;</html:label>
</html:td>
</html:tr>
</html:table>
</html:div>
</html:fieldset>
<html:fieldset>
<html:legend align="left">&Allmsg;</html:legend>
<vbox flex="100%" style="width: 100%; height: 100%">
<html:div class="hspace-both">&offlineMsgs;</html:div>
<html:div class="hspace-both vspace">
<button class="dialog push" label="&select;" align="left"/>
</html:div>
</vbox>
<spacer style="height: 30px;"/>
</html:fieldset>
</page>

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

@ -100,11 +100,6 @@
<outlinercell url="chrome://communicator/content/pref/pref-tabs.xul" label="&tabWindows.label;"/>
</outlinerrow>
</outlineritem>
<outlineritem>
<outlinerrow>
<outlinercell url="chrome://communicator/content/pref/pref-download.xul" label="&download.label;"/>
</outlinerrow>
</outlineritem>
<!-- Taking out Policies panel b/c bug 44121
<outlineritem>
<outlinerrow>

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

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

@ -29,7 +29,6 @@
<!ENTITY debug.label "Debug">
<!ENTITY debug1.label "Events">
<!ENTITY debug2.label "Networking">
<!ENTITY download.label "Downloads">
<!ENTITY search.label "Internet Search">
<!ENTITY policies.label "Security Policies">
<!ENTITY mousewheel.label "Mouse Wheel">