Bug 495818 Zoom menu applies to the message pane rather than the browser in the selected tab. r=philringnalda
This commit is contained in:
Родитель
971a458069
Коммит
463eb8cdca
|
@ -229,6 +229,10 @@ var DefaultController =
|
|||
case "cmd_selectThread":
|
||||
case "cmd_moveToFolderAgain":
|
||||
case "cmd_selectFlagged":
|
||||
case "cmd_fullZoomReduce":
|
||||
case "cmd_fullZoomEnlarge":
|
||||
case "cmd_fullZoomReset":
|
||||
case "cmd_fullZoomToggle":
|
||||
return true;
|
||||
case "cmd_downloadFlagged":
|
||||
case "cmd_downloadSelected":
|
||||
|
@ -496,6 +500,11 @@ var DefaultController =
|
|||
}
|
||||
return pref.getCharPref("mail.last_msg_movecopy_target_uri") &&
|
||||
GetNumSelectedMessages() > 0;
|
||||
case "cmd_fullZoomReduce":
|
||||
case "cmd_fullZoomEnlarge":
|
||||
case "cmd_fullZoomReset":
|
||||
case "cmd_fullZoomToggle":
|
||||
return IsFolderSelected() && !IsMessagePaneCollapsed();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -784,6 +793,18 @@ var DefaultController =
|
|||
case "cmd_selectFlagged":
|
||||
gDBView.doCommand(nsMsgViewCommandType.selectFlagged);
|
||||
break;
|
||||
case "cmd_fullZoomReduce":
|
||||
ZoomManager.reduce();
|
||||
break;
|
||||
case "cmd_fullZoomEnlarge":
|
||||
ZoomManager.enlarge();
|
||||
break;
|
||||
case "cmd_fullZoomReset":
|
||||
ZoomManager.reset();
|
||||
break;
|
||||
case "cmd_fullZoomToggle":
|
||||
ZoomManager.toggleZoom();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ function InitMsgWindow()
|
|||
Components.classes["@mozilla.org/messenger/services/session;1"]
|
||||
.getService(Components.interfaces.nsIMsgMailSession)
|
||||
.AddMsgWindow(msgWindow);
|
||||
getBrowser().docShell.allowAuth = false;
|
||||
document.getElementById("messagepane").docShell.allowAuth = false;
|
||||
msgWindow.rootDocShell.allowAuth = true;
|
||||
msgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
|
||||
// Ensure we don't load xul error pages into the main window
|
||||
|
@ -545,10 +545,13 @@ function HidingThreadPane()
|
|||
document.getElementById("key_toggleMessagePane").setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
// the find toolbar needs a method called getBrowser
|
||||
// The zoom manager, view source and possibly some other functions still rely
|
||||
// on the getBrowser function.
|
||||
function getBrowser()
|
||||
{
|
||||
return document.getElementById("messagepane");
|
||||
let tabmail = document.getElementById('tabmail');
|
||||
return tabmail ? tabmail.getBrowserForSelectedTab() :
|
||||
document.getElementById("messagepane");
|
||||
}
|
||||
|
||||
var gCurrentDisplayDeckId = "";
|
||||
|
|
|
@ -1732,6 +1732,10 @@ let mailTabType = {
|
|||
}
|
||||
if (aTab.msgSelectedFolder)
|
||||
aTab.mailView = GetMailViewForFolder(aTab.msgSelectedFolder);
|
||||
|
||||
// Now let other tabs have a primary browser if they want.
|
||||
document.getElementById("messagepane").setAttribute("type",
|
||||
"content-targetable");
|
||||
},
|
||||
|
||||
_displayFolderAndThreadPane: function(show) {
|
||||
|
@ -1804,6 +1808,10 @@ let mailTabType = {
|
|||
},
|
||||
|
||||
showTab: function(aTab) {
|
||||
// Set the messagepane as the primary browser for content.
|
||||
document.getElementById("messagepane").setAttribute("type",
|
||||
"content-primary");
|
||||
|
||||
// restore globals
|
||||
messenger = aTab.messenger;
|
||||
gDBView = aTab.dbView;
|
||||
|
@ -1889,6 +1897,11 @@ let mailTabType = {
|
|||
|
||||
onEvent: function(aTab, aEvent) {
|
||||
DefaultController.onEvent(aEvent);
|
||||
},
|
||||
|
||||
getBrowser: function(aTab) {
|
||||
// We currently use the messagepane element for all tab types.
|
||||
return document.getElementById("messagepane");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -142,11 +142,18 @@
|
|||
<command id="cmd_viewThreadsWithUnread" oncommand="goDoCommand('cmd_viewThreadsWithUnread')" disabled="true"/>
|
||||
<command id="cmd_viewWatchedThreadsWithUnread" oncommand="goDoCommand('cmd_viewWatchedThreadsWithUnread')" disabled="true"/>
|
||||
<command id="cmd_viewIgnoredThreads" oncommand="goDoCommand('cmd_viewIgnoredThreads')" disabled="true"/>
|
||||
<commandset id="viewZoomCommands">
|
||||
<command id="cmd_fullZoomReduce" oncommand="ZoomManager.reduce()"/>
|
||||
<command id="cmd_fullZoomEnlarge" oncommand="ZoomManager.enlarge()"/>
|
||||
<command id="cmd_fullZoomReset" oncommand="ZoomManager.reset()"/>
|
||||
<command id="cmd_fullZoomToggle" oncommand="ZoomManager.toggleZoom();"/>
|
||||
<commandset id="viewZoomCommands"
|
||||
commandupdater="true"
|
||||
events="create-menu-view"
|
||||
oncommandupdate="goUpdateMailMenuItems(this);">
|
||||
<command id="cmd_fullZoomReduce"
|
||||
oncommand="goDoCommand('cmd_fullZoomReduce');"/>
|
||||
<command id="cmd_fullZoomEnlarge"
|
||||
oncommand="goDoCommand('cmd_fullZoomEnlarge');"/>
|
||||
<command id="cmd_fullZoomReset"
|
||||
oncommand="goDoCommand('cmd_fullZoomReset');"/>
|
||||
<command id="cmd_fullZoomToggle"
|
||||
oncommand="goDoCommand('cmd_fullZoomToggle');"/>
|
||||
</commandset>
|
||||
</commandset>
|
||||
|
||||
|
|
|
@ -806,6 +806,10 @@ var MessageWindowController =
|
|||
case "cmd_createFilterFromPopup":
|
||||
case "cmd_createFilterFromMenu":
|
||||
case "cmd_moveToFolderAgain":
|
||||
case "cmd_fullZoomReduce":
|
||||
case "cmd_fullZoomEnlarge":
|
||||
case "cmd_fullZoomReset":
|
||||
case "cmd_fullZoomToggle":
|
||||
return true;
|
||||
case "cmd_synchronizeOffline":
|
||||
case "cmd_downloadFlagged":
|
||||
|
@ -909,6 +913,10 @@ var MessageWindowController =
|
|||
case "cmd_goForward":
|
||||
case "cmd_goBack":
|
||||
case "cmd_applyFiltersToSelection":
|
||||
case "cmd_fullZoomReduce":
|
||||
case "cmd_fullZoomEnlarge":
|
||||
case "cmd_fullZoomReset":
|
||||
case "cmd_fullZoomToggle":
|
||||
return true;
|
||||
case "button_goForward":
|
||||
case "button_goBack":
|
||||
|
@ -1123,6 +1131,18 @@ var MessageWindowController =
|
|||
case "cmd_applyFiltersToSelection":
|
||||
MsgApplyFiltersToSelection();
|
||||
break;
|
||||
case "cmd_fullZoomReduce":
|
||||
ZoomManager.reduce();
|
||||
break;
|
||||
case "cmd_fullZoomEnlarge":
|
||||
ZoomManager.enlarge();
|
||||
break;
|
||||
case "cmd_fullZoomReset":
|
||||
ZoomManager.reset();
|
||||
break;
|
||||
case "cmd_fullZoomToggle":
|
||||
ZoomManager.toggleZoom();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1095,7 +1095,10 @@ function GetMessagePane()
|
|||
|
||||
function GetMessagePaneFrame()
|
||||
{
|
||||
return window.content;
|
||||
// We must use the message pane element directly here, as other tabs can
|
||||
// have browser elements as well (which could be set to content-primary,
|
||||
// which would confuse things with a window.content return).
|
||||
return document.getElementById("messagepane").contentWindow;
|
||||
}
|
||||
|
||||
function getMailToolbox()
|
||||
|
|
|
@ -63,6 +63,7 @@ var specialTabs = {
|
|||
contentTabType: {
|
||||
name: "contentTab",
|
||||
perTabPanel: "vbox",
|
||||
lastBrowserId: 0,
|
||||
modes: {
|
||||
contentTab: {
|
||||
type: "contentTab",
|
||||
|
@ -98,23 +99,89 @@ var specialTabs = {
|
|||
openTab: function onTabOpened(aTab, aContentPage, aTitle) {
|
||||
// You can't dynamically change an iframe from a non-content to a content
|
||||
// type, therefore we dynamically create the element instead.
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.setAttribute("type", "content");
|
||||
let iframe = document.createElement("browser");
|
||||
iframe.setAttribute("type", "content-primary");
|
||||
iframe.setAttribute("flex", "1");
|
||||
iframe.setAttribute("autocompleteenabled", false);
|
||||
iframe.setAttribute("disablehistory", true);
|
||||
iframe.setAttribute("id", "contentTabType" + this.lastBrowserId);
|
||||
|
||||
aTab.panel.appendChild(iframe);
|
||||
|
||||
iframe.setAttribute("src", aContentPage);
|
||||
|
||||
aTab.title = aTitle;
|
||||
|
||||
let findbar = document.createElement("findbar");
|
||||
findbar.setAttribute("browserid", "contentTabType" + this.lastBrowserId);
|
||||
aTab.panel.appendChild(findbar);
|
||||
this.lastBrowserId++;
|
||||
},
|
||||
closeTab: function onTabClosed(aTab) {
|
||||
},
|
||||
saveTabState: function onSaveTabState(aTab) {
|
||||
aTab.panel.firstChild.setAttribute("type", "content-targetable");
|
||||
},
|
||||
showTab: function onShowTab(aTab) {
|
||||
aTab.panel.firstChild.setAttribute("type", "content-primary");
|
||||
},
|
||||
onTitleChanged: function onTitleChanged(aTab) {
|
||||
},
|
||||
supportsCommand: function supportsCommand(aTab, aCommand) {
|
||||
switch (aCommand) {
|
||||
case "cmd_fullZoomReduce":
|
||||
case "cmd_fullZoomEnlarge":
|
||||
case "cmd_fullZoomReset":
|
||||
case "cmd_fullZoomToggle":
|
||||
case "cmd_find":
|
||||
case "cmd_findAgain":
|
||||
case "cmd_findPrevious":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
isCommandEnabled: function isCommandEnabled(aTab, aCommand) {
|
||||
switch (aCommand) {
|
||||
case "cmd_fullZoomReduce":
|
||||
case "cmd_fullZoomEnlarge":
|
||||
case "cmd_fullZoomReset":
|
||||
case "cmd_fullZoomToggle":
|
||||
case "cmd_find":
|
||||
case "cmd_findAgain":
|
||||
case "cmd_findPrevious":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
doCommand: function isCommandEnabled(aTab, aCommand) {
|
||||
switch (aCommand) {
|
||||
case "cmd_fullZoomReduce":
|
||||
ZoomManager.reduce();
|
||||
break;
|
||||
case "cmd_fullZoomEnlarge":
|
||||
ZoomManager.enlarge();
|
||||
break;
|
||||
case "cmd_fullZoomReset":
|
||||
ZoomManager.reset();
|
||||
break;
|
||||
case "cmd_fullZoomToggle":
|
||||
ZoomManager.toggleZoom();
|
||||
break;
|
||||
case "cmd_find":
|
||||
aTab.panel.childNodes[1].onFindCommand();
|
||||
break;
|
||||
case "cmd_findAgain":
|
||||
aTab.panel.childNodes[1].onFindAgainCommand(false);
|
||||
break;
|
||||
case "cmd_findPrevious":
|
||||
aTab.panel.childNodes[1].onFindAgainCommand(true);
|
||||
break;
|
||||
}
|
||||
},
|
||||
getBrowser: function getBrowser(aTab) {
|
||||
return aTab.panel.firstChild;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -168,6 +168,10 @@
|
|||
- be executed. Perform the action appropriate to the command.
|
||||
- * onEvent(aTab, aEvent): This can be used to handle different events on
|
||||
- the window.
|
||||
- * getBrowser(aTab): This function should return the browser element for
|
||||
- your tab if there is one (return null or don't define this function
|
||||
- otherwise). It is used for some toolkit functions that require a
|
||||
- global "getBrowser" function, e.g. ZoomManager.
|
||||
-
|
||||
- Tab monitoring code is expected to be used for widgets on the screen
|
||||
- outside of the tab box that need to update themselves as the active tab
|
||||
|
@ -486,6 +490,22 @@
|
|||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<!-- getBrowserForSelectedTab is required as some toolkit functions
|
||||
require a getBrowser() function. -->
|
||||
<method name="getBrowserForSelectedTab">
|
||||
<body><![CDATA[
|
||||
if (!this.currentTabInfo)
|
||||
this.currentTabInfo = this.tabInfo[0];
|
||||
|
||||
let tab = this.currentTabInfo;
|
||||
|
||||
let browserFunc = tab.mode.getBrowser || tab.mode.tabType.getBrowser;
|
||||
if (browserFunc)
|
||||
return browserFunc.call(tab.mode.tabType, tab);
|
||||
|
||||
return null;
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="removeCurrentTab">
|
||||
<body><![CDATA[
|
||||
this.removeTabByNode(
|
||||
|
|
Загрузка…
Ссылка в новой задаче