зеркало из https://github.com/mozilla/pjs.git
Er, these weren't supposed to go in.
This commit is contained in:
Родитель
cb9774d60a
Коммит
5c5044eabf
|
@ -28,9 +28,16 @@ profile = profile.QueryInterface(Components.interfaces.nsIProfileInternal);
|
|||
var gCreateProfileWizardBundle;
|
||||
var gProfileManagerBundle;
|
||||
|
||||
// Navigation Set for pages contained in wizard
|
||||
var wizardMap = {
|
||||
newProfile1_1: { previous: null, next: "newProfile1_2", finish: false },
|
||||
newProfile1_2: { previous: "newProfile1_1", next: null, finish: true },
|
||||
}
|
||||
|
||||
// page specific variables
|
||||
var profName = "";
|
||||
var profDir = "";
|
||||
var wizardManager = null;
|
||||
|
||||
// startup procedure
|
||||
function Startup( startPage, frame_id )
|
||||
|
@ -42,6 +49,15 @@ function Startup( startPage, frame_id )
|
|||
gCreateProfileWizardBundle = document.getElementById("bundle_createProfileWizard");
|
||||
gProfileManagerBundle = document.getElementById("bundle_profileManager");
|
||||
|
||||
// instantiate the Wizard Manager
|
||||
wizardManager = new WizardManager( frame_id, null, null, wizardMap );
|
||||
wizardManager.URL_PagePrefix = "chrome://communicator/content/profile/";
|
||||
wizardManager.URL_PagePostfix = ".xul";
|
||||
|
||||
// set the button handler functions
|
||||
wizardManager.SetHandlers( null, null, onFinish, onCancel, null, null );
|
||||
// load the start page
|
||||
wizardManager.LoadPage (startPage, false);
|
||||
// move to center of screen if no opener, otherwise, to center of opener
|
||||
if( window.opener )
|
||||
moveToAlertPosition();
|
||||
|
@ -62,59 +78,37 @@ function onCancel()
|
|||
}
|
||||
window.close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function onFinish()
|
||||
{
|
||||
var profName = document.getElementById("ProfileName").value;
|
||||
var profDir = document.getElementById("ProfileDir").getAttribute("rootFolder");
|
||||
var profLang = document.getElementById("ProfileLanguage").getAttribute("data");
|
||||
var profRegion = document.getElementById("ProfileRegion").getAttribute("data");
|
||||
|
||||
// check if we're at final stage
|
||||
if( !wizardManager.wizardMap[wizardManager.currentPageTag].finish )
|
||||
return;
|
||||
|
||||
var tag = wizardManager.WSM.GetTagFromURL( wizardManager.content_frame.src, "/", ".xul" );
|
||||
wizardManager.WSM.SavePageData( tag, null, null, null );
|
||||
|
||||
var profName = wizardManager.WSM.PageData["newProfile1_2"].ProfileName.value;
|
||||
var profDir = wizardManager.WSM.PageData["newProfile1_2"].ProfileDir.value;
|
||||
var profLang = wizardManager.WSM.PageData["newProfile1_2"].ProfileLanguage.value;
|
||||
var profRegion = wizardManager.WSM.PageData["newProfile1_2"].ProfileRegion.value;
|
||||
|
||||
// Get & select langcode
|
||||
var proceed = processCreateProfileData(profName, profDir, profLang, profRegion);
|
||||
|
||||
proceed = processCreateProfileData(profName, profDir, profLang, profRegion);
|
||||
|
||||
if( proceed ) {
|
||||
alert('fo');
|
||||
if( window.opener ) {
|
||||
window.opener.CreateProfile(profName, profDir);
|
||||
}
|
||||
else {
|
||||
profile.startApprunner(profName);
|
||||
}
|
||||
alert('fo');
|
||||
window.close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// function createProfileWizard.js::chooseProfileFolder();
|
||||
// invoke a folder selection dialog for choosing the directory of profile storage.
|
||||
function chooseProfileFolder( aRootFolder )
|
||||
{
|
||||
if( !aRootFolder ) {
|
||||
try {
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
|
||||
var newProfile1_2Bundle = document.getElementById("bundle_newProfile1_2");
|
||||
fp.init(window, newProfile1_2Bundle.getString("chooseFolder"), Components.interfaces.nsIFilePicker.modeGetFolder);
|
||||
fp.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
|
||||
fp.show();
|
||||
// later change to
|
||||
aRootFolder = fp.file.unicodePath;
|
||||
}
|
||||
catch(e) {
|
||||
aRootFolder = null;
|
||||
}
|
||||
}
|
||||
if( aRootFolder ) {
|
||||
var folderText = document.getElementById("ProfileDir");
|
||||
dump("*** setting rootFolderAttribute to " + aRootFolder + "\n");
|
||||
folderText.setAttribute( "rootFolder", aRootFolder );
|
||||
if ( aRootFolder != top.profile.defaultProfileParentDir.unicodePath )
|
||||
document.getElementById( "useDefault" ).removeAttribute("disabled");
|
||||
updateProfileName();
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
/** void processCreateProfileData( void ) ;
|
||||
|
@ -180,76 +174,4 @@ function processCreateProfileData( aProfName, aProfDir, langcode, regioncode)
|
|||
dump("*** Failed to create a profile\n");
|
||||
}
|
||||
}
|
||||
function updateProfileName()
|
||||
{
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
const nsILocalFile_CONTRACTID = "@mozilla.org/file/local;1";
|
||||
|
||||
var profileName = document.getElementById( "ProfileName" );
|
||||
var folderDisplayElement = document.getElementById( "ProfileDir" );
|
||||
var rootFolder = folderDisplayElement.getAttribute( "rootFolder" );
|
||||
try {
|
||||
|
||||
var sfile = Components.classes[nsILocalFile_CONTRACTID].createInstance(nsILocalFile);
|
||||
if ( sfile ) {
|
||||
// later change to
|
||||
sfile.initWithUnicodePath(rootFolder);
|
||||
}
|
||||
// later change to
|
||||
sfile.appendUnicode(profileName.value);
|
||||
|
||||
clearFolderDisplay();
|
||||
// later change to
|
||||
var value = document.createTextNode( sfile.unicodePath );
|
||||
folderDisplayElement.appendChild( value );
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
}
|
||||
function clearFolderDisplay()
|
||||
{
|
||||
var folderText = document.getElementById("ProfileDir");
|
||||
if ( folderText.hasChildNodes() ) {
|
||||
while ( folderText.hasChildNodes() )
|
||||
folderText.removeChild( folderText.firstChild );
|
||||
}
|
||||
}
|
||||
function setDisplayToDefaultFolder()
|
||||
{
|
||||
var profileName = document.getElementById( "ProfileName" );
|
||||
var profileDisplay = document.getElementById( "ProfileDir" );
|
||||
|
||||
var fileSpec;
|
||||
try {
|
||||
fileSpec = top.profile.defaultProfileParentDir;
|
||||
if ( fileSpec )
|
||||
fileSpec = fileSpec.QueryInterface( Components.interfaces.nsIFile );
|
||||
if ( fileSpec )
|
||||
profileDisplay.setAttribute("rootFolder", fileSpec.unicodePath );
|
||||
|
||||
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
|
||||
document.getElementById("useDefault").setAttribute("disabled", "true");
|
||||
|
||||
// reset the display field
|
||||
updateProfileName();
|
||||
}
|
||||
|
||||
function showLangDialog()
|
||||
{
|
||||
var selectedLanguage = document.getElementById("ProfileLanguage").getAttribute("data");
|
||||
var selectedRegion = document.getElementById("ProfileRegion").getAttribute("data");
|
||||
var selectLang = window.openDialog("chrome://communicator/content/profile/selectLang.xul","","modal=yes,titlebar,resizable=no", selectedLanguage, selectedRegion);
|
||||
}
|
||||
|
||||
// check to see if some user specified profile folder exists, otherwise use
|
||||
// default.
|
||||
function initPage2()
|
||||
{
|
||||
var displayField = document.getElementById( "ProfileDir" );
|
||||
if ( !displayField.value || !displayField.rootFolder )
|
||||
setDisplayToDefaultFolder();
|
||||
}
|
||||
|
|
|
@ -12,53 +12,32 @@
|
|||
]>
|
||||
|
||||
|
||||
<window title="&newprofile.title;" orient="horizontal" class="color-dialog"
|
||||
<window title="&newprofile.title;" orient="vertical"
|
||||
class="color-dialog"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="window.sizeToContent(); Startup('newProfile1_1','content');">
|
||||
onclose="onCancel();"
|
||||
onload="Startup('newProfile1_1','content');">
|
||||
|
||||
<stringbundle id="bundle_createProfileWizard"
|
||||
src="chrome://communicator/locale/profile/createProfileWizard.properties"/>
|
||||
<stringbundle id="bundle_profileManager"
|
||||
src="chrome://communicator/locale/profile/profileManager.properties"/>
|
||||
<stringbundle id="bundle_newProfile1_2"
|
||||
src="chrome://communicator/locale/profile/newProfile1_2.properties"/>
|
||||
|
||||
|
||||
<!-- XXX: strres.js is needed so that wizardManager.js will work -->
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/profile/createProfileWizard.js"/>
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="5"/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row align="center">
|
||||
<description value="&pnl2.pname.label;" accesskey="P" control="ProfileName"/>
|
||||
<textbox id="ProfileName" value="&pnl2.defaultPName.label;" onkeypress="updateProfileName();"/>
|
||||
<spacer/>
|
||||
</row>
|
||||
<row>
|
||||
<separator class="thin"/>
|
||||
<separator class="thin"/>
|
||||
<spacer/>
|
||||
</row>
|
||||
<row align="center">
|
||||
<hbox>
|
||||
<description>&pnl2.pdir.label;</description>
|
||||
<hbox id="dirbox">
|
||||
<description class="indent" id="ProfileDir" flex="1" style="overflow: auto;"/>
|
||||
<vbox valign="top">
|
||||
<button label="&button.choosefolder.label;" oncommand="chooseProfileFolder();"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<spacer/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<script type="application/x-javascript" src="chrome://global/content/wizardOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/wizardHandlerSet.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/wizardManager.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/widgetStateManager.js"/>
|
||||
|
||||
<data id="ProfileLanguage" />
|
||||
<data id="ProfileRegion" />
|
||||
<hbox class="box-header" id="header" title="&window.title.label;" description="&profileWizard.title;"/>
|
||||
<hbox class="wizard-box" flex="1">
|
||||
<html:iframe src="about:blank" style="width: 40em; height: 23em; overflow: auto;" name="content" id="content" flex="1"/>
|
||||
</hbox>
|
||||
<separator class="groove"/>
|
||||
<hbox id="wizardButtons"/>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -68,7 +68,16 @@ function SetFields( aElement, aValue, aDataObject )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// check to see if some user specified profile folder exists, otherwise use
|
||||
// default.
|
||||
function initFields()
|
||||
{
|
||||
var displayField = document.getElementById( "ProfileDir" );
|
||||
if ( !displayField.value || !displayField.rootFolder )
|
||||
setDisplayToDefaultFolder();
|
||||
|
||||
gNewProfile1_2Bundle = document.getElementById("bundle_newProfile1_2");
|
||||
}
|
||||
|
||||
// function createProfileWizard.js::chooseProfileFolder();
|
||||
// invoke a folder selection dialog for choosing the directory of profile storage.
|
||||
|
|
|
@ -8,18 +8,4 @@
|
|||
<!ENTITY dialup.title "Dialup">
|
||||
<!ENTITY mailnews.title "Mail News">
|
||||
<!ENTITY addrbook.title "Address Book">
|
||||
<!-- LOCALIZATION NOTE (pnl1.p1.text): Don't translate "&brandShortName" -->
|
||||
<!ENTITY pnl1.p1.text "&brandShortName; stores information about your settings, preferences, bookmarks, and mail in your personal profile.">
|
||||
<!ENTITY pnl1.p2.text "If you are sharing this copy of &brandShortName; with other users, you can use profiles to keep each user's information separate. To do this, each user should create his or her own profile.">
|
||||
<!ENTITY pnl1.p3.text "If you are the only person using this copy of &brandShortName;, you must have at least one profile. If you would like, you can create multiple profiles for yourself to store different sets of settings and preferences. For example, you may want to have separate profiles for business and personal use.">
|
||||
<!ENTITY pnl1.p4.text "To begin creating your profile, click Next.">
|
||||
<!ENTITY pnl2.intro.text "If you create several profiles you can tell them apart by the profile names. You may use the name provided here or use one of your own.">
|
||||
<!ENTITY pnl2.pname.label "Profile Name:">
|
||||
<!ENTITY pnl2.pdir.label "Profile Directory:">
|
||||
<!ENTITY pnl2.deffldr.label " the default folder.">
|
||||
<!ENTITY pnl2.finish.text "Click Finish to create this new profile.">
|
||||
<!ENTITY button.choosefolder.label "Choose Folder...">
|
||||
<!ENTITY button.usedefault.label "Use Default">
|
||||
<!ENTITY pnl2.defaultPName.label "Default User">
|
||||
|
||||
<!ENTITY langSelection.label "Region Selection...">
|
||||
|
|
Загрузка…
Ссылка в новой задаче