rem: identitySelect.value = args.preselectid; 
add: identity = getIdentityForKey(args.preselectid); 
context: function ComposeStartup(){	dump("Compose: ComposeStartup\n");	// Get arguments	var args = GetArgs();    // fill in Identity combobox    var identitySelect = document.getElementById("msgIdentity");    if (identitySelect) {        fillIdentitySelect(identitySelect);	// because of bug #14312, a default option was in the select widget	// remove it now 	identitySelect.remove(0);       }    if (args.preselectid)        identitySelect.value = args.preselectid;    else        identitySelect.selectedIndex = 0;    // fill in Recipient type combobox    FillRecipientTypeCombobox();    	if (msgComposeService)	{        // this is frustrating, we need to convert the preselect identity key        // back to an identity, to pass to initcompose        // it would be nice if there was some way to actually send the        // identity through "args"        var identity = getIdentityForKey(args.preselectid);        		msgCompose = msgComposeService.InitCompose(window, args.originalMsg, args.type, args.format, args.fieldsAddr, identity);		if (msgCompose)		{			//Creating a Editor Shell  			var editorShell = Components.classes["component://netscape/editor/editorshell"].createInstance();  			editorShell = editorShell.QueryInterface(Components.interfaces.nsIEditorShell);			if (!editorShell)			{				dump("Failed to create editorShell!\n");				return;			}						// save the editorShell in the window. The editor JS expects to find it there.			window.editorShell = editorShell;			window.editorShell.Init();			dump("Created editorShell\n");			SetupToolbarElements(); //defined into EditorCommands.js            contentWindow = window.content;			// setEditorType MUST be call before setContentWindow			if (msgCompose.composeHTML)			{				window.editorShell.SetEditorType("htmlmail");				dump("editor initialized in HTML mode\n");			}			else			{			    //Remove HTML toolbar as we are editing in plain text mode			    document.getElementById("FormatToolbar").setAttribute("hidden", true);				window.editorShell.SetEditorType("text");				try				{					window.editorShell.wrapColumn = msgCompose.wrapLength;				}				catch (e)				{					dump("### window.editorShell.wrapColumn exception text: " + e + " - failed\n");				}				dump("editor initialized in PLAIN TEXT mode\n");			}			window.editorShell.SetContentWindow(contentWindow);			window.editorShell.SetWebShellWindow(window);			window.editorShell.SetToolbarWindow(window);				    	var msgCompFields = msgCompose.compFields;	    	if (msgCompFields)	    	{	    		if (args.body) //We need to set the body before setting msgCompose.editor;	    			msgCompFields.SetBody(args.body);	    		if (args.to)	    			msgCompFields.SetTo(args.to);	    		if (args.cc)	    			msgCompFields.SetCc(args.cc);	    		if (args.bcc)	    			msgCompFields.SetBcc(args.bcc);	    		if (args.newsgroups)	    			msgCompFields.SetNewsgroups(args.newsgroups);	    		if (args.subject)	    			msgCompFields.SetSubject(args.subject);	    		if (args.attachment)	    			msgCompFields.SetAttachments(args.attachment);							var subjectValue = msgCompFields.GetSubject();				if (subjectValue != "") {					document.getElementById("msgSubject").value = subjectValue;				}                var attachmentValue = msgCompFields.GetAttachments();                if (attachmentValue != "") {                   var atts =  attachmentValue.split(",");                    for (var i=0; i < atts.length; i++)                    {                        AddAttachment(atts[i]);                    }                }			}						// Now that we have an Editor AppCore, we can finish to initialize the Compose AppCore			msgCompose.editor = window.editorShell;			msgCompose.RegisterStateListener(stateListener);			WaitFinishLoadingDocument();		}	}}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/d964874e77b9b9ee068328a7345859f947ac9085/MsgComposeCommands.js/buggy/mailnews/compose/resources/content/MsgComposeCommands.js