Bug 56696. Add ctrl-enter Send shortcut to mailnews composer. r=ducarroz, sr=blizzard

This commit is contained in:
roc+%cs.cmu.edu 2001-10-01 02:14:05 +00:00
Родитель 9d0e4a50ab
Коммит 8220d847e0
6 изменённых файлов: 70 добавлений и 19 удалений

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

@ -68,6 +68,9 @@ var gAutocompleteSession = null;
var gSetupLdapAutocomplete = false;
var gLDAPSession = null;
var gComposeMsgsBundle;
var gSavedSendNowKey;
const DEBUG = false;
var other_header = "";
var sendFormat = msgCompSendFormat.AskUser;
@ -225,6 +228,7 @@ var defaultController =
case "cmd_saveAsTemplate":
case "cmd_sendButton":
case "cmd_sendNow":
case "cmd_sendWithCheck":
case "cmd_sendLater":
// case "cmd_printSetup":
case "cmd_print":
@ -336,9 +340,10 @@ var defaultController =
case "cmd_sendLater":
// case "cmd_printSetup":
case "cmd_print":
case "cmd_sendWithCheck":
return !gWindowLocked;
case "cmd_sendNow":
return !(gWindowLocked || (ioService && ioService.offline))
return !(gWindowLocked || isOffline);
case "cmd_quit":
return true;
@ -462,6 +467,7 @@ var defaultController =
}
break;
case "cmd_sendNow" : if (defaultController.isCommandEnabled(command)) SendMessage(); break;
case "cmd_sendWithCheck" : if (defaultController.isCommandEnabled(command)) SendMessageWithCheck(); break;
case "cmd_sendLater" : if (defaultController.isCommandEnabled(command)) SendMessageLater(); break;
// case "cmd_printSetup" : dump("PRINT SETUP\n"); break;
case "cmd_print" : DoCommandPrint(); break;
@ -575,16 +581,28 @@ function MessageComposeOfflineStateChanged(goingOffline)
{
try {
var sendButton = document.getElementById("button-send");
var sendNowMenuItem = document.getElementById("menu-item-send-now");
if (!gSavedSendNowKey) {
gSavedSendNowKey = sendNowMenuItem.getAttribute('key');
}
// don't use goUpdateCommand here ... the defaultController might not be installed yet
goSetCommandEnabled("cmd_sendNow", defaultController.isCommandEnabled("cmd_sendNow"));
if (goingOffline)
{
sendButton.label = sendButton.getAttribute('later_label');
sendButton.setAttribute('tooltiptext', sendButton.getAttribute('later_tooltiptext'));
sendNowMenuItem.removeAttribute('key');
}
else
{
sendButton.label = sendButton.getAttribute('now_label');
sendButton.setAttribute('tooltiptext', sendButton.getAttribute('now_tooltiptext'));
if (gSavedSendNowKey) {
sendNowMenuItem.setAttribute('key', gSavedSendNowKey);
}
}
} catch(e) {}
@ -1446,18 +1464,49 @@ function GenericSendMessage( msgType )
function SendMessage()
{
dump("SendMessage from XUL\n");
// 0 = nsMsgDeliverNow
// RICHIE: We should really have a way of using constants and not
// hardcoded numbers for the first argument
GenericSendMessage(msgCompDeliverMode.Now);
}
function SendMessageWithCheck()
{
var warn;
try {
warn = prefs.GetBoolPref("mail.warn_on_send_accel_key");
} catch (ex) {
warn = true;
}
if (warn) {
var buttonPressed = {value:1};
var checkValue = {value:false};
if (!gPromptService) {
gPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
gPromptService = gPromptService.QueryInterface(Components.interfaces.nsIPromptService);
}
gPromptService.confirmEx(window,
gComposeMsgsBundle.getString('sendMessageCheckWindowTitle'),
gComposeMsgsBundle.getString('sendMessageCheckLabel'),
(gPromptService.BUTTON_TITLE_IS_STRING * gPromptService.BUTTON_POS_0) +
(gPromptService.BUTTON_TITLE_CANCEL * gPromptService.BUTTON_POS_1),
gComposeMsgsBundle.getString('sendMessageCheckSendButtonLabel'),
null, null,
gComposeMsgsBundle.getString('CheckMsg'),
checkValue, buttonPressed);
if (!buttonPressed || buttonPressed.value != 0) {
return;
}
if (checkValue.value) {
prefs.SetBoolPref("mail.warn_on_send_accel_key", false);
}
}
GenericSendMessage(isOffline ? msgCompDeliverMode.Later
: msgCompDeliverMode.Now);
}
function SendMessageLater()
{
dump("SendMessageLater from XUL\n");
// 1 = nsMsgQueueForLater
// RICHIE: We should really have a way of using constants and not
// hardcoded numbers for the first argument
GenericSendMessage(msgCompDeliverMode.Later);
}
@ -1486,9 +1535,6 @@ function SaveAsDraft()
{
dump("SaveAsDraft from XUL\n");
// 4 = nsMsgSaveAsDraft
// RICHIE: We should really have a way of using constants and not
// hardcoded numbers for the first argument
GenericSendMessage(msgCompDeliverMode.SaveAsDraft);
defaultSaveOperation = "draft";
}
@ -1497,9 +1543,6 @@ function SaveAsTemplate()
{
dump("SaveAsTemplate from XUL\n");
// 5 = nsMsgSaveAsTemplate
// RICHIE: We should really have a way of using constants and not
// hardcoded numbers for the first argument
GenericSendMessage(msgCompDeliverMode.SaveAsTemplate);
defaultSaveOperation = "template";
}

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

@ -107,6 +107,7 @@
<command id="cmd_saveAsTemplate" oncommand="goDoCommand('cmd_saveAsTemplate')"/>
<command id="cmd_sendButton" oncommand="goDoCommand('cmd_sendButton')"/>
<command id="cmd_sendNow" oncommand="goDoCommand('cmd_sendNow')"/>
<command id="cmd_sendWithCheck" oncommand="goDoCommand('cmd_sendWithCheck')"/>
<command id="cmd_sendLater" oncommand="goDoCommand('cmd_sendLater')"/>
<!--NYI <command id="cmd_printSetup" oncommand="dump('PRINT SETUP\n');"/> -->
<command id="cmd_print" oncommand="goDoCommand('cmd_print')"/>
@ -147,8 +148,8 @@
<key id="key_newBlankPage"/>
<key id="key_close"/>
<key id="key_save" key="&saveCmd.key;" command="cmd_saveDefault" modifiers="accel"/>
<!-- key id="key_sendNow" xulkey="true" keycode="&sendNowCmd.keycode;" command="cmd_sendNow"/ -->
<!-- key id="key_sendLater" xulkey="true" keycode="&sendLaterCmd.keycode;" shift="true" command="cmd_sendLater"/ -->
<key id="key_send" keycode="&sendCmd.keycode;" observes="cmd_sendWithCheck" modifiers="accel"/>
<key id="key_sendLater" keycode="&sendLaterCmd.keycode;" observes="cmd_sendLater" modifiers="accel, shift"/>
<key id="key_print" key="&printCmd.key;" command="cmd_print" modifiers="accel"/>
<key id="key_quit"/>
@ -202,8 +203,8 @@
</menupopup>
</menu>
<menuseparator/>
<menuitem label="&sendNowCmd.label;" accesskey="&sendNowCmd.accesskey;" command="cmd_sendNow"/>
<menuitem label="&sendLaterCmd.label;" accesskey="&sendLaterCmd.accesskey;" command="cmd_sendLater"/>
<menuitem label="&sendNowCmd.label;" accesskey="&sendNowCmd.accesskey;" key="key_send" command="cmd_sendNow" id="menu-item-send-now"/>
<menuitem label="&sendLaterCmd.label;" accesskey="&sendLaterCmd.accesskey;" key="key_sendLater" command="cmd_sendLater"/>
<menuseparator/>
<!--NYI <menuitem label="&printSetupCmd.label;" accesskey="&printSetupCmd.accesskey;" command="cmd_printSetup"/> -->
<menuitem id="printMenuItem" label="&printCmd.label;" accesskey="&printCmd.accesskey;" key="key_print" command="cmd_print"/>

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

@ -237,3 +237,8 @@ quitComposeWindowTitle=Sending Message
quitComposeWindowMessage=Mail is currently in the process of sending a message.\nWould you like to wait until the message has been sent before quitting or quit now?
quitComposeWindowQuitButtonLabel=Quit
quitComposeWindowWaitButtonLabel=Wait
## Strings used by prompt for Ctrl-Enter check before sending message
sendMessageCheckWindowTitle=Send Message
sendMessageCheckLabel=Are you sure you are ready to send this message?
sendMessageCheckSendButtonLabel=Send

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

@ -29,10 +29,10 @@
<!ENTITY attachPageCmd.label "Attach Web Page...">
<!ENTITY attachPageCmd.accesskey "W">
<!ENTITY sendNowCmd.label "Send Now">
<!ENTITY sendNowCmd.keycode "VK_ENTER">
<!ENTITY sendCmd.keycode "VK_RETURN">
<!ENTITY sendNowCmd.accesskey "d">
<!ENTITY sendLaterCmd.label "Send Later">
<!ENTITY sendLaterCmd.keycode "VK_ENTER">
<!ENTITY sendLaterCmd.keycode "VK_RETURN">
<!ENTITY sendLaterCmd.accesskey "L">
<!ENTITY printSetupCmd.label "Page Setup...">
<!ENTITY printSetupCmd.accesskey "u">

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

@ -311,6 +311,7 @@ pref("mailnews.nav_crosses_folders", 1); // prompt user when crossing folders
pref("news.cancel.confirm",true);
pref("news.cancel.alert_on_success",true);
pref("mail.SpellCheckBeforeSend",false);
pref("mail.warn_on_send_accel_key", true);
pref("mail.enable_autocomplete",true);
pref("mailnews.html_domains","");
pref("mailnews.plaintext_domains","");

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

@ -311,6 +311,7 @@ pref("mailnews.nav_crosses_folders", 1); // prompt user when crossing folders
pref("news.cancel.confirm",true);
pref("news.cancel.alert_on_success",true);
pref("mail.SpellCheckBeforeSend",false);
pref("mail.warn_on_send_accel_key", true);
pref("mail.enable_autocomplete",true);
pref("mailnews.html_domains","");
pref("mailnews.plaintext_domains","");