mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-14 22:13:31 +00:00
fix bug 317396, edited template disappears when saving or autosaving as draft, sr=mscott, part of patch by mkmelin+bugzilla@cc.hut.fi
This commit is contained in:
parent
fcc986ac4c
commit
c4f2e82bad
@ -3182,7 +3182,7 @@ nsMsgComposeSendListener::RemoveCurrentDraftMessage(nsIMsgCompose *compObj, PRBo
|
||||
PRUint32 folderFlags;
|
||||
msgFolder->GetFlags(&folderFlags);
|
||||
// only do this if it's a drafts or templates folder.
|
||||
if (folderFlags & (MSG_FOLDER_FLAG_DRAFTS | MSG_FOLDER_FLAG_TEMPLATES))
|
||||
if (folderFlags & MSG_FOLDER_FLAG_DRAFTS)
|
||||
{ // build the msg arrary
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
@ -3195,7 +3195,7 @@ nsMsgComposeSendListener::RemoveCurrentDraftMessage(nsIMsgCompose *compObj, PRBo
|
||||
rv = messageArray->AppendElement(msgDBHdr);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't append msg header to array.");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = msgFolder->DeleteMessages(messageArray, nsnull, PR_TRUE, PR_FALSE, nsnull, PR_FALSE /*allowUndo*/);
|
||||
rv = msgFolder->DeleteMessages(messageArray, nsnull, PR_TRUE, PR_FALSE, nsnull, PR_FALSE /*allowUndo*/);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't delete message.");
|
||||
}
|
||||
}
|
||||
@ -3253,6 +3253,7 @@ nsMsgComposeSendListener::RemoveCurrentDraftMessage(nsIMsgCompose *compObj, PRBo
|
||||
// regardless whether or not the exiting msg can be deleted.
|
||||
if (calledByCopy)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> savedToFolder;
|
||||
nsCOMPtr<nsIMsgSend> msgSend;
|
||||
rv = compObj->GetMessageSend(getter_AddRefs(msgSend));
|
||||
NS_ASSERTION(msgSend, "RemoveCurrentDraftMessage msgSend is null.");
|
||||
@ -3263,25 +3264,21 @@ nsMsgComposeSendListener::RemoveCurrentDraftMessage(nsIMsgCompose *compObj, PRBo
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Make sure we have a folder interface pointer
|
||||
if (!msgFolder)
|
||||
{
|
||||
rv = GetMsgFolder(compObj, getter_AddRefs(msgFolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = GetMsgFolder(compObj, getter_AddRefs(savedToFolder));
|
||||
|
||||
// Reset draft (uid) url with the new uid.
|
||||
if (msgFolder && newUid != nsMsgKey_None)
|
||||
if (savedToFolder && newUid != nsMsgKey_None)
|
||||
{
|
||||
PRUint32 folderFlags;
|
||||
msgFolder->GetFlags(&folderFlags);
|
||||
savedToFolder->GetFlags(&folderFlags);
|
||||
if (folderFlags & MSG_FOLDER_FLAG_DRAFTS)
|
||||
{
|
||||
rv = msgFolder->GenerateMessageURI(newUid, getter_Copies(newDraftIdURL));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
compFields->SetDraftId(newDraftIdURL.get());
|
||||
rv = savedToFolder->GenerateMessageURI(newUid, getter_Copies(newDraftIdURL));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
compFields->SetDraftId(newDraftIdURL.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user