зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
5ab3a82465
Коммит
54fa156d30
|
@ -49,7 +49,7 @@ Rights Reserved.
|
|||
<treecol id="sizeCol" class="sortDirectionIndicator" persist="hidden ordinal width" flex="1" label="&sizeColumn.label;"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<!-- 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"/>
|
||||
-->
|
||||
<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::kHasImageAtom = nsnull;
|
||||
|
||||
nsIAtom * nsMsgDBView::kJunkMsgAtom = nsnull;
|
||||
nsIAtom * nsMsgDBView::kNotJunkMsgAtom = nsnull;
|
||||
|
||||
nsIAtom * nsMsgDBView::mLabelPrefColorAtoms[PREF_LABELS_MAX] = {nsnull, nsnull, nsnull, nsnull, nsnull};
|
||||
|
||||
nsIAtom * nsMsgDBView::kLabelColorWhiteAtom = nsnull;
|
||||
|
@ -160,6 +163,8 @@ void nsMsgDBView::InitializeAtomsAndLiterals()
|
|||
kWatchThreadAtom = NS_NewAtom("watch");
|
||||
kIgnoreThreadAtom = NS_NewAtom("ignore");
|
||||
kHasImageAtom = NS_NewAtom("hasimage");
|
||||
kJunkMsgAtom = NS_NewAtom("junk");
|
||||
kNotJunkMsgAtom = NS_NewAtom("notjunk");
|
||||
|
||||
#ifdef SUPPORT_PRIORITY_COLORS
|
||||
kHighestPriorityAtom = NS_NewAtom("priority-highest");
|
||||
|
@ -204,6 +209,8 @@ nsMsgDBView::~nsMsgDBView()
|
|||
NS_IF_RELEASE(kWatchThreadAtom);
|
||||
NS_IF_RELEASE(kIgnoreThreadAtom);
|
||||
NS_IF_RELEASE(kHasImageAtom);
|
||||
NS_IF_RELEASE(kJunkMsgAtom);
|
||||
NS_IF_RELEASE(kNotJunkMsgAtom);
|
||||
|
||||
#ifdef SUPPORT_PRIORITY_COLORS
|
||||
NS_IF_RELEASE(kHighestPriorityAtom);
|
||||
|
@ -1125,6 +1132,17 @@ NS_IMETHODIMP nsMsgDBView::GetCellProperties(PRInt32 aRow, const PRUnichar *colI
|
|||
{
|
||||
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;
|
||||
msgHdr->GetStringProperty("keywords", getter_Copies(keywordProperty));
|
||||
if (!keywordProperty.IsEmpty())
|
||||
|
@ -1532,6 +1550,22 @@ NS_IMETHODIMP nsMsgDBView::CycleCell(PRInt32 row, const PRUnichar *colID)
|
|||
else
|
||||
ApplyCommandToIndices(nsMsgViewCommandType::flagMessages, (nsMsgViewIndex *) &row, 1);
|
||||
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
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
|
@ -1551,7 +1585,6 @@ NS_IMETHODIMP nsMsgDBView::CycleCell(PRInt32 row, const PRUnichar *colID)
|
|||
msgHdr->SetLabel(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -133,6 +133,9 @@ protected:
|
|||
static nsIAtom* kLabelColorWhiteAtom;
|
||||
static nsIAtom* kLabelColorBlackAtom;
|
||||
|
||||
static nsIAtom* kJunkMsgAtom;
|
||||
static nsIAtom* kNotJunkMsgAtom;
|
||||
|
||||
static PRUnichar* kReadString;
|
||||
static PRUnichar* kRepliedString;
|
||||
static PRUnichar* kForwardedString;
|
||||
|
|
Загрузка…
Ссылка в новой задаче