fix for #33749. first time compose window problems on linux. use skinnable menulist instead of html-select (kill two birds with one stone.) right-on=mscott, amen=leaf.

This commit is contained in:
sspitzer%netscape.com 2000-04-07 23:47:31 +00:00
parent 8429a748bc
commit 6fdba025f1
2 changed files with 33 additions and 18 deletions

View File

@ -159,14 +159,15 @@ function ComposeStartup()
{
dump("Compose: ComposeStartup\n");
// Get arguments
//dump("Get arguments\n");
var args = GetArgs();
// fill in Identity combobox
var identitySelect = document.getElementById("msgIdentity");
//dump("fill in Identity menulist\n");
var identityList = document.getElementById("msgIdentity");
var identityListPopup = document.getElementById("msgIdentityPopup");
if (identitySelect) {
fillIdentitySelect(identitySelect);
if (identityListPopup) {
fillIdentityListPopup(identityListPopup);
}
var identity;
@ -179,7 +180,15 @@ function ComposeStartup()
identity = identities.QueryElementAt(0, Components.interfaces.nsIMsgIdentity);
}
identitySelect.value = identity.key;
for (i=0;i<identityListPopup.childNodes.length;i++) {
var item = identityListPopup.childNodes[i];
var id = item.getAttribute('id');
if (id == identity.key) {
identityList.selectedItem = item;
break;
}
}
if (msgComposeService)
{
@ -705,28 +714,32 @@ function GetIdentities()
return identities;
}
function fillIdentitySelect(selectElement)
function fillIdentityListPopup(popup)
{
var identities = GetIdentities();
// dump("identities = " + identities + "\n");
for (var i=0; i<identities.length; i++)
{
var identity = identities[i];
var opt = new Option(identity.identityName, identity.key);
// dump(i + " = " + identity.identityName + "," +identity.key + "\n");
selectElement.add(opt, null);
//dump(i + " = " + identity.identityName + "," +identity.key + "\n");
var item=document.createElement('menuitem');
item.setAttribute('value', identity.identityName);
item.setAttribute('id', identity.key);
popup.appendChild(item);
}
}
function getCurrentIdentity()
{
// fill in Identity combobox
var identitySelect = document.getElementById("msgIdentity");
var identityKey = identitySelect.value;
// dump("Looking for identity " + identityKey + "\n");
var identityList = document.getElementById("msgIdentity");
var item = identityList.selectedItem;
var identityKey = item.getAttribute('id');
//dump("Looking for identity " + identityKey + "\n");
var identity = accountManager.getIdentity(identityKey);
return identity;

View File

@ -397,10 +397,12 @@ ACTUALLY, EVERY TIME YOU TYPE ANY OF THE KEY DEFINED HERE AFTER WITHOUT ANY OF T
<box align="vertical" flex="75%">
<spring style="height:0.5em"/>
<box align="horizontal">
<html:div>&fromAddr.label;</html:div>
<text value="&fromAddr.label;" />
<spring style="width:0.5em"/>
<html:select id="msgIdentity" onchange="contentChanged=true;"/>
</box>
<menulist id="msgIdentity" value="..." onchange="contentChanged=true;">
<menupopup id="msgIdentityPopup" />
</menulist>
</box>
<spring style="height:0.5em"/>
<!-- addressing widget -->