Bug 78274 Convert profile manager into a <dialog> r=jag sr=sspitzer

This commit is contained in:
neil%parkwaycc.co.uk 2004-07-14 21:51:09 +00:00
parent 83f8d9aab5
commit f30f0c46a3
10 changed files with 54 additions and 111 deletions

View File

@ -245,9 +245,11 @@ function SwitchProfileManagerMode()
captionLine = "Manage Profiles *";
}
var manage = document.getElementById( "manage" ); // hide the manage profiles button...
var manageParent = manage.parentNode;
manageParent.removeChild( manage );
var profileList = document.getElementById("profiles");
profileList.focus();
// hide the manage profiles button...
document.documentElement.getButton("extra2").hidden = true;
profileManagerMode = "manager"; // swap the mode
}
else {
@ -283,7 +285,7 @@ function DoEnabling()
{
var renbutton = document.getElementById( "renbutton" );
var delbutton = document.getElementById( "delbutton" );
var start = document.getElementById( "ok" );
var start = document.documentElement.getButton( "accept" );
var profileList = document.getElementById( "profiles" );
if (profileList.view.selection.count == 0)
@ -326,7 +328,7 @@ function HandleKeyEvent( aEvent )
return;
ConfirmDelete();
break;
case "VK_F2":
case KeyEvent.DOM_VK_F2:
if( profileManagerMode != "manager" )
return;
RenameProfile();

View File

@ -59,26 +59,24 @@ function StartUp()
gProfileManagerBundle = document.getElementById("bundle_profileManager");
gBrandBundle = document.getElementById("bundle_brand");
SetUpOKCancelButtons();
centerWindowOnScreen();
if (gStartupMode) {
document.documentElement.setAttribute("buttonlabelcancel",
document.documentElement.getAttribute("buttonlabelexit"));
document.documentElement.setAttribute("buttonlabelaccept",
document.documentElement.getAttribute("buttonlabelstart"));
}
if(window.location && window.location.search && window.location.search == "?manage=true" )
SwitchProfileManagerMode();
// Set up the intro text, depending on our context
var introTextItem = document.getElementById("intro");
var introText, insertText;
if (gStartupMode) {
insertText = gProfileManagerBundle.getFormattedString("startButton",
[gBrandBundle.getString("brandShortName")]);
introText = gProfileManagerBundle.getFormattedString("intro_start",
[insertText]);
else {
// Set up the intro text, depending on our context
var introTextItem = document.getElementById("intro");
var insertText = document.documentElement.getAttribute("buttonlabelaccept");
var introText = gProfileManagerBundle.getFormattedString(
gStartupMode ? "intro_start" : "intro_switch",
[insertText]);
introTextItem.textContent = introText;
}
else {
insertText = gProfileManagerBundle.getString("selectButton");
introText = gProfileManagerBundle.getFormattedString("intro_switch",
[insertText]);
}
introTextItem.childNodes[0].nodeValue = introText;
var dirServ = Components.classes['@mozilla.org/file/directory_service;1']
.getService(Components.interfaces.nsIProperties);
@ -287,32 +285,3 @@ function onExit()
gDialogParams.SetInt(0, 0); // 0 == cancel
return true;
}
function SetUpOKCancelButtons()
{
doSetOKCancel( onStart, onExit, null, null );
var okButton = document.getElementById("ok");
var cancelButton = document.getElementById("cancel");
var okButtonString;
var cancelButtonString;
try {
if (gStartupMode) {
okButtonString = gProfileManagerBundle.getFormattedString("startButton",
[gBrandBundle.getString("brandShortName")]);
cancelButtonString = gProfileManagerBundle.getString("exitButton");
}
else {
okButtonString = gProfileManagerBundle.getString("selectButton");
cancelButtonString = gProfileManagerBundle.getString("cancel");
}
} catch (e) {
okButtonString = "Start Yah";
cancelButtonString = "Exit Yah";
}
okButton.setAttribute( "label", okButtonString );
okButton.setAttribute( "class", ( okButton.getAttribute("class") + " padded" ) );
cancelButton.setAttribute( "label", cancelButtonString );
}

View File

@ -43,24 +43,30 @@
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/profile/profile.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE window [
<!DOCTYPE dialog [
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
%brandDTD;
<!ENTITY % profileDTD SYSTEM "chrome://communicator/locale/profile/profileSelection.dtd">
%profileDTD;
]>
<window
<dialog
id="profileWindow"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="color-dialog non-resizable"
title="&windowtitle.label;"
windowtype="mozilla:profileSelection"
orient="vertical"
style="width: 42em;"
onclose="onExit();"
spacerflex="1"
buttons="accept,cancel,extra2"
buttonlabelstart="&start.label;"
buttonlabelexit="&exit.label;"
buttonlabelaccept="&select.label;"
buttonlabelextra2="&manage.label;"
buttonaccesskeyextra2="&manage.accesskey;"
ondialogaccept="onStart();"
ondialogcancel="onExit();"
ondialogextra2="SwitchProfileManagerMode();"
onload="StartUp();">
<stringbundle id="bundle_profileManager"
@ -71,8 +77,6 @@
<script type="application/x-javascript" src="chrome://communicator/content/profile/profileSelection.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/profile/profileManager.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/profile/createProfileWizard.js"/>
<keyset id="dialogKeys"/>
<dialogheader class="header-large" id="header" title="&profilemanager.label;" description="&windowtitle.label;"/>
@ -80,7 +84,7 @@
<!-- instructions -->
<deck id="prattle">
<description id="intro" style="width: 17em;border:1px solid transparent;" flex="1">""</description>
<description id="intro" style="width: 17em;"/>
<vbox id="manager">
<description style="width: 17em;" class="label">&pmTextA.label;</description>
<separator/>
@ -114,16 +118,4 @@
</vbox>
</hbox>
<hbox class="selection">
<separator class="thin" orient="vertical"/>
<button id="manage" label="&manage.label;" accesskey="&manage.accesskey;" oncommand="SwitchProfileManagerMode();"/>
<spacer flex="1"/>
<hbox id="okCancelButtons"/>
<separator class="thin" orient="vertical"/>
</hbox>
<separator class="thin" />
<hbox id="profileManager-status" class="box-status" value="&profilemanager.label;" progress=""/>
</window>
</dialog>

View File

@ -26,12 +26,6 @@ intro_switch=To switch to another profile, which contains stored messages, setti
pm_button=Back...
ps_button=Manage Profiles...
selectButton=Use Profile
startButton=Start %S
exitButton=Exit
cancel=Cancel
invalidChar=The character "%S" is not allowed in profile names. Please choose a different name.
profileCreationFailed=Profile couldn't be created. Probably the chosen folder isn't writable.

View File

@ -51,6 +51,7 @@
<!ENTITY exit.label "Exit">
<!ENTITY manage.label "Manage Profiles...">
<!ENTITY manage.accesskey "M">
<!ENTITY select.label "Use Profile">
<!ENTITY availprofiles.label "Available Profiles">

View File

@ -78,7 +78,7 @@ dialogheader {
.header-large {
-moz-box-orient: vertical;
margin: 0;
margin: -8px -10px 8px -10px;
border-left: none;
border-right: none;
border-top: 1px solid;

View File

@ -77,7 +77,7 @@ dialogheader {
.header-large {
-moz-box-orient: vertical;
margin: 0;
margin: -8px -10px 8px -10px;
border-left: none;
border-right: none;
border-top: none;

View File

@ -71,7 +71,7 @@ dialogheader {
.header-large {
-moz-box-orient: vertical;
margin: 0;
margin: -7px -5px 5px -7px;
border-left: none;
border-right: none;
border-top: none;
@ -89,4 +89,4 @@ dialogheader {
.header-large > .dialogheader-description {
margin-left: 12px !important;
}
}

View File

@ -19,12 +19,13 @@
<xul:hbox class="dialog-button-box" pack="end" anonid="buttons"
xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient">
<xul:button dlgtype="accept" class="dialog-button"/>
<xul:button dlgtype="extra1" class="dialog-button" hidden="true" label=""/>
<xul:button dlgtype="extra2" class="dialog-button" hidden="true" label=""/>
<xul:button dlgtype="cancel" class="dialog-button"/>
<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
<xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
<xul:button dlgtype="extra2" class="dialog-button" hidden="true" label="" xbl:inherits="label=buttonlabelextra2,accesskey=buttonaccesskeyextra2"/>
<xul:spacer xbl:inherits="flex=spacerflex"/>
<xul:button dlgtype="accept" class="dialog-button" xbl:inherits="label=buttonlabelaccept,accesskey=buttonaccesskeyaccept"/>
<xul:button dlgtype="extra1" class="dialog-button" hidden="true" label="" xbl:inherits="label=buttonlabelextra1,accesskey=buttonaccesskeyextra1"/>
<xul:button dlgtype="cancel" class="dialog-button" xbl:inherits="label=buttonlabelcancel,accesskey=buttonaccesskeycancel"/>
<xul:button dlgtype="help" class="dialog-button" hidden="true" xbl:inherits="label=buttonlabelhelp,accesskey=buttonaccesskeyhelp"/>
<xul:button dlgtype="disclosure" class="dialog-button" hidden="true" xbl:inherits="label=buttonlabeldisclosure,accesskey=buttonaccesskeydisclosure"/>
</xul:hbox>
</content>
@ -243,22 +244,6 @@
</method>
<method name="_doButtonCommand">
<parameter name="aDlgType"/>
<body>
<![CDATA[
// calling window.close() while an oncommand event
// call is on the stack fails to close the window,
// so we need to do this ugly setTimeout hack
window.setTimeout(
function(aDlgType) {
document.documentElement._reallyDoButtonCommand(aDlgType);
},
0, aDlgType);
]]>
</body>
</method>
<method name="_reallyDoButtonCommand">
<parameter name="aDlgType"/>
<body>
<![CDATA[

View File

@ -13,13 +13,13 @@
<xul:hbox class="dialog-button-box"
xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient">
<xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
<xul:button dlgtype="extra2" class="dialog-button" hidden="true" label=""/>
<xul:button dlgtype="extra1" class="dialog-button" hidden="true" label=""/>
<xul:button dlgtype="disclosure" class="dialog-button" hidden="true" xbl:inherits="label=buttonlabeldisclosure,accesskey=buttonaccesskeydisclosure"/>
<xul:button dlgtype="help" class="dialog-button" hidden="true" xbl:inherits="label=buttonlabelhelp,accesskey=buttonaccesskeyhelp"/>
<xul:button dlgtype="extra2" class="dialog-button" hidden="true" label="" xbl:inherits="label=buttonlabelextra2,accesskey=buttonaccesskeyextra2"/>
<xul:button dlgtype="extra1" class="dialog-button" hidden="true" label="" xbl:inherits="label=buttonlabelextra1,accesskey=buttonaccesskeyextra1"/>
<xul:spacer flex="1"/>
<xul:button dlgtype="cancel" class="dialog-button"/>
<xul:button dlgtype="accept" class="dialog-button"/>
<xul:button dlgtype="cancel" class="dialog-button" xbl:inherits="label=buttonlabelcancel,accesskey=buttonaccesskeycancel"/>
<xul:button dlgtype="accept" class="dialog-button" xbl:inherits="label=buttonlabelaccept,accesskey=buttonaccesskeyaccept"/>
</xul:hbox>
</content>