зеркало из https://github.com/mozilla/gecko-dev.git
update support for boolean filters
This commit is contained in:
Родитель
8f64ff18fd
Коммит
5a614b70b9
|
@ -87,22 +87,29 @@ function initializeDialog(filter)
|
|||
var filterRowContainer = document.getElementById("filterTermList");
|
||||
var numTerms = filter.numTerms;
|
||||
for (var i=0; i<numTerms; i++) {
|
||||
var filterRow = createFilterRow(filter, i);
|
||||
var filterRow = createFilterRow(i);
|
||||
filterRowContainer.appendChild(filterRow);
|
||||
|
||||
// now that it's been added to the document, we can initialize it.
|
||||
var filterTermObject = document.getElementById("searchTerm" + i);
|
||||
|
||||
if (filterTermObject) {
|
||||
filterTermObject.searchScope = scope;
|
||||
var searchTerm =
|
||||
filter.searchTerms.QueryElementAt(i, Components.interfaces.nsIMsgSearchTerm);
|
||||
if (searchTerm)
|
||||
filterTermObject.searchTerm = searchTerm;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
dump("Ack! Can't find searchTerm" + i + "!\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function createFilterRow(filter, index)
|
||||
function createFilterRow(index)
|
||||
{
|
||||
var searchAttr = document.createElement("searchattribute");
|
||||
var searchOp = document.createElement("searchoperator");
|
||||
|
@ -115,7 +122,10 @@ function createFilterRow(filter, index)
|
|||
|
||||
searchAttr.setAttribute("for", searchOp.id + "," + searchVal.id);
|
||||
|
||||
var rowdata = new Array(null, searchAttr, null, searchOp, null, searchVal, null);
|
||||
var rowdata = new Array(null, searchAttr,
|
||||
null, searchOp,
|
||||
null, searchVal,
|
||||
null);
|
||||
var searchrow = constructRow(rowdata);
|
||||
|
||||
searchrow.id = "searchRow" + index;
|
||||
|
@ -131,13 +141,20 @@ function createFilterRow(filter, index)
|
|||
// now re-find the inserted element
|
||||
searchTerm = document.getElementById(searchTerm.id);
|
||||
|
||||
|
||||
searchTerm.searchattribute = searchAttr;
|
||||
searchTerm.searchoperator = searchOp;
|
||||
searchTerm.searchvalue = searchVal;
|
||||
|
||||
// probably a noop?
|
||||
// searchTerm.initialize(filter, index);
|
||||
// this is scary - basically we want to take every other
|
||||
// treecell, which will be a text label, and set the searchTerm's
|
||||
// booleanNodes to that
|
||||
var stringNodes = new Array;
|
||||
var treecells = searchrow.firstChild.childNodes;
|
||||
var j=0;
|
||||
for (var i=0; i<treecells.length; i+=2) {
|
||||
stringNodes[j++] = treecells[i];
|
||||
}
|
||||
searchTerm.booleanNodes = stringNodes;
|
||||
|
||||
|
||||
// now return the row
|
||||
|
@ -152,9 +169,10 @@ function constructRow(treeCellChildren)
|
|||
var row = document.createElement("treerow");
|
||||
for (var i = 0; i<treeCellChildren.length; i++) {
|
||||
var treecell = document.createElement("treecell");
|
||||
treecell.setAttribute("allowevents", "true");
|
||||
|
||||
// it's ok to have empty cells
|
||||
if (treeCellChildren[i]) {
|
||||
treecell.setAttribute("allowevents", "true");
|
||||
treeCellChildren[i].setAttribute("flex", "1");
|
||||
treecell.appendChild(treeCellChildren[i]);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ Rights Reserved.
|
|||
|
||||
<script language="JavaScript" src="chrome://messenger/content/FilterEditor.js"/>
|
||||
<script language="JavaScript" src="chrome://global/content/strres.js"/>
|
||||
<script src="resource:/res/samples/DumpDOM.js"/>
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<box orient="horizontal" class="padded">
|
||||
|
@ -60,13 +59,13 @@ Rights Reserved.
|
|||
searchoperator="searchOp"
|
||||
searchvalue="searchValue"/>
|
||||
</searchterms>
|
||||
<tree class="inset" flex="1">
|
||||
<treecol id="preSearchAttr" width="0*"/>
|
||||
<treecol id="searchAttr" width="1*"/>
|
||||
<tree class="inset" flex="1" id="searchTermTree">
|
||||
<treecol id="preSearchAttr" width="1*"/>
|
||||
<treecol id="searchAttr" width="4*"/>
|
||||
<treecol id="preSearchOp" width="0*"/>
|
||||
<treecol id="searchOp" width="1*"/>
|
||||
<treecol id="searchOp" width="4*"/>
|
||||
<treecol id="preSearchValue" width="0*"/>
|
||||
<treecol id="searchValue" width="1*"/>
|
||||
<treecol id="searchValue" width="4*"/>
|
||||
<treecol id="postSearchValue" width="0*"/>
|
||||
|
||||
<treechildren id="filterTermList">
|
||||
|
@ -141,7 +140,6 @@ Rights Reserved.
|
|||
<menupopup/>
|
||||
</menulist>
|
||||
</titledbox>
|
||||
<button onclick="DumpDOM(document.getElementById('actionTargetFolder'))" value="dump"/>
|
||||
<separator class="groove"/>
|
||||
<box id="okCancelButtons"/>
|
||||
</window>
|
||||
|
|
Загрузка…
Ссылка в новой задаче