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:
srilatha%netscape.com 2002-01-03 21:56:36 +00:00
Родитель ab717109c0
Коммит ab1db95e68
6 изменённых файлов: 63 добавлений и 0 удалений

Просмотреть файл

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