From 9fbb586804f6102e42e4b6e2bb727dab6590218f Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Sun, 19 Sep 1999 09:34:59 +0000 Subject: [PATCH] fix layout of main panel add support for nsIFileSpec style fields --- .../prefs/resources/content/AccountManager.js | 72 ++++++++------- .../base/prefs/resources/content/am-main.xul | 92 ++++++++++--------- 2 files changed, 86 insertions(+), 78 deletions(-) diff --git a/mailnews/base/prefs/resources/content/AccountManager.js b/mailnews/base/prefs/resources/content/AccountManager.js index 60c38e46a34c..0958889089ca 100644 --- a/mailnews/base/prefs/resources/content/AccountManager.js +++ b/mailnews/base/prefs/resources/content/AccountManager.js @@ -243,7 +243,7 @@ function setAccountValue(accountValues, type, slot, value) { if (!accountValues[type]) accountValues[type] = new Array; - dump("Form->Array: accountValues[" + type + "][" + slot + "] = " + value + "\n"); + //dump("Form->Array: accountValues[" + type + "][" + slot + "] = " + value + "\n"); accountValues[type][slot] = value; } @@ -280,11 +280,11 @@ function getAccountValue(account, accountValues, type, slot) { } if (source) { - accountValues[type][slot] = getStringValueOf(source[slot]); + accountValues[type][slot] = source[slot]; } } var value = accountValues[type][slot]; - dump("Array->Form: accountValues[" + type + "][" + slot + "] = " + value + "\n"); + //dump("Array->Form: accountValues[" + type + "][" + slot + "] = " + value + "\n"); return value; } // @@ -325,26 +325,28 @@ function getFormElementValue(formElement) { return !formElement.checked; else return formElement.checked; - } else + } + + else if (formElement.type == "text" && + formElement.getAttribute("datatype") == "nsIFileSpec") { + var filespec = Components.classes["component://netscape/filespec"].createInstance(Components.interfaces.nsIFileSpec); + filespec.nativePath = formElement.value; + return filespec; + } + + + else return formElement.value; } -function getStringValueOf(obj) { - - var value = obj; - if (value && typeof(value) == "object") { - try { - var filespec = value.QueryInterface(Components.interfaces.nsIFileSpec); - realvalue = filespec.nativePath; - } catch (ex) {} - } - return obj; -} // // sets the value of a widget // function setFormElementValue(formElement, value) { - + + //formElement.value = formElement.defaultValue; + // formElement.checked = formElement.defaultChecked; + if (formElement.type == "checkbox") { if (value == undefined) { formElement.checked = formElement.defaultChecked; @@ -354,7 +356,26 @@ function setFormElementValue(formElement, value) { else formElement.checked = value; } - } else { + + } + + // handle nsIFileSpec + else if (formElement.type == "text" && + formElement.getAttribute("datatype") == "nsIFileSpec") { + if (value) { + var filespec = value.QueryInterface(Components.interfaces.nsIFileSpec); + try { + formElement.value = filespec.nativePath; + } catch (ex) { + dump("Still need to fix uninitialized filespec problem!\n"); + } + } else + formElement.value = formElement.defaultValue; + + } + + // let the form figure out what to do with it + else { if (value == undefined) formElement.value = formElement.defaultValue; else @@ -362,23 +383,6 @@ function setFormElementValue(formElement, value) { } } - -function fillAccountValues(accountValues, account, fields) { - - var identity = account.defaultIdentity; - var server = account.incomingServer; - - for (var i=0; i - -function onInit() { - dump("am-main being initted!\n"); -} - - + &accountTitle.label; - - &accountSettingsDesc.label; + + &accountSettingsDesc.label; &accountNameDesc.label; &accountName.label; @@ -25,42 +20,41 @@ function onInit() { - &identityTitle.label; - - &identityDesc.label; - - &name.label; - - - - &email.label; - - - - &replyTo.label; - - - - &organization.label; - - - - - - &useHtml.label; - - - + &identityTitle.label; + + &identityDesc.label; + + + + &name.label; + + + + &email.label; + + + + &replyTo.label; + + + + &organization.label; + + + + - &attachVCard.label; + &attachVCard.label; - - - - - &signature.label; - - + + + + + + &signature.label; + + + - + + + + + + + &useHtml.label; + + +