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:
sspitzer%netscape.com 2001-10-01 18:45:16 +00:00
parent 510114e522
commit 009b529d4d
9 changed files with 40 additions and 51 deletions

View File

@ -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

View File

@ -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);
}
]]>

View File

@ -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

View File

@ -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);
};

View File

@ -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};

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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...

View File

@ -84,6 +84,7 @@ var browserRemoteControl = {
null,
Components.interfaces.nsIMsgCompType.New,
Components.interfaces.nsIMsgCompFormat.Default,
null,
null);
}
return(true);