зеркало из https://github.com/mozilla/gecko-dev.git
hook up cancel for imap fcc 206408 r/a=sspitzer, sr=mscott
This commit is contained in:
Родитель
fe3a6f546b
Коммит
19f948f27d
|
@ -41,6 +41,7 @@
|
|||
#include "nsIWebProgressListener.idl"
|
||||
|
||||
interface nsIDOMWindowInternal;
|
||||
interface nsIMsgWindow;
|
||||
|
||||
[scriptable, uuid(9f4dd200-3b1f-11d5-9daa-c345c9453d3c)]
|
||||
interface nsIMsgProgress: nsIWebProgressListener {
|
||||
|
@ -48,7 +49,7 @@ interface nsIMsgProgress: nsIWebProgressListener {
|
|||
/* Open the progress dialog
|
||||
you can specify parameters through an xpcom object
|
||||
*/
|
||||
void openProgressDialog(in nsIDOMWindowInternal parent, in string dialogURL, in nsISupports parameters);
|
||||
void openProgressDialog(in nsIDOMWindowInternal parent, in nsIMsgWindow aMsgWindow, in string dialogURL, in nsISupports parameters);
|
||||
|
||||
/* Close the progress dialog */
|
||||
void closeProgressDialog(in boolean forceClose);
|
||||
|
@ -64,6 +65,8 @@ interface nsIMsgProgress: nsIWebProgressListener {
|
|||
|
||||
/* Indicated if the user asked to cancel the current process */
|
||||
attribute boolean processCanceledByUser;
|
||||
|
||||
attribute nsIMsgWindow msgWindow;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -68,13 +68,16 @@ nsMsgProgress::~nsMsgProgress()
|
|||
(void)ReleaseListeners();
|
||||
}
|
||||
|
||||
/* void openProgressDialog (in nsIDOMWindowInternal parent, in string dialogURL, in nsISupports parameters); */
|
||||
NS_IMETHODIMP nsMsgProgress::OpenProgressDialog(nsIDOMWindowInternal *parent,
|
||||
/* void openProgressDialog (in nsIDOMWindowInternal parent, in nsIMsgWindow aMsgWindow,
|
||||
in string dialogURL, in nsISupports parameters);
|
||||
*/
|
||||
NS_IMETHODIMP nsMsgProgress::OpenProgressDialog(nsIDOMWindowInternal *parent, nsIMsgWindow *aMsgWindow,
|
||||
const char *dialogURL,
|
||||
nsISupports *parameters)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
m_msgWindow = aMsgWindow;
|
||||
if (m_dialog)
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
|
@ -206,6 +209,9 @@ NS_IMETHODIMP nsMsgProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequ
|
|||
}
|
||||
}
|
||||
|
||||
if (aStateFlags == nsIWebProgressListener::STATE_STOP && m_msgWindow)
|
||||
m_msgWindow->StopUrls();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -331,3 +337,15 @@ NS_IMETHODIMP nsMsgProgress::CloseWindow()
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProgress::SetMsgWindow(nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
m_msgWindow = aMsgWindow;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgProgress::GetMsgWindow(nsIMsgWindow **aMsgWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMsgWindow);
|
||||
NS_IF_ADDREF(*aMsgWindow = m_msgWindow);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -43,17 +43,18 @@
|
|||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
|
||||
class nsMsgProgress : public nsIMsgProgress, public nsIMsgStatusFeedback
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMSGPROGRESS
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSIMSGSTATUSFEEDBACK
|
||||
|
||||
nsMsgProgress();
|
||||
virtual ~nsMsgProgress();
|
||||
nsMsgProgress();
|
||||
virtual ~nsMsgProgress();
|
||||
|
||||
private:
|
||||
nsresult ReleaseListeners(void);
|
||||
|
@ -64,5 +65,6 @@ private:
|
|||
PRInt32 m_pendingStateFlags;
|
||||
PRInt32 m_pendingStateValue;
|
||||
nsCOMPtr<nsIDOMWindowInternal> m_dialog;
|
||||
nsCOMPtr<nsIMsgWindow> m_msgWindow;
|
||||
nsCOMPtr<nsISupportsArray> m_listenerList;
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Bienvenu - bienvenu@nventure.com
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -45,6 +46,7 @@
|
|||
interface nsIDOMWindowInternal;
|
||||
interface nsIDOMNode;
|
||||
interface nsIEditor;
|
||||
interface nsIMsgWindow;
|
||||
|
||||
typedef long MSG_ComposeSaveType;
|
||||
|
||||
|
@ -139,7 +141,7 @@ interface nsIMsgCompose : nsISupports {
|
|||
void UnregisterStateListener(in nsIMsgComposeStateListener stateListener);
|
||||
|
||||
/* ... */
|
||||
void SendMsg(in MSG_DeliverMode deliverMode, in nsIMsgIdentity identity, in nsIMsgProgress progress);
|
||||
void SendMsg(in MSG_DeliverMode deliverMode, in nsIMsgIdentity identity, in nsIMsgWindow aMsgWindow, in nsIMsgProgress progress);
|
||||
|
||||
/* ... */
|
||||
void CloseWindow(in boolean reclycleIt);
|
||||
|
|
|
@ -54,6 +54,7 @@ var sNameProperty = null;
|
|||
in the other js file.
|
||||
*/
|
||||
var msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"].createInstance();
|
||||
msgWindow = msgWindow.QueryInterface(Components.interfaces.nsIMsgWindow);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1668,7 +1669,9 @@ function GenericSendMessage( msgType )
|
|||
progress.registerListener(progressListener);
|
||||
gSendOrSaveOperationInProgress = true;
|
||||
}
|
||||
gMsgCompose.SendMsg(msgType, getCurrentIdentity(), progress);
|
||||
msgWindow.SetDOMWindow(window);
|
||||
|
||||
gMsgCompose.SendMsg(msgType, getCurrentIdentity(), msgWindow, progress);
|
||||
}
|
||||
catch (ex) {
|
||||
dump("failed to SendMsg: " + ex + "\n");
|
||||
|
@ -2309,7 +2312,7 @@ function FocusOnFirstAttachment()
|
|||
|
||||
function AttachmentElementHasItems()
|
||||
{
|
||||
var element = document.getElementById("bucketList");
|
||||
var element = document.getElementById("attachmentBucket");
|
||||
|
||||
return element ? element.childNodes.length : 0;
|
||||
}
|
||||
|
|
|
@ -970,7 +970,7 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *ide
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *identity, nsIMsgProgress *progress)
|
||||
NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *identity, nsIMsgWindow *aMsgWindow, nsIMsgProgress *progress)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRBool entityConversionDone = PR_FALSE;
|
||||
|
@ -1058,7 +1058,7 @@ NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity
|
|||
params->SetSubject((const PRUnichar*) msgSubject);
|
||||
params->SetDeliveryMode(deliverMode);
|
||||
|
||||
mProgress->OpenProgressDialog(m_window, "chrome://messenger/content/messengercompose/sendProgress.xul", params);
|
||||
mProgress->OpenProgressDialog(m_window, aMsgWindow, "chrome://messenger/content/messengercompose/sendProgress.xul", params);
|
||||
mProgress->GetPrompter(getter_AddRefs(prompt));
|
||||
}
|
||||
}
|
||||
|
@ -2795,10 +2795,6 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS
|
|||
nsCOMPtr<nsIMsgProgress> progress;
|
||||
compose->GetProgress(getter_AddRefs(progress));
|
||||
|
||||
//Unregister ourself from msg compose progress
|
||||
if (progress)
|
||||
progress->UnregisterListener(this);
|
||||
|
||||
if (NS_SUCCEEDED(aStatus))
|
||||
{
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -2821,7 +2817,10 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS
|
|||
{
|
||||
compose->NotifyStateListeners(eComposeProcessDone, NS_OK);
|
||||
if (progress)
|
||||
{
|
||||
progress->UnregisterListener(this);
|
||||
progress->CloseProgressDialog(PR_FALSE);
|
||||
}
|
||||
compose->CloseWindow(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -2830,7 +2829,10 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS
|
|||
{
|
||||
compose->NotifyStateListeners(eComposeProcessDone, NS_OK);
|
||||
if (progress)
|
||||
{
|
||||
progress->UnregisterListener(this);
|
||||
progress->CloseProgressDialog(PR_FALSE);
|
||||
}
|
||||
compose->CloseWindow(PR_TRUE); // if we fail on the simple GetFcc call, close the window to be safe and avoid
|
||||
// windows hanging around to prevent the app from exiting.
|
||||
}
|
||||
|
@ -2848,7 +2850,10 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS
|
|||
#endif
|
||||
compose->NotifyStateListeners(eComposeProcessDone,aStatus);
|
||||
if (progress)
|
||||
{
|
||||
progress->CloseProgressDialog(PR_TRUE);
|
||||
progress->UnregisterListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMsgSendListener> externalListener;
|
||||
|
@ -2915,7 +2920,12 @@ nsMsgComposeSendListener::OnStopCopy(nsresult aStatus)
|
|||
nsCOMPtr<nsIMsgProgress> progress;
|
||||
compose->GetProgress(getter_AddRefs(progress));
|
||||
if (progress)
|
||||
{
|
||||
//Unregister ourself from msg compose progress
|
||||
progress->UnregisterListener(this);
|
||||
progress->CloseProgressDialog(NS_FAILED(aStatus));
|
||||
}
|
||||
|
||||
compose->NotifyStateListeners(eComposeProcessDone,aStatus);
|
||||
|
||||
if (NS_SUCCEEDED(aStatus))
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "nsIMsgImapMailFolder.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsMsgSimulateError.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
@ -238,10 +239,20 @@ nsMsgCopy::StartCopyOperation(nsIMsgIdentity *aUserIdentity,
|
|||
return NS_MSG_COULDNT_OPEN_FCC_FOLDER;
|
||||
}
|
||||
|
||||
nsCOMPtr <nsIMsgWindow> msgWindow;
|
||||
|
||||
if (aMsgSendObj)
|
||||
{
|
||||
nsCOMPtr <nsIMsgProgress> progress;
|
||||
aMsgSendObj->GetProgress(getter_AddRefs(progress));
|
||||
if (progress)
|
||||
progress->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
}
|
||||
|
||||
mMode = aMode;
|
||||
if (!waitForUrl)
|
||||
{
|
||||
rv = DoCopy(aFileSpec, dstFolder, aMsgToReplace, isDraft, nsnull, aMsgSendObj);
|
||||
rv = DoCopy(aFileSpec, dstFolder, aMsgToReplace, isDraft, msgWindow, aMsgSendObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4681,7 +4681,6 @@ nsMsgComposeAndSend::StartMessageCopyOperation(nsIFileSpec *aFileSpec,
|
|||
// default to the default "Flagged" folder choices
|
||||
//
|
||||
nsresult rv;
|
||||
|
||||
if (dest_uri && *dest_uri)
|
||||
m_folderName = dest_uri;
|
||||
else
|
||||
|
|
|
@ -398,7 +398,7 @@ nsresult nsMapiHook::BlindSendMail (unsigned long aSession, nsIMsgCompFields * a
|
|||
rv = pMsgCompose->Initialize(hiddenWindow, pMsgComposeParams) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
|
||||
pMsgCompose->SendMsg(nsIMsgSend::nsMsgDeliverNow, pMsgId, nsnull) ;
|
||||
pMsgCompose->SendMsg(nsIMsgSend::nsMsgDeliverNow, pMsgId, nsnull, nsnull) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
|
||||
// assign to interface pointer from nsCOMPtr to facilitate typecast below
|
||||
|
|
Загрузка…
Ссылка в новой задаче