Bug 394873 - Switch Mac to a Firefox-style <panel>-sheet for toolbar customization, r=mscott
git-svn-id: svn://10.0.0.236/trunk@236015 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
5592a7d991
commit
0ac5814b7f
@ -52,4 +52,8 @@ ifndef MOZ_BRANDING_DIRECTORY
|
||||
DEFINES += -DMOZ_USE_GENERIC_BRANDING
|
||||
endif
|
||||
|
||||
ifeq (cocoa, $(MOZ_WIDGET_TOOLKIT))
|
||||
DEFINES += -DTOOLBAR_CUSTOMIZATION_SHEET
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@ -54,19 +54,24 @@ var gPreviousIconSize = null;
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
gToolbox = window.arguments[0];
|
||||
InitWithToolbox(window.arguments[0]);
|
||||
repositionDialog();
|
||||
}
|
||||
|
||||
function InitWithToolbox(aToolbox)
|
||||
{
|
||||
gToolbox = aToolbox;
|
||||
gToolboxDocument = gToolbox.ownerDocument;
|
||||
|
||||
gToolbox.addEventListener("draggesture", onToolbarDragGesture, false);
|
||||
gToolbox.addEventListener("dragover", onToolbarDragOver, false);
|
||||
gToolbox.addEventListener("dragexit", onToolbarDragExit, false);
|
||||
gToolbox.addEventListener("dragdrop", onToolbarDragDrop, false);
|
||||
repositionDialog();
|
||||
|
||||
initDialog();
|
||||
}
|
||||
|
||||
function onUnload(aEvent)
|
||||
function finishToolbarCustomization()
|
||||
{
|
||||
removeToolboxListeners();
|
||||
unwrapToolbarItems(true);
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
title="&dialog.title;"
|
||||
onload="onLoad();"
|
||||
onunload="onUnload();"
|
||||
onunload="finishToolbarCustomization();"
|
||||
buttons="accept,cancel"
|
||||
ondialogaccept="return onAccept();"
|
||||
ondialogcancel="return onCancel();"
|
||||
|
||||
42
mozilla/mail/base/content/customizeToolbarSheet.js
Normal file
42
mozilla/mail/base/content/customizeToolbarSheet.js
Normal file
@ -0,0 +1,42 @@
|
||||
# ***** 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
|
||||
# Mozilla Corporation
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005-2006
|
||||
# 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 *****
|
||||
|
||||
var gCustomizeToolbarSheet = {
|
||||
init: function() {
|
||||
InitWithToolbox(window.parent.getMailToolbox());
|
||||
}
|
||||
};
|
||||
121
mozilla/mail/base/content/customizeToolbarSheet.xul
Normal file
121
mozilla/mail/base/content/customizeToolbarSheet.xul
Normal file
@ -0,0 +1,121 @@
|
||||
<?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 Communicator client code, released
|
||||
# March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# David Hyatt (hyatt@apple.com)
|
||||
# Blake Ross (blaker@netscape.com)
|
||||
# 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 *****
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
|
||||
%customizeToolbarDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://global/content/customizeToolbar.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/customizeToolbar.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://messenger/skin/addressbook/addressbook.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://messenger/skin/messengercompose/messengercompose.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://messenger/skin/smime/msgCompSMIMEOverlay.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://messenger/skin/primaryToolbar.css" type="text/css"?>
|
||||
|
||||
<window id="CustomizeToolbarSheet"
|
||||
title="&dialog.title;"
|
||||
style="&dialog.style;"
|
||||
onload="gCustomizeToolbarSheet.init();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://global/content/customizeToolbar.js"/>
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://messenger/content/customizeToolbarSheet.js"/>
|
||||
|
||||
<stringbundle id="stringBundle"
|
||||
src="chrome://global/locale/customizeToolbar.properties"/>
|
||||
|
||||
<keyset id="CustomizeToolbarSheetKeyset">
|
||||
<key id="cmd_close_sheet"
|
||||
keycode="VK_ESCAPE"
|
||||
oncommand="finishToolbarCustomization();"/>
|
||||
<key id="cmd_close_sheet" keycode="VK_RETURN"
|
||||
oncommand="finishToolbarCustomization();"/>
|
||||
<key id="cmd_close_sheet" keycode="VK_ENTER"
|
||||
oncommand="finishToolbarCustomization();"/>
|
||||
</keyset>
|
||||
|
||||
<vbox id="main-box" flex="1">
|
||||
<label id="instructions" value="&instructions.description;"/>
|
||||
|
||||
<vbox flex="1" id="palette-box"
|
||||
ondraggesture="nsDragAndDrop.startDrag(event, dragStartObserver);"
|
||||
ondragover="nsDragAndDrop.dragOver(event, paletteDNDObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, paletteDNDObserver);"/>
|
||||
|
||||
<box align="center">
|
||||
<label value="&show.label;"/>
|
||||
<menulist id="modelist"
|
||||
value="icons"
|
||||
oncommand="updateToolbarMode(this.value);">
|
||||
<menupopup>
|
||||
<menuitem value="full" label="&iconsAndText.label;"/>
|
||||
<menuitem value="icons" label="&icons.label;"/>
|
||||
<menuitem value="text" label="&text.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
|
||||
<checkbox id="smallicons"
|
||||
oncommand="updateIconSize(this.checked);"
|
||||
label="&useSmallIcons.label;"/>
|
||||
|
||||
<button label="&restoreDefaultSet.label;"
|
||||
oncommand="restoreDefaultSet();"
|
||||
icon="refresh"/>
|
||||
</box>
|
||||
|
||||
<separator class="groove"/>
|
||||
|
||||
<hbox align="center" pack="end">
|
||||
<button label="&saveChanges.label;"
|
||||
oncommand="finishToolbarCustomization();"
|
||||
default="true"
|
||||
icon="close"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
|
||||
@ -52,16 +52,32 @@ function CustomizeMailToolbar(id)
|
||||
var customizePopup = document.getElementById("CustomizeMailToolbar");
|
||||
customizePopup.setAttribute("disabled", "true");
|
||||
|
||||
var toolbox = document.getElementById(id);
|
||||
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
var sheetFrame = document.getElementById("customizeToolbarSheetIFrame");
|
||||
sheetFrame.hidden = false;
|
||||
var sheetWidth = sheetFrame.style.width.match(/([0-9]+)px/)[1];
|
||||
document.getElementById("customizeToolbarSheetPopup")
|
||||
.openPopup(toolbox, "after_start",
|
||||
(window.innerWidth - sheetWidth) / 2, 0);
|
||||
#else
|
||||
var wintype = document.documentElement.getAttribute("windowtype");
|
||||
wintype = wintype.replace(/:/g, "");
|
||||
|
||||
window.openDialog("chrome://global/content/customizeToolbar.xul",
|
||||
"CustomizeToolbar"+wintype,
|
||||
"chrome,all,dependent", document.getElementById(id));
|
||||
"chrome,all,dependent", toolbox);
|
||||
#endif
|
||||
}
|
||||
|
||||
function MailToolboxCustomizeDone(aToolboxChanged)
|
||||
{
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
document.getElementById("customizeToolbarSheetIFrame").hidden = true;
|
||||
document.getElementById("customizeToolbarSheetPopup").hidePopup();
|
||||
#endif
|
||||
|
||||
// Update global UI elements that may have been added or removed
|
||||
|
||||
// Re-enable parts of the UI we disabled during the dialog
|
||||
|
||||
@ -1209,3 +1209,7 @@ function LoadNavigatedToMessage(msgHdr, folder, folderUri)
|
||||
}
|
||||
}
|
||||
|
||||
function getMailToolbox ()
|
||||
{
|
||||
return document.getElementById("mail-toolbox");
|
||||
}
|
||||
|
||||
@ -50,6 +50,10 @@
|
||||
%brandDTD;
|
||||
<!ENTITY % messengerDTD SYSTEM "chrome://messenger/locale/messenger.dtd" >
|
||||
%messengerDTD;
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
|
||||
%customizeToolbarDTD;
|
||||
#endif
|
||||
]>
|
||||
|
||||
<window id="messengerWindow"
|
||||
@ -168,6 +172,14 @@
|
||||
<hbox id="attachmentView"/>
|
||||
<findbar id="FindToolbar" browserid="messagepane"/>
|
||||
</vbox>
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<panel id="customizeToolbarSheetPopup" noautohide="true">
|
||||
<iframe id="customizeToolbarSheetIFrame"
|
||||
style="&dialog.style;"
|
||||
src="chrome://global/content/customizeToolbar.xul"
|
||||
hidden="true"/>
|
||||
</panel>
|
||||
#endif
|
||||
|
||||
<statusbar class="chromeclass-status" id="status-bar"/>
|
||||
</window>
|
||||
|
||||
@ -50,6 +50,10 @@
|
||||
%brandDTD;
|
||||
<!ENTITY % messengerDTD SYSTEM "chrome://messenger/locale/messenger.dtd" >
|
||||
%messengerDTD;
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
|
||||
%customizeToolbarDTD;
|
||||
#endif
|
||||
]>
|
||||
|
||||
<window id="messengerWindow"
|
||||
@ -409,6 +413,14 @@
|
||||
</box> <!-- end of mailContent -->
|
||||
|
||||
</tabmail>
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<panel id="customizeToolbarSheetPopup" noautohide="true">
|
||||
<iframe id="customizeToolbarSheetIFrame"
|
||||
style="&dialog.style;"
|
||||
src="chrome://global/content/customizeToolbar.xul"
|
||||
hidden="true"/>
|
||||
</panel>
|
||||
#endif
|
||||
|
||||
<statusbar id="status-bar" class="chromeclass-status">
|
||||
<statusbarpanel id="unreadMessageCount"/>
|
||||
|
||||
@ -1274,6 +1274,11 @@ function GetMessagePaneFrame()
|
||||
return window.content;
|
||||
}
|
||||
|
||||
function getMailToolbox()
|
||||
{
|
||||
return document.getElementById("mail-toolbox");
|
||||
}
|
||||
|
||||
function FindInSidebar(currentWindow, id)
|
||||
{
|
||||
var item = currentWindow.document.getElementById(id);
|
||||
|
||||
@ -118,6 +118,9 @@ messenger.jar:
|
||||
#ifdef XP_MACOSX
|
||||
content/messenger/macMenuOverlay.xul (content/macMenuOverlay.xul)
|
||||
#endif
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
* content/messenger/customizeToolbarSheet.js (content/customizeToolbarSheet.js)
|
||||
#endif
|
||||
|
||||
comm.jar:
|
||||
% content communicator %content/communicator/ xpcnativewrappers=yes
|
||||
@ -129,5 +132,9 @@ comm.jar:
|
||||
% content help %content/help/ xpcnativewrappers=yes
|
||||
|
||||
toolkit.jar:
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
*+ content/global/customizeToolbar.xul (content/customizeToolbarSheet.xul)
|
||||
#else
|
||||
*+ content/global/customizeToolbar.xul (content/customizeToolbar.xul)
|
||||
#endif
|
||||
*+ content/global/customizeToolbar.js (content/customizeToolbar.js)
|
||||
|
||||
@ -44,3 +44,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq (cocoa, $(MOZ_WIDGET_TOOLKIT))
|
||||
DEFINES += -DTOOLBAR_CUSTOMIZATION_SHEET
|
||||
endif
|
||||
|
||||
@ -857,3 +857,7 @@ function AbIMSelected()
|
||||
LaunchUrl(url);
|
||||
}
|
||||
|
||||
function getMailToolbox()
|
||||
{
|
||||
return document.getElementById("ab-toolbox");
|
||||
}
|
||||
|
||||
@ -49,6 +49,10 @@
|
||||
%abMainWindowDTD;
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
|
||||
%customizeToolbarDTD;
|
||||
#endif
|
||||
]>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
@ -790,6 +794,14 @@
|
||||
</hbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<panel id="customizeToolbarSheetPopup" noautohide="true">
|
||||
<iframe id="customizeToolbarSheetIFrame"
|
||||
style="&dialog.style;"
|
||||
src="chrome://global/content/customizeToolbar.xul"
|
||||
hidden="true"/>
|
||||
</panel>
|
||||
#endif
|
||||
|
||||
<statusbar id="status-bar" class="chromeclass-status">
|
||||
<statusbarpanel id="statusText" flex="1" value="&statusText.label;"/>
|
||||
|
||||
@ -44,3 +44,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq (cocoa, $(MOZ_WIDGET_TOOLKIT))
|
||||
DEFINES += -DTOOLBAR_CUSTOMIZATION_SHEET
|
||||
endif
|
||||
|
||||
@ -3600,3 +3600,8 @@ function enableInlineSpellCheck(aEnableInlineSpellCheck)
|
||||
InlineSpellCheckerUI.enabled = aEnableInlineSpellCheck;
|
||||
document.getElementById('msgSubject').setAttribute('spellcheck', aEnableInlineSpellCheck);
|
||||
}
|
||||
|
||||
function getMailToolbox()
|
||||
{
|
||||
return document.getElementById("compose-toolbox");
|
||||
}
|
||||
|
||||
@ -53,6 +53,10 @@
|
||||
%brandDTD;
|
||||
<!ENTITY % charsetDTD SYSTEM "chrome://global/locale/charsetOverlay.dtd" >
|
||||
%charsetDTD;
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
|
||||
%customizeToolbarDTD;
|
||||
#endif
|
||||
]>
|
||||
|
||||
<window id="msgcomposeWindow"
|
||||
@ -823,6 +827,14 @@
|
||||
|
||||
</vbox>
|
||||
</hbox>
|
||||
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
|
||||
<panel id="customizeToolbarSheetPopup" noautohide="true">
|
||||
<iframe id="customizeToolbarSheetIFrame"
|
||||
style="&dialog.style;"
|
||||
src="chrome://global/content/customizeToolbar.xul"
|
||||
hidden="true"/>
|
||||
</panel>
|
||||
#endif
|
||||
|
||||
<statusbar id="status-bar" class="chromeclass-status">
|
||||
<statusbarpanel id="statusText" flex="1"/>
|
||||
|
||||
@ -562,3 +562,14 @@ toolbar[iconsize="small"] #button-goforward[disabled] {
|
||||
margin: 6px 6px 0px 6px;
|
||||
color: black;
|
||||
}
|
||||
|
||||
#CustomizeToolbarSheet > #main-box {
|
||||
border-top: none !important;
|
||||
border-left: 2px solid;
|
||||
border-right: 2px solid;
|
||||
border-bottom: 3px solid;
|
||||
-moz-border-right-colors: -moz-mac-menushadow ThreeDLightShadow !important;
|
||||
-moz-border-bottom-colors: -moz-mac-menushadow -moz-mac-menushadow ThreeDShadow !important;
|
||||
-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight !important;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user