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