make default sort order and type configurable, patch by mozbugzilla@velox.ch, r/sr=bienvenu 86845

This commit is contained in:
bienvenu%nventure.com 2006-08-14 20:02:23 +00:00
Родитель d2b7567aa3
Коммит c369867ffe
6 изменённых файлов: 45 добавлений и 4 удалений

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

@ -118,7 +118,7 @@ interface nsIMsgDBService : nsISupports
void unregisterPendingListener(in nsIDBChangeListener aListener);
};
[scriptable, uuid(6393FEF1-D6C6-444A-90B8-BEC84E8BD8D7)]
[scriptable, uuid(6c8db586-57ff-4a1b-bb7e-acff79d6a4ce)]
interface nsIMsgDatabase : nsIDBChangeAnnouncer {
void Open(in nsIFileSpec aFolderName, in boolean aCreate, in boolean aLeaveInvalidDB);
@ -287,6 +287,7 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
// news can be threaded by default)
readonly attribute nsMsgViewFlagsTypeValue defaultViewFlags;
readonly attribute nsMsgViewSortTypeValue defaultSortType;
readonly attribute nsMsgViewSortOrderValue defaultSortOrder;
// for msg hdr hash table allocation. controllable by caller to improve folder loading preformance.
attribute unsigned long msgHdrCacheSize;

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

@ -78,6 +78,7 @@ public:
NS_IMETHOD GetDefaultViewFlags(nsMsgViewFlagsTypeValue *aDefaultViewFlags);
NS_IMETHOD GetDefaultSortType(nsMsgViewSortTypeValue *aDefaultSortType);
NS_IMETHOD GetDefaultSortOrder(nsMsgViewSortOrderValue *aDefaultSortOrder);
protected:
// this is owned by the nsNewsFolder, which lives longer than the db.

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

@ -826,8 +826,12 @@ NS_IMETHODIMP nsDBFolderInfo::SetSortType(nsMsgViewSortTypeValue aSortType)
/* attribute nsMsgViewSortOrderValue sortOrder; */
NS_IMETHODIMP nsDBFolderInfo::GetSortOrder(nsMsgViewSortOrderValue *aSortOrder)
{
nsMsgViewSortOrderValue defaultSortOrder;
nsresult rv = m_mdb->GetDefaultSortOrder(&defaultSortOrder);
NS_ENSURE_SUCCESS(rv,rv);
PRUint32 sortOrderValue;
nsresult rv = GetUint32Property("sortOrder", nsMsgViewSortOrder::ascending, &sortOrderValue);
rv = GetUint32Property("sortOrder", defaultSortOrder, &sortOrderValue);
*aSortOrder = sortOrderValue;
return rv;
}

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

@ -4746,7 +4746,19 @@ NS_IMETHODIMP nsMsgDatabase::GetDefaultViewFlags(nsMsgViewFlagsTypeValue *aDefau
NS_IMETHODIMP nsMsgDatabase::GetDefaultSortType(nsMsgViewSortTypeValue *aDefaultSortType)
{
NS_ENSURE_ARG_POINTER(aDefaultSortType);
*aDefaultSortType = nsMsgViewSortType::byDate;
GetIntPref("mailnews.default_sort_type", aDefaultSortType);
if (*aDefaultSortType < nsMsgViewSortType::byDate ||
*aDefaultSortType > nsMsgViewSortType::byAccount)
*aDefaultSortType = nsMsgViewSortType::byDate;
return NS_OK;
}
NS_IMETHODIMP nsMsgDatabase::GetDefaultSortOrder(nsMsgViewSortOrderValue *aDefaultSortOrder)
{
NS_ENSURE_ARG_POINTER(aDefaultSortOrder);
GetIntPref("mailnews.default_sort_order", aDefaultSortOrder);
if (*aDefaultSortOrder != nsMsgViewSortOrder::descending)
*aDefaultSortOrder = nsMsgViewSortOrder::ascending;
return NS_OK;
}

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

@ -366,6 +366,19 @@ NS_IMETHODIMP
nsNewsDatabase::GetDefaultSortType(nsMsgViewSortTypeValue *aDefaultSortType)
{
NS_ENSURE_ARG_POINTER(aDefaultSortType);
*aDefaultSortType = nsMsgViewSortType::byThread;
GetIntPref("mailnews.default_news_sort_type", aDefaultSortType);
if (*aDefaultSortType < nsMsgViewSortType::byDate ||
*aDefaultSortType > nsMsgViewSortType::byAccount)
*aDefaultSortType = nsMsgViewSortType::byThread;
return NS_OK;
}
NS_IMETHODIMP
nsNewsDatabase::GetDefaultSortOrder(nsMsgViewSortOrderValue *aDefaultSortOrder)
{
NS_ENSURE_ARG_POINTER(aDefaultSortOrder);
GetIntPref("mailnews.default_news_sort_order", aDefaultSortOrder);
if (*aDefaultSortOrder != nsMsgViewSortOrder::descending)
*aDefaultSortOrder = nsMsgViewSortOrder::ascending;
return NS_OK;
}

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

@ -72,6 +72,16 @@ pref("mailnews.headers.showUserAgent", false);
// is displayed in the message pane or not...
pref("mailnews.headers.showOrganization", false);
// default sort order settings (when creating new folder views)
// sort_order is an int value reflecting nsMsgViewSortOrder values
// as defined in nsIMsgDBView.idl (ascending = 1, descending = 2)
// sort_type is an int value reflecting nsMsgViewSortType values
// as defined in nsIMsgDBView.idl (byDate = 18, byThread = 22 etc.)
pref("mailnews.default_sort_order", 1); // for Mail/RSS/... (nsMsgDatabase)
pref("mailnews.default_sort_type", 18); //
pref("mailnews.default_news_sort_order", 1); // for News (nsNewsDatabase)
pref("mailnews.default_news_sort_type", 22); //
// mailnews tcp read+write timeout in seconds.
pref("mailnews.tcptimeout", 60);