зеркало из https://github.com/mozilla/gecko-dev.git
checking in for rdayal.
Bug # 115307, second patch. r = ducarroz, sr=bienvenu. Adding a new notification method in nsIMsgSendListener when the compose window is closed without clicking on Send.
This commit is contained in:
Родитель
ab717109c0
Коммит
ab1db95e68
|
@ -80,4 +80,10 @@ interface nsIMsgSendListener : nsISupports {
|
|||
*/
|
||||
void onGetDraftFolderURI(in string aFolderURI);
|
||||
|
||||
/**
|
||||
* Notify the observer when the user aborts the send without actually doing the send
|
||||
* eg : by closing the compose window without Send.
|
||||
*/
|
||||
void onSendNotPerformed(in string aMsgID, in nsresult aStatus);
|
||||
|
||||
};
|
||||
|
|
|
@ -206,8 +206,19 @@ var stateListener = {
|
|||
SetContentAndBodyAsUnmodified();
|
||||
|
||||
if (gCloseWindowAfterSave)
|
||||
{
|
||||
// Notify the SendListener that Send has been aborted and Stopped
|
||||
if (gMsgCompose)
|
||||
{
|
||||
var externalListener = gMsgCompose.getExternalSendListener();
|
||||
if (externalListener)
|
||||
{
|
||||
externalListener.onSendNotPerformed(null, Components.results.NS_ERROR_ABORT);
|
||||
}
|
||||
}
|
||||
MsgComposeCloseWindow(true);
|
||||
}
|
||||
}
|
||||
|
||||
gCloseWindowAfterSave = false;
|
||||
},
|
||||
|
@ -996,6 +1007,17 @@ function DoCommandClose()
|
|||
{
|
||||
var retVal;
|
||||
if ((retVal = ComposeCanClose())) {
|
||||
|
||||
// Notify the SendListener that Send has been aborted and Stopped
|
||||
if (gMsgCompose)
|
||||
{
|
||||
var externalListener = gMsgCompose.getExternalSendListener();
|
||||
if (externalListener)
|
||||
{
|
||||
externalListener.onSendNotPerformed(null, Components.results.NS_ERROR_ABORT);
|
||||
}
|
||||
}
|
||||
|
||||
MsgComposeCloseWindow(true);
|
||||
// at this point, we might be caching this window.
|
||||
// in which case, we don't want to close it
|
||||
|
|
|
@ -2284,6 +2284,29 @@ nsMsgComposeSendListener::OnStatus(const char *aMsgID, const PRUnichar *aMsg)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgComposeSendListener::OnSendNotPerformed(const char *aMsgID, nsresult aStatus)
|
||||
{
|
||||
// since OnSendNotPerformed is called in the case where the user aborts the operation
|
||||
// by closing the compose window, we need not do the stuff required
|
||||
// for closing the windows. However we would need to do the other operations as below.
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIMsgCompose>compose = do_QueryReferent(mWeakComposeObj);
|
||||
if (compose)
|
||||
{
|
||||
compose->NotifyStateListeners(eComposeProcessDone,aStatus);
|
||||
|
||||
nsCOMPtr<nsIMsgSendListener> externalListener;
|
||||
compose->GetExternalSendListener(getter_AddRefs(externalListener));
|
||||
if (externalListener)
|
||||
externalListener->OnSendNotPerformed(aMsgID, aStatus) ;
|
||||
}
|
||||
|
||||
return rv ;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec)
|
||||
{
|
||||
|
|
|
@ -376,6 +376,12 @@ SendOperationListener::OnStatus(const char *aMsgID, const PRUnichar *aMsg)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
SendOperationListener::OnSendNotPerformed(const char *aMsgID, nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
|
|
|
@ -124,6 +124,9 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void OnSendNotPerformed */
|
||||
NS_IMETHOD OnSendNotPerformed(const char *aMsgID, nsresult aStatus) {return NS_OK;}
|
||||
|
||||
/* void OnGetDraftFolderURI (); */
|
||||
NS_IMETHOD OnGetDraftFolderURI(const char *aFolderURI) {return NS_OK;}
|
||||
|
||||
|
|
|
@ -122,6 +122,9 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void OnSendNotPerformed */
|
||||
NS_IMETHOD OnSendNotPerformed(const char *aMsgID, nsresult aStatus) {return NS_OK;}
|
||||
|
||||
/* void OnGetDraftFolderURI (); */
|
||||
NS_IMETHOD OnGetDraftFolderURI(const char *aFolderURI) {return NS_OK;}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче