зеркало из https://github.com/mozilla/pjs.git
82764 r=bienvenu sr=sspitzer a=blizzard; make undo for multiple messages work across servers and also make it so that we do a copy when we do move/copy across
message. 75936 r=bienvenu sr=mscott a=chofmann; clearing the copystate and calling onStopCopy() at the right place to make filing messages across server from search window work.
This commit is contained in:
Родитель
65fe351f5f
Коммит
08da26b629
|
@ -484,9 +484,9 @@ function MsgMoveMessage(destFolder)
|
|||
var destUri = destFolder.getAttribute('id');
|
||||
var destResource = RDF.GetResource(destUri);
|
||||
var destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
|
||||
var sameServer = destMsgFolder.server == gDBView.msgFolder.server;
|
||||
// we don't move news messages, we copy them
|
||||
if (isNewsURI(gDBView.msgFolder.URI)) {
|
||||
if (isNewsURI(gDBView.msgFolder.URI) || !sameServer) {
|
||||
gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, destMsgFolder);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -399,10 +399,11 @@ function DropOnFolderTree(event)
|
|||
}
|
||||
else {
|
||||
// fix this, will not work for multiple 3 panes
|
||||
if (!ctrlKeydown) {
|
||||
var sameServer = (sourceServer == targetServer);
|
||||
if (!ctrlKeydown && sameServer) {
|
||||
SetNextMessageAfterDelete();
|
||||
}
|
||||
messenger.CopyMessages(sourceFolder, targetFolder, list, !ctrlKeydown);
|
||||
messenger.CopyMessages(sourceFolder, targetFolder, list, (!ctrlKeydown && sameServer));
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
|
|
|
@ -3866,6 +3866,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
if (m_transactionManager && m_copyState->m_undoMsgTxn)
|
||||
m_transactionManager->DoTransaction(m_copyState->m_undoMsgTxn);
|
||||
ClearCopyState(aExitCode);
|
||||
sendEndCopyNotification = PR_TRUE;
|
||||
}
|
||||
else
|
||||
NS_ASSERTION(PR_FALSE, "not clearing copy state");
|
||||
|
@ -4453,8 +4454,6 @@ nsImapMailFolder::CopyNextStreamMessage(nsIImapProtocol* aProtocol,
|
|||
PR_TRUE, PR_TRUE, nsnull, PR_FALSE);
|
||||
// we want to send this notification after the source messages have
|
||||
// been deleted.
|
||||
if (mCopyListener)
|
||||
mCopyListener->OnStopCopy(NS_OK);
|
||||
nsCOMPtr<nsIMsgLocalMailFolder> popFolder = do_QueryInterface(srcFolder);
|
||||
if (popFolder) //needed if move pop->imap to notify FE
|
||||
srcFolder->NotifyFolderEvent(mDeleteOrMoveMsgCompletedAtom);
|
||||
|
|
|
@ -4770,7 +4770,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
|||
m_runningUrl->GetImapAction(&imapAction);
|
||||
|
||||
if (GetServerStateParser().LastCommandSuccessful() && (
|
||||
imapAction == nsIImapUrl::nsImapAppendDraftFromFile ))
|
||||
imapAction == nsIImapUrl::nsImapAppendDraftFromFile || imapAction == nsIImapUrl::nsImapAppendMsgFromFile ))
|
||||
{
|
||||
if (GetServerStateParser().GetCapabilityFlag() &
|
||||
kUidplusCapability)
|
||||
|
@ -4794,7 +4794,11 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
|||
}
|
||||
}
|
||||
else if (m_imapExtensionSink)
|
||||
{ // *** code me to search for the newly appended message
|
||||
{ // *** code me to search for the newly appended message
|
||||
// go to selected state
|
||||
AutoSubscribeToMailboxIfNecessary(mailboxName);
|
||||
SelectMailbox(mailboxName);
|
||||
|
||||
nsCString messageId;
|
||||
rv = m_imapExtensionSink->GetMessageId(this, &messageId,
|
||||
m_runningUrl);
|
||||
|
@ -4804,7 +4808,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
|||
{
|
||||
command = "SEARCH SEEN HEADER Message-ID ";
|
||||
command.Append(messageId);
|
||||
|
||||
|
||||
// Clean up result sequence before issuing the cmd.
|
||||
GetServerStateParser().ResetSearchResultSequence();
|
||||
|
||||
|
|
|
@ -2277,8 +2277,10 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndCopy(PRBool copySucceeded)
|
|||
newHdr->AndFlags(~MSG_FLAG_OFFLINE, &newHdrFlags);
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && localUndoTxn && mCopyState->m_message)
|
||||
PRBool isImap;
|
||||
if (NS_SUCCEEDED(rv) && localUndoTxn)
|
||||
localUndoTxn->GetSrcIsImap(&isImap);
|
||||
if (NS_SUCCEEDED(rv) && localUndoTxn && (!isImap || !mCopyState->m_copyingMultipleMessages))
|
||||
{
|
||||
nsMsgKey aKey;
|
||||
mCopyState->m_message->GetMessageKey(&aKey);
|
||||
|
@ -2359,9 +2361,14 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndCopy(PRBool copySucceeded)
|
|||
srcFolder->NotifyFolderEvent(mDeleteOrMoveMsgCompletedAtom);
|
||||
|
||||
nsCOMPtr<nsISupports> srcSupport = do_QueryInterface(mCopyState->m_srcSupport);
|
||||
nsCOMPtr<nsIMsgCopyServiceListener> listener =do_QueryInterface(mCopyState->m_listener);
|
||||
|
||||
if (!mCopyState->m_copyingMultipleMessages || multipleCopiesFinished)
|
||||
ClearCopyState(PR_TRUE);
|
||||
|
||||
if (listener) //notify after clearing the copy state;
|
||||
listener->OnStopCopy(NS_OK);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(result))
|
||||
copyService->NotifyCompletion(srcSupport, this, rv);
|
||||
|
@ -2403,10 +2410,11 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndMove()
|
|||
mTxnMgr->DoTransaction(mCopyState->m_undoMsgTxn);
|
||||
|
||||
nsCOMPtr<nsISupports> srcSupport = do_QueryInterface(mCopyState->m_srcSupport);
|
||||
|
||||
if (mCopyState->m_listener)
|
||||
mCopyState->m_listener->OnStopCopy(NS_OK);
|
||||
ClearCopyState(PR_TRUE); // ### we don't know if it succeeded
|
||||
nsCOMPtr<nsIMsgCopyServiceListener> listener =do_QueryInterface(mCopyState->m_listener);
|
||||
ClearCopyState(PR_TRUE); //clear the copy state so that the next message from a different folder can be moved
|
||||
if (listener) //notify after clearing the copy state;
|
||||
listener->OnStopCopy(NS_OK);
|
||||
// ### we don't know if it succeeded
|
||||
//passing in NS_OK because we only get in here if copy portion succeeded
|
||||
|
||||
copyService->NotifyCompletion(srcSupport, this, NS_OK);
|
||||
|
@ -2437,6 +2445,12 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndMessage(nsMsgKey key)
|
|||
if (NS_SUCCEEDED(rv))
|
||||
localUndoTxn->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
}
|
||||
|
||||
if (localUndoTxn)
|
||||
{
|
||||
localUndoTxn->AddSrcKey(key);
|
||||
localUndoTxn->AddDstKey(mCopyState->m_curDstKey);
|
||||
}
|
||||
|
||||
// I think this is always true for online to offline copy
|
||||
mCopyState->m_dummyEnvelopeNeeded = PR_TRUE;
|
||||
|
|
|
@ -97,7 +97,12 @@ nsLocalMoveCopyMsgTxn::Init(nsIMsgFolder* srcFolder, nsIMsgFolder* dstFolder,
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsLocalMoveCopyMsgTxn::GetSrcIsImap(PRBool *isImap)
|
||||
{
|
||||
*isImap = m_srcIsImap4;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult
|
||||
nsLocalMoveCopyMsgTxn::SetSrcFolder(nsIMsgFolder* srcFolder)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
nsresult AddDstKey(nsMsgKey aKey);
|
||||
nsresult AddDstMsgSize(PRUint32 msgSize);
|
||||
nsresult SetSrcFolder(nsIMsgFolder* srcFolder);
|
||||
nsresult GetSrcIsImap(PRBool *isImap);
|
||||
nsresult SetDstFolder(nsIMsgFolder* dstFolder);
|
||||
nsresult Init(nsIMsgFolder* srcFolder,
|
||||
nsIMsgFolder* dstFolder,
|
||||
|
|
Загрузка…
Ссылка в новой задаче