Bug 486432 Can't get back to "What's New" tab. r=mkmelin,ui-review=clarkbw
authorMark Banner <bugzilla@standard8.plus.com>
Tue, 18 Aug 2009 10:01:59 +0100
changeset 3324 0ab74a7268e0506d7e6740b2fe679506f0beb5e6
parent 3323 ff71e2728be6074bb3db1de8c2035fb5770c1ad3
child 3325 f59c45dbd7c99addaa7adaf07965626d5004a69b
push idunknown
push userunknown
push dateunknown
reviewersmkmelin
bugs486432
Bug 486432 Can't get back to "What's New" tab. r=mkmelin,ui-review=clarkbw
mail/base/content/baseMenuOverlay.xul
mail/base/content/specialTabs.js
mail/base/content/utilityOverlay.js
mail/locales/en-US/chrome/messenger/baseMenuOverlay.dtd
--- a/mail/base/content/baseMenuOverlay.xul
+++ b/mail/base/content/baseMenuOverlay.xul
@@ -68,16 +68,19 @@
       <menuitem id="menu_openHelp"
                 label="&openHelp.label;" accesskey="&openHelp.accesskey;"
                 oncommand="openSupportURL();"
                 key="key_openHelp"/>
 #endif
       <menuitem id="releaseNotes"
                 label="&releaseCmd.label;" accesskey="&releaseCmd.accesskey;"
                 oncommand="openFormattedURL('app.releaseNotesURL');"/>
+      <menuitem id="whatsNew"
+                label="&whatsNewCmd.label;" accesskey="&whatsNewCmd.accesskey;"
+                oncommand="openWhatsNew();"/>
       <menuseparator id="menu_HelpAboutSeparator"/>
       <menuitem id="checkForUpdates" class="menuitem-iconic"
 #ifdef MOZ_UPDATER
                 label="&updateCmd.label;"
                 oncommand="checkForUpdates();"/>
 #else
                 hidden="true"/>
 #endif
--- a/mail/base/content/specialTabs.js
+++ b/mail/base/content/specialTabs.js
@@ -248,23 +248,17 @@ var specialTabs = {
     }
     return false;
   },
 
   /**
    * Shows the what's new page in a content tab.
    */
   showWhatsNewPage: function onShowWhatsNewPage() {
-    let startpage =
-        Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
-                  .getService(Components.interfaces.nsIURLFormatter)
-                  .formatURLPref("mailnews.start_page.override_url");
-
-    document.getElementById('tabmail').openTab("contentTab",
-                                               { contentPage: startpage });
+    openWhatsNew();
   },
 
   /**
    * Looks at the existing prefs and determines if we should show about:rights
    * or not.
    *
    * This is controlled by two prefs:
    *
--- a/mail/base/content/utilityOverlay.js
+++ b/mail/base/content/utilityOverlay.js
@@ -1,9 +1,9 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -302,8 +302,41 @@ function buildHelpMenu()
 // Firefox and SeaMonkey have a function with the same name,
 // so extensions can use this everywhere to open links.
 // We currently only react to left click in Thunderbird.
 function openUILink(url, event)
 {
   if (!event.button)
     messenger.launchExternalURL(url);
 }
+
+function openWhatsNew()
+{
+  let startpage =
+    Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
+              .getService(Components.interfaces.nsIURLFormatter)
+              .formatURLPref("mailnews.start_page.override_url");
+
+  openContentTab(startpage);
+}
+
+function openContentTab(url)
+{
+  let tabmail = document.getElementById("tabmail");
+  if (!tabmail) {
+    // Try opening new tabs in an existing 3pane window
+    let mail3PaneWindow = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                                    .getService(Components.interfaces.nsIWindowMediator)
+                                    .getMostRecentWindow("mail:3pane");
+    if (mail3PaneWindow) {
+      tabmail = mail3PaneWindow.document.getElementById("tabmail");
+      mail3PaneWindow.focus();
+    }
+  }
+
+  if (tabmail)
+    tabmail.openTab("contentTab", {contentPage: url});
+  else
+    window.openDialog("chrome://messenger/content/", "_blank",
+                      "chrome,dialog=no,all", null,
+                      { tabType: "contentTab",
+                        tabParams: {contentPage: url} });
+}
--- a/mail/locales/en-US/chrome/messenger/baseMenuOverlay.dtd
+++ b/mail/locales/en-US/chrome/messenger/baseMenuOverlay.dtd
@@ -2,16 +2,18 @@
 <!ENTITY helpMenu.label "Help">
 <!ENTITY helpMenu.accesskey "H">
 <!-- LOCALIZATION NOTE some localizations of Windows use "?"
                        for the help button in the menubar but Gnome does not.   -->
 <!ENTITY helpMenuWin.label "Help">
 <!ENTITY helpMenuWin.accesskey "H">
 <!ENTITY releaseCmd.label "Release Notes">
 <!ENTITY releaseCmd.accesskey "R">
+<!ENTITY whatsNewCmd.label "What's New">
+<!ENTITY whatsNewCmd.accesskey "W">
 <!ENTITY openHelp.label "Help Contents">
 <!ENTITY openHelp.accesskey "H">
 <!ENTITY openHelp.commandkey "VK_F1">
 <!ENTITY openHelpMac.label "&brandShortName; Help">
 <!ENTITY openHelpMac2.commandkey   "?">
 <!ENTITY openHelpMac2.modifiers    "accel">
 
 <!ENTITY updateCmd.label "Check for Updates…">