From 794ea02f3ddae8a7b0405f8b74d4202e9266b26a Mon Sep 17 00:00:00 2001 From: "bugzilla%standard8.demon.co.uk" Date: Fri, 14 Apr 2006 08:57:03 +0000 Subject: [PATCH] Bug 216245 Subscribe/account wizard for newsgroups forgets account name. r=mnyromyr,sr=bienvenu for main patch, r/sr=bienvenu for regression fix (included in checkin) a=mscott for both patches git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@194401 18797224-902f-48f8-a5cc-f745e15eee43 --- .../prefs/resources/content/AccountWizard.js | 7 +++- .../prefs/resources/content/aw-accname.js | 2 ++ .../prefs/resources/content/aw-accounttype.js | 9 ++++- .../base/prefs/resources/content/aw-done.js | 36 ++++++++++--------- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/mozilla/mailnews/base/prefs/resources/content/AccountWizard.js b/mozilla/mailnews/base/prefs/resources/content/AccountWizard.js index e39b13329c1..ec9f5fdbb4f 100644 --- a/mozilla/mailnews/base/prefs/resources/content/AccountWizard.js +++ b/mozilla/mailnews/base/prefs/resources/content/AccountWizard.js @@ -294,12 +294,15 @@ function AccountDataToPageData(accountData, pageData) setPageData(pageData, "server", "servertype", server.type); setPageData(pageData, "server", "hostname", server.hostName); } + setPageData(pageData, "accounttype", "otheraccount", false); } setPageData(pageData, "login", "username", server.username); setPageData(pageData, "login", "password", server.password); setPageData(pageData, "login", "rememberPassword", server.rememberPassword); setPageData(pageData, "accname", "prettyName", server.prettyName); + setPageData(pageData, "accname", "userset", false); + setPageData(pageData, "ispdata", "supplied", false); var identity; @@ -628,7 +631,7 @@ function setupCopiesAndFoldersServer(account, accountIsDeferred) if (!am.localFoldersServer) { dump("error! we should have a local mail server at this point\n"); - return; + return false; } copiesAndFoldersServer = am.localFoldersServer; } @@ -929,6 +932,8 @@ function PrefillAccountForIsp(ispName) dump("PrefillAccountForISP: filling with " + ispData + "\n"); SetCurrentAccountData(ispData); AccountDataToPageData(ispData, pageData); + + setPageData(pageData, "ispdata", "supplied", true); } // does any cleanup work for the the account data diff --git a/mozilla/mailnews/base/prefs/resources/content/aw-accname.js b/mozilla/mailnews/base/prefs/resources/content/aw-accname.js index dba0a4f938b..57ad4fdb9c4 100644 --- a/mozilla/mailnews/base/prefs/resources/content/aw-accname.js +++ b/mozilla/mailnews/base/prefs/resources/content/aw-accname.js @@ -76,6 +76,8 @@ function acctNamePageValidate() } setPageData(pageData, "accname", "prettyName", accountname); + // Set this to true so we know the user has set the name. + setPageData(pageData, "accname", "userset", true); return true; } diff --git a/mozilla/mailnews/base/prefs/resources/content/aw-accounttype.js b/mozilla/mailnews/base/prefs/resources/content/aw-accounttype.js index 1206e8d5334..85e847c0201 100644 --- a/mozilla/mailnews/base/prefs/resources/content/aw-accounttype.js +++ b/mozilla/mailnews/base/prefs/resources/content/aw-accounttype.js @@ -69,13 +69,20 @@ function setupWizardPanels() { } var pageData = parent.GetPageData(); + + // We default this to false, even though we could set it to true if we + // are going to display the page. However as the accname page will set + // it to true for us, we'll just default it to false and not work it out + // twice. + setPageData(pageData, "accname", "userset", false); // If we need to skip wizardpanels, set the wizard to jump to the // summary page i.e., last page. Otherwise, set the flow based // on type of account (mail or news) user is creating. var skipPanels = ""; try { - skipPanels = gCurrentAccountData.wizardSkipPanels.toString().toLowerCase(); + if (gCurrentAccountData.wizardSkipPanels) + skipPanels = gCurrentAccountData.wizardSkipPanels.toString().toLowerCase(); } catch(ex) {} // "done" is the only required panel for all accounts. We used to require an identity panel but not anymore. diff --git a/mozilla/mailnews/base/prefs/resources/content/aw-done.js b/mozilla/mailnews/base/prefs/resources/content/aw-done.js index c3ad5335b54..8563b0aadb8 100644 --- a/mozilla/mailnews/base/prefs/resources/content/aw-done.js +++ b/mozilla/mailnews/base/prefs/resources/content/aw-done.js @@ -102,25 +102,29 @@ function donePageInit() { smtpUserName = getUsernameFromEmail(email); setDivTextFromForm("smtpServer.username", smtpUserName); - var accountName=""; if (pageData.accname && pageData.accname.prettyName) { - accountName = pageData.accname.prettyName.value; + // If currentAccountData has a pretty name (e.g. news link or from + // isp data) only set the user name with the pretty name if the + // pretty name originally came from ispdata + if ((currentAccountData && + currentAccountData.incomingServer.prettyName) && + (pageData.ispdata && + pageData.ispdata.supplied && + pageData.ispdata.supplied.value)) + { + // Get the polished account name - if the user has modified the + // account name then use that, otherwise use the userName. + pageData.accname.prettyName.value = + gPrefsBundle.getFormattedString("accountName", + [currentAccountData.incomingServer.prettyName, + (pageData.accname.userset && pageData.accname.userset.value) ? pageData.accname.prettyName.value : userName]); + } + // else just use the default supplied name - // If the AccountData exists, tha means we have values read from rdf file. - // Get the pretty name and polish the account name - if ( currentAccountData && - currentAccountData.incomingServer.prettyName) - { - var prettyName = currentAccountData.incomingServer.prettyName; - // Get the polished account name - accountName = gPrefsBundle.getFormattedString("accountName", - [prettyName, - userName]); - // Set that to be the name in the pagedata - pageData.accname.prettyName.value = accountName; - } + setDivTextFromForm("account.name", pageData.accname.prettyName.value); + } else { + setDivTextFromForm("account.name", ""); } - setDivTextFromForm("account.name", accountName); // Show mail servers (incoming&outgoing) details // based on current account data. ISP can set