зеркало из https://github.com/mozilla/pjs.git
Bug 298841: first lessButton in edit virtual folder not fully functional; p=Henrik Skupin <hskupin@gmail.com>, r=me, sr=neil, a=cbeard
This commit is contained in:
Родитель
7974c73eb2
Коммит
16df5dbf3c
|
@ -105,14 +105,9 @@ function onLoad()
|
|||
function setupSearchRows(aSearchTerms)
|
||||
{
|
||||
if (aSearchTerms && aSearchTerms.Count() > 0)
|
||||
{
|
||||
// load the search terms for the folder
|
||||
initializeSearchRows(nsMsgSearchScope.offlineMail, aSearchTerms);
|
||||
if (aSearchTerms.Count() == 1)
|
||||
document.getElementById("less0").setAttribute("disabled", "true");
|
||||
}
|
||||
initializeSearchRows(nsMsgSearchScope.offlineMail, aSearchTerms); // load the search terms for the folder
|
||||
else
|
||||
onMore(null, 0);
|
||||
onMore(null);
|
||||
}
|
||||
|
||||
function updateOnlineSearchState()
|
||||
|
|
|
@ -195,7 +195,7 @@ function initializeBooleanWidgets()
|
|||
|
||||
function initializeSearchRows(scope, searchTerms)
|
||||
{
|
||||
for (i = 0; i < searchTerms.Count(); i++) {
|
||||
for (var i = 0; i < searchTerms.Count(); i++) {
|
||||
var searchTerm = searchTerms.QueryElementAt(i, nsIMsgSearchTerm);
|
||||
createSearchRow(i, scope, searchTerm);
|
||||
gTotalSearchTerms++;
|
||||
|
@ -204,37 +204,36 @@ function initializeSearchRows(scope, searchTerms)
|
|||
updateRemoveRowButton();
|
||||
}
|
||||
|
||||
// enables/disables tless button for the first row of search terms.
|
||||
// enables/disables the less button for the first row of search terms.
|
||||
function updateRemoveRowButton()
|
||||
{
|
||||
var firstListItem = gSearchTermList.getItemAtIndex(0);
|
||||
if (firstListItem)
|
||||
firstListItem.lastChild.lastChild.lastChild.disabled = gTotalSearchTerms == 1;
|
||||
firstListItem.lastChild.lastChild.lastChild.setAttribute("disabled", gTotalSearchTerms == 1);
|
||||
}
|
||||
|
||||
// Returns the actual list item row index in the list of search rows
|
||||
// that contains the passed in element id.
|
||||
function getSearchRowIndexForElement(aElement)
|
||||
{
|
||||
var listitem = aElement;
|
||||
while (listitem)
|
||||
{
|
||||
if (listitem.localName == "listitem")
|
||||
break;
|
||||
listitem = listitem.parentNode;
|
||||
}
|
||||
var listItem = aElement;
|
||||
|
||||
return gSearchTermList.getIndexOfItem(listitem);
|
||||
while (listItem && listItem.localName != "listitem")
|
||||
listItem = listItem.parentNode;
|
||||
|
||||
return gSearchTermList.getIndexOfItem(listItem);
|
||||
}
|
||||
|
||||
function onMore(event)
|
||||
{
|
||||
// if we have an event, extract the list row index and use that as the row number
|
||||
// for our insertion point. If there is no event, append to the end....
|
||||
var rowIndex;
|
||||
|
||||
var rowIndex = gSearchTermList.getRowCount();
|
||||
if (event)
|
||||
rowIndex = getSearchRowIndexForElement(event.target) + 1;
|
||||
else
|
||||
rowIndex = gSearchTermList.getRowCount();
|
||||
|
||||
createSearchRow(rowIndex, gSearchScope, null);
|
||||
gTotalSearchTerms++;
|
||||
|
@ -246,15 +245,11 @@ function onMore(event)
|
|||
|
||||
function onLess(event)
|
||||
{
|
||||
if (gTotalSearchTerms > 1)
|
||||
{
|
||||
var rowIndex;
|
||||
if (event)
|
||||
if (event && gTotalSearchTerms > 1)
|
||||
{
|
||||
removeSearchRow(getSearchRowIndexForElement(event.target));
|
||||
--gTotalSearchTerms;
|
||||
}
|
||||
}
|
||||
|
||||
updateRemoveRowButton();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче