Fix for bug 57678. Disable menu item Send and Change button Send to Send Later when offline. R=varada, SR=mscott, A=pdt

This commit is contained in:
ducarroz%netscape.com 2000-11-02 01:39:32 +00:00
Родитель 13fafc7130
Коммит 82717f33fa
2 изменённых файлов: 48 добавлений и 4 удалений

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

@ -37,6 +37,9 @@ msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMs
var commonDialogsService = Components.classes["@mozilla.org/appshell/commonDialogs;1"].getService();
commonDialogsService = commonDialogsService.QueryInterface(Components.interfaces.nsICommonDialogs);
var ioService = Components.classesByID["{9ac9e770-18bc-11d3-9337-00104ba0fd40}"].getService();
ioService = ioService.QueryInterface(Components.interfaces.nsIIOService);
var msgCompose = null;
var MAX_RECIPIENTS = 0;
var currentAttachment = null;
@ -102,6 +105,7 @@ var defaultController =
case "cmd_saveAsFile":
case "cmd_saveAsDraft":
case "cmd_saveAsTemplate":
case "cmd_sendButton":
case "cmd_sendNow":
case "cmd_sendLater":
case "cmd_quit":
@ -207,9 +211,11 @@ var defaultController =
case "cmd_saveAsFile":
case "cmd_saveAsDraft":
case "cmd_saveAsTemplate":
case "cmd_sendNow":
case "cmd_sendButton":
case "cmd_sendLater":
return !windowLocked;
case "cmd_sendNow":
return !(windowLocked || (ioService && ioService.offline))
case "cmd_quit":
return true;
@ -323,6 +329,15 @@ var defaultController =
case "cmd_saveAsFile" : SaveAsFile(true); break;
case "cmd_saveAsDraft" : SaveAsDraft(); break;
case "cmd_saveAsTemplate" : SaveAsTemplate(); break;
case "cmd_sendButton" :
if (defaultController.isCommandEnabled(command))
{
if (ioService && ioService.offline)
SendMessageLater();
else
SendMessage();
}
break;
case "cmd_sendNow" : if (defaultController.isCommandEnabled(command)) SendMessage(); break;
case "cmd_sendLater" : if (defaultController.isCommandEnabled(command)) SendMessageLater(); break;
case "cmd_account" : MsgAccountManager(); break;
@ -368,6 +383,7 @@ function CommandUpdate_MsgCompose()
goUpdateCommand("cmd_saveAsFile");
goUpdateCommand("cmd_saveAsDraft");
goUpdateCommand("cmd_saveAsTemplate");
goUpdateCommand("cmd_sendButton");
goUpdateCommand("cmd_sendNow");
goUpdateCommand("cmd_sendLater");
goUpdateCommand("cmd_quit");
@ -459,6 +475,27 @@ function CommandUpdate_MsgCompose()
} catch(e) {}
}
function UpdateOfflineState()
{
dump("UpdateOfflineState\n");
try {
var sendButton = document.getElementById("button-send");
if (ioService && ioService.offline)
{
sendButton.value = sendButton.getAttribute('later_value');
sendButton.setAttribute('tooltiptext', sendButton.getAttribute('later_tooltiptext'));
}
else
{
sendButton.value = sendButton.getAttribute('now_value');
sendButton.setAttribute('tooltiptext', sendButton.getAttribute('now_tooltiptext'));
}
goUpdateCommand('cmd_sendNow');
} catch(e) {}
}
function DoCommandClose()
{
if (ComposeCanClose())

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

@ -39,6 +39,7 @@
onunload="ComposeUnload()"
onload="ComposeLoad()"
onclose="return ComposeCanClose()"
onfocus="UpdateOfflineState()"
title="&msgComposeWindow.title;"
windowtype="msgcompose"
orient="vertical"
@ -91,6 +92,7 @@
<broadcaster id="cmd_saveAsFile" oncommand="goDoCommand('cmd_saveAsFile')"/>
<broadcaster id="cmd_saveAsDraft" oncommand="goDoCommand('cmd_saveAsDraft')"/>
<broadcaster id="cmd_saveAsTemplate" oncommand="goDoCommand('cmd_saveAsTemplate')"/>
<broadcaster id="cmd_sendButton" oncommand="goDoCommand('cmd_sendButton')"/>
<broadcaster id="cmd_sendNow" oncommand="goDoCommand('cmd_sendNow')"/>
<broadcaster id="cmd_sendLater" oncommand="goDoCommand('cmd_sendLater')"/>
<broadcaster id="cmd_quit"/>
@ -400,9 +402,14 @@
<toolbar class="toolbar-primary" id="composeToolbar" persist="collapsed">
<box id="toolbar_button_box">
<button class="button-toolbar-2 top"
id="button-send" value="&sendButton.label;"
id="button-send" value="&sendButton.label;"
tooltip="aTooltip" tooltiptext="&sendButton.tooltip;"
observes="cmd_sendNow"/>
observes="cmd_sendButton"
now_value="&sendButton.label;"
now_tooltiptext="&sendButton.tooltip;"
later_value="&sendLaterCmd.label;"
later_tooltiptext=""
/>
<toolbarseparator class="toolbarseparator-primary"/>
<button class="button-toolbar-2 top"
id="button-address" value="&addressButton.label;"
@ -505,7 +512,7 @@
</box>
<statusbar id="status-bar">
<statusbarpanel id="offline-status"/>
<statusbarpanel id="offline-status" onclick="setTimeout('UpdateOfflineState()', 0)"/>
<progressmeter class="progressmeter-statusbar" mode="normal" value="0"/>
<statusbarpanel id="statusText" flex="1" value="&defaultStatusText.label;"/>
</statusbar>