diff --git a/xpfe/global/resources/content/globalOverlay.js b/xpfe/global/resources/content/globalOverlay.js index 60882e2e786..5bfaf5490e6 100644 --- a/xpfe/global/resources/content/globalOverlay.js +++ b/xpfe/global/resources/content/globalOverlay.js @@ -65,11 +65,8 @@ function goEditCardDialog(abURI, card, okCallback) function goPreferences(id, pane) { - if (!top.goPrefWindow) - top.goPrefWindow = Components.classes['component://netscape/prefwindow'].getService(Components.interfaces.nsIPrefWindow); - - if ( top.goPrefWindow ) - top.goPrefWindow.showWindow(id, window, pane); + //if( !top.goPrefWindow ) // XXXX commenting out for now until we find a way to duplicate this. + top.goPrefWindow = window.openDialog("chrome://pref/content/pref.xul","PrefWindow", "chrome,modal=yes,resizable=yes", pane); } diff --git a/xpfe/global/resources/content/widgetStateManager.js b/xpfe/global/resources/content/widgetStateManager.js index 7561738deea..918d5afac18 100644 --- a/xpfe/global/resources/content/widgetStateManager.js +++ b/xpfe/global/resources/content/widgetStateManager.js @@ -114,22 +114,34 @@ function WSM_SavePageData( currentPageTag, optAttributes, exclElements, inclElem for( var j = 0, idx = 0; j < formElement.options.length; j++ ) { if( formElement.options[j].selected ) { - elementEntry.value[idx] = formElement.options[j].text; + elementEntry.value[idx] = formElement.options[j].value; idx++; } } } else { - // single selections - var value = formElement.options[formElement.selectedIndex].text; - formElement.arbitraryvalue = value; - this.AddAttributes( formElement, elementEntry, "arbitraryvalue", optAttributes ); + // single selections + if (formElement.options[formElement.selectedIndex]) { + var value = formElement.options[formElement.selectedIndex].value; + dump("*** VALUE=" + value + "\n"); + formElement.arbitraryvalue = value; + this.AddAttributes( formElement, elementEntry, "arbitraryvalue", optAttributes ); + } } } - else if( formElement.getAttribute("type") && ( formElement.type.toLowerCase() == "checkbox" || formElement.type.toLowerCase() == "radio" ) ) { + else if( formElement.getAttribute("type") && formElement.type.toLowerCase() == "checkbox" ) { // XXX 11/04/99 this.AddAttributes( formElement, elementEntry, "checked", optAttributes ); } + else if( formElement.getAttribute("type") && formElement.type.toLowerCase() == "radio" ) { + if( formElement.getAttribute("preftype").toLowerCase() == "bool" ) { + if( formElement.getAttribute("checked") == true ) + this.AddAttributes( formElement, elementEntry, "prefindex", optAttributes ); + } + else { + this.AddAttributes( formElement, elementEntry, "checked", optAttributes ); + } + } else if( formElement.type == "text" && formElement.getAttribute( "datatype" ) == "nsIFileSpec" && formElement.value ) { @@ -176,7 +188,7 @@ function WSM_SetPageData( currentPageTag, hasExtraAttributes ) var id = this.PageData[currentPageTag][i].id; var value = this.PageData[currentPageTag][i].value; - //dump("*** id & value: " + id + " : " + value + "\n"); + dump("*** id & value: " + id + " : " + value + "\n"); if( this.content_frame.SetFields && !hasExtraAttributes ) this.content_frame.SetFields( id, value ); // user provided setfields @@ -238,7 +250,7 @@ function WSM_SetPageData( currentPageTag, hasExtraAttributes ) { for ( var k = 0; k < formElement.options.length; k++ ) { - if( formElement.options[k].text == value[j] ) + if( formElement.options[k].value == value[j] ) formElement.options[k].selected = true; } } @@ -247,7 +259,8 @@ function WSM_SetPageData( currentPageTag, hasExtraAttributes ) // single selected item for ( var k = 0; k < formElement.options.length; k++ ) { - if( formElement.options[k].text == value ) + dump("*** value=" + value + "; options[k].value=" + formElement.options[k].value + "\n"); + if( formElement.options[k].value == value ) formElement.options[k].selected = true; } } @@ -313,7 +326,11 @@ function WSM_toString() **/ function WSM_AddAttributes( formElement, elementEntry, valueAttribute, optAttributes ) { - elementEntry.value = formElement[valueAttribute]; // get the value (e.g. "checked") + // 07/01/00 adding in a reversed thing here for alecf's ultra picky mail prefs :P:P + if( formElement.getAttribute("reversed") ) + elementEntry.value = !formElement[valueAttribute]; // get the value (e.g. "checked") + else + elementEntry.value = formElement[valueAttribute]; // get the value (e.g. "checked") if( optAttributes ) { // if we've got optional attributes, add em for(var k = 0; k < optAttributes.length; k++ )