diff --git a/mozilla/mailnews/base/public/nsIMsgDBView.idl b/mozilla/mailnews/base/public/nsIMsgDBView.idl index 9ca54a21554..93bea1a1b01 100644 --- a/mozilla/mailnews/base/public/nsIMsgDBView.idl +++ b/mozilla/mailnews/base/public/nsIMsgDBView.idl @@ -293,6 +293,9 @@ interface nsIMsgDBView : nsISupports //to tell us if we are in the search view attribute boolean isSearchView; + + //to notify outliner that rows are going away + void onDeleteCompleted(in boolean succeeded); }; /* this interface is rapidly morphing from a command updater interface into a more generic diff --git a/mozilla/mailnews/base/resources/content/msgMail3PaneWindow.js b/mozilla/mailnews/base/resources/content/msgMail3PaneWindow.js index acd92d65a2f..bd7f77c307a 100644 --- a/mozilla/mailnews/base/resources/content/msgMail3PaneWindow.js +++ b/mozilla/mailnews/base/resources/content/msgMail3PaneWindow.js @@ -235,6 +235,7 @@ var folderObserver = { function HandleDeleteOrMoveMsgFailed(folder) { + gDBView.onDeleteCompleted(false); if(IsCurrentLoadedFolder(folder)) { if(gNextMessageAfterDelete) { gNextMessageAfterDelete = null; @@ -248,6 +249,7 @@ function HandleDeleteOrMoveMsgFailed(folder) function HandleDeleteOrMoveMsgCompleted(folder) { + gDBView.onDeleteCompleted(true); if (gNextMessageViewIndexAfterDelete != -2) { if (IsCurrentLoadedFolder(folder)) diff --git a/mozilla/mailnews/base/src/nsMsgDBView.cpp b/mozilla/mailnews/base/src/nsMsgDBView.cpp index 0e2e2be643b..9bc5611e39d 100644 --- a/mozilla/mailnews/base/src/nsMsgDBView.cpp +++ b/mozilla/mailnews/base/src/nsMsgDBView.cpp @@ -107,7 +107,6 @@ NS_INTERFACE_MAP_BEGIN(nsMsgDBView) NS_INTERFACE_MAP_ENTRY(nsIMsgDBView) NS_INTERFACE_MAP_ENTRY(nsIDBChangeListener) NS_INTERFACE_MAP_ENTRY(nsIOutlinerView) - NS_INTERFACE_MAP_ENTRY(nsIMsgCopyServiceListener) NS_INTERFACE_MAP_ENTRY(nsIMsgSearchNotify) NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_END @@ -128,7 +127,7 @@ nsMsgDBView::nsMsgDBView() mIsSpecialFolder = PR_FALSE; mIsNews = PR_FALSE; mDeleteModel = nsMsgImapDeleteModels::MoveToTrash; - m_deletingMsgs = PR_FALSE; + m_deletingRows = PR_FALSE; mRemovingRow = PR_FALSE; mIsSearchView = PR_FALSE; // initialize any static atoms or unicode strings @@ -1856,8 +1855,8 @@ nsMsgDBView::CopyMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32 if (msgHdr) messageArray->AppendElement(msgHdr); } - m_deletingMsgs = isMove; - rv = destFolder->CopyMessages(m_folder /* source folder */, messageArray, isMove, window, this /* listener */, PR_FALSE /* isFolder */, PR_TRUE /*allowUndo*/); + m_deletingRows = isMove && mDeleteModel != nsMsgImapDeleteModels::IMAPDelete; + rv = destFolder->CopyMessages(m_folder /* source folder */, messageArray, isMove, window, nsnull /* listener */, PR_FALSE /* isFolder */, PR_TRUE /*allowUndo*/); return rv; } @@ -1997,11 +1996,13 @@ nsresult nsMsgDBView::RemoveByIndex(nsMsgViewIndex index) { if (!IsValidIndex(index)) return NS_MSG_INVALID_DBVIEW_INDEX; - m_keys.RemoveAt(index); m_flags.RemoveAt(index); m_levels.RemoveAt(index); - NoteChange(index, -1, nsMsgViewNotificationCode::insertOrDelete); + + if (!m_deletingRows) + NoteChange(index, -1, nsMsgViewNotificationCode::insertOrDelete); // an example where view is not the listener - D&D messages + return NS_OK; } @@ -2020,8 +2021,9 @@ nsresult nsMsgDBView::DeleteMessages(nsIMsgWindow *window, nsMsgViewIndex *indic messageArray->AppendElement(msgHdr); } - m_deletingMsgs = PR_TRUE; - m_folder->DeleteMessages(messageArray, window, deleteStorage, PR_FALSE, this, PR_TRUE /*allow Undo*/ ); + if (mDeleteModel != nsMsgImapDeleteModels::IMAPDelete) + m_deletingRows = PR_TRUE; + m_folder->DeleteMessages(messageArray, window, deleteStorage, PR_FALSE, nsnull, PR_TRUE /*allow Undo*/ ); return rv; } @@ -4806,40 +4808,41 @@ nsMsgDBView::GetURIForFirstSelectedMessage(char **uri) return NS_OK; } -// nsIMsgCopyServiceListener methods NS_IMETHODIMP -nsMsgDBView::OnStartCopy() +nsMsgDBView::OnDeleteCompleted(PRBool aSucceeded) { - return NS_OK; -} + if (m_deletingRows) + { + if (aSucceeded) + { + PRInt32 selectionCount; + //selection count cannot be zero, we would not be here + mOutlinerSelection->GetRangeCount(&selectionCount); + NS_ASSERTION(selectionCount, "selected indices for deletion is 0"); + PRInt32 *startRangeArray = (PRInt32*) PR_MALLOC(selectionCount* sizeof(PRInt32)); + PRInt32 *endRangeArray = (PRInt32*) PR_MALLOC(selectionCount* sizeof(PRInt32)); + PRInt32 i; + for (i=0; iGetRangeAt(i, &startRangeArray[i], &endRangeArray[i]); -NS_IMETHODIMP -nsMsgDBView::OnProgress(PRUint32 aProgress, PRUint32 aProgressMax) -{ - return NS_OK; -} + PRInt32 delta=0; //keeps no of rows deleted. + for (i=0; i m_folder; PRBool mIsSpecialFolder; // for special folders, the Sender column really shows recipients. PRBool mIsNews; // we have special icons for news, and for news, we show lines instead of size diff --git a/mozilla/mailnews/base/src/nsMsgRDFUtils.cpp b/mozilla/mailnews/base/src/nsMsgRDFUtils.cpp index 5bbd9fc879d..2943770f01d 100644 --- a/mozilla/mailnews/base/src/nsMsgRDFUtils.cpp +++ b/mozilla/mailnews/base/src/nsMsgRDFUtils.cpp @@ -44,6 +44,7 @@ nsresult createNode(const PRUnichar *str, nsIRDFNode **node, nsIRDFService *rdfS { nsresult rv; nsCOMPtr value; + NS_ASSERTION(rdfService, "rdfService is null"); if (!rdfService) return NS_OK; diff --git a/mozilla/mailnews/base/src/nsMsgSearchDBView.cpp b/mozilla/mailnews/base/src/nsMsgSearchDBView.cpp index 75108a72170..75a0c35797f 100644 --- a/mozilla/mailnews/base/src/nsMsgSearchDBView.cpp +++ b/mozilla/mailnews/base/src/nsMsgSearchDBView.cpp @@ -61,7 +61,7 @@ nsMsgSearchDBView::~nsMsgSearchDBView() /* destructor code */ } -NS_IMPL_ISUPPORTS_INHERITED1(nsMsgSearchDBView, nsMsgDBView, nsIMsgDBView) +NS_IMPL_ISUPPORTS_INHERITED2(nsMsgSearchDBView, nsMsgDBView, nsIMsgDBView, nsIMsgCopyServiceListener) NS_IMETHODIMP nsMsgSearchDBView::Open(nsIMsgFolder *folder, nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder, nsMsgViewFlagsTypeValue viewFlags, PRInt32 *pCount) { @@ -352,6 +352,33 @@ nsMsgSearchDBView::InitializeGlobalsForDeleteAndFile(nsMsgViewIndex *indices, PR } + +// nsIMsgCopyServiceListener methods + +NS_IMETHODIMP +nsMsgSearchDBView::OnStartCopy() +{ + return NS_OK; +} + +NS_IMETHODIMP +nsMsgSearchDBView::OnProgress(PRUint32 aProgress, PRUint32 aProgressMax) +{ + return NS_OK; +} + +// believe it or not, these next two are msgcopyservice listener methods! +NS_IMETHODIMP +nsMsgSearchDBView::SetMessageKey(PRUint32 aMessageKey) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsMsgSearchDBView::GetMessageId(nsCString* aMessageId) +{ + return NS_OK; +} NS_IMETHODIMP nsMsgSearchDBView::OnStopCopy(nsresult aStatus) @@ -370,6 +397,8 @@ nsMsgSearchDBView::OnStopCopy(nsresult aStatus) return rv; } +// end nsIMsgCopyServiceListener methods + nsresult nsMsgSearchDBView::ProcessRequestsInOneFolder(nsIMsgWindow *window) { nsresult rv = NS_OK; diff --git a/mozilla/mailnews/base/src/nsMsgSearchDBView.h b/mozilla/mailnews/base/src/nsMsgSearchDBView.h index 0793a44ae58..468e0abe9fa 100644 --- a/mozilla/mailnews/base/src/nsMsgSearchDBView.h +++ b/mozilla/mailnews/base/src/nsMsgSearchDBView.h @@ -41,7 +41,7 @@ #include "nsMsgDBView.h" #include "nsIMsgCopyServiceListener.h" -class nsMsgSearchDBView : public nsMsgDBView +class nsMsgSearchDBView : public nsMsgDBView, public nsIMsgCopyServiceListener { public: nsMsgSearchDBView(); @@ -49,6 +49,7 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIMSGSEARCHNOTIFY + NS_DECL_NSIMSGCOPYSERVICELISTENER virtual const char * GetViewName(void) {return "SearchView"; } NS_IMETHOD Open(nsIMsgFolder *folder, nsMsgViewSortTypeValue sortType, nsMsgViewSortOrderValue sortOrder, @@ -64,9 +65,6 @@ public: virtual nsresult OnNewHeader(nsMsgKey newKey, nsMsgKey parentKey, PRBool ensureListed); NS_IMETHOD GetFolderForViewIndex(nsMsgViewIndex index, nsIMsgFolder **folder); - // override to chain move/copies from next folder in search results - NS_IMETHOD OnStopCopy(nsresult aStatus); - virtual nsresult GetFolders(nsISupportsArray **aFolders); protected: nsresult FetchLocation(PRInt32 aRow, PRUnichar ** aLocationString);