fix for bug #86326. make it so news is threaded by default.

r=bienvenu, sr=mscott.
This commit is contained in:
sspitzer%netscape.com 2001-06-29 00:48:14 +00:00
Родитель d3765cf59b
Коммит 6b89bb98c0
6 изменённых файлов: 50 добавлений и 28 удалений

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

@ -298,10 +298,8 @@ function RerootFolder(uri, newFolder, viewType, viewFlags, sortType, sortOrder)
//Clear out the thread pane so that we can sort it with the new sort id without taking any time.
// folder.setAttribute('ref', "");
if (isNewsURI(uri))
SetNewsFolderColumns(true);
else
SetNewsFolderColumns(false);
// show "Lines" for news, "Size" for mail
SetNewsFolderColumns(isNewsURI(uri));
// null this out, so we don't try sort.
if (gDBView) {
@ -563,28 +561,6 @@ function CreateBareDBView(msgFolder, viewType, viewFlags, sortType, sortOrder)
gDBView = Components.classes[dbviewContractId].createInstance(Components.interfaces.nsIMsgDBView);
var isNews = isNewsURI(msgFolder.URI);
if (!viewFlags) {
if (isNews) {
// news defaults to threaded mode
viewFlags = nsMsgViewFlagsType.kThreadedDisplay;
}
}
if (!sortType) {
if (isNews) {
// news defaults to threaded mode
sortType = nsMsgViewSortType.byThread;
}
else {
sortType = nsMsgViewSortType.byDate;
}
}
if (!sortOrder) {
sortOrder = nsMsgViewSortOrder.ascending;
}
gCurViewFlags = viewFlags;
var count = new Object;
if (!gThreadPaneCommandUpdater)

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

@ -24,6 +24,7 @@
#include "MailNewsTypes2.idl"
#include "nsIFileSpec.idl"
#include "nsIDBChangeAnnouncer.idl"
#include "nsIMsgDBView.idl"
%{C++
#include "nsMsgKeyArray.h"
@ -240,5 +241,11 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
// for sorting
[noscript] void createCollationKey(in wstring sourceString, out octetPtr key, out unsigned long len);
[noscript] long compareCollationKeys(out octet key1, in unsigned long len1, out octet key2, in unsigned long len2);
// when creating a view, the default sort order and view flags
// use these for the default. (this allows news to override, so that
// news can be threaded by default)
readonly attribute nsMsgViewFlagsTypeValue defaultViewFlags;
readonly attribute nsMsgViewSortTypeValue defaultSortType;
};

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

@ -85,6 +85,9 @@ public:
// caller needs to free
static char *GetGroupNameFromURL(const char *url);
NS_IMETHOD GetDefaultViewFlags(nsMsgViewFlagsTypeValue *aDefaultViewFlags);
NS_IMETHOD GetDefaultSortType(nsMsgViewSortTypeValue *aDefaultSortType);
protected:
virtual PRBool ThreadBySubjectWithoutRe() ;

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

@ -770,8 +770,12 @@ NS_IMETHODIMP nsDBFolderInfo::SetViewType(nsMsgViewTypeValue aViewType)
/* attribute nsMsgViewFlagsTypeValue viewFlags; */
NS_IMETHODIMP nsDBFolderInfo::GetViewFlags(nsMsgViewFlagsTypeValue *aViewFlags)
{
nsMsgViewFlagsTypeValue defaultViewFlags;
nsresult rv = m_mdb->GetDefaultViewFlags(&defaultViewFlags);
NS_ENSURE_SUCCESS(rv,rv);
PRUint32 viewFlagsValue;
nsresult rv = GetUint32Property("viewFlags", &viewFlagsValue, nsMsgViewFlagsType::kNone);
rv = GetUint32Property("viewFlags", &viewFlagsValue, defaultViewFlags);
*aViewFlags = viewFlagsValue;
return rv;
}
@ -783,8 +787,12 @@ NS_IMETHODIMP nsDBFolderInfo::SetViewFlags(nsMsgViewFlagsTypeValue aViewFlags)
/* attribute nsMsgViewSortTypeValue sortType; */
NS_IMETHODIMP nsDBFolderInfo::GetSortType(nsMsgViewSortTypeValue *aSortType)
{
nsMsgViewSortTypeValue defaultSortType;
nsresult rv = m_mdb->GetDefaultSortType(&defaultSortType);
NS_ENSURE_SUCCESS(rv,rv);
PRUint32 sortTypeValue;
nsresult rv = GetUint32Property("sortType", &sortTypeValue, nsMsgViewSortType::byDate);
rv = GetUint32Property("sortType", &sortTypeValue, defaultSortType);
*aSortType = sortTypeValue;
return rv;
}

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

@ -4148,3 +4148,16 @@ NS_IMETHODIMP nsMsgDownloadSettings::SetAgeLimitOfMsgsToDownload(PRUint32 ageLim
return NS_OK;
}
NS_IMETHODIMP nsMsgDatabase::GetDefaultViewFlags(nsMsgViewFlagsTypeValue *aDefaultViewFlags)
{
NS_ENSURE_ARG_POINTER(aDefaultViewFlags);
*aDefaultViewFlags = nsMsgViewFlagsType::kNone;
return NS_OK;
}
NS_IMETHODIMP nsMsgDatabase::GetDefaultSortType(nsMsgViewSortTypeValue *aDefaultSortType)
{
NS_ENSURE_ARG_POINTER(aDefaultSortType);
*aDefaultSortType = nsMsgViewSortType::byDate;
return NS_OK;
}

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

@ -447,3 +447,18 @@ NS_IMETHODIMP nsNewsDatabase::MarkAllRead(nsMsgKeyArray *thoseMarked)
return err;
}
NS_IMETHODIMP
nsNewsDatabase::GetDefaultViewFlags(nsMsgViewFlagsTypeValue *aDefaultViewFlags)
{
NS_ENSURE_ARG_POINTER(aDefaultViewFlags);
*aDefaultViewFlags = nsMsgViewFlagsType::kThreadedDisplay;
return NS_OK;
}
NS_IMETHODIMP
nsNewsDatabase::GetDefaultSortType(nsMsgViewSortTypeValue *aDefaultSortType)
{
NS_ENSURE_ARG_POINTER(aDefaultSortType);
*aDefaultSortType = nsMsgViewSortType::byThread;
return NS_OK;
}