зеркало из https://github.com/mozilla/gecko-dev.git
Fix for tabbrowser not being localizable as well as fixes to expose Closing of tabs via CTRL+W and the top-level menus. r=jag, sr=jst
This commit is contained in:
Родитель
3c5e9197e3
Коммит
65c1a51c18
|
@ -895,7 +895,7 @@ function BrowserSetForcedDetector()
|
|||
getBrowser().documentCharsetInfo.forcedDetector = true;
|
||||
}
|
||||
|
||||
function BrowserClose()
|
||||
function BrowserCloseTabOrWindow()
|
||||
{
|
||||
var browser = getBrowser();
|
||||
if (browser && browser.localName == 'tabbrowser' && browser.mTabContainer.childNodes.length > 1) {
|
||||
|
@ -904,6 +904,11 @@ function BrowserClose()
|
|||
return;
|
||||
}
|
||||
|
||||
BrowserCloseWindow();
|
||||
}
|
||||
|
||||
function BrowserCloseWindow()
|
||||
{
|
||||
// This code replicates stuff in Shutdown(). It is here because
|
||||
// window.screenX and window.screenY have real values. We need
|
||||
// to fix this eventually but by replicating the code here, we
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
<key id="key_editPage" key="&editPageCmd.commandkey;" command="Browser:EditPage" modifiers="accel"/>
|
||||
<key id="printKb" key="&printCmd.commandkey;" command="Browser:Print" modifiers="accel"/>
|
||||
<key id="key_close"/>
|
||||
<key id="key_closeWindow"/>
|
||||
<key id="key_quit"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
|
@ -114,8 +115,9 @@
|
|||
<command id="cmd_printSetup" oncommand="goPageSetup();"/>
|
||||
<command id="Browser:Print" oncommand="BrowserPrint();"/>
|
||||
<command id="cmd_quit"/>
|
||||
<command id="cmd_close" oncommand="BrowserClose()"/>
|
||||
|
||||
<command id="cmd_close" oncommand="BrowserCloseTabOrWindow()"/>
|
||||
<command id="cmd_closeWindow" oncommand="BrowserCloseWindow()"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
<command id="cmd_undo"/>
|
||||
<command id="cmd_redo"/>
|
||||
|
@ -182,6 +184,8 @@
|
|||
<menuitem label="&openFileCmd.label;" accesskey="&openFileCmd.accesskey;" key="openFileKb" command="Browser:OpenFile"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_close"/>
|
||||
<menuitem id="menu_closeWindow" hidden="true" command="cmd_closeWindow" key="key_closeWindow" label="&closeWindow.label;"/>
|
||||
<menuseparator id="menu_closeSeparator" hidden="true"/>
|
||||
<menuitem label="&savePageCmd.label;" accesskey="&savePageCmd.accesskey;" key="key_savePage" command="Browser:SavePage"/>
|
||||
<menuitem id="savepage" label="&saveFrameCmd.label;" accesskey="&saveFrameCmd.accesskey;" oncommand="savePage(gFocusedURL);" hidden="true"/>
|
||||
<menuseparator/>
|
||||
|
|
|
@ -69,6 +69,8 @@
|
|||
<!ENTITY translateMenu.accesskey "t">
|
||||
<!ENTITY translate.commandKey "t">
|
||||
|
||||
<!ENTITY closeWindow.label "Close Window">
|
||||
|
||||
<!-- I'd like all this to move to an overlay or something -->
|
||||
<!ENTITY bidiMenu.label "Bidi Options">
|
||||
<!ENTITY directionBidiMenu.label "Default Direction">
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem label="&quitApplicationCmd.label;" key="key_quit" command="cmd_quit"/>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem label="&quitApplicationCmd.label;" key="key_quit" accesskey="&quitApplicationCmd.accesskey;" command="cmd_quit"/>
|
||||
|
|
|
@ -82,6 +82,7 @@ en-US.jar:
|
|||
locale/en-US/global/brand.properties (resources/locale/en-US/brand.properties)
|
||||
locale/en-US/global/brand.dtd (resources/locale/en-US/brand.dtd)
|
||||
locale/en-US/global/tabbrowser.dtd (resources/locale/en-US/tabbrowser.dtd)
|
||||
locale/en-US/global/tabbrowser.properties (resources/locale/en-US/tabbrowser.properties)
|
||||
locale/en-US/global/wizardManager.properties (resources/locale/en-US/wizardManager.properties)
|
||||
locale/en-US/global/wizardOverlay.dtd (resources/locale/en-US/wizardOverlay.dtd)
|
||||
locale/en-US/global/keys.properties (resources/locale/en-US/keys.properties)
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:stringbundle src="chrome://global/locale/tabbrowser.properties"/>
|
||||
<xul:tabbox onselect="if (event.target.localName != 'tabpanels') return; this.parentNode.updateCurrentBrowser();">
|
||||
<xul:stack collapsed="true" tooltip="_child" context="_child">
|
||||
<xul:tooltip onpopupshowing="event.preventBubble(); if (document.tooltipNode.getAttribute('label')) { this.childNodes[0].value = document.tooltipNode.getAttribute('label'); return true; } return false;">
|
||||
|
@ -68,7 +69,7 @@
|
|||
onclick="if (event.button != 1 || event.target.localName != 'tab') return; this.parentNode.parentNode.parentNode.removeTab(event.target);"
|
||||
ondragover="nsDragAndDrop.dragOver(event, this.parentNode.parentNode.parentNode); event.stopPropagation();"
|
||||
ondragdrop="nsDragAndDrop.drop(event, this.parentNode.parentNode.parentNode); event.stopPropagation();">
|
||||
<xul:tab maxwidth="250" width="0" minwidth="30" flex="100000" class="tabbrowser-tab" label="(Untitled)" crop="end"/>
|
||||
<xul:tab maxwidth="250" width="0" minwidth="30" flex="100000" class="tabbrowser-tab" label="&untitledTab;" crop="end"/>
|
||||
</xul:tabs>
|
||||
</xul:stack>
|
||||
<xul:tabpanels flex="1" style="margin:0px; padding:0px; border:0px;">
|
||||
|
@ -79,7 +80,7 @@
|
|||
</content>
|
||||
<implementation>
|
||||
<field name="mTabBox">
|
||||
document.getAnonymousNodes(this)[0]
|
||||
document.getAnonymousNodes(this)[1]
|
||||
</field>
|
||||
<field name="mStrip">
|
||||
this.mTabBox.firstChild
|
||||
|
@ -90,6 +91,9 @@
|
|||
<field name="mPanelContainer">
|
||||
this.mTabBox.childNodes[1]
|
||||
</field>
|
||||
<field name="mStringBundle">
|
||||
document.getAnonymousNodes(this)[0]
|
||||
</field>
|
||||
<field name="mCurrentTab">
|
||||
null
|
||||
</field>
|
||||
|
@ -151,7 +155,7 @@
|
|||
if (!this.mBlank && aStateFlags & nsIWebProgressListener.STATE_START &&
|
||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
this.mTab.setAttribute("busy", "true");
|
||||
this.mTab.label = "Loading...";
|
||||
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading");
|
||||
|
||||
if (this.mTabBrowser.mCurrentTab == this.mTab)
|
||||
this.mTabBrowser.mIsBusy = true;
|
||||
|
@ -162,8 +166,8 @@
|
|||
this.mBlank = false;
|
||||
else {
|
||||
this.mTab.removeAttribute("busy");
|
||||
if (this.mTab.label == "Loading...")
|
||||
this.mTab.label = "(Untitled)";
|
||||
if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.loading"))
|
||||
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.untitled")
|
||||
|
||||
if (this.mTabBrowser.mCurrentTab == this.mTab)
|
||||
this.mTabBrowser.mIsBusy = false;
|
||||
|
@ -331,6 +335,27 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="setStripVisibilityTo">
|
||||
<parameter name="aShow"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.mStrip.collapsed = !aShow;
|
||||
if (aShow) {
|
||||
// XXXdwh temporary unclean dependency on specific menu items in navigator.xul
|
||||
document.getElementById("menu_closeWindow").hidden = false;
|
||||
document.getElementById("menu_closeSeparator").hidden = false;
|
||||
document.getElementById("menu_close").setAttribute("label", this.mStringBundle.getString("tabs.closeTab"));
|
||||
}
|
||||
else {
|
||||
// XXXdwh temporary unclean dependency on specific menu items in navigator.xul
|
||||
document.getElementById("menu_closeWindow").hidden = true;
|
||||
document.getElementById("menu_closeSeparator").hidden = true;
|
||||
document.getElementById("menu_close").setAttribute("label", this.mStringBundle.getString("tabs.close"));
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addTab">
|
||||
<parameter name="aURI"/>
|
||||
<body>
|
||||
|
@ -366,7 +391,7 @@
|
|||
"tab");
|
||||
|
||||
if (blank)
|
||||
t.setAttribute("label", "(Untitled)");
|
||||
t.setAttribute("label", this.mStringBundle.getString("tabs.untitled"));
|
||||
else
|
||||
t.setAttribute("label", aURI);
|
||||
|
||||
|
@ -385,10 +410,10 @@
|
|||
this.mPanelContainer.appendChild(b);
|
||||
|
||||
b.addEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
||||
|
||||
|
||||
if (this.mStrip.collapsed)
|
||||
this.mStrip.collapsed = false;
|
||||
|
||||
this.setStripVisibilityTo(true);
|
||||
|
||||
// wire up a progress listener for the new browser object.
|
||||
var position = this.mTabContainer.childNodes.length-1;
|
||||
var tabListener = (this.mTabProgressListener)(this, t, blank);
|
||||
|
@ -449,7 +474,7 @@
|
|||
var pref = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefService).getBranch(null);
|
||||
var autohide = pref.getBoolPref("browser.tabs.autoHide");
|
||||
if (autohide)
|
||||
this.mStrip.collapsed = true; // Go ahead and collapse, since we're going back to 1 tab.
|
||||
this.setStripVisibilityTo(false);
|
||||
}
|
||||
|
||||
var index = -1;
|
||||
|
@ -533,7 +558,8 @@
|
|||
var pref = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefService).getBranch(null);
|
||||
var autohide = pref.getBoolPref("browser.tabs.autoHide");
|
||||
if (!autohide) {
|
||||
this.mStrip.collapsed = false;
|
||||
this.setStripVisibilityTo(true);
|
||||
|
||||
this.mTabbedMode = true;
|
||||
this.mCurrentBrowser.addEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<menupopup id="menu_FilePopup">
|
||||
<!-- Page setup -->
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuseparator id="menu_FileQuitSeparator"/>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<!-- close -->
|
||||
<menuitem id="menu_close" label="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" command="cmd_close"/>
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
|
||||
<key id="key_closeWindow" key="&closeCmd.key;" command="cmd_closeWindow" modifiers="accel,shift"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuseparator id="menu_FileQuitSeparator"/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<!ENTITY untitledTab "(Untitled)">
|
||||
<!ENTITY newTab.label "New Tab">
|
||||
<!ENTITY newTab.accesskey "n">
|
||||
<!ENTITY closeTab.label "Close Tab">
|
||||
|
|
Загрузка…
Ссылка в новой задаче