more changes for the spam UI. fix the junk status column. part of bug #169638. not visible to end user yet. r/sr=bienvenu, a=asa

This commit is contained in:
sspitzer%netscape.com 2002-10-10 02:21:40 +00:00
Родитель 5ab3a82465
Коммит 54fa156d30
3 изменённых файлов: 38 добавлений и 2 удалений

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

@ -49,7 +49,7 @@ Rights Reserved.
<treecol id="sizeCol" class="sortDirectionIndicator" persist="hidden ordinal width" flex="1" label="&sizeColumn.label;"/> <treecol id="sizeCol" class="sortDirectionIndicator" persist="hidden ordinal width" flex="1" label="&sizeColumn.label;"/>
<splitter class="tree-splitter"/> <splitter class="tree-splitter"/>
<!-- not ready yet <!-- not ready yet
<treecol id="junkStatusCol" class="sortDirectionIndicator" persist="hidden ordinal width" flex="1" label="&junkStatusColumn.label;"/> <treecol id="junkStatusCol" fixed="true" persist="hidden ordinal width" class="treecol-image junkStatusHeader" display="&junkStatusColumn.label;" cycler="true"/>
<splitter class="tree-splitter"/> <splitter class="tree-splitter"/>
--> -->
<treecol id="flaggedCol" fixed="true" persist="hidden ordinal" class="treecol-image flagColumnHeader" display="&flagColumn.label;" cycler="true"/> <treecol id="flaggedCol" fixed="true" persist="hidden ordinal" class="treecol-image flagColumnHeader" display="&flagColumn.label;" cycler="true"/>

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

@ -88,6 +88,9 @@ nsIAtom * nsMsgDBView::kWatchThreadAtom = nsnull;
nsIAtom * nsMsgDBView::kIgnoreThreadAtom = nsnull; nsIAtom * nsMsgDBView::kIgnoreThreadAtom = nsnull;
nsIAtom * nsMsgDBView::kHasImageAtom = nsnull; nsIAtom * nsMsgDBView::kHasImageAtom = nsnull;
nsIAtom * nsMsgDBView::kJunkMsgAtom = nsnull;
nsIAtom * nsMsgDBView::kNotJunkMsgAtom = nsnull;
nsIAtom * nsMsgDBView::mLabelPrefColorAtoms[PREF_LABELS_MAX] = {nsnull, nsnull, nsnull, nsnull, nsnull}; nsIAtom * nsMsgDBView::mLabelPrefColorAtoms[PREF_LABELS_MAX] = {nsnull, nsnull, nsnull, nsnull, nsnull};
nsIAtom * nsMsgDBView::kLabelColorWhiteAtom = nsnull; nsIAtom * nsMsgDBView::kLabelColorWhiteAtom = nsnull;
@ -160,6 +163,8 @@ void nsMsgDBView::InitializeAtomsAndLiterals()
kWatchThreadAtom = NS_NewAtom("watch"); kWatchThreadAtom = NS_NewAtom("watch");
kIgnoreThreadAtom = NS_NewAtom("ignore"); kIgnoreThreadAtom = NS_NewAtom("ignore");
kHasImageAtom = NS_NewAtom("hasimage"); kHasImageAtom = NS_NewAtom("hasimage");
kJunkMsgAtom = NS_NewAtom("junk");
kNotJunkMsgAtom = NS_NewAtom("notjunk");
#ifdef SUPPORT_PRIORITY_COLORS #ifdef SUPPORT_PRIORITY_COLORS
kHighestPriorityAtom = NS_NewAtom("priority-highest"); kHighestPriorityAtom = NS_NewAtom("priority-highest");
@ -204,6 +209,8 @@ nsMsgDBView::~nsMsgDBView()
NS_IF_RELEASE(kWatchThreadAtom); NS_IF_RELEASE(kWatchThreadAtom);
NS_IF_RELEASE(kIgnoreThreadAtom); NS_IF_RELEASE(kIgnoreThreadAtom);
NS_IF_RELEASE(kHasImageAtom); NS_IF_RELEASE(kHasImageAtom);
NS_IF_RELEASE(kJunkMsgAtom);
NS_IF_RELEASE(kNotJunkMsgAtom);
#ifdef SUPPORT_PRIORITY_COLORS #ifdef SUPPORT_PRIORITY_COLORS
NS_IF_RELEASE(kHighestPriorityAtom); NS_IF_RELEASE(kHighestPriorityAtom);
@ -1125,6 +1132,17 @@ NS_IMETHODIMP nsMsgDBView::GetCellProperties(PRInt32 aRow, const PRUnichar *colI
{ {
properties->AppendElement(kHasImageAtom); properties->AppendElement(kHasImageAtom);
} }
nsXPIDLCString junkScoreStr;
msgHdr->GetStringProperty("junkscore", getter_Copies(junkScoreStr));
if (!junkScoreStr.IsEmpty())
{
// I set the cut off at 50. this may change
// it works for our bayesian plugin, as "0" is good, and "100" is junk
// but it might need tweaking for other plugins
properties->AppendElement(atoi(junkScoreStr.get()) > 50 ? kJunkMsgAtom : kNotJunkMsgAtom);
}
nsXPIDLCString keywordProperty; nsXPIDLCString keywordProperty;
msgHdr->GetStringProperty("keywords", getter_Copies(keywordProperty)); msgHdr->GetStringProperty("keywords", getter_Copies(keywordProperty));
if (!keywordProperty.IsEmpty()) if (!keywordProperty.IsEmpty())
@ -1532,6 +1550,22 @@ NS_IMETHODIMP nsMsgDBView::CycleCell(PRInt32 row, const PRUnichar *colID)
else else
ApplyCommandToIndices(nsMsgViewCommandType::flagMessages, (nsMsgViewIndex *) &row, 1); ApplyCommandToIndices(nsMsgViewCommandType::flagMessages, (nsMsgViewIndex *) &row, 1);
break; break;
case 'j': // junkStatus column
{
nsCOMPtr <nsIMsgDBHdr> msgHdr;
nsresult rv = GetMsgHdrForViewIndex(row, getter_AddRefs(msgHdr));
if (NS_SUCCEEDED(rv) && msgHdr)
{
nsXPIDLCString junkScoreStr;
rv = msgHdr->GetStringProperty("junkscore", getter_Copies(junkScoreStr));
if (junkScoreStr.IsEmpty() || (atoi(junkScoreStr.get()) < 50))
ApplyCommandToIndices(nsMsgViewCommandType::junk, (nsMsgViewIndex *) &row, 1);
else
ApplyCommandToIndices(nsMsgViewCommandType::unjunk, (nsMsgViewIndex *) &row, 1);
}
}
break;
case 'l': // label column case 'l': // label column
{ {
nsCOMPtr <nsIMsgDBHdr> msgHdr; nsCOMPtr <nsIMsgDBHdr> msgHdr;
@ -1551,7 +1585,6 @@ NS_IMETHODIMP nsMsgDBView::CycleCell(PRInt32 row, const PRUnichar *colID)
msgHdr->SetLabel(0); msgHdr->SetLabel(0);
} }
} }
} }
break; break;
default: default:

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

@ -133,6 +133,9 @@ protected:
static nsIAtom* kLabelColorWhiteAtom; static nsIAtom* kLabelColorWhiteAtom;
static nsIAtom* kLabelColorBlackAtom; static nsIAtom* kLabelColorBlackAtom;
static nsIAtom* kJunkMsgAtom;
static nsIAtom* kNotJunkMsgAtom;
static PRUnichar* kReadString; static PRUnichar* kReadString;
static PRUnichar* kRepliedString; static PRUnichar* kRepliedString;
static PRUnichar* kForwardedString; static PRUnichar* kForwardedString;