Bug 239218 - [Mac] (First part) Menus are nonfunctional in the Download Manager, About and Page Info windows. r=mconnor, a=asa

This commit is contained in:
mozilla.mano%sent.com 2005-04-19 15:32:38 +00:00
parent da13e64cf2
commit e1aa396492
11 changed files with 141 additions and 46 deletions

View File

@ -46,6 +46,10 @@
%aboutDialogDTD;
]>
#ifdef XP_MACOSX
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
#endif
<dialog xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="aboutDialog"
@ -82,14 +86,9 @@
</deck>
<separator class="groove" id="groove"/>
# manually add Cmd+W until we add a menubar on mac
#ifdef XP_MACOSX
<keyset id="mainKeyset">
<key id="keyClose"
modifiers="accel"
key="&cmdClose.macKey;"
oncommand="window.close();"/>
</keyset>
#include browserMountPoints.inc
#endif
</dialog>

View File

@ -51,16 +51,20 @@
<stringbundle id="bundle_preferences" src="chrome://browser/locale/preferences/preferences.properties"/>
</stringbundleset>
<commandset commandupdater="true"
<commandset id="globalEditCommandSet"
commandupdater="true"
events="focus"
oncommandupdate="goUpdateGlobalEditMenuItems()"/>
<commandset commandupdater="true"
<commandset id="selectEditCommandSet"
commandupdater="true"
events="select"
oncommandupdate="goUpdateSelectEditMenuItems()"/>
<commandset commandupdater="true"
<commandset id="undoEditCommandSet"
commandupdater="true"
events="undo"
oncommandupdate="goUpdateUndoEditMenuItems()"/>
<commandset commandupdater="true"
<commandset id="pasteCommandSet"
commandupdater="true"
events="clipboard"
oncommandupdate="goUpdatePasteMenuItems()"/>

View File

@ -516,7 +516,7 @@ const gXPInstallObserver = {
}
};
function Startup()
function BrowserStartup()
{
gBrowser = document.getElementById("content");
@ -879,7 +879,7 @@ function delayedStartup()
theToolbar.appendChild(updateItem);
}
function Shutdown()
function BrowserShutdown()
{
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
@ -953,12 +953,12 @@ function Shutdown()
}
#ifdef XP_MACOSX
// The following functions should be used by both hiddenWindow.xul
// and any other windows which only have menus on Mac OS X
// nonBrowserWindowStartup() and nonBrowserWindowDelayedStartup() are used for
// non-browser windows in macBrowserOverlay
function nonBrowserWindowStartup()
{
// Disable inappropriate commands / submenus
var disabledItems = ['cmd_newNavigatorTab', 'cmd_close', 'Browser:SavePage', 'Browser:SendLink',
var disabledItems = ['cmd_newNavigatorTab', 'Browser:SavePage', 'Browser:SendLink',
'cmd_pageSetup', 'cmd_print', 'cmd_find', 'cmd_findAgain', 'viewToolbarsMenu',
'cmd_toggleTaskbar', 'viewSidebarMenuMenu', 'Browser:Reload', 'Browser:ReloadSkipCache',
'viewTextZoomMenu', 'pageStyleMenu', 'charsetMenu', 'View:PageSource', 'View:FullScreen',
@ -972,14 +972,18 @@ function nonBrowserWindowStartup()
element.setAttribute("disabled", "true");
}
// If no windows are active (i.e. we're the hidden window), disable the minimize
// If no windows are active (i.e. we're the hidden window), disable the close, minimize
// and zoom menu commands as well
if (window.location.href == "chrome://browser/content/hiddenWindow.xul")
{
element = document.getElementById("minimizeWindow");
element.setAttribute("disabled", "true");
element = document.getElementById("zoomWindow");
element.setAttribute("disabled", "true");
var hiddenWindowDisabledItems = ['cmd_close', 'minimizeWindow', 'zoomWindow'];
for (var id in hiddenWindowDisabledItems)
{
element = document.getElementById(hiddenWindowDisabledItems[id]);
if (element)
element.setAttribute("disabled", "true");
}
// also hide the window-list separator
element = document.getElementById("sep-window-list");
element.setAttribute("hidden", "true");
@ -1563,8 +1567,8 @@ function openLocation()
}
else {
#ifdef XP_MACOSX
if (window.location.href == "chrome://browser/content/hiddenWindow.xul") {
// If no windows are active, open a new one.
if (window.location.href != getBrowserURL()) {
// If it's not a browser window, open a new one.
window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no", "about:blank");
}
else
@ -1619,6 +1623,14 @@ function BrowserOpenFileWindow()
function BrowserCloseTabOrWindow()
{
#ifdef XP_MACOSX
// If we're not a browser window, just close the window
if (window.location.href != getBrowserURL()) {
closeWindow(true);
return;
}
#endif
if (gBrowser.localName == 'tabbrowser' && gBrowser.tabContainer.childNodes.length > 1) {
// Just close up a tab.
gBrowser.removeCurrentTab();
@ -1637,7 +1649,7 @@ function BrowserTryToCloseWindow()
function BrowserCloseWindow()
{
// This code replicates stuff in Shutdown(). It is here because
// This code replicates stuff in BrowserShutdown(). 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
// provide a means of saving position (it just requires that the

View File

@ -47,11 +47,7 @@
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/findBar.css" type="text/css"?>
#ifdef XP_MACOSX
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
#else
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
#endif
# All DTD information is stored in a separate file so that it can be shared by
# hiddenWindow.xul.
@ -60,7 +56,7 @@
<window id="main-window"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="Startup()" onunload="Shutdown()" onclose="return WindowIsClosing();"
onload="BrowserStartup()" onunload="BrowserShutdown()" onclose="return WindowIsClosing();"
contenttitlesetting="true"
title="&mainWindow.title;"
titlemodifier="&mainWindow.title;"
@ -69,7 +65,6 @@
screenX="4" screenY="4"
persist="screenX screenY width height sizemode">
#ifndef XP_MACOSX
# All JS files that browser.xul wishes to include *must* go into the browser-scripts.inc file
# so that they can be shared by hiddenWindow.xul.
#include browser-scripts.inc
@ -77,7 +72,6 @@
# All sets except for popupsets (commands, keys, stringbundles and broadcasters) *must* go into the
# browser-sets.inc file for sharing with hiddenWindow.xul.
#include browser-sets.inc
#endif
<popupset id="mainPopupSet">
<popup id="backMenu"
@ -114,10 +108,8 @@
</popupset>
#ifndef XP_MACOSX
# The hacky hidden tree used by the Go menu to build items.
#include browser-gotreehack.inc
#endif
<!-- bookmarks context menu -->
<popupset>
@ -145,11 +137,9 @@
#endif
mode="icons" context="toolbar-context-menu">
<toolbaritem id="menubar-items" align="center">
#ifndef XP_MACOSX
# The entire main menubar is placed into browser-menubar.inc, so that it can be shared by
# hiddenWindow.xul.
#include browser-menubar.inc
#endif
</toolbaritem>
<toolbaritem id="softwareupdate-item" title="&updatesItem.title;" align="center" pack="center">
<toolbarbutton type="updates" id="softwareupdate"/>

View File

@ -0,0 +1,19 @@
<stringbundleset id="stringbundleset"/>
<commandset id="globalEditCommandSet"/>
<commandset id="selectEditCommandSet"/>
<commandset id="undoEditCommandSet"/>
<commandset id="pasteCommandSet"/>
<commandset id="mainCommandSet"/>
<commandset id="baseMenuCommandSet"/>
<broadcasterset id="mainBroadcasterSet"/>
<keyset id="mainKeyset"/>
<keyset id="baseMenuKeyset"/>
<menubar id="main-menubar"/>
<template id="bookmarks-template"/>
<tree id="hiddenHistoryTree"/>

View File

@ -15,6 +15,16 @@
chrome:localeVersion="0.9.9"
chrome:skinVersion="1.5">
</RDF:Description>
# Overlays Points
#ifdef XP_MACOSX
<RDF:Seq RDF:about="urn:mozilla:overlays">
<RDF:li RDF:resource="chrome://mozapps/content/downloads/downloads.xul"/>
</RDF:Seq>
<RDF:Seq RDF:about="chrome://mozapps/content/downloads/downloads.xul">
<RDF:li>chrome://browser/content/downloadManagerOverlay.xul</RDF:li>
</RDF:Seq>
#endif
</RDF:RDF>

View File

@ -0,0 +1,50 @@
<?xml version="1.0"?>
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla.org code.
#
# The Initial Developer of the Original Code is Asaf Romano
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Asaf Romano <mozilla.mano@sent.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
<overlay id="downloadManagerOverlay"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
<window id="downloadManager">
#include browserMountPoints.inc
</window>
</overlay>

View File

@ -45,8 +45,9 @@
<window id="main-window"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="nonBrowserWindowStartup();">
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
#include browserMountPoints.inc
</window>

View File

@ -24,6 +24,7 @@
#
# Contributor(s):
# David Hyatt <hyatt@mozilla.org> (Original Author)
# Asaf Romano <mozilla.mano@sent.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -39,8 +40,6 @@
#
# ***** END LICENSE BLOCK *****
#ifdef XP_MACOSX
# All DTD information is stored in a separate file so that it can be shared by
# hiddenWindow.xul.
#include browser-doctype.inc
@ -55,7 +54,9 @@
# so that they can be shared by hiddenWindow.xul.
#include browser-scripts.inc
<window id="main-window">
<script type="application/x-javascript">
addEventListener("load", nonBrowserWindowStartup, false);
</script>
# All sets except for popupsets (commands, keys, stringbundles and broadcasters) *must* go into the
# browser-sets.inc file for sharing with hiddenWindow.xul.
@ -68,8 +69,4 @@
# hiddenWindow.xul.
#include browser-menubar.inc
</window>
</overlay>
#endif

View File

@ -48,6 +48,10 @@
%pageInfoDTD;
]>
#ifdef XP_MACOSX
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
#endif
<window id="main-window"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
windowtype="Browser:page-info"
@ -354,4 +358,9 @@
<!-- Others added by overlay -->
</tabpanels>
</tabbox>
#ifdef XP_MACOSX
#include browserMountPoints.inc
#endif
</window>

View File

@ -8,8 +8,6 @@ browser.jar:
* content/browser/browser.js (content/browser.js)
* content/browser/browser.xul (content/browser.xul)
* content/browser/credits.xhtml (content/credits.xhtml)
* content/browser/hiddenWindow.xul (content/hiddenWindow.xul)
* content/browser/macBrowserOverlay.xul (content/macBrowserOverlay.xul)
* content/browser/metaData.js (content/metaData.js)
* content/browser/metaData.xul (content/metaData.xul)
content/browser/monitor.png (content/monitor.png)
@ -29,6 +27,12 @@ browser.jar:
* content/browser/web-panels.js (content/web-panels.js)
* content/browser/web-panels.xul (content/web-panels.xul)
* content/browser/baseMenuOverlay.xul (content/baseMenuOverlay.xul)
# XXX: We should exclude this one as well (bug 71895)
* content/browser/hiddenWindow.xul (content/hiddenWindow.xul)
#ifdef XP_MACOSX
* content/browser/macBrowserOverlay.xul (content/macBrowserOverlay.xul)
* content/browser/downloadManagerOverlay.xul (content/downloadManagerOverlay.xul)
#endif
#ifndef MOZ_USE_OFFICIAL_BRANDING
content/branding/contents.rdf (branding/contents.rdf)
content/branding/about.png (branding/about.png)