From ca75db33ebf4bbc8ae357679b6889f7a2bb9d125 Mon Sep 17 00:00:00 2001 From: "bienvenu%netscape.com" Date: Fri, 5 Apr 2002 14:43:20 +0000 Subject: [PATCH] display status during send unsent messages 134624 r=ducarroz, sr=sspitzer, a=asa --- mailnews/base/public/nsIMessenger.idl | 2 +- mailnews/base/resources/content/mailWindowOverlay.js | 2 +- mailnews/base/src/nsMessenger.cpp | 3 ++- mailnews/compose/public/nsIMsgSend.idl | 2 ++ mailnews/compose/src/nsMsgSend.cpp | 5 +++++ mailnews/compose/src/nsMsgSend.h | 2 +- mailnews/compose/src/nsMsgSendLater.cpp | 4 ++++ mailnews/compose/src/nsMsgSendLater.h | 2 +- 8 files changed, 17 insertions(+), 5 deletions(-) diff --git a/mailnews/base/public/nsIMessenger.idl b/mailnews/base/public/nsIMessenger.idl index b2942a9eb881..d5bbbcee677f 100644 --- a/mailnews/base/public/nsIMessenger.idl +++ b/mailnews/base/public/nsIMessenger.idl @@ -93,7 +93,7 @@ interface nsIMessenger : nsISupports { unsigned long GetRedoTransactionType(); void Undo(in nsIMsgWindow msgWindow); void Redo(in nsIMsgWindow msgWindow); - void SendUnsentMessages(in nsIMsgIdentity aIdentity); + void sendUnsentMessages(in nsIMsgIdentity aIdentity, in nsIMsgWindow aMsgWindow); void SetDocumentCharset(in wstring characterSet); void saveAs(in string url, in boolean asFile, in nsIMsgIdentity identity, in nsIMsgWindow aMsgWindow); void openAttachment(in string contentTpe, in string url, in string displayName, in string messageUri); diff --git a/mailnews/base/resources/content/mailWindowOverlay.js b/mailnews/base/resources/content/mailWindowOverlay.js index d4815859e6cb..5ce5fc3453f0 100644 --- a/mailnews/base/resources/content/mailWindowOverlay.js +++ b/mailnews/base/resources/content/mailWindowOverlay.js @@ -1456,7 +1456,7 @@ function SendUnsentMessages() if(msgFolder) { numMessages = msgFolder.getTotalMessages(false /* include subfolders */); if(numMessages > 0) { - messenger.SendUnsentMessages(currentIdentity); + messenger.sendUnsentMessages(currentIdentity, msgWindow); // right now, all identities point to the same unsent messages // folder, so to avoid sending multiple copies of the // unsent messages, we only call messenger.SendUnsentMessages() once diff --git a/mailnews/base/src/nsMessenger.cpp b/mailnews/base/src/nsMessenger.cpp index 1ea949b6728a..311b1eb933d4 100644 --- a/mailnews/base/src/nsMessenger.cpp +++ b/mailnews/base/src/nsMessenger.cpp @@ -1485,7 +1485,7 @@ SendLaterListener::OnStopSending(nsresult aStatus, const PRUnichar *aMsg, PRUint } NS_IMETHODIMP -nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity) +nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity, nsIMsgWindow *aMsgWindow) { nsresult rv; nsCOMPtr pMsgSendLater; @@ -1503,6 +1503,7 @@ nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity) NS_ADDREF(sendLaterListener); pMsgSendLater->AddListener(sendLaterListener); + pMsgSendLater->SetMsgWindow(aMsgWindow); pMsgSendLater->SendUnsentMessages(aIdentity); NS_RELEASE(sendLaterListener); diff --git a/mailnews/compose/public/nsIMsgSend.idl b/mailnews/compose/public/nsIMsgSend.idl index 693a32a18631..a91b8002e5f6 100644 --- a/mailnews/compose/public/nsIMsgSend.idl +++ b/mailnews/compose/public/nsIMsgSend.idl @@ -70,6 +70,7 @@ interface nsIMsgHdr; interface nsIDocShell; interface nsIFileSpec; interface nsIMsgComposeSecure; +interface nsIMsgStatusFeedback; typedef long nsMsgDeliverMode; @@ -213,6 +214,7 @@ interface nsIMsgSend : nsISupports in nsMsgDeliverMode mode, in nsIMsgDBHdr msgToReplace, in nsIMsgSendListener aListener, + in nsIMsgStatusFeedback aStatusFeedback, in string password ); diff --git a/mailnews/compose/src/nsMsgSend.cpp b/mailnews/compose/src/nsMsgSend.cpp index aba8756ff51b..e662375020e6 100644 --- a/mailnews/compose/src/nsMsgSend.cpp +++ b/mailnews/compose/src/nsMsgSend.cpp @@ -3246,6 +3246,9 @@ nsMsgComposeAndSend::DeliverFileAsMail() mComposeBundle->GetStringByID(NS_MSG_SENDING_MESSAGE, getter_Copies(msg)); SetStatusMessage( msg ); nsCOMPtr msgStatus (do_QueryInterface(mSendProgress)); + // if the sendProgress isn't set, let's use the member variable. + if (!msgStatus) + msgStatus = do_QueryInterface(mStatusFeedback); rv = smtpService->SendMailMessage(aFileSpec, buf, mUserIdentity, mSmtpPassword.get(), uriListener, msgStatus, @@ -3775,6 +3778,7 @@ nsMsgComposeAndSend::SendMessageFile( nsMsgDeliverMode mode, nsIMsgDBHdr *msgToReplace, nsIMsgSendListener *aListener, + nsIMsgStatusFeedback *aStatusFeedback, const char *password ) { @@ -3787,6 +3791,7 @@ nsMsgComposeAndSend::SendMessageFile( if (!fields) return NS_ERROR_INVALID_ARG; + mStatusFeedback = aStatusFeedback; // // First check to see if the external file we are sending is a valid file. // diff --git a/mailnews/compose/src/nsMsgSend.h b/mailnews/compose/src/nsMsgSend.h index fcb53db14e0d..571c45989579 100644 --- a/mailnews/compose/src/nsMsgSend.h +++ b/mailnews/compose/src/nsMsgSend.h @@ -310,7 +310,7 @@ public: nsCOMPtr mParentWindow; nsCOMPtr mSendProgress; nsCOMPtr mListener; - + nsCOMPtr mStatusFeedback; nsCOMPtr mRunningRequest; PRBool mSendMailAlso; nsIFileSpec *mReturnFileSpec; // a holder for file spec's to be returned to caller diff --git a/mailnews/compose/src/nsMsgSendLater.cpp b/mailnews/compose/src/nsMsgSendLater.cpp index a70f9201dc4c..aa403cc5f0a7 100644 --- a/mailnews/compose/src/nsMsgSendLater.cpp +++ b/mailnews/compose/src/nsMsgSendLater.cpp @@ -541,6 +541,9 @@ nsCOMPtr pMsgSend = nsnull; // set this object for use on completion... sendListener->SetSendLaterObject(this); + nsCOMPtr statusFeedback; + if (m_window) + m_window->GetStatusFeedback(getter_AddRefs(statusFeedback)); NS_ADDREF(this); //TODO: We should remove this!!! rv = pMsgSend->SendMessageFile(mIdentity, compFields, // nsIMsgCompFields *fields, @@ -550,6 +553,7 @@ nsCOMPtr pMsgSend = nsnull; nsIMsgSend::nsMsgSendUnsent, // nsMsgDeliverMode mode, nsnull, // nsIMsgDBHdr *msgToReplace, sendListener, + statusFeedback, nsnull); NS_IF_RELEASE(sendListener); return rv; diff --git a/mailnews/compose/src/nsMsgSendLater.h b/mailnews/compose/src/nsMsgSendLater.h index 550e1e1ea395..7c060322eb19 100644 --- a/mailnews/compose/src/nsMsgSendLater.h +++ b/mailnews/compose/src/nsMsgSendLater.h @@ -74,7 +74,7 @@ public: // nsIMsgCopyServiceListener interface NS_DECL_NSIMSGCOPYSERVICELISTENER - + NS_IMETHOD SetSendLaterObject(nsMsgSendLater *obj); private: nsMsgSendLater *mSendLater;