Bug 466019 - Fix switching to mail tab in new tabbed interface (via ctrl+tab number) [r=mkmelin]

This commit is contained in:
David Ascher 2009-02-04 08:27:56 +00:00
Родитель 8eac043cb8
Коммит 9e73adeec2
5 изменённых файлов: 67 добавлений и 11 удалений

Просмотреть файл

@ -55,10 +55,4 @@
oncommand="toAddressBook();" id="tasksMenuAddressBook" oncommand="toAddressBook();" id="tasksMenuAddressBook"
insertbefore="sep-window-list"/> insertbefore="sep-window-list"/>
</menupopup> </menupopup>
<keyset id="tasksKeys">
<key id="key_addressbook" key="&addressBookCmd.commandkey;"
oncommand="toAddressBook();" modifiers="accel"/>
</keyset>
</overlay> </overlay>

Просмотреть файл

@ -196,6 +196,29 @@ function toMessengerWindow()
toOpenWindowByType("mail:3pane", "chrome://messenger/content/messenger.xul"); toOpenWindowByType("mail:3pane", "chrome://messenger/content/messenger.xul");
} }
function focusOnMail(tabNo, event)
{
// this is invoked by accel-<number>
// 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() function toAddressBook()
{ {
toOpenWindowByType("mail:addressbook", "chrome://messenger/content/addressbook/addressbook.xul"); toOpenWindowByType("mail:addressbook", "chrome://messenger/content/addressbook/addressbook.xul");

Просмотреть файл

@ -315,7 +315,7 @@
<!-- Mac Window menu --> <!-- Mac Window menu -->
<command id="minimizeWindow" label="&minimizeWindow.label;" oncommand="window.minimize();"/> <command id="minimizeWindow" label="&minimizeWindow.label;" oncommand="window.minimize();"/>
<command id="zoomWindow" label="&zoomWindow.label;" oncommand="zoomWindow();"/> <command id="zoomWindow" label="&zoomWindow.label;" oncommand="zoomWindow();"/>
<command id="Tasks:Mail" oncommand="toMessengerWindow();"/> <command id="Tasks:Mail" oncommand="focusOnMail(1);"/>
<command id="Tasks:AddressBook" oncommand="toAddressBook();"/> <command id="Tasks:AddressBook" oncommand="toAddressBook();"/>
</commandset> </commandset>
#endif #endif
@ -451,8 +451,29 @@
#else #else
<key id="key_searchMail" key="&searchMailCmd.key;" oncommand="goDoCommand('cmd_search')" modifiers="accel, shift"/> <key id="key_searchMail" key="&searchMailCmd.key;" oncommand="goDoCommand('cmd_search')" modifiers="accel, shift"/>
#endif #endif
<key id="key_mail" key="&messengerCmd.commandkey;" oncommand="toMessengerWindow();" modifiers="accel"/>
<key id="key_addressbook" key="&addressBookCmd.commandkey;" oncommand="toAddressBook();" modifiers="accel"/> #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 <key id="key_mail" oncommand="focusOnMail(0, event);" key="1" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand <key id="key_selectTab2" oncommand="focusOnMail(1, event);" key="2" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand <key id="key_selectTab3" oncommand="focusOnMail(2, event);" key="3" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand <key id="key_selectTab4" oncommand="focusOnMail(3, event);" key="4" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand <key id="key_selectTab5" oncommand="focusOnMail(4, event);" key="5" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand <key id="key_selectTab6" oncommand="focusOnMail(5, event);" key="6" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand <key id="key_selectTab7" oncommand="focusOnMail(6, event);" key="7" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand <key id="key_selectTab8" oncommand="focusOnMail(7, event);" key="8" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand <key id="key_selectLastTab" oncommand="focusOnMail(-1, event);" key="9" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#ifdef XP_MACOSX #ifdef XP_MACOSX
<!-- Mac Window menu keys --> <!-- Mac Window menu keys -->
<key id="key_minimizeWindow" command="minimizeWindow" key="&minimizeWindow.key;" modifiers="accel"/> <key id="key_minimizeWindow" command="minimizeWindow" key="&minimizeWindow.key;" modifiers="accel"/>

Просмотреть файл

@ -379,6 +379,26 @@
} }
]]></body> ]]></body>
</method> </method>
<method name="selectTabByIndex">
<parameter name="aEvent"/>
<parameter name="aIndex"/>
<body><![CDATA[
// count backwards for aIndex < 0
if (aIndex < 0)
aIndex += this.tabInfo.length;
if (aIndex >= 0 &&
aIndex < this.tabInfo.length &&
aIndex != this.tabContainer.selectedIndex) {
this.tabContainer.selectedIndex = aIndex;
}
if (aEvent) {
aEvent.preventDefault();
aEvent.stopPropagation();
}
]]></body>
</method>
<method name="closeTabs"> <method name="closeTabs">
<body> <body>
<![CDATA[ <![CDATA[

Просмотреть файл

@ -413,10 +413,8 @@ you can use these alternative items. Otherwise, their values should be empty. -
<!ENTITY activitymanager.accesskey "a"> <!ENTITY activitymanager.accesskey "a">
<!ENTITY messengerCmd.label "Mail &amp; Newsgroups"> <!ENTITY messengerCmd.label "Mail &amp; Newsgroups">
<!ENTITY messengerCmd.accesskey "m"> <!ENTITY messengerCmd.accesskey "m">
<!ENTITY messengerCmd.commandkey "1">
<!ENTITY addressBookCmd.label "Address Book"> <!ENTITY addressBookCmd.label "Address Book">
<!ENTITY addressBookCmd.accesskey "a"> <!ENTITY addressBookCmd.accesskey "a">
<!ENTITY addressBookCmd.commandkey "2">
<!ENTITY runJunkControls.label "Run Junk Mail Controls on Folder"> <!ENTITY runJunkControls.label "Run Junk Mail Controls on Folder">
<!ENTITY runJunkControls.accesskey "u"> <!ENTITY runJunkControls.accesskey "u">
<!ENTITY deleteJunk.label "Delete Mail Marked as Junk in Folder"> <!ENTITY deleteJunk.label "Delete Mail Marked as Junk in Folder">