зеркало из https://github.com/mozilla/pjs.git
fix for bug#99393;message compose performance improvements; r=ducarroz; sr=sspitzer
This commit is contained in:
Родитель
98de00307b
Коммит
418038a3db
|
@ -56,7 +56,7 @@ try {
|
|||
var msgCompose = null;
|
||||
var MAX_RECIPIENTS = 0;
|
||||
var currentAttachment = null;
|
||||
var windowLocked = false;
|
||||
var gWindowLocked = false;
|
||||
var contentChanged = false;
|
||||
var gCurrentIdentity = null;
|
||||
var defaultSaveOperation = "draft";
|
||||
|
@ -113,7 +113,7 @@ var stateListener = {
|
|||
|
||||
ComposeProcessDone: function(aResult) {
|
||||
dump("\n RECEIVE ComposeProcessDone\n\n");
|
||||
windowLocked = false;
|
||||
gWindowLocked = false;
|
||||
CommandUpdate_MsgCompose();
|
||||
enableEditableFields();
|
||||
|
||||
|
@ -336,9 +336,9 @@ var defaultController =
|
|||
case "cmd_sendLater":
|
||||
// case "cmd_printSetup":
|
||||
case "cmd_print":
|
||||
return !windowLocked;
|
||||
return !gWindowLocked;
|
||||
case "cmd_sendNow":
|
||||
return !(windowLocked || (ioService && ioService.offline))
|
||||
return !(gWindowLocked || (ioService && ioService.offline))
|
||||
case "cmd_quit":
|
||||
return true;
|
||||
|
||||
|
@ -375,7 +375,7 @@ var defaultController =
|
|||
|
||||
//Options Menu
|
||||
case "cmd_selectAddress":
|
||||
return !windowLocked;
|
||||
return !gWindowLocked;
|
||||
case "cmd_spelling":
|
||||
return !focusedElement;
|
||||
case "cmd_outputFormat":
|
||||
|
@ -880,7 +880,7 @@ function DoCommandPreferences()
|
|||
|
||||
function ToggleWindowLock()
|
||||
{
|
||||
windowLocked = !windowLocked;
|
||||
gWindowLocked = !gWindowLocked;
|
||||
CommandUpdate_MsgCompose();
|
||||
}
|
||||
|
||||
|
@ -1408,7 +1408,7 @@ function GenericSendMessage( msgType )
|
|||
}
|
||||
}
|
||||
try {
|
||||
windowLocked = true;
|
||||
gWindowLocked = true;
|
||||
CommandUpdate_MsgCompose();
|
||||
disableEditableFields();
|
||||
|
||||
|
@ -1422,7 +1422,7 @@ function GenericSendMessage( msgType )
|
|||
}
|
||||
catch (ex) {
|
||||
dump("failed to SendMsg: " + ex + "\n");
|
||||
windowLocked = false;
|
||||
gWindowLocked = false;
|
||||
enableEditableFields();
|
||||
CommandUpdate_MsgCompose();
|
||||
}
|
||||
|
|
|
@ -124,18 +124,31 @@ function CompFields2Recipients(msgCompFields, msgType)
|
|||
var newTreeChildrenNode = treeChildren.cloneNode(false);
|
||||
var templateNode = treeChildren.firstChild;
|
||||
|
||||
top.MAX_RECIPIENTS = 0;
|
||||
|
||||
awSetInputAndPopupFromArray(msgCompFields.SplitRecipients(msgCompFields.replyTo, false), "addr_reply", newTreeChildrenNode, templateNode);
|
||||
awSetInputAndPopupFromArray(msgCompFields.SplitRecipients(msgCompFields.to, false), "addr_to", newTreeChildrenNode, templateNode);
|
||||
awSetInputAndPopupFromArray(msgCompFields.SplitRecipients(msgCompFields.cc, false), "addr_cc", newTreeChildrenNode, templateNode);
|
||||
awSetInputAndPopupFromArray(msgCompFields.SplitRecipients(msgCompFields.bcc, false), "addr_bcc", newTreeChildrenNode, templateNode);
|
||||
awSetInputAndPopup(msgCompFields.otherRandomHeaders, "addr_other", newTreeChildrenNode, templateNode);
|
||||
awSetInputAndPopup(msgCompFields.newsgroups, "addr_newsgroups", newTreeChildrenNode, templateNode);
|
||||
awSetInputAndPopup(msgCompFields.followupTo, "addr_followup", newTreeChildrenNode, templateNode);
|
||||
top.MAX_RECIPIENTS = 0;
|
||||
var msgReplyTo = msgCompFields.replyTo;
|
||||
var msgTo = msgCompFields.to;
|
||||
var msgCC = msgCompFields.cc;
|
||||
var msgBCC = msgCompFields.bcc;
|
||||
var msgRandomHeaders = msgCompFields.otherRandomHeaders;
|
||||
var msgNewsgroups = msgCompFields.newsgroups;
|
||||
var msgFollowupTo = msgCompFields.followupTo;
|
||||
if(msgReplyTo)
|
||||
awSetInputAndPopupFromArray(msgCompFields.SplitRecipients(msgReplyTo, false), "addr_reply", newTreeChildrenNode, templateNode);
|
||||
if(msgTo)
|
||||
awSetInputAndPopupFromArray(msgCompFields.SplitRecipients(msgTo, false), "addr_to", newTreeChildrenNode, templateNode);
|
||||
if(msgCC)
|
||||
awSetInputAndPopupFromArray(msgCompFields.SplitRecipients(msgCC, false), "addr_cc", newTreeChildrenNode, templateNode);
|
||||
if(msgBCC)
|
||||
awSetInputAndPopupFromArray(msgCompFields.SplitRecipients(msgBCC, false), "addr_bcc", newTreeChildrenNode, templateNode);
|
||||
if(msgRandomHeaders)
|
||||
awSetInputAndPopup(msgRandomHeaders, "addr_other", newTreeChildrenNode, templateNode);
|
||||
if(msgNewsgroups)
|
||||
awSetInputAndPopup(msgNewsgroups, "addr_newsgroups", newTreeChildrenNode, templateNode);
|
||||
if(msgFollowupTo)
|
||||
awSetInputAndPopup(msgFollowupTo, "addr_followup", newTreeChildrenNode, templateNode);
|
||||
|
||||
//If it's a new message, we need to add an extrat empty recipient.
|
||||
var msgComposeType = Components.interfaces.nsIMsgCompType;
|
||||
if (!msgCompFields.to && !msgCompFields.newsgroups)
|
||||
if (!msgTo && !msgNewsgroups)
|
||||
_awSetInputAndPopup("", "addr_to", newTreeChildrenNode, templateNode);
|
||||
dump("replacing child in comp fields 2 recips \n");
|
||||
var parent = treeChildren.parentNode;
|
||||
|
|
|
@ -551,9 +551,11 @@ const char* nsMsgCompFields::GetBody()
|
|||
return m_body ? m_body : "";
|
||||
}
|
||||
|
||||
|
||||
nsresult nsMsgCompFields::SplitRecipients(const PRUnichar *recipients, PRBool emailAddressOnly, nsIMsgRecipientArray **_retval)
|
||||
// This method is called during the creation of a new window.
|
||||
NS_IMETHODIMP nsMsgCompFields::SplitRecipients(const PRUnichar *recipients, PRBool emailAddressOnly, nsIMsgRecipientArray **_retval)
|
||||
{
|
||||
NS_ASSERTION(recipients, "The recipient list is not supposed to be null -Fix the caller!");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (! _retval)
|
||||
|
@ -628,9 +630,12 @@ nsresult nsMsgCompFields::SplitRecipients(const PRUnichar *recipients, PRBool em
|
|||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//This method is called during the sending of message from NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients
|
||||
nsresult nsMsgCompFields::SplitRecipientsEx(const PRUnichar *recipients, nsIMsgRecipientArray ** fullAddrsArray, nsIMsgRecipientArray ** emailsArray)
|
||||
{
|
||||
NS_ASSERTION(recipients, "The recipient list is not supposed to be null -Fix the caller!");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsMsgRecipientArray* pAddrsArray = nsnull;
|
||||
|
@ -733,7 +738,7 @@ nsresult nsMsgCompFields::SplitRecipientsEx(const PRUnichar *recipients, nsIMsgR
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgCompFields::ConvertBodyToPlainText()
|
||||
NS_IMETHODIMP nsMsgCompFields::ConvertBodyToPlainText()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
|
|
@ -3124,11 +3124,11 @@ nsresult nsMsgCompose::GetMailListAddresses(nsString& name, nsISupportsArray* ma
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define MAX_OF_RECIPIENT_ARRAY 3
|
||||
|
||||
NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList, PRBool returnNonHTMLRecipients, PRUnichar **nonHTMLRecipients, PRUint32 *_retval)
|
||||
{
|
||||
#define MAX_OF_RECIPIENT_ARRAY 3
|
||||
|
||||
if (returnNonHTMLRecipients && !nonHTMLRecipients || !_retval)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
@ -3153,8 +3153,10 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
nsCOMPtr<nsIMsgRecipientArray> addressArray;
|
||||
nsCOMPtr<nsIMsgRecipientArray> emailArray;
|
||||
for (i = 0; i < MAX_OF_RECIPIENT_ARRAY; i ++)
|
||||
{
|
||||
rv = m_compFields->SplitRecipientsEx((const PRUnichar *)(originalRecipients[i]), getter_AddRefs(addressArray), getter_AddRefs(emailArray));
|
||||
{
|
||||
if (originalRecipients[i].IsEmpty())
|
||||
continue;
|
||||
rv = m_compFields->SplitRecipientsEx((const PRUnichar *)(originalRecipients[i]), getter_AddRefs(addressArray), getter_AddRefs(emailArray));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRInt32 nbrRecipients;
|
||||
|
@ -3238,7 +3240,9 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
|
||||
stillNeedToSearch = PR_FALSE;
|
||||
for (i = 0; i < MAX_OF_RECIPIENT_ARRAY; i ++)
|
||||
{
|
||||
{
|
||||
if (!recipientsList[i])
|
||||
continue;
|
||||
recipientsList[i]->Count(&nbrRecipients);
|
||||
for (j = 0; j < (PRInt32)nbrRecipients; j ++, recipientsList[i]->Count(&nbrRecipients))
|
||||
{
|
||||
|
@ -3390,9 +3394,12 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
|
||||
*_retval = -1;
|
||||
for (i = 0; i < MAX_OF_RECIPIENT_ARRAY; i ++)
|
||||
{
|
||||
{
|
||||
if (!recipientsList[i])
|
||||
continue;
|
||||
recipientsStr.SetLength(0);
|
||||
PRUint32 nbrRecipients;
|
||||
|
||||
recipientsList[i]->Count(&nbrRecipients);
|
||||
for (j = 0; j < (PRInt32)nbrRecipients; j ++)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче