Bug 33045 Pref for whether newsgroups use "Size" or "Lines" p=ch.ey@gmx.net r=me sr=bienvenu

This commit is contained in:
neil%parkwaycc.co.uk 2004-05-14 22:10:51 +00:00
Родитель 3c5d3b2c85
Коммит 26d6260d6b
7 изменённых файлов: 36 добавлений и 13 удалений

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

@ -297,8 +297,6 @@ 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', "");
// show "Lines" for news, "Size" for mail
SetNewsFolderColumns(isNewsURI(uri));
// null this out, so we don't try sort.
if (gDBView) {
@ -432,11 +430,11 @@ function SetSentFolderColumns(isSentFolder)
}
}
function SetNewsFolderColumns(isNewsFolder)
function SetNewsFolderColumns()
{
var sizeColumn = document.getElementById("sizeCol");
if (isNewsFolder) {
if (gDBView.usingLines) {
sizeColumn.setAttribute("label",gMessengerBundle.getString("linesColumnHeader"));
}
else {

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

@ -320,6 +320,9 @@ interface nsIMsgDBView : nsISupports
nsMsgViewIndex findIndexFromKey(in nsMsgKey aMsgKey, in boolean aExpand);
void ExpandAndSelectThreadByIndex(in nsMsgViewIndex aIndex, in boolean aAugment);
// use lines or kB for size?
readonly attribute boolean usingLines;
};
/* this interface is rapidly morphing from a command updater interface into a more generic

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

@ -305,8 +305,6 @@ 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', "");
// show "Lines" for news, "Size" for mail
SetNewsFolderColumns(isNewsURI(uri));
// null this out, so we don't try sort.
if (gDBView) {
@ -438,11 +436,11 @@ function SetSentFolderColumns(isSentFolder)
}
}
function SetNewsFolderColumns(isNewsFolder)
function SetNewsFolderColumns()
{
var sizeColumn = document.getElementById("sizeCol");
if (isNewsFolder) {
if (gDBView.usingLines) {
sizeColumn.setAttribute("tooltiptext",gMessengerBundle.getString("linesColumnTooltip"));
sizeColumn.setAttribute("label",gMessengerBundle.getString("linesColumnHeader"));
}

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

@ -410,6 +410,8 @@ function EnsureRowInThreadTreeIsVisible(index)
function RerootThreadPane()
{
SetNewsFolderColumns();
var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
if (treeView)
{

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

@ -144,7 +144,8 @@ nsMsgDBView::nsMsgDBView()
m_deletingRows = PR_FALSE;
mJunkIndices = nsnull;
mNumJunkIndices = 0;
mShowSizeInLines = PR_FALSE;
/* mCommandsNeedDisablingBecauseOffline - A boolean that tell us if we needed to disable commands because we're offline w/o a downloaded msg select */
mCommandsNeedDisablingBecauseOffline = PR_FALSE;
@ -679,8 +680,8 @@ nsresult nsMsgDBView::FetchSize(nsIMsgHdr * aHdr, PRUnichar ** aSizeString)
nsAutoString formattedSizeString;
PRUint32 msgSize = 0;
// for news, show the line count not the size
if (mIsNews)
// for news, show the line count, not the size if the user wants so
if (mShowSizeInLines)
{
aHdr->GetLineCount(&msgSize);
formattedSizeString.AppendInt(msgSize);
@ -1766,6 +1767,18 @@ NS_IMETHODIMP nsMsgDBView::Open(nsIMsgFolder *folder, nsMsgViewSortTypeValue sor
mIsNews = !strcmp("nntp",type.get());
GetImapDeleteModel(nsnull);
if (mIsNews)
{
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs)
{
PRBool temp;
rv = prefs->GetBoolPref("news.show_size_in_lines", &temp);
if (NS_SUCCEEDED(rv))
mShowSizeInLines = temp;
}
}
}
return NS_OK;
}
@ -1846,6 +1859,12 @@ NS_IMETHODIMP nsMsgDBView::GetSuppressMsgDisplay(PRBool * aSuppressDisplay)
return NS_OK;
}
NS_IMETHODIMP nsMsgDBView::GetUsingLines(PRBool * aUsingLines)
{
*aUsingLines = mShowSizeInLines;
return NS_OK;
}
int PR_CALLBACK CompareViewIndices (const void *v1, const void *v2, void *)
{
nsMsgViewIndex i1 = *(nsMsgViewIndex*) v1;
@ -3250,7 +3269,7 @@ nsresult nsMsgDBView::GetLongField(nsIMsgDBHdr *msgHdr, nsMsgViewSortTypeValue s
switch (sortType)
{
case nsMsgViewSortType::bySize:
rv = (mIsNews) ? msgHdr->GetLineCount(result) : msgHdr->GetMessageSize(result);
rv = (mShowSizeInLines) ? msgHdr->GetLineCount(result) : msgHdr->GetMessageSize(result);
break;
case nsMsgViewSortType::byPriority:
nsMsgPriorityValue priority;
@ -5751,6 +5770,7 @@ nsresult nsMsgDBView::CopyDBView(nsMsgDBView *aNewMsgDBView, nsIMessenger *aMess
if (m_db)
aNewMsgDBView->m_db->AddListener(aNewMsgDBView);
aNewMsgDBView->mIsNews = mIsNews;
aNewMsgDBView->mShowSizeInLines = mShowSizeInLines;
aNewMsgDBView->mHeaderParser = mHeaderParser;
aNewMsgDBView->mDeleteModel = mDeleteModel;
aNewMsgDBView->m_flags.CopyArray(m_flags);

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

@ -331,7 +331,8 @@ protected:
// and decendents of those folders
// (like the "Sent" folder, "Sent/Old Sent")
// the Sender column really shows recipients.
PRPackedBool mIsNews; // we have special icons for news, and for news, we show lines instead of size
PRPackedBool mIsNews; // we have special icons for news
PRPackedBool mShowSizeInLines; // for news we show lines instead of size when true
PRPackedBool m_sortValid;
PRUint8 m_saveRestoreSelectionDepth;

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

@ -170,6 +170,7 @@ pref("news.fcc_folder", "");
pref("news.notify.on", true);
pref("news.max_articles", 500);
pref("news.mark_old_read", false);
pref("news.show_size_in_lines", true);
pref("mailnews.wraplength", 72);
pref("mail.compose.wrap_to_window_width", false);