From 9e73adeec249e6309796359fcb353e8f69288315 Mon Sep 17 00:00:00 2001 From: David Ascher Date: Wed, 4 Feb 2009 08:27:56 +0000 Subject: [PATCH] Bug 466019 - Fix switching to mail tab in new tabbed interface (via ctrl+tab number) [r=mkmelin] --- mail/base/content/macMenuOverlay.xul | 6 ----- mail/base/content/mailCore.js | 23 ++++++++++++++++ mail/base/content/mailWindowOverlay.xul | 27 ++++++++++++++++--- mail/base/content/tabmail.xml | 20 ++++++++++++++ .../en-US/chrome/messenger/messenger.dtd | 2 -- 5 files changed, 67 insertions(+), 11 deletions(-) diff --git a/mail/base/content/macMenuOverlay.xul b/mail/base/content/macMenuOverlay.xul index 15c69767b7..d291655bdf 100644 --- a/mail/base/content/macMenuOverlay.xul +++ b/mail/base/content/macMenuOverlay.xul @@ -55,10 +55,4 @@ oncommand="toAddressBook();" id="tasksMenuAddressBook" insertbefore="sep-window-list"/> - - - - - diff --git a/mail/base/content/mailCore.js b/mail/base/content/mailCore.js index f283330327..f197228868 100644 --- a/mail/base/content/mailCore.js +++ b/mail/base/content/mailCore.js @@ -196,6 +196,29 @@ function toMessengerWindow() toOpenWindowByType("mail:3pane", "chrome://messenger/content/messenger.xul"); } + +function focusOnMail(tabNo, event) +{ + // this is invoked by accel- + // if the window isn't visible or focused, make it so + const Cc = Components.classes; + const Ci = Components.interfaces; + var windowManager = Cc['@mozilla.org/appshell/window-mediator;1'].getService(); + var windowManagerInterface = windowManager.QueryInterface(Ci.nsIWindowMediator); + + var topWindow = windowManagerInterface.getMostRecentWindow("mail:3pane"); + if (topWindow) { + if (topWindow != window) + topWindow.focus(); + else + document.getElementById('tabmail').selectTabByIndex(event, tabNo); + } + else { + window.open("chrome://messenger/content/messenger.xul", + "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar"); + } +} + function toAddressBook() { toOpenWindowByType("mail:addressbook", "chrome://messenger/content/addressbook/addressbook.xul"); diff --git a/mail/base/content/mailWindowOverlay.xul b/mail/base/content/mailWindowOverlay.xul index f2d8eb920a..f7bf4b4a6c 100644 --- a/mail/base/content/mailWindowOverlay.xul +++ b/mail/base/content/mailWindowOverlay.xul @@ -315,7 +315,7 @@ - + #endif @@ -451,8 +451,29 @@ #else #endif - - + +#ifdef XP_UNIX +#ifndef XP_MACOSX +#define XP_GNOME 1 +#endif +#endif + +#ifdef XP_GNOME +#define NUM_SELECT_TAB_MODIFIER alt +#else +#define NUM_SELECT_TAB_MODIFIER accel +#endif + +#expand +#expand +#expand +#expand +#expand +#expand +#expand +#expand +#expand + #ifdef XP_MACOSX diff --git a/mail/base/content/tabmail.xml b/mail/base/content/tabmail.xml index c349452f65..2ebb96e3a0 100644 --- a/mail/base/content/tabmail.xml +++ b/mail/base/content/tabmail.xml @@ -379,6 +379,26 @@ } ]]> + + + + = 0 && + aIndex < this.tabInfo.length && + aIndex != this.tabContainer.selectedIndex) { + this.tabContainer.selectedIndex = aIndex; + } + + if (aEvent) { + aEvent.preventDefault(); + aEvent.stopPropagation(); + } + ]]> + - -