Bug 422814 - enable autoconfig, r=bienvenu
authorPhil Ringnalda <philringnalda@gmail.com>
Fri, 24 Apr 2009 18:34:52 -0700
changeset 2479 c393002d58827a28a035cdc197d993e3fa2b9dce
parent 2478 1a798b290ea19bd2082f11027ad819bd739b7c05
child 2480 73916621f482fbd6b0d6cb8c164b7064e313d779
push idunknown
push userunknown
push dateunknown
reviewersbienvenu
bugs422814
Bug 422814 - enable autoconfig, r=bienvenu
mail/base/content/mailWindowOverlay.xul
mail/base/jar.mn
mailnews/base/prefs/resources/content/accountUtils.js
mailnews/base/prefs/resources/content/accountcreation/emailWizard.xul
mailnews/base/resources/content/msgAccountCentral.xul
mailnews/jar.mn
mailnews/mailnews.js
--- a/mail/base/content/mailWindowOverlay.xul
+++ b/mail/base/content/mailWindowOverlay.xul
@@ -805,16 +805,20 @@
         <menu id="menu_File">
           <menupopup id="menu_FilePopup" onpopupshowing="file_init();">
           <menu id="menu_New">
             <menupopup id="menu_NewPopup" onpopupshowing="menu_new_init();">
               <menuitem id="newNewMsgCmd" label="&newNewMsgCmd.label;"
                         accesskey="&newNewMsgCmd.accesskey;"
                         key="key_newMessage2"
                         oncommand="MsgNewMessage(null);"/>
+              <menuitem id="newMailAccountMenuItem"
+                        label="&newMailAccountCmd.label;"
+                        accesskey="&newMailAccountCmd.accesskey;"
+                        oncommand="NewMailAccount(msgWindow);"/>
               <menuitem id="menu_newFolder" label="&newFolderCmd.label;"
                          oncommand="gFolderTreeController.newFolder();"
                          accesskey="&newFolderCmd.accesskey;"/>
               <menuitem id="menu_newVirtualFolder" label="&newVirtualFolderCmd.label;"
                          oncommand="gFolderTreeController.newVirtualFolder();"
                          accesskey="&newVirtualFolderCmd.accesskey;"/>
               <menuitem id="newAccountMenuItem" label="&newAccountCmd.label;"
                          accesskey="&newAccountCmd.accesskey;"
--- a/mail/base/jar.mn
+++ b/mail/base/jar.mn
@@ -5,16 +5,20 @@ messenger.jar:
 % overlay chrome://global/content/viewSource.xul chrome://messenger/content/viewSourceOverlay.xul
 % overlay chrome://global/content/config.xul chrome://messenger/content/configEditorOverlay.xul
 % style chrome://global/content/customizeToolbar.xul chrome://messenger/content/messenger.css
 % style chrome://global/content/customizeToolbar.xul chrome://messenger/skin/
 % style chrome://global/content/customizeToolbar.xul chrome://messenger/skin/addressbook/addressbook.css
 % style chrome://global/content/customizeToolbar.xul chrome://messenger/skin/messengercompose/messengercompose.css
 % style chrome://global/content/customizeToolbar.xul chrome://messenger/skin/smime/msgCompSMIMEOverlay.css
 % style chrome://global/content/customizeToolbar.xul chrome://messenger/skin/primaryToolbar.css
+    content/messenger/accountCreation.dtd           (content/accountCreation.dtd)
+    content/messenger/accountCreation.properties    (content/accountCreation.properties)
+    content/messenger/accountCreationModel.properties (content/accountCreationModel.properties)
+    content/messenger/accountCreationUtil.properties  (content/accountCreationUtil.properties)
 *   content/messenger/mailWindow.js                 (content/mailWindow.js)
 *   content/messenger/mailWindowOverlay.js          (content/mailWindowOverlay.js)
 *   content/messenger/mailWindowOverlay.xul         (content/mailWindowOverlay.xul)
 *   content/messenger/extraCustomizeItems.xul       (content/extraCustomizeItems.xul)
 *   content/messenger/mailOverlay.xul               (content/mailOverlay.xul)
 *   content/messenger/messageWindow.xul             (content/messageWindow.xul)
 *   content/messenger/messageWindow.js              (content/messageWindow.js)
 *   content/messenger/mailContextMenus.js           (content/mailContextMenus.js)
--- a/mailnews/base/prefs/resources/content/accountUtils.js
+++ b/mailnews/base/prefs/resources/content/accountUtils.js
@@ -290,8 +290,29 @@ function migrateGlobalQuotingPrefs(allId
           identity.replyOnTop = reply_on_top;
         }
       }
     }
     pref.setIntPref("mailnews.quotingPrefs.version", 1);
   }
   return migrated;
 }
+
+// we do this from a timer because if this is called from the onload=
+// handler, then the parent window doesn't appear until after the wizard
+// has closed, and this is confusing to the user
+function NewMailAccount(msgWindow)
+{
+  setTimeout(msgNewMailAccount, 0, msgWindow);
+}
+
+function msgNewMailAccount(msgWindow)
+{
+  let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                     .getService()
+                     .QueryInterface(Components.interfaces.nsIWindowMediator);
+  let existingWindow = wm.getMostRecentWindow("mail:autoconfig");
+  if (existingWindow)
+    existingWindow.focus();
+  else
+    window.openDialog("chrome://messenger/content/accountcreation/emailWizard.xul",
+                      "AccountSetup", "chrome,titlebar,centerscreen",{msgWindow:msgWindow});
+}
--- a/mailnews/base/prefs/resources/content/accountcreation/emailWizard.xul
+++ b/mailnews/base/prefs/resources/content/accountcreation/emailWizard.xul
@@ -42,16 +42,17 @@
   <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
   %brandDTD;
   <!ENTITY % acDTD SYSTEM "chrome://messenger/content/accountCreation.dtd">
   %acDTD;
 ]>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         id="autoconfigWizard"
+        windowtype="mail:autoconfig"
         title="&welcome.description;"
         style="&autoconfigWizard.style;"
         onload="gEmailConfigWizard.onLoad();"
         onkeydown="gEmailConfigWizard.onKeyDown()"
         onclose="gEmailConfigWizard.onWizardShutdown();"
         onunload="gEmailConfigWizard.onWizardShutdown();"
         >
 
--- a/mailnews/base/resources/content/msgAccountCentral.xul
+++ b/mailnews/base/resources/content/msgAccountCentral.xul
@@ -148,17 +148,27 @@
       <row id="AccountSettings" class="acctCentralRow">
         <hbox> 
           <label class="acctCentralText acctCentralLinkText" value="&settingsLink.label;" chromedir="&locale.dir;" onclick="ViewSettings(null);"/> 
         </hbox> 
       </row>
       <separator id="AccountSettings.separator" class="thin"/>
       <row id="CreateAccount" class="acctCentralRow">
         <hbox> 
-          <label class="acctCentralText acctCentralLinkText" value="&newAcctLink.label;" chromedir="&locale.dir;" onclick="CreateNewAccount();"/> 
+#ifdef MOZ_THUNDERBIRD
+          <label class="acctCentralText acctCentralLinkText"
+                 value="&newAcctLink.label;"
+                 chromedir="&locale.dir;"
+                 onclick="msgNewMailAccount();"/>
+#else
+          <label class="acctCentralText acctCentralLinkText"
+                 value="&newAcctLink.label;"
+                 chromedir="&locale.dir;"
+                 onclick="CreateNewAccount();"/>
+#endif
         </hbox> 
       </row>
       <separator id="CreateAccount.separator" class="thin"/>
 
       <separator id="AccountsSection.separator1"/>
       <separator id="AccountsSection.separator2"/>
       <separator id="AccountsSection.separator3"/>
 
--- a/mailnews/jar.mn
+++ b/mailnews/jar.mn
@@ -60,27 +60,41 @@ messenger.jar:
     content/messenger/aw-done.js                                               (base/prefs/resources/content/aw-done.js)
     content/messenger/accountUtils.js                                          (base/prefs/resources/content/accountUtils.js)
     content/messenger/amUtils.js                                               (base/prefs/resources/content/amUtils.js)
     content/messenger/ispUtils.js                                              (base/prefs/resources/content/ispUtils.js)
     content/messenger/SmtpServerEdit.xul                                       (base/prefs/resources/content/SmtpServerEdit.xul)
     content/messenger/SmtpServerEdit.js                                        (base/prefs/resources/content/SmtpServerEdit.js)
     content/messenger/smtpEditOverlay.xul                                      (base/prefs/resources/content/smtpEditOverlay.xul)
     content/messenger/smtpEditOverlay.js                                       (base/prefs/resources/content/smtpEditOverlay.js)
+#ifdef MOZ_THUNDERBIRD
+    content/messenger/accountcreation/accountConfig.js                         (base/prefs/resources/content/accountcreation/accountConfig.js)
+    content/messenger/accountcreation/createInBackend.js                       (base/prefs/resources/content/accountcreation/createInBackend.js)
+    content/messenger/accountcreation/emailWizard.js                           (base/prefs/resources/content/accountcreation/emailWizard.js)
+    content/messenger/accountcreation/emailWizard.xul                          (base/prefs/resources/content/accountcreation/emailWizard.xul)
+    content/messenger/accountcreation/fetchConfig.js                           (base/prefs/resources/content/accountcreation/fetchConfig.js)
+    content/messenger/accountcreation/fetchhttp.js                             (base/prefs/resources/content/accountcreation/fetchhttp.js)
+    content/messenger/accountcreation/guessConfig.js                           (base/prefs/resources/content/accountcreation/guessConfig.js)
+    content/messenger/accountcreation/MyBadCertHandler.js                      (base/prefs/resources/content/accountcreation/MyBadCertHandler.js)
+    content/messenger/accountcreation/readFromXML.js                           (base/prefs/resources/content/accountcreation/readFromXML.js)
+    content/messenger/accountcreation/sanitizeDatatypes.js                     (base/prefs/resources/content/accountcreation/sanitizeDatatypes.js)
+    content/messenger/accountcreation/util.js                                  (base/prefs/resources/content/accountcreation/util.js)
+    content/messenger/accountcreation/verifyConfig.js                          (base/prefs/resources/content/accountcreation/verifyConfig.js)
+#endif
     content/messenger/msgSynchronize.xul                                       (base/resources/content/msgSynchronize.xul)
     content/messenger/msgSynchronize.js                                        (base/resources/content/msgSynchronize.js)
     content/messenger/folderProps.xul                                          (base/resources/content/folderProps.xul)
     content/messenger/folderProps.js                                           (base/resources/content/folderProps.js)
     content/messenger/folderWidgets.xml                                        (base/resources/content/folderWidgets.xml)
     content/messenger/retention.js                                             (base/resources/content/retention.js)
     content/messenger/shareglue.js                                             (base/resources/content/shareglue.js)
     content/messenger/newFolderDialog.xul                                      (base/resources/content/newFolderDialog.xul)
     content/messenger/newFolderDialog.js                                       (base/resources/content/newFolderDialog.js)
     content/messenger/msgViewNavigation.js                                     (base/resources/content/msgViewNavigation.js)
-    content/messenger/msgAccountCentral.xul                                    (base/resources/content/msgAccountCentral.xul)
+*   content/messenger/msgAccountCentral.xul                                    (base/resources/content/msgAccountCentral.xul)
     content/messenger/msgAccountCentral.js                                     (base/resources/content/msgAccountCentral.js)
     content/messenger/msgFolderPickerOverlay.js                                (base/resources/content/msgFolderPickerOverlay.js)
     content/messenger/renameFolderDialog.xul                                   (base/resources/content/renameFolderDialog.xul)
     content/messenger/renameFolderDialog.js                                    (base/resources/content/renameFolderDialog.js)
     content/messenger/virtualFolderProperties.xul                              (base/resources/content/virtualFolderProperties.xul)
     content/messenger/virtualFolderProperties.js                               (base/resources/content/virtualFolderProperties.js)
     content/messenger/virtualFolderListDialog.xul                              (base/resources/content/virtualFolderListDialog.xul)
     content/messenger/virtualFolderListDialog.js                               (base/resources/content/virtualFolderListDialog.js)
--- a/mailnews/mailnews.js
+++ b/mailnews/mailnews.js
@@ -815,16 +815,19 @@ pref("nglayout.enable_drag_images", fals
 #ifdef XP_OS2
 pref("mail.compose.max_recycled_windows", 0);
 #endif
 
 // For the Empty Junk/Trash confirmation dialogs.
 pref("mailnews.emptyJunk.dontAskAgain", false);
 pref("mailnews.emptyTrash.dontAskAgain", false);
 
+// where to fetch auto config information from.
+pref("mailnews.auto_config_url", "https://live.mozillamessaging.com/autoconfig/");
+
 // -- Summary Database options
 // dontPreserveOnCopy: a space separated list of properties that are not
 //                     copied to the new nsIMsgHdr when a message is copied.
 //                     Allows extensions to control preservation of properties.
 pref("mailnews.database.summary.dontPreserveOnCopy",
   "account msgOffset threadParent msgThreadId statusOfset flag size numLines ProtoThreadFlags label gloda-id gloda-dirty");
 
 // dontPreserveOnMove: a space separated list of properties that are not