Bug 354204 - Fix click event for address book import items. r?jorgk
MozReview-Commit-ID: 2qgjrVULYad
--- a/mailnews/import/content/fieldMapImport.js
+++ b/mailnews/import/content/fieldMapImport.js
@@ -77,36 +77,43 @@ function ListFields() {
}
}
function CreateField( name, index, on)
{
var item = document.createElement('listitem');
item.setAttribute('field-index', index);
item.setAttribute('type', "checkbox");
- var cell = document.createElement('listcell');
- var cCell = document.createElement( 'listcell');
- cCell.setAttribute('type', "checkbox");
- cCell.setAttribute( 'label', name);
+ item.setAttribute('allowevents', 'true');
+
+ var secondCell = document.createElement('listcell');
+ var checkboxCell = document.createElement('listcell');
+ var firstCell = document.createElement('listcell');
+ checkboxCell.setAttribute('type', 'checkbox');
+ checkboxCell.addEventListener('click', cellClicked);
+ firstCell.setAttribute('label', name);
+
if (on == true)
- cCell.setAttribute( 'checked', "true");
- item.appendChild( cCell);
- cell.setAttribute( "class", "importsampledata");
- cell.setAttribute( 'label', "");
- item.appendChild( cell);
- return( item);
+ checkboxCell.setAttribute('checked', "true");
+
+ item.appendChild(checkboxCell);
+ secondCell.setAttribute('class', 'importsampledata');
+ secondCell.setAttribute('label', '');
+ item.appendChild(firstCell);
+ item.appendChild(secondCell);
+ return(item);
}
function AddFieldToList(name, index, on)
{
var item = CreateField(name, index, on);
gListbox.appendChild(item);
}
-function itemClicked(event)
+function cellClicked(event)
{
if (event.button == 0) {
var on = gListbox.selectedItem.firstChild.getAttribute('checked');
gListbox.selectedItem.firstChild.setAttribute('checked', (on != "true"));
}
}
// The "Move Up/Move Down" buttons should move the items in the left column
--- a/mailnews/import/content/fieldMapImport.xul
+++ b/mailnews/import/content/fieldMapImport.xul
@@ -35,24 +35,25 @@
</hbox>
<separator class="thin"/>
<label control="fieldList">&fieldMapImport.text;</label>
<separator class="thin"/>
<!-- field list -->
<hbox flex="1">
- <listbox id="fieldList" flex="1" onselect="disableMoveButtons();"
- onclick="itemClicked(event);">
+ <listbox id="fieldList" flex="1" onselect="disableMoveButtons();">
<listcols>
+ <listcol flex="2"/>
<listcol flex="7"/>
<listcol flex="13"/>
</listcols>
<listhead>
+ <listheader />
<listheader id="fieldNameHeader" label="&fieldMapImport.fieldListTitle;"/>
<listheader id="sampleDataHeader" label="&fieldMapImport.dataTitle;"/>
</listhead>
</listbox>
<vbox>
<spacer flex="1"/>
<button id="upButton" class="up" label="&fieldMapImport.up.label;"