Bug 1600955 - Port |Bug 501426 - make the open tabs in background pref be named mail.tabs.loadInBackground and allow overriding default for context/middle click with the shift key| to SeaMonkey. r=frg
This commit is contained in:
Родитель
86ff60859e
Коммит
dba843372a
|
@ -359,6 +359,10 @@ pref("network.auth.non-web-content-triggered-resources-http-auth-allow", true);
|
|||
|
||||
pref("mail.biff.show_new_alert", true);
|
||||
|
||||
// If messages or folders are opened using the context menu or a middle click,
|
||||
// should we open them in the foreground or in the background?
|
||||
pref("mail.tabs.loadInBackground", true);
|
||||
|
||||
pref("mailnews.ui.deleteMarksRead", true);
|
||||
pref("mailnews.ui.deleteAlwaysSelectedMessages", false);
|
||||
|
||||
|
|
|
@ -75,6 +75,9 @@
|
|||
sorting messages</a>. If it is not selected, &brandShortName; automatically
|
||||
displays the messages unthreaded when you sort them by clicking on the
|
||||
column headers.</li>
|
||||
<li><strong>Switch to new tabs when opened</strong>: Select this to make
|
||||
&brandShortName; switch to the new tab when opened using <q>Open in New
|
||||
Tab</q> or <q>Open Message in New Tab</q> context menu options.</li>
|
||||
<li><strong>Only check for new mail after opening Mail &
|
||||
Newsgroups</strong>: By default, &brandShortName; checks for new messages
|
||||
even if only a browser window is open. Choose this option if you want to
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
<!ENTITY confirmMove.accesskey "C">
|
||||
<!ENTITY preserveThreading.label "Preserve threading when sorting messages">
|
||||
<!ENTITY preserveThreading.accesskey "v">
|
||||
<!ENTITY loadInBackground.label "Switch to new tabs when opened">
|
||||
<!ENTITY loadInBackground.accesskey "t">
|
||||
<!ENTITY mailBiffOnNewWindow.label "Only check for new mail after opening Mail & Newsgroups">
|
||||
<!ENTITY mailBiffOnNewWindow.accesskey "O">
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
<preference id="mailnews.thread_pane_column_unthreads"
|
||||
name="mailnews.thread_pane_column_unthreads"
|
||||
inverted="true" type="bool"/>
|
||||
<preference id="mail.tabs.loadInBackground"
|
||||
name="mail.tabs.loadInBackground"
|
||||
inverted="true" type="bool"/>
|
||||
<preference id="mailnews.start_page.enabled"
|
||||
onchange="this.parentNode.parentNode.startPageCheck();"
|
||||
name="mailnews.start_page.enabled" type="bool"/>
|
||||
|
@ -76,6 +79,13 @@
|
|||
preference="mailnews.thread_pane_column_unthreads"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<checkbox id="loadInBackground"
|
||||
label="&loadInBackground.label;"
|
||||
accesskey="&loadInBackground.accesskey;"
|
||||
preference="mail.tabs.loadInBackground"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<checkbox id="mailBiffOnNewWindow"
|
||||
label="&mailBiffOnNewWindow.label;"
|
||||
|
|
|
@ -402,7 +402,7 @@
|
|||
<menuitem id="folderPaneContext-openNewTab"
|
||||
label="&folderContextOpenNewTab.label;"
|
||||
accesskey="&folderContextOpenNewTab.accesskey;"
|
||||
oncommand="MsgOpenNewTabForFolder();"/>
|
||||
oncommand="FolderPaneContextMenuNewTab(event);"/>
|
||||
<menuitem id="folderPaneContext-openNewWindow"
|
||||
label="&folderContextOpenNewWindow.label;"
|
||||
accesskey="&folderContextOpenNewWindow.accesskey;"
|
||||
|
@ -499,7 +499,7 @@
|
|||
<menuitem id="mailContext-openNewTab"
|
||||
label="&contextOpenNewTab.label;"
|
||||
accesskey="&contextOpenNewTab.accesskey;"
|
||||
oncommand="MsgOpenNewTabForMessage();"/>
|
||||
oncommand="OpenMessageInNewTab(event);"/>
|
||||
<menuitem id="mailContext-openNewWindow"
|
||||
label="&contextOpenNewWindow.label;"
|
||||
accesskey="&contextOpenNewWindow.accesskey;"
|
||||
|
|
|
@ -1197,6 +1197,13 @@ function TreeOnMouseDown(event)
|
|||
ChangeSelectionWithoutContentLoad(event, event.target.parentNode);
|
||||
}
|
||||
|
||||
function FolderPaneContextMenuNewTab(event) {
|
||||
var bgLoad = Services.prefs.getBoolPref("mail.tabs.loadInBackground");
|
||||
if (event.shiftKey)
|
||||
bgLoad = !bgLoad;
|
||||
MsgOpenNewTabForFolder(bgLoad);
|
||||
}
|
||||
|
||||
function FolderPaneOnClick(event)
|
||||
{
|
||||
// usually, we're only interested in tree content clicks, not scrollbars etc.
|
||||
|
@ -1208,7 +1215,7 @@ function FolderPaneOnClick(event)
|
|||
{
|
||||
if (AllowOpenTabOnMiddleClick())
|
||||
{
|
||||
MsgOpenNewTabForFolder();
|
||||
FolderPaneContextMenuNewTab(event);
|
||||
RestoreSelectionWithoutContentLoad(GetFolderTree());
|
||||
return;
|
||||
}
|
||||
|
@ -1242,7 +1249,7 @@ function FolderPaneDoubleClick(folderIndex, event)
|
|||
// We either open the folder in a tab or a new window...
|
||||
if (AllowOpenTabOnDoubleClick())
|
||||
{
|
||||
MsgOpenNewTabForFolder();
|
||||
FolderPaneContextMenuNewTab(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1258,6 +1265,14 @@ function FolderPaneDoubleClick(folderIndex, event)
|
|||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function OpenMessageInNewTab(event) {
|
||||
var bgLoad = Services.prefs.getBoolPref("mail.tabs.loadInBackground");
|
||||
if (event.shiftKey)
|
||||
bgLoad = !bgLoad;
|
||||
|
||||
MsgOpenNewTabForMessage(bgLoad);
|
||||
}
|
||||
|
||||
function ChangeSelection(tree, newIndex)
|
||||
{
|
||||
if(newIndex >= 0)
|
||||
|
|
|
@ -37,11 +37,12 @@ var gMailNewsTabsType =
|
|||
type: "3pane",
|
||||
|
||||
// aTabInfo belongs to the newly created tab,
|
||||
// aModeBits is a combination of kTabShow* layout bits (or null),
|
||||
// aFolderURI designates the folder to select (or null)
|
||||
// aMsgHdr designates the message to select (or null)
|
||||
openTab: function(aTabInfo, aModeBits, aFolderURI, aMsgHdr)
|
||||
{
|
||||
// aArgs can contain:
|
||||
// * modeBits is a combination of kTabShow* layout bits (or null),
|
||||
// * folderURI designates the folder to select (or null)
|
||||
// * msgHdr designates the message to select (or null)
|
||||
openTab: function(aTabInfo, {modeBits: aModeBits, folderURI: aFolderURI,
|
||||
msgHdr: aMsgHdr}) {
|
||||
// clone the current 3pane state before overriding parts of it
|
||||
this.saveTabState(aTabInfo);
|
||||
|
||||
|
@ -525,24 +526,21 @@ function GetTabMail()
|
|||
return document.getElementById("tabmail");
|
||||
}
|
||||
|
||||
function MsgOpenNewTab(aType, aModeBits)
|
||||
{
|
||||
function MsgOpenNewTab(aType, aModeBits, aBackground) {
|
||||
// duplicate the current tab
|
||||
var tabmail = GetTabMail();
|
||||
if (tabmail)
|
||||
tabmail.openTab(aType, aModeBits);
|
||||
tabmail.openTab(aType, {modeBits: aModeBits, background: aBackground});
|
||||
}
|
||||
|
||||
function MsgOpenNewTabForFolder()
|
||||
{
|
||||
function MsgOpenNewTabForFolder(aBackground) {
|
||||
// open current folder in full 3pane tab
|
||||
MsgOpenNewTab("3pane", kTabModeFolder);
|
||||
MsgOpenNewTab("3pane", kTabModeFolder, aBackground);
|
||||
}
|
||||
|
||||
function MsgOpenNewTabForMessage()
|
||||
{
|
||||
function MsgOpenNewTabForMessage(aBackground) {
|
||||
// open current message in message tab
|
||||
MsgOpenNewTab("3pane", kTabModeMessage);
|
||||
MsgOpenNewTab("3pane", kTabModeMessage, aBackground);
|
||||
}
|
||||
|
||||
// A Thunderbird compatibility function called from e.g. newsblog.
|
||||
|
|
|
@ -37,9 +37,12 @@
|
|||
- 3) Code that wants to monitor to know when the active tab changes.
|
||||
-
|
||||
- Consumer code should use the following methods:
|
||||
- * openTab(aTabModeName, arguments...): Open a tab of the given "mode",
|
||||
- passing the provided arguments. The tab type author should tell you
|
||||
- the modes they implement and the required/optional arguments.
|
||||
- * openTab(aTabModeName, aArgs): Open a tab of the given "mode",
|
||||
- passing the provided arguments as an object. The tab type author
|
||||
- should tell you the modes they implement and the required/optional
|
||||
- arguments.
|
||||
- One of the arguments you can pass is "background": if this is true,
|
||||
- the tab will be loaded in the background.
|
||||
- * setTabTitle([aOptionalTabInfo]): Tells us that the title of the current
|
||||
- tab (if no argument is provided) or provided tab needs to be updated.
|
||||
- This will result in a call to the tab mode's logic to update the title.
|
||||
|
@ -93,22 +96,23 @@
|
|||
- If this limit is reached, any additional calls to openTab for this
|
||||
- mode will simply result in the first existing tab of this mode being
|
||||
- displayed.
|
||||
- * shouldSwitchTo(arguments...): Optional function. Called when
|
||||
- openTab is called on the top-level tabmail binding. It is used to
|
||||
- decide if the openTab function should switch to an existing tab or
|
||||
- actually open a new tab.
|
||||
- * shouldSwitchTo(aArgs): Optional function. Called when openTab is called
|
||||
- on the top-level tabmail binding. It is used to decide if the openTab
|
||||
- function should switch to an existing tab or actually open a new tab.
|
||||
- If the openTab function should switch to an existing tab, return the
|
||||
- index of that tab; otherwise return -1.
|
||||
- * openTab(aTabInfo, arguments...): Called when a tab of the given mode is
|
||||
- in the process of being opened. aTabInfo will have its "mode"
|
||||
- attribute set to the mode definition of the tab mode being opened.
|
||||
- You should set the "title" attribute on it, and may set any other
|
||||
- attributes you wish for your own use in subsequent functions. Note
|
||||
- that 'this' points to the tab type definition, not the mode definition
|
||||
- as you might expect. This allows you to place common logic code on
|
||||
- the tab type for use by multiple modes and to defer to it. Any
|
||||
- arguments provided to the caller of tabmail.openTab will be passed to
|
||||
- your function as well.
|
||||
- aArgs is a set of named parameters (the ones that are later passed to
|
||||
- openTab).
|
||||
- * openTab(aTabInfo, aArgs): Called when a tab of the given mode is in the
|
||||
- process of being opened. aTabInfo will have its "mode" attribute
|
||||
- set to the mode definition of the tab mode being opened. You should
|
||||
- set the "title" attribute on it, and may set any other attributes
|
||||
- you wish for your own use in subsequent functions. Note that 'this'
|
||||
- points to the tab type definition, not the mode definition as you
|
||||
- might expect. This allows you to place common logic code on the
|
||||
- tab type for use by multiple modes and to defer to it. Any arguments
|
||||
- provided to the caller of tabmail.openTab will be passed to your
|
||||
- function as well, including background.
|
||||
- * canCloseTab(aTabInfo): Optional function.
|
||||
- Return true (false) if the tab is (not) allowed to close.
|
||||
- A tab's default permission is stored in aTabInfo.canClose.
|
||||
|
@ -362,7 +366,7 @@
|
|||
|
||||
<method name="openTab">
|
||||
<parameter name="aTabModeName"/>
|
||||
<!-- parameter name="aMoreParameters..."/-->
|
||||
<parameter name="aArgs"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!aTabModeName)
|
||||
|
@ -377,22 +381,27 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Do this so that we don't generate strict warnings.
|
||||
let background = ("background" in aArgs) && aArgs.background;
|
||||
|
||||
// If the mode wants us to, we should switch to an existing tab
|
||||
// rather than open a new one.
|
||||
// rather than open a new one. We shouldn't switch to the tab if
|
||||
// we're opening it in the background, though.
|
||||
let shouldSwitchToFunc = tabMode.shouldSwitchTo ||
|
||||
tabMode.tabType.shouldSwitchTo;
|
||||
|
||||
if (shouldSwitchToFunc)
|
||||
{
|
||||
let args = Array.prototype.slice.call(arguments, 1);
|
||||
let tabIndex = shouldSwitchToFunc.apply(tabMode.tabType, args);
|
||||
let tabIndex = shouldSwitchToFunc.apply(tabMode.tabType, [aArgs]);
|
||||
if (tabIndex >= 0)
|
||||
{
|
||||
if (!background)
|
||||
this.selectTabByIndex(tabIndex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!background)
|
||||
// we need to save the state before it gets corrupted
|
||||
this.saveCurrentTabState();
|
||||
|
||||
|
@ -422,19 +431,18 @@
|
|||
let oldPanel = this.panelContainer.selectedPanel;
|
||||
|
||||
// Open new tabs in the background?
|
||||
let switchToNewTab = !this.mPrefs.getBoolPref("browser.tabs.loadInBackground");
|
||||
tabInfo.switchToNewTab = switchToNewTab;
|
||||
tabInfo.switchToNewTab = !background;
|
||||
|
||||
// the order of the following statements is important
|
||||
let oldTabInfo = this.currentTabInfo;
|
||||
this.tabInfo[this.tabContainer.childNodes.length - 1] = tabInfo;
|
||||
|
||||
if (switchToNewTab)
|
||||
{
|
||||
if (!background) {
|
||||
this.currentTabInfo = tabInfo;
|
||||
// this has a side effect of calling updateCurrentTab, but our
|
||||
// setting currentTabInfo above will cause it to take no action.
|
||||
this.tabContainer.selectedIndex = this.tabContainer.childNodes.length - 1;
|
||||
this.tabContainer.selectedIndex =
|
||||
this.tabContainer.childNodes.length - 1;
|
||||
}
|
||||
// make sure we are on the right panel
|
||||
let selectedPanel;
|
||||
|
@ -458,7 +466,7 @@
|
|||
{
|
||||
selectedPanel = tabInfo.mode.tabType.panel;
|
||||
}
|
||||
if (switchToNewTab)
|
||||
if (!background)
|
||||
this.panelContainer.selectedPanel = selectedPanel;
|
||||
|
||||
oldPanel.removeAttribute("selected");
|
||||
|
@ -466,27 +474,23 @@
|
|||
|
||||
let tabOpenFunc = tabInfo.mode.openTab ||
|
||||
tabInfo.mode.tabType.openTab;
|
||||
let args = [tabInfo].concat(Array.prototype.slice.call(arguments, 1));
|
||||
if (tabOpenFunc)
|
||||
tabOpenFunc.apply(tabInfo.mode.tabType, args);
|
||||
tabOpenFunc.apply(tabInfo.mode.tabType, [tabInfo, aArgs]);
|
||||
|
||||
if (!switchToNewTab)
|
||||
{
|
||||
if (background) {
|
||||
// if the new tab isn't made current,
|
||||
// its title won't change automatically
|
||||
this.setTabTitle(tabInfo);
|
||||
}
|
||||
|
||||
if (this.tabMonitors.length)
|
||||
{
|
||||
if (switchToNewTab)
|
||||
if (!background && this.tabMonitors.length) {
|
||||
for (let tabMonitor of this.tabMonitors)
|
||||
tabMonitor.onTabSwitched(tabInfo, oldTabInfo);
|
||||
}
|
||||
|
||||
t.setAttribute("label", tabInfo.title);
|
||||
if (switchToNewTab)
|
||||
{
|
||||
|
||||
if (!background) {
|
||||
let docTitle = tabInfo.title;
|
||||
if (AppConstants.platform != "macosx") {
|
||||
docTitle += " - " + gBrandBundle.getString("brandFullName");
|
||||
|
@ -1478,7 +1482,7 @@
|
|||
{
|
||||
// new-tab-button only appears in the tabstrip
|
||||
// duplicate the current tab
|
||||
tabmail.openTab();
|
||||
tabmail.openTab("", {});
|
||||
}
|
||||
}
|
||||
]]>
|
||||
|
|
|
@ -19,7 +19,7 @@ function ThreadPaneOnClick(event)
|
|||
// we don't allow new tabs in the search dialog
|
||||
if (document.documentElement.id != "searchMailWindow")
|
||||
{
|
||||
MsgOpenNewTabForMessage();
|
||||
OpenMessageInNewTab(event);
|
||||
RestoreSelectionWithoutContentLoad(GetThreadTree());
|
||||
}
|
||||
return;
|
||||
|
@ -51,7 +51,7 @@ function ThreadPaneOnClick(event)
|
|||
// twisty, don't open the message in a new window.
|
||||
if (event.detail == 2 && !cell.col.cycler && (cell.childElt != "twisty"))
|
||||
{
|
||||
ThreadPaneDoubleClick();
|
||||
ThreadPaneDoubleClick(event);
|
||||
// Double clicking should not toggle the open/close state of the thread.
|
||||
// This will happen if we don't prevent the event from bubbling to the
|
||||
// default handler in tree.xml.
|
||||
|
@ -178,8 +178,7 @@ function HandleColumnClick(columnID)
|
|||
}
|
||||
}
|
||||
|
||||
function ThreadPaneDoubleClick()
|
||||
{
|
||||
function ThreadPaneDoubleClick(event) {
|
||||
const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
|
||||
if (IsSpecialFolderSelected(nsMsgFolderFlags.Drafts, true))
|
||||
{
|
||||
|
@ -194,7 +193,7 @@ function ThreadPaneDoubleClick()
|
|||
document.documentElement.id != "searchMailWindow")
|
||||
{ // we don't allow new tabs in the search dialog
|
||||
// open the message in a new tab on double click
|
||||
MsgOpenNewTabForMessage();
|
||||
OpenMessageInNewTab(event);
|
||||
RestoreSelectionWithoutContentLoad(GetThreadTree());
|
||||
}
|
||||
else
|
||||
|
@ -206,7 +205,7 @@ function ThreadPaneDoubleClick()
|
|||
function ThreadPaneKeyPress(event)
|
||||
{
|
||||
if (event.keyCode == KeyEvent.DOM_VK_RETURN)
|
||||
ThreadPaneDoubleClick();
|
||||
ThreadPaneDoubleClick(event);
|
||||
}
|
||||
|
||||
function MsgSortByThread()
|
||||
|
|
Загрузка…
Ссылка в новой задаче