partial fix for #100835. fwding (inline) imap messages with large attachments
and editing imap templates & drafts with large attachments is slow since we have to download the attachment. this makes it so the user sees download progress in the msg window. r=ducarroz, sr=mscott git-svn-id: svn://10.0.0.236/trunk@104327 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
510114e522
commit
009b529d4d
@ -183,13 +183,13 @@ function ComposeMessage(type, format, folder, messageArray)
|
||||
if (type == msgComposeType.New) //new message
|
||||
{
|
||||
//dump("OpenComposeWindow with " + identity + "\n");
|
||||
msgComposeService.OpenComposeWindow(null, null, type, format, identity);
|
||||
msgComposeService.OpenComposeWindow(null, null, type, format, identity, msgWindow);
|
||||
return;
|
||||
}
|
||||
else if (type == msgComposeType.NewsPost)
|
||||
{
|
||||
//dump("OpenComposeWindow with " + identity + " and " + newsgroup + "\n");
|
||||
msgComposeService.OpenComposeWindow(null, newsgroup, type, format, identity);
|
||||
msgComposeService.OpenComposeWindow(null, newsgroup, type, format, identity, msgWindow);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ function ComposeMessage(type, format, folder, messageArray)
|
||||
type == msgComposeType.ReplyToSenderAndGroup ||
|
||||
type == msgComposeType.Template || type == msgComposeType.Draft)
|
||||
{
|
||||
msgComposeService.OpenComposeWindow(null, messageUri, type, format, identity);
|
||||
msgComposeService.OpenComposeWindow(null, messageUri, type, format, identity, msgWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -222,7 +222,7 @@ function ComposeMessage(type, format, folder, messageArray)
|
||||
}
|
||||
if (type == msgComposeType.ForwardAsAttachment)
|
||||
{
|
||||
msgComposeService.OpenComposeWindow(null, uri, type, format, identity);
|
||||
msgComposeService.OpenComposeWindow(null, uri, type, format, identity, msgWindow);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -16,24 +16,24 @@
|
||||
|
||||
function goOpenNewMessage()
|
||||
{
|
||||
try
|
||||
{
|
||||
var cwindowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
|
||||
var iwindowManager = Components.interfaces.nsIWindowMediator;
|
||||
var windowManager = cwindowManager.QueryInterface(iwindowManager);
|
||||
var mailWindow = windowManager.getMostRecentWindow('mail:3pane');
|
||||
mailWindow.MsgNewMessage();
|
||||
try
|
||||
{
|
||||
var cwindowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
|
||||
var iwindowManager = Components.interfaces.nsIWindowMediator;
|
||||
var windowManager = cwindowManager.QueryInterface(iwindowManager);
|
||||
var mailWindow = windowManager.getMostRecentWindow('mail:3pane');
|
||||
mailWindow.MsgNewMessage();
|
||||
return;
|
||||
}
|
||||
catch(ex) {
|
||||
;
|
||||
}
|
||||
|
||||
var msgComposeService = Components.classes["@mozilla.org/messengercompose;1"].getService();
|
||||
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
|
||||
msgComposeService.OpenComposeWindow(null, null,
|
||||
Components.interfaces.nsIMsgCompType.New,
|
||||
Components.interfaces.nsIMsgCompFormat.Default,
|
||||
null);
|
||||
null, null);
|
||||
}
|
||||
|
||||
]]>
|
||||
|
||||
@ -43,14 +43,15 @@
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIDOMWindowInternal;
|
||||
|
||||
interface nsIMsgWindow;
|
||||
|
||||
[scriptable, uuid(B004F4AE-1AC2-11d3-A715-0060B0EB39B5)]
|
||||
interface nsIMsgComposeService : nsISupports {
|
||||
|
||||
/* ... */
|
||||
/* we need a msg window because when we forward inline we may need progress */
|
||||
void OpenComposeWindow(in string msgComposeWindowURL, in string originalMsgURI, in MSG_ComposeType type, in MSG_ComposeFormat format,
|
||||
in nsIMsgIdentity identity);
|
||||
in nsIMsgIdentity identity,
|
||||
in nsIMsgWindow aMsgWindow);
|
||||
|
||||
/* use this method to invoke a compose window given a mailto url.
|
||||
aMsgComposeWindowURL --> can be null in most cases. If you have your own chrome
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "nsIMsgIdentity.idl"
|
||||
#include "nsIMsgHdr.idl"
|
||||
|
||||
interface nsIMsgWindow;
|
||||
|
||||
[scriptable, uuid(A6237474-453B-11d3-8F0F-00A024A7D144)]
|
||||
|
||||
@ -49,9 +50,9 @@ interface nsIMsgDraft : nsISupports
|
||||
* a URI
|
||||
*/
|
||||
void OpenDraftMsg(in string msgURI, out nsIMsgDBHdr aMsgToReplace,
|
||||
in nsIMsgIdentity identity, in PRBool addInlineHeaders);
|
||||
in nsIMsgIdentity identity, in PRBool addInlineHeaders, in nsIMsgWindow aMsgWindow);
|
||||
|
||||
void OpenEditorTemplate(in string msgURI, out nsIMsgDBHdr aMsgReplace,
|
||||
in nsIMsgIdentity identity);
|
||||
in nsIMsgIdentity identity, in nsIMsgWindow aMsgWindow);
|
||||
};
|
||||
|
||||
|
||||
@ -1469,12 +1469,7 @@ function SendMessage()
|
||||
|
||||
function SendMessageWithCheck()
|
||||
{
|
||||
var warn;
|
||||
try {
|
||||
warn = prefs.GetBoolPref("mail.warn_on_send_accel_key");
|
||||
} catch (ex) {
|
||||
warn = true;
|
||||
}
|
||||
var warn = prefs.GetBoolPref("mail.warn_on_send_accel_key");
|
||||
|
||||
if (warn) {
|
||||
var buttonPressed = {value:1};
|
||||
|
||||
@ -157,7 +157,7 @@ static nsresult openWindow( const char *chrome, nsIMsgComposeParams *params )
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgComposeService::OpenComposeWindow(const char *msgComposeWindowURL, const char *originalMsgURI,
|
||||
MSG_ComposeType type, MSG_ComposeFormat format, nsIMsgIdentity * identity)
|
||||
MSG_ComposeType type, MSG_ComposeFormat format, nsIMsgIdentity * identity, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -175,13 +175,13 @@ nsMsgComposeService::OpenComposeWindow(const char *msgComposeWindowURL, const ch
|
||||
switch(type)
|
||||
{
|
||||
case nsIMsgCompType::ForwardInline:
|
||||
rv = pMsgDraft->OpenDraftMsg(uriToOpen.get(), nsnull, identity, PR_TRUE);
|
||||
rv = pMsgDraft->OpenDraftMsg(uriToOpen.get(), nsnull, identity, PR_TRUE, aMsgWindow);
|
||||
break;
|
||||
case nsIMsgCompType::Draft:
|
||||
rv = pMsgDraft->OpenDraftMsg(uriToOpen.get(), nsnull, identity, PR_FALSE);
|
||||
rv = pMsgDraft->OpenDraftMsg(uriToOpen.get(), nsnull, identity, PR_FALSE, aMsgWindow);
|
||||
break;
|
||||
case nsIMsgCompType::Template:
|
||||
rv = pMsgDraft->OpenEditorTemplate(uriToOpen.get(), nsnull, identity);
|
||||
rv = pMsgDraft->OpenEditorTemplate(uriToOpen.get(), nsnull, identity, aMsgWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,6 @@
|
||||
#include "nsMsgCopy.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsMsgMimeCID.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
||||
@ -104,7 +103,7 @@ static NS_DEFINE_CID(kStreamConverterCID, NS_MAILNEWS_MIME_STREAM_CONVERTER_C
|
||||
|
||||
nsresult
|
||||
nsMsgDraft::ProcessDraftOrTemplateOperation(const char *msgURI, nsMimeOutputType aOutType,
|
||||
nsIMsgIdentity * identity, nsIMsgDBHdr **aMsgToReplace)
|
||||
nsIMsgIdentity * identity, nsIMsgDBHdr **aMsgToReplace, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -166,25 +165,17 @@ nsMsgDraft::ProcessDraftOrTemplateOperation(const char *msgURI, nsMimeOutputType
|
||||
nsCOMPtr<nsIURI> aURL;
|
||||
rv = CreateStartupUrl(mURI, getter_AddRefs(aURL));
|
||||
|
||||
// HACK: if we are forwarding a message and that message used a charset over ride
|
||||
// (as speciifed in the top most window (assuming the reply originated from that window)
|
||||
// if we are forwarding a message and that message used a charset over ride
|
||||
// then use that over ride charset instead of the charset specified in the message
|
||||
nsCOMPtr <nsIMsgMailSession> mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID);
|
||||
nsXPIDLString mailCharset;
|
||||
if (mailSession)
|
||||
if (aMsgWindow)
|
||||
{
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
|
||||
if (msgWindow)
|
||||
aMsgWindow->GetMailCharacterSet(getter_Copies(mailCharset));
|
||||
if (mailCharset)
|
||||
{
|
||||
|
||||
msgWindow->GetMailCharacterSet(getter_Copies(mailCharset));
|
||||
if (mailCharset)
|
||||
{
|
||||
nsCOMPtr<nsIMsgI18NUrl> i18nUrl(do_QueryInterface(aURL));
|
||||
if (i18nUrl)
|
||||
i18nUrl->SetCharsetOverRide(mailCharset);
|
||||
}
|
||||
nsCOMPtr<nsIMsgI18NUrl> i18nUrl(do_QueryInterface(aURL));
|
||||
if (i18nUrl)
|
||||
i18nUrl->SetCharsetOverRide(mailCharset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +198,7 @@ nsMsgDraft::ProcessDraftOrTemplateOperation(const char *msgURI, nsMimeOutputType
|
||||
GetMsgDBHdrFromURI(msgURI, aMsgToReplace);
|
||||
|
||||
// Now, just plug the two together and get the hell out of the way!
|
||||
rv = mMessageService->DisplayMessage(mURI, convertedListener, nsnull, nsnull, mailCharset, nsnull);
|
||||
rv = mMessageService->DisplayMessage(mURI, convertedListener, aMsgWindow, nsnull, mailCharset, nsnull);
|
||||
|
||||
ReleaseMessageServiceFromURI(mURI, mMessageService);
|
||||
mMessageService = nsnull;
|
||||
@ -221,7 +212,7 @@ nsMsgDraft::ProcessDraftOrTemplateOperation(const char *msgURI, nsMimeOutputType
|
||||
|
||||
nsresult
|
||||
nsMsgDraft::OpenDraftMsg(const char *msgURI, nsIMsgDBHdr **aMsgToReplace,
|
||||
nsIMsgIdentity * identity, PRBool addInlineHeaders)
|
||||
nsIMsgIdentity * identity, PRBool addInlineHeaders, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
// We should really never get here, but if we do, just return
|
||||
// with an error
|
||||
@ -230,14 +221,14 @@ nsMsgDraft::OpenDraftMsg(const char *msgURI, nsIMsgDBHdr **aMsgToReplace,
|
||||
|
||||
mAddInlineHeaders = addInlineHeaders;
|
||||
return ProcessDraftOrTemplateOperation(msgURI, nsMimeOutput::nsMimeMessageDraftOrTemplate,
|
||||
identity, aMsgToReplace);
|
||||
identity, aMsgToReplace, aMsgWindow);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgDraft::OpenEditorTemplate(const char *msgURI, nsIMsgDBHdr **aMsgToReplace,
|
||||
nsIMsgIdentity * identity)
|
||||
nsIMsgIdentity * identity, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
return ProcessDraftOrTemplateOperation(msgURI, nsMimeOutput::nsMimeMessageEditorTemplate,
|
||||
identity, aMsgToReplace);
|
||||
identity, aMsgToReplace, aMsgWindow);
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
NS_DECL_NSIMSGDRAFT
|
||||
|
||||
nsresult ProcessDraftOrTemplateOperation(const char *msgURI, nsMimeOutputType aOutType,
|
||||
nsIMsgIdentity * identity, nsIMsgDBHdr **aMsgToReplace);
|
||||
nsIMsgIdentity * identity, nsIMsgDBHdr **aMsgToReplace, nsIMsgWindow *aMsgWindow);
|
||||
|
||||
//
|
||||
// Implementation data...
|
||||
|
||||
@ -84,6 +84,7 @@ var browserRemoteControl = {
|
||||
null,
|
||||
Components.interfaces.nsIMsgCompType.New,
|
||||
Components.interfaces.nsIMsgCompFormat.Default,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
return(true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user