Bug 492764 -nsMsgSearchDBView::OnSearchHit ignores sort. r/sr=bienvenu.

This commit is contained in:
Andrew Sutherland 2009-05-13 09:32:08 -07:00
Родитель c23f3b289b
Коммит d9e322b7a7
4 изменённых файлов: 26 добавлений и 20 удалений

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

@ -86,6 +86,9 @@ NS_IMETHODIMP nsMsgSearchDBView::Open(nsIMsgFolder *folder,
NS_ENSURE_SUCCESS(rv, rv);
prefBranch->GetBoolPref("mail.strict_threading", &gReferenceOnlyThreading);
// our sort is automatically valid because we have no contents at this point!
m_sortValid = PR_TRUE;
if (pCount)
*pCount = 0;
m_folder = nsnull;
@ -646,6 +649,24 @@ nsMsgSearchDBView::GetMessageEnumerator(nsISimpleEnumerator **enumerator)
return nsMsgDBView::GetViewEnumerator(enumerator);
}
nsresult nsMsgSearchDBView::InsertHdrFromFolder(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder)
{
nsMsgViewIndex insertIndex = GetInsertIndex(msgHdr);
if (insertIndex == nsMsgViewIndex_None)
return AddHdrFromFolder(msgHdr, folder);
nsMsgKey msgKey;
PRUint32 msgFlags;
msgHdr->GetMessageKey(&msgKey);
msgHdr->GetFlags(&msgFlags);
InsertMsgHdrAt(insertIndex, msgHdr, msgKey, msgFlags, 0);
// the call to NoteChange() has to happen after we add the key
// as NoteChange() will call RowCountChanged() which will call our GetRowCount()
NoteChange(insertIndex, 1, nsMsgViewNotificationCode::insertOrDelete);
return NS_OK;
}
NS_IMETHODIMP
nsMsgSearchDBView::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *folder)
{
@ -663,7 +684,10 @@ nsMsgSearchDBView::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *folder)
m_dbToUseList.AppendObject(dbToUse);
}
}
return AddHdrFromFolder(aMsgHdr, folder);
if (m_sortValid)
return InsertHdrFromFolder(aMsgHdr, folder);
else
return AddHdrFromFolder(aMsgHdr, folder);
}
NS_IMETHODIMP

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

@ -121,6 +121,7 @@ protected:
void MoveThreadAt(nsMsgViewIndex threadIndex);
virtual nsresult GetMessageEnumerator(nsISimpleEnumerator **enumerator);
virtual nsresult InsertHdrFromFolder(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder);
nsCOMArray<nsIMsgFolder> m_folders;
nsCOMPtr <nsISupportsArray> m_hdrsForEachFolder;

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

@ -199,24 +199,6 @@ NS_IMETHODIMP nsMsgXFVirtualFolderDBView::OnHdrPropertyChanged(nsIMsgDBHdr *aHdr
return NS_OK;
}
nsresult nsMsgXFVirtualFolderDBView::InsertHdrFromFolder(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder)
{
nsMsgViewIndex insertIndex = GetInsertIndex(msgHdr);
if (insertIndex == nsMsgViewIndex_None)
return AddHdrFromFolder(msgHdr, folder);
nsMsgKey msgKey;
PRUint32 msgFlags;
msgHdr->GetMessageKey(&msgKey);
msgHdr->GetFlags(&msgFlags);
InsertMsgHdrAt(insertIndex, msgHdr, msgKey, msgFlags, 0);
// the call to NoteChange() has to happen after we add the key
// as NoteChange() will call RowCountChanged() which will call our GetRowCount()
NoteChange(insertIndex, 1, nsMsgViewNotificationCode::insertOrDelete);
return NS_OK;
}
void nsMsgXFVirtualFolderDBView::UpdateCacheAndViewForFolder(nsIMsgFolder *folder, nsMsgKey *newHits, PRUint32 numNewHits)
{
nsCOMPtr <nsIMsgDatabase> db;

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

@ -77,7 +77,6 @@ public:
NS_IMETHOD GetMsgFolder(nsIMsgFolder **aMsgFolder);
virtual nsresult OnNewHeader(nsIMsgDBHdr *newHdr, nsMsgKey parentKey, PRBool ensureListed);
virtual nsresult InsertHdrFromFolder(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder);
void UpdateCacheAndViewForPrevSearchedFolders(nsIMsgFolder *curSearchFolder);
void UpdateCacheAndViewForFolder(nsIMsgFolder *folder, nsMsgKey *newHits, PRUint32 numNewHits);
void RemovePendingDBListeners();