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