зеркало из https://github.com/mozilla/pjs.git
fix the create profile wizard ui.
this work was done by the almighty Ben Goodger <rgoodger@ihug.co.nz> r=sspitzer I did a little clean up, and made it so show the native file path
This commit is contained in:
Родитель
4629012b8e
Коммит
7ae0702f14
|
@ -62,7 +62,7 @@ interface nsIProfile : nsISupports {
|
|||
|
||||
void migrateProfileInfo();
|
||||
|
||||
void createNewProfile(in string data);
|
||||
void createNewProfile(in string profileName, in string nativeProfileDir);
|
||||
void renameProfile(in string oldName, in string newName);
|
||||
|
||||
void deleteProfile(in string name, in string canDeleteFiles);
|
||||
|
|
|
@ -3,7 +3,9 @@ createProfileWizard.xul
|
|||
deleteProfile.xul
|
||||
migrateAllProfile.xul
|
||||
newProfile1_1.xul
|
||||
newProfile1_1.js
|
||||
newProfile1_2.xul
|
||||
newProfile1_2.js
|
||||
profileManager.js
|
||||
profileManager.xul
|
||||
renameProfile.xul
|
||||
|
|
|
@ -33,6 +33,8 @@ FILES = \
|
|||
renameProfile.xul \
|
||||
newProfile1_1.xul \
|
||||
newProfile1_2.xul \
|
||||
newProfile1_1.js \
|
||||
newProfile1_2.js \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
|
||||
|
||||
// The WIZARD of GORE
|
||||
|
||||
var wizardMap = ["newProfile1_1.xul"];
|
||||
var content;
|
||||
var wizardHash = new Array;
|
||||
|
@ -15,15 +19,11 @@ var currentPageTag;
|
|||
var profName = "";
|
||||
var profDir = "";
|
||||
|
||||
function wizardPageLoaded(tag) {
|
||||
//dump("**********wizardPageLoaded\n");
|
||||
|
||||
if (firstTime) {
|
||||
function wizardPageLoaded(tag)
|
||||
{
|
||||
if (firstTime)
|
||||
Startup();
|
||||
}
|
||||
|
||||
currentPageTag = tag;
|
||||
//dump("currentPageTag: "+currentPageTag+"\n");
|
||||
SetButtons();
|
||||
populatePage();
|
||||
}
|
||||
|
@ -34,64 +34,47 @@ var finishButton = null;
|
|||
|
||||
function loadPage(thePage)
|
||||
{
|
||||
if (!firstTime) {
|
||||
if (!firstTime)
|
||||
saveData();
|
||||
}
|
||||
|
||||
//dump("**********loadPage\n");
|
||||
//dump("thePage: "+thePage+"\n");
|
||||
displayPage(thePage);
|
||||
|
||||
firstTime = false;
|
||||
return(true);
|
||||
}
|
||||
|
||||
function SetButtons()
|
||||
{
|
||||
if (!currentPageTag) return;
|
||||
|
||||
if (!backButton) {
|
||||
if (!currentPageTag)
|
||||
return;
|
||||
if (!backButton)
|
||||
backButton = document.getElementById("back");
|
||||
}
|
||||
if (!nextButton) {
|
||||
if (!nextButton)
|
||||
nextButton = document.getElementById("next");
|
||||
}
|
||||
if (!finishButton) {
|
||||
finishButton = document.getElementById("finish");
|
||||
}
|
||||
|
||||
//dump("currentPageTag == " + currentPageTag + "\n");
|
||||
nextTag = testMap[currentPageTag].next;
|
||||
//dump("nextTag == " + nextTag + "\n");
|
||||
if (nextTag) {
|
||||
//dump("next on, finish off\n");
|
||||
nextButton.setAttribute("disabled", "false");
|
||||
finishButton.setAttribute("disabled", "true");
|
||||
var nextLabel = bundle.GetStringFromName("nextButtonLabel");
|
||||
nextButton.setAttribute("value",nextLabel);
|
||||
nextButton.setAttribute("onclick","onNext()");
|
||||
}
|
||||
else {
|
||||
//dump("next off, finish on\n");
|
||||
nextButton.setAttribute("disabled", "true");
|
||||
finishButton.setAttribute("disabled", "false");
|
||||
var finishLabel = bundle.GetStringFromName("finishButtonLabel");
|
||||
nextButton.setAttribute("value",finishLabel);
|
||||
nextButton.setAttribute("onclick","Finish(opener)");
|
||||
}
|
||||
|
||||
prevTag = testMap[currentPageTag].previous;
|
||||
//dump("prevTag == " + prevTag + "\n");
|
||||
if (prevTag) {
|
||||
//dump("back on\n");
|
||||
if (prevTag)
|
||||
backButton.setAttribute("disabled", "false");
|
||||
}
|
||||
else {
|
||||
//dump("back off\n");
|
||||
else
|
||||
backButton.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
|
||||
function onNext()
|
||||
{
|
||||
//dump("in onnext\n");
|
||||
if (nextButton.getAttribute("disabled") == "true") {
|
||||
return;
|
||||
}
|
||||
|
||||
saveData();
|
||||
var nextPageTag = testMap[currentPageTag].next;
|
||||
var url = getUrlFromTag(nextPageTag);
|
||||
|
@ -100,9 +83,9 @@ function onNext()
|
|||
|
||||
function onBack()
|
||||
{
|
||||
if (backButton.getAttribute("disabled") == "true") {
|
||||
//dump("in onback\n");
|
||||
if (backButton.getAttribute("disabled") == "true")
|
||||
return;
|
||||
}
|
||||
|
||||
saveData();
|
||||
previousPageTag = testMap[currentPageTag].previous;
|
||||
|
@ -112,67 +95,46 @@ function onBack()
|
|||
|
||||
function displayPage(content)
|
||||
{
|
||||
//dump(content + "\n");
|
||||
//dump("********INSIDE DISPLAYPAGE\n\n");
|
||||
|
||||
if (content != "")
|
||||
{
|
||||
var contentFrame = document.getElementById("content");
|
||||
if (contentFrame)
|
||||
{
|
||||
contentFrame.setAttribute("src", content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function populatePage()
|
||||
{
|
||||
//dump("************initializePage\n");
|
||||
var contentWindow = window.frames["content"];
|
||||
var doc = contentWindow.document;
|
||||
|
||||
for (var i in wizardHash) {
|
||||
var formElement=doc.getElementById(i);
|
||||
//dump("formElement: "+formElement+"\n");
|
||||
|
||||
if (formElement) {
|
||||
formElement.value = wizardHash[i];
|
||||
//dump("wizardHash["+"i]: "+wizardHash[i]+"\n");
|
||||
}
|
||||
}
|
||||
for (var i in wizardHash)
|
||||
{
|
||||
var element = doc.getElementById(i);
|
||||
if (element)
|
||||
contentWindow.SetFields(element,wizardHash[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function saveData()
|
||||
{
|
||||
//dump("************ SAVE DATA\n");
|
||||
|
||||
var contentWindow = window.frames["content"];
|
||||
var doc = contentWindow.document;
|
||||
|
||||
var inputs = doc.getElementsByTagName("FORM")[0].elements;
|
||||
|
||||
//dump("There are " + inputs.length + " input tags\n");
|
||||
for (var i=0 ; i<inputs.length; i++) {
|
||||
//dump("Saving: ");
|
||||
//dump("ID=" + inputs[i].id + " Value=" + inputs[i].value + "..");
|
||||
wizardHash[inputs[i].id] = inputs[i].value;
|
||||
}
|
||||
//dump("done.\n");
|
||||
var data = contentWindow.GetFields();
|
||||
if(data != undefined) {
|
||||
for(var i = 0; i < data.length; i++)
|
||||
wizardHash[data[i][0]] = data[i][1];
|
||||
}
|
||||
}
|
||||
|
||||
function onCancel()
|
||||
{
|
||||
//dump("************** ON CANCEL\n");
|
||||
saveData();
|
||||
var i;
|
||||
for (i in wizardHash) {
|
||||
//dump("element: "+i+"\n");
|
||||
//dump("value: "+wizardHash[i]+"\n");
|
||||
}
|
||||
// we came from the profile manager window...
|
||||
if (top.window.opener)
|
||||
window.close();
|
||||
else
|
||||
ExitApp()
|
||||
}
|
||||
|
||||
|
||||
// utility functions
|
||||
function getUrlFromTag(title)
|
||||
{
|
||||
|
@ -186,16 +148,12 @@ function Startup()
|
|||
|
||||
function Finish(opener)
|
||||
{
|
||||
if (finishButton.getAttribute("disabled") == "true") {
|
||||
return;
|
||||
}
|
||||
|
||||
//dump("******FINISH ROUTINE\n");
|
||||
|
||||
// lets check if we're at final stage using null
|
||||
if(testMap[currentPageTag].next)
|
||||
return null;
|
||||
try {
|
||||
saveData();
|
||||
processCreateProfileData();
|
||||
|
||||
if (opener) {
|
||||
opener.CreateProfile();
|
||||
}
|
||||
|
@ -208,34 +166,22 @@ function Finish(opener)
|
|||
function processCreateProfileData()
|
||||
{
|
||||
//Process Create Profile Data
|
||||
|
||||
//dump("******processCreateProfileData ROUTINE\n");
|
||||
|
||||
var i;
|
||||
var data = "";
|
||||
|
||||
for (i in wizardHash) {
|
||||
//dump("element: "+i+"\n");
|
||||
//dump("value: "+wizardHash[i]+"\n");
|
||||
|
||||
if (i == "ProfileName") {
|
||||
profName = wizardHash[i];
|
||||
data = data+i+"="+profName+"%";
|
||||
}
|
||||
|
||||
if (i == "ProfileDir") {
|
||||
profDir = wizardHash[i];
|
||||
data = data+i+"="+profDir+"%";
|
||||
}
|
||||
if (i == "ProfileName") {
|
||||
profName = wizardHash[i];
|
||||
}
|
||||
if (i == "ProfileDir") {
|
||||
profDir = wizardHash[i];
|
||||
}
|
||||
}
|
||||
|
||||
//dump("data: "+data+"\n");
|
||||
var profile = Components.classes["component://netscape/profile/manager"].createInstance();
|
||||
profile = profile.QueryInterface(Components.interfaces.nsIProfile);
|
||||
//dump("profile = " + profile + "\n");
|
||||
//dump("********DATA: "+data+"\n\n");
|
||||
try {
|
||||
profile.createNewProfile(data);
|
||||
//dump("name,dir = " + profName + "," + profDir + "\n");
|
||||
profile.createNewProfile(profName, profDir);
|
||||
profile.startCommunicator(profName);
|
||||
}
|
||||
catch (ex) {
|
||||
|
@ -247,19 +193,10 @@ function processCreateProfileData()
|
|||
|
||||
function ExitApp()
|
||||
{
|
||||
// Need to call this to stop the event loop
|
||||
var appShell = Components.classes['component://netscape/appshell/appShellService'].getService();
|
||||
appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService);
|
||||
appShell.Quit();
|
||||
// Need to call this to stop the event loop
|
||||
var appShell = Components.classes['component://netscape/appshell/appShellService'].getService();
|
||||
appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService);
|
||||
appShell.Quit();
|
||||
}
|
||||
|
||||
function onCancel()
|
||||
{
|
||||
if (top.window.opener) {
|
||||
// we came from the profile manager window...
|
||||
window.close();
|
||||
}
|
||||
else {
|
||||
ExitApp()
|
||||
}
|
||||
}
|
||||
var bundle = srGetStrBundle("chrome://profile/locale/createProfileWizard.properties");
|
||||
|
|
|
@ -1,35 +1,42 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://profile/skin/createProfileWizard.css" type="text/css"?>
|
||||
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://profile/locale/createProfileWizard.dtd">
|
||||
|
||||
<window title="&window.title.label;" style="width: 100%; height: 100%" align="vertical"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="loadPage('newProfile1_1.xul')"
|
||||
width="500" height="400">
|
||||
|
||||
<html:script src="createProfileWizard.js" />
|
||||
|
||||
<tabcontrol align="vertical">
|
||||
<tabbox align="horizontal">
|
||||
<tab onclick="loadPage('newProfile1_1.xul');">&newprofile.title;</tab>
|
||||
</tabbox>
|
||||
|
||||
<tabpanel />
|
||||
</tabcontrol>
|
||||
|
||||
<html:iframe src="about:blank" flex="100%" name="content" id="content" scrolling="auto"/>
|
||||
|
||||
<box align="horizontal">
|
||||
<titledbutton id="back" value="&back.label;" onclick="onBack()" align="left" disabled="true" style="margin-top: 1em;"/>
|
||||
<titledbutton id="next" value="&next.label;" onclick="onNext()" align="left" style="margin-top: 1em;"/>
|
||||
<titledbutton id="cancel" value="&cancel.label;" onclick="onCancel()" align="left" style=" margin-top: 1em;"/>
|
||||
<titledbutton id="finish" value="&finish.label;" onclick="Finish(opener)" disabled="true" align="left" style=" margin-top: 1em;"/>
|
||||
|
||||
</box>
|
||||
|
||||
|
||||
</window>
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://profile/skin/createProfileWizard.css" type="text/css"?>
|
||||
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://profile/locale/createProfileWizard.dtd">
|
||||
|
||||
<window title="&window.title.label;" style="width: 100%; height: 100%" align="vertical"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="loadPage('newProfile1_1.xul')">
|
||||
|
||||
<html:script language="javascript" src="chrome://global/content/strres.js" />
|
||||
<html:script src="createProfileWizard.js" />
|
||||
|
||||
<box id="header" align="vertical">
|
||||
<box align="vertical">
|
||||
<html:div id="cplabel">&createprofile.heading;</html:div>
|
||||
<html:div id="cpsubl">&createprofile.subheading;</html:div>
|
||||
</box>
|
||||
<tabcontrol align="vertical">
|
||||
<tabbox align="horizontal">
|
||||
<tab class="selected">&newprofile.title;</tab>
|
||||
<!-- <tab class="nonselected" onclick="loadPage('mailnews.xul');">&mailnewssettings.title;</tab>-->
|
||||
</tabbox>
|
||||
</tabcontrol>
|
||||
</box>
|
||||
|
||||
<box id="contentsink" flex="100%">
|
||||
<html:iframe src="about:blank" style="width: 100%;" name="content" id="content" scrolling="auto" flex="100%"/>
|
||||
</box>
|
||||
<box align="horizontal" style="width: 450px;">
|
||||
<spring flex="100%"/>
|
||||
<titledbutton id="cancel" value="&cancel.label;" onclick="ExitApp()" align="left" style=" margin-top: 1em;"/>
|
||||
<spring flex="20%"/>
|
||||
<titledbutton id="back" value="&back.label;" onclick="onBack()" align="left" style="margin-top: 1em;"/>
|
||||
<titledbutton id="next" value="&next.label;" onclick="onNext()" align="left" style="margin-top: 1em;"/>
|
||||
<spring flex="5%"/>
|
||||
</box>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -26,7 +26,9 @@ FILES=\
|
|||
deleteProfile.xul \
|
||||
migrateAllProfile.xul \
|
||||
newProfile1_1.xul \
|
||||
newProfile1_1.js \
|
||||
newProfile1_2.xul \
|
||||
newProfile1_2.js \
|
||||
profileManager.js \
|
||||
profileManager.xul \
|
||||
renameProfile.xul \
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Netscape are
|
||||
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger (30/09/99)
|
||||
*/
|
||||
|
||||
// although these functions aren't used on this intro page, they're actually
|
||||
// essential for the wizard progress. They do nothing and simply exist so that
|
||||
// they are defined so that the wizard can call them.
|
||||
|
||||
// the getting procedure is unique to each page, since each page can different
|
||||
// types of elements (not necessarily form elements). So each page must provide
|
||||
// its own GetFields function
|
||||
function GetFields() { }
|
||||
|
||||
// the setting procedure is unique to each page, and as such each page
|
||||
// must provide its own SetFields function
|
||||
function SetFields(element,value) { }
|
|
@ -1,46 +1,46 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "NPL"); you may not use this file except in
|
||||
compliance with the NPL. You may obtain a copy of the NPL at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
for the specific language governing rights and limitations under the
|
||||
NPL.
|
||||
|
||||
The Initial Developer of this code under the NPL is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
Reserved.
|
||||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://profile/skin/profileManager.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_1.dtd" >
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog"
|
||||
width="500" height="500"
|
||||
onload="parent.wizardPageLoaded('newProfile1_1');">
|
||||
|
||||
<html:div flex="100%" style="width: 100%; height: 100%;">
|
||||
<html:div style="width: 300px;">&heading;</html:div>
|
||||
<html:br/>
|
||||
|
||||
<html:div>&title;</html:div>
|
||||
<html:div>¶.one;</html:div>
|
||||
<html:br/>
|
||||
|
||||
<html:div>¶.two;</html:div>
|
||||
<html:br/>
|
||||
|
||||
<html:div>¶.three;</html:div>
|
||||
<html:br/>
|
||||
<html:div>¶.four;</html:div>
|
||||
</html:div>
|
||||
|
||||
</window>
|
||||
<?xml version="1.0"?>
|
||||
<!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "NPL"); you may not use this file except in
|
||||
compliance with the NPL. You may obtain a copy of the NPL at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
for the specific language governing rights and limitations under the
|
||||
NPL.
|
||||
|
||||
The Initial Developer of this code under the NPL is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
Reserved.
|
||||
|
||||
-->
|
||||
|
||||
<!-- this is PAGE ONE of the Profile Creation Wizard -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://profile/skin/pwiz_panels.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_1.dtd" >
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog"
|
||||
onload="parent.wizardPageLoaded('newProfile1_1');">
|
||||
|
||||
<html:script language="JavaScript" src="newProfile1_1.js"/>
|
||||
|
||||
<box flex="100%" align="vertical">
|
||||
<html:div>&pnl1.p1.text;</html:div>
|
||||
<spring flex="50%"/>
|
||||
<html:div>&pnl1.p2.text;</html:div>
|
||||
<spring flex="50%"/>
|
||||
<html:div>&pnl1.p3.text;</html:div>
|
||||
<spring flex="50%"/>
|
||||
<html:div>&pnl1.p4.text;</html:div>
|
||||
<spring flex="50%"/>
|
||||
</box>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Netscape are
|
||||
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger (30/09/99)
|
||||
*/
|
||||
|
||||
// note: offloading this into a separate JS file where it should be.
|
||||
// also got rid of seemingly useless function "foo". If it is needed, please
|
||||
// feel free to reimplement ;)
|
||||
|
||||
var bundle = srGetStrBundle("chrome://profile/locale/newProfile1_2.properties");
|
||||
var detect = false;
|
||||
|
||||
function InitializeValues()
|
||||
{
|
||||
element = document.getElementById("ProfileName");
|
||||
element.value = parent.profName;
|
||||
|
||||
element = document.getElementById("ProfileDir");
|
||||
element.value = parent.profDir;
|
||||
}
|
||||
|
||||
function commit()
|
||||
{
|
||||
var element;
|
||||
element = document.getElementById("ProfileName");
|
||||
parent.SetValue(element.id, element.value);
|
||||
parent.profName = element.value;
|
||||
|
||||
element = document.getElementById("ProfileDir");
|
||||
parent.SetValue(element.id, element.value);
|
||||
parent.profDir = element.value;
|
||||
}
|
||||
|
||||
// the getting procedure is unique to each page, since each page can different
|
||||
// types of elements (not necessarily form elements). So each page must provide
|
||||
// its own GetFields function
|
||||
function GetFields()
|
||||
{
|
||||
var profName = document.getElementById("ProfileName").value;
|
||||
var profDir = document.getElementById("ProfileDir");
|
||||
for(var i = 0; i < profDir.attributes.length; i++)
|
||||
{
|
||||
// this is just an awful, bad, terrible hack. I shouldn't have to do this
|
||||
// to get the value. but all other ways return "undefined".
|
||||
if(profDir.attributes[i].nodeName == "value")
|
||||
profDirContent = profDir.attributes[i].nodeValue;
|
||||
}
|
||||
return [["ProfileName",profName],["ProfileDir",profDirContent]];
|
||||
}
|
||||
|
||||
// the setting procedure is unique to each page, and as such each page
|
||||
// must provide its own SetFields function
|
||||
function SetFields(element,set)
|
||||
{
|
||||
//dump("In SetFields(" + element + "," + set + ");\n");
|
||||
if(element.id == "ProfileDir" && set != "")
|
||||
getProfileDir(set,false);
|
||||
else if(element.id == "ProfileName")
|
||||
element.value = set;
|
||||
}
|
||||
|
||||
// function createProfileWizard.js::chooseFolder();
|
||||
// utility function responsible for displaying a folder selection dialog.
|
||||
function chooseFolder(string)
|
||||
{
|
||||
try {
|
||||
var fileSpec = Components.classes["component://netscape/filespecwithui"].createInstance();
|
||||
if(fileSpec) {
|
||||
fileSpec = fileSpec.QueryInterface(Components.interfaces.nsIFileSpecWithUI);
|
||||
return fileSpec.chooseDirectory(string);
|
||||
} else
|
||||
return false;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function removeChildren(which)
|
||||
{
|
||||
if(which.hasChildNodes()) {
|
||||
for(var i = 0; i < which.childNodes.length; i++)
|
||||
{
|
||||
which.removeChild(which.lastChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// function createProfileWizard.js::getProfileDir();
|
||||
// invoke a folder selection dialog for choosing the directory of profile storage.
|
||||
function getProfileDir(folder, showPopup)
|
||||
{
|
||||
if(showPopup)
|
||||
folder = chooseFolder("Choose Profile Directory");
|
||||
//dump("folder = " + folder + "\n");
|
||||
if(folder != undefined && folder ) {
|
||||
var folderText = document.getElementById("ProfileDir");
|
||||
oldText = document.getElementById("deffoldername");
|
||||
removeChildren(oldText);
|
||||
// covert the file URL to a native file path.
|
||||
// only need to do this if we called chooseFolder()
|
||||
// otherwise, it's already a native file path.
|
||||
// this can happen when the user goes back and next after
|
||||
// selecting a folder
|
||||
if (showPopup) {
|
||||
try {
|
||||
var spec = Components.classes["component://netscape/filespec"].createInstance();
|
||||
spec = spec.QueryInterface(Components.interfaces.nsIFileSpec);
|
||||
spec.URLString = folder;
|
||||
folder = spec.nativePath;
|
||||
}
|
||||
catch (ex) {
|
||||
dump("failed to convert URL to native path\n");
|
||||
}
|
||||
}
|
||||
folderText.setAttribute("value",folder);
|
||||
if(!detect) {
|
||||
var useDefault = document.createElement("titledbutton");
|
||||
useDefault.setAttribute("value",bundle.GetStringFromName("useDefaultFolder"));
|
||||
useDefault.setAttribute("id","useDefaultButton");
|
||||
useDefault.setAttribute("onclick","UseDefaultFolder();");
|
||||
document.getElementById("folderbuttons").appendChild(useDefault);
|
||||
detect = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function UseDefaultFolder()
|
||||
{
|
||||
var ProfileDir = document.getElementById("ProfileDir");
|
||||
ProfileDir.setAttribute("value","");
|
||||
var FolderButtons = document.getElementById("folderbuttons");
|
||||
if(FolderButtons.childNodes.length > 1)
|
||||
FolderButtons.removeChild(FolderButtons.lastChild);
|
||||
var span = document.getElementById("deffoldername")
|
||||
var text = document.createTextNode(bundle.GetStringFromName("defaultString"));
|
||||
span.appendChild(text);
|
||||
detect = false;
|
||||
}
|
|
@ -1,79 +1,64 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "NPL"); you may not use this file except in
|
||||
compliance with the NPL. You may obtain a copy of the NPL at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
for the specific language governing rights and limitations under the
|
||||
NPL.
|
||||
|
||||
The Initial Developer of this code under the NPL is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
Reserved.
|
||||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://profile/skin/profileManager.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_2.dtd" >
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog"
|
||||
width="500" height="500"
|
||||
onload="parent.wizardPageLoaded('newProfile1_2');">
|
||||
|
||||
<html:script>
|
||||
function foo()
|
||||
{
|
||||
// what the hell is this?
|
||||
}
|
||||
|
||||
function InitializeValues()
|
||||
{
|
||||
element = document.getElementById("ProfileName");
|
||||
element.value = parent.profName;
|
||||
|
||||
element = document.getElementById("ProfileDir");
|
||||
element.value = parent.profDir;
|
||||
}
|
||||
|
||||
function commit()
|
||||
{
|
||||
var element;
|
||||
|
||||
element = document.getElementById("ProfileName");
|
||||
parent.SetValue(element.id, element.value);
|
||||
parent.profName = element.value;
|
||||
|
||||
element = document.getElementById("ProfileDir");
|
||||
data += "ProfileDir="+element.value+"%";
|
||||
parent.SetValue(element.id, element.value);
|
||||
parent.profDir = element.value;
|
||||
}
|
||||
|
||||
setTimeout("foo()", 0);
|
||||
</html:script>
|
||||
|
||||
<html:div flex="100%" style="width: 100%; height: 100%;">
|
||||
|
||||
<html:div>&intro;</html:div>
|
||||
<html:br/>
|
||||
<html:div>&profile.name;</html:div>
|
||||
<html:input type="text" id="ProfileName" value="mozProfile" size="30"/>
|
||||
<html:br/>
|
||||
<html:br/>
|
||||
|
||||
<html:div>&profile.dir;</html:div>
|
||||
<html:input type="text" id="ProfileDir" size="30"/>
|
||||
|
||||
<html:br/>
|
||||
<html:br/>
|
||||
<html:div>¶</html:div>
|
||||
</html:div>
|
||||
|
||||
</window>
|
||||
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the Netscape Public License
|
||||
Version 1.0 (the "NPL"); you may not use this file except in
|
||||
compliance with the NPL. You may obtain a copy of the NPL at
|
||||
http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
for the specific language governing rights and limitations under the
|
||||
NPL.
|
||||
|
||||
The Initial Developer of this code under the NPL is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
Reserved.
|
||||
|
||||
-->
|
||||
|
||||
<!-- this is PAGE TWO of the Profile Creation Wizard -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://profile/skin/pwiz_panels.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_2.dtd" >
|
||||
<window
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog"
|
||||
width="500" height="500"
|
||||
onload="parent.wizardPageLoaded('newProfile1_2');">
|
||||
|
||||
<html:script language="javascript" src="chrome://global/content/strres.js" />
|
||||
<html:script language="JavaScript" src="newProfile1_2.js"/>
|
||||
|
||||
<box flex="100%" align="vertical">
|
||||
<html:div>&pnl2.intro.text;</html:div>
|
||||
<spring flex="50%"/>
|
||||
<html:div>&pnl2.pname.label;</html:div>
|
||||
<html:div class="input1">
|
||||
<html:input type="text" id="ProfileName" value="mozProfile" style="width: 95%"/>
|
||||
<spring flex="5%"/>
|
||||
</html:div>
|
||||
<html:div style="padding-bottom: 0px;">
|
||||
&pnl2.pdir.label;
|
||||
<html:span id="deffoldername">&pnl2.deffldr.label;</html:span>
|
||||
</html:div>
|
||||
<box align="horizontal" id="dirbox">
|
||||
<html:div class="dirLabel" flex="100%">
|
||||
<!-- replace this button with an input field when they start responding
|
||||
to css styles properly as the cropping is a problem. -->
|
||||
<titledbutton id="ProfileDir" value="" crop="right"/>
|
||||
</html:div>
|
||||
<spring flex="100%"/>
|
||||
<box align="vertical" id="folderbuttons">
|
||||
<titledbutton value="&button.choosefolder.label;" onclick="getProfileDir(null,true);"/>
|
||||
</box>
|
||||
<spring flex="5%"/>
|
||||
</box>
|
||||
<html:div>&pnl2.finish.text;</html:div>
|
||||
<spring flex="50%"/>
|
||||
</box>
|
||||
|
||||
</window>
|
|
@ -5,3 +5,5 @@ profileManager.dtd
|
|||
profileManagerDelete.dtd
|
||||
profileManagerMigrateAll.dtd
|
||||
profileManagerRename.dtd
|
||||
createProfileWizard.properties
|
||||
newProfile1_2.properties
|
||||
|
|
|
@ -31,6 +31,8 @@ FILES = \
|
|||
profileManagerDelete.dtd \
|
||||
profileManagerMigrateAll.dtd \
|
||||
profileManagerRename.dtd \
|
||||
createProfileWizard.properties \
|
||||
newProfile1_2.properties \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<!-- extracted from cpw.xul -->
|
||||
|
||||
<!ENTITY window.title.label "Communicator Profile Manager">
|
||||
<!ENTITY newprofile.title "New Profile">
|
||||
<!ENTITY dialup.title "Dialup">
|
||||
<!ENTITY mailnews.title "Mail News">
|
||||
<!ENTITY addrbook.title "Address Book">
|
||||
<!ENTITY window.title.label "Mozilla Profile Manager">
|
||||
<!ENTITY newprofile.title "Create New Profile">
|
||||
<!ENTITY dialup.title "Dialup">
|
||||
<!ENTITY mailnews.title "Mail News">
|
||||
<!ENTITY addrbook.title "Address Book">
|
||||
<!ENTITY back.label "Back">
|
||||
<!ENTITY next.label "Next">
|
||||
<!ENTITY cancel.label "Cancel">
|
||||
<!ENTITY finish.label "Finish">
|
||||
<!ENTITY createprofile.heading "Create New Profile">
|
||||
<!ENTITY createprofile.subheading "MOZILLA PROFILE MANAGER">
|
|
@ -0,0 +1,2 @@
|
|||
finishButtonLabel=Finish
|
||||
nextButtonLabel=Next
|
|
@ -28,6 +28,8 @@ FILES=\
|
|||
profileManagerDelete.dtd \
|
||||
profileManagerMigrateAll.dtd \
|
||||
profileManagerRename.dtd \
|
||||
createProfileWizard.properties \
|
||||
newProfile1_2.properties \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<!-- extracted from test-content1_1.xul -->
|
||||
|
||||
<!ENTITY heading "Communicator Profile Manager">
|
||||
<!ENTITY title "Creating a New Profile">
|
||||
<!ENTITY para.one "Communicator stores information about your settings, preferences, bookmarks, and stored messages in your personal profile.">
|
||||
<!ENTITY para.two "If you are sharing this copy of Communicator 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 and optionally protect it with a password.">
|
||||
<!ENTITY para.three "If you are the only person using this copy of Communicator, you must create at least one profile. If you would like, you can create multiple profiles for yourself to store different sets of setting and preferences. For example, you may want to have separate profiles for business and personal use.">
|
||||
<!ENTITY para.four "To begin creating your profile, click Next.">
|
||||
<!ENTITY pnl1.p1.text "Mozilla stores information about your settings, preferences, bookmarks, and stored messages in your personal profile.">
|
||||
<!ENTITY pnl1.p2.text "If you are sharing this copy of Mozilla 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 and optionally protect it with a password.">
|
||||
<!ENTITY pnl1.p3.text "If you are the only person using this copy of Mozilla, you must have at least one profile. If you would like, you can create multiple profiles for yourself to store different sets of setting 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.">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<!-- extracted from test-content1_2.xul -->
|
||||
<!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 "Enter New Profile name:">
|
||||
<!ENTITY pnl2.pdir.label "Your user settings, preferences, bookmarks and mail will be stored in ">
|
||||
<!ENTITY pnl2.deffldr.label " the default folder.">
|
||||
<!ENTITY pnl2.finish.text "Click Finish to create this new profile.">
|
||||
|
||||
<!ENTITY intro "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 profile.name "Enter New Profile name.">
|
||||
<!ENTITY profile.dir "Your user settings, preferences, bookmarks and stored messages will be stored in the directory below. We recommend that you use the default directory (by leaving the box blank).">
|
||||
<!ENTITY para "Click Finish to create this new profile.">
|
||||
<!ENTITY button.choosefolder.label "Change Folder...">
|
|
@ -0,0 +1,2 @@
|
|||
useDefaultFolder=Use Default Folder
|
||||
defaultString= the default folder.
|
|
@ -1,3 +1,5 @@
|
|||
createProfileWizard.css
|
||||
profile.css
|
||||
profileManager.css
|
||||
pwiz_panels.css
|
||||
header.gif
|
||||
|
|
|
@ -24,9 +24,11 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
|
||||
FILES = \
|
||||
profile.css \
|
||||
createProfileWizard.css \
|
||||
profile.css \
|
||||
createProfileWizard.css \
|
||||
profileManager.css \
|
||||
pwiz_panels.css \
|
||||
header.gif \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -7,7 +7,7 @@ window {
|
|||
iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0px;
|
||||
border: 1px outset #CCCCDD;
|
||||
}
|
||||
|
||||
box {
|
||||
|
@ -16,20 +16,62 @@ box {
|
|||
display: block;
|
||||
}
|
||||
|
||||
box#header {
|
||||
background-color : #FFFFFF;
|
||||
background : url('chrome://profile/skin/header.gif');
|
||||
background-repeat : no-repeat;
|
||||
background-position : top left;
|
||||
padding-top : 11px;
|
||||
}
|
||||
|
||||
tab.selected {
|
||||
background-color : #CCCCDD;
|
||||
margin : 0px 0px 0px 2px;
|
||||
padding-left : 5px;
|
||||
padding-right : 4px;
|
||||
}
|
||||
|
||||
tab.nonselected {
|
||||
background-color : transparent;
|
||||
color : #D4C8B8;
|
||||
margin : 0px 0px 0px 2px;
|
||||
padding-left : 5px;
|
||||
padding-right : 4px;
|
||||
}
|
||||
|
||||
titledbutton.active {
|
||||
color: yellow;
|
||||
border: 0px;
|
||||
margin: 1px;
|
||||
padding: 3px 2px 0px 1px
|
||||
border : 0px;
|
||||
margin : 2px;
|
||||
padding : 3px 13px 0px 11px
|
||||
}
|
||||
|
||||
titledbutton[disabled] {
|
||||
color: black;
|
||||
color : black;
|
||||
}
|
||||
|
||||
titledbutton {
|
||||
color: black;
|
||||
margin: 1px;
|
||||
padding: 2px 1px 1px 2px
|
||||
color : black;
|
||||
width : 35px;
|
||||
margin : 2px;
|
||||
padding : 2px 12px 1px 12px
|
||||
}
|
||||
|
||||
div#cplabel {
|
||||
font-family : serif;
|
||||
font-size : 26px;
|
||||
color : #61400A;
|
||||
font-weight : bold;
|
||||
letter-spacing : 1px;
|
||||
margin-left : 20px;
|
||||
margin-bottom : -7px;
|
||||
}
|
||||
|
||||
div#cpsubl {
|
||||
font-family : serif;
|
||||
font-size : 14px;
|
||||
color : #AFA081;
|
||||
font-weight : bold;
|
||||
letter-spacing : 1px;
|
||||
margin-left : 80px;
|
||||
margin-bottom : 15px;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ FILES=\
|
|||
profile.css \
|
||||
createProfileWizard.css \
|
||||
profileManager.css \
|
||||
pwiz_panels.css \
|
||||
header.gif \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
window {
|
||||
display : block;
|
||||
width : 100%;
|
||||
}
|
||||
|
||||
box {
|
||||
width : 100%;
|
||||
height : 100%;
|
||||
display : block;
|
||||
}
|
||||
|
||||
box.picker {
|
||||
margin-left : 10px;
|
||||
margin-top : 10px;
|
||||
margin-bottom : 5px;
|
||||
margin-right : 20px;
|
||||
}
|
||||
|
||||
div {
|
||||
cursor : default;
|
||||
padding : 10px;
|
||||
}
|
||||
|
||||
div.dirLabel {
|
||||
margin-left : 15px;
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
div.input1 {
|
||||
margin-left : 5px;
|
||||
margin-top : 0px;
|
||||
padding : 0px;
|
||||
}
|
||||
|
||||
titledbutton.active {
|
||||
border : 0px;
|
||||
margin : 2px;
|
||||
padding : 3px 13px 0px 11px
|
||||
}
|
||||
|
||||
titledbutton[disabled] {
|
||||
color : black;
|
||||
}
|
||||
|
||||
titledbutton#ProfileDir {
|
||||
border : none;
|
||||
color : black;
|
||||
font-weight : bold;
|
||||
padding : none;
|
||||
margin : none;
|
||||
text-decoration : none;
|
||||
}
|
||||
|
||||
titledbutton {
|
||||
color : black;
|
||||
margin : 2px;
|
||||
padding : 2px 12px 1px 12px
|
||||
}
|
||||
|
||||
box#folderbuttons {
|
||||
margin-top : 10px;
|
||||
margin-bottom : -10px;
|
||||
margin-right : 7px;
|
||||
}
|
||||
|
||||
box#folderbuttons titledbutton {
|
||||
width : 90px;
|
||||
}
|
||||
|
||||
box#dirbox {
|
||||
height : 50px;
|
||||
}
|
||||
|
||||
span#deffoldername {
|
||||
margin-left : 2px;
|
||||
}
|
|
@ -1033,14 +1033,14 @@ NS_IMETHODIMP nsProfile::SetProfileDir(const char *profileName, nsFileSpec& prof
|
|||
|
||||
|
||||
// Creates a new profile
|
||||
NS_IMETHODIMP nsProfile::CreateNewProfile(const char* charData)
|
||||
NS_IMETHODIMP nsProfile::CreateNewProfile(const char* profileName, const char* nativeProfileDir)
|
||||
{
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#if defined(DEBUG_profile)
|
||||
printf("ProfileManager : CreateNewProfile\n");
|
||||
printf("ProfileManagerData*** : %s\n", charData);
|
||||
printf("Profile Name: %s\n", profileName);
|
||||
printf("Profile Dir: %s\n", (!nativeProfileDir || !*nativeProfileDir)?"(use default)":nativeProfileDir);
|
||||
#endif
|
||||
|
||||
NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);
|
||||
|
@ -1048,38 +1048,29 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(const char* charData)
|
|||
if (NS_FAILED(rv) || !locator)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsString data(charData);
|
||||
|
||||
// Set the gathered info into an array
|
||||
SetDataArray(data);
|
||||
|
||||
char* dirName = GetValue("ProfileDir");
|
||||
char* unescapedProfileName = GetValue("ProfileName");
|
||||
|
||||
if (!unescapedProfileName || !*unescapedProfileName)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (!profileName) return NS_ERROR_FAILURE;
|
||||
|
||||
// Escape profile name to create a valid direrctory,
|
||||
// if directory value is not provided
|
||||
char* profileName = nsEscape(unescapedProfileName, url_Path); // temp hack
|
||||
|
||||
nsFileSpec dirSpec(dirName);
|
||||
|
||||
if (!dirName || !*dirName)
|
||||
nsFileSpec dirSpec;
|
||||
|
||||
if (!nativeProfileDir || !*nativeProfileDir)
|
||||
{
|
||||
// They didn't type a directory path...
|
||||
// Get current profile, make the new one a sibling...
|
||||
nsCOMPtr <nsIFileSpec> horribleCOMDirSpecThing;
|
||||
rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, getter_AddRefs(horribleCOMDirSpecThing));
|
||||
nsCOMPtr <nsIFileSpec> defaultRoot;
|
||||
rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, getter_AddRefs(defaultRoot));
|
||||
|
||||
if (NS_FAILED(rv) || !horribleCOMDirSpecThing)
|
||||
if (NS_FAILED(rv) || !defaultRoot)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
//Append profile name to form a directory name
|
||||
horribleCOMDirSpecThing->GetFileSpec(&dirSpec);
|
||||
//dirSpec.SetLeafName(profileName);
|
||||
//dirSpec += profileName;
|
||||
defaultRoot->GetFileSpec(&dirSpec);
|
||||
if (!dirSpec.Exists())
|
||||
dirSpec.CreateDirectory();
|
||||
|
||||
// append profile name
|
||||
dirSpec += profileName;
|
||||
}
|
||||
else {
|
||||
dirSpec = nativeProfileDir;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_profile)
|
||||
printf("before SetProfileDir\n");
|
||||
|
@ -1088,31 +1079,20 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(const char* charData)
|
|||
if (!dirSpec.Exists())
|
||||
dirSpec.CreateDirectory();
|
||||
|
||||
dirSpec += profileName;
|
||||
|
||||
// Set the directory value and add the entry to the registry tree.
|
||||
// Creates required user directories.
|
||||
rv = SetProfileDir(unescapedProfileName, dirSpec);
|
||||
|
||||
PR_DELETE(unescapedProfileName);
|
||||
rv = SetProfileDir(profileName, dirSpec);
|
||||
|
||||
#if defined(DEBUG_profile)
|
||||
printf("after SetProfileDir\n");
|
||||
#endif
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
nsCRT::free(profileName);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Get profile defaults folder..
|
||||
nsCOMPtr <nsIFileSpec> profDefaultsDir;
|
||||
rv = locator->GetFileLocation(nsSpecialFileSpec::App_ProfileDefaultsFolder50, getter_AddRefs(profDefaultsDir));
|
||||
|
||||
if (NS_FAILED(rv) || !profDefaultsDir)
|
||||
{
|
||||
nsCRT::free(profileName);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1126,12 +1106,6 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(const char* charData)
|
|||
defaultsDirSpec.RecursiveCopy(dirSpec);
|
||||
}
|
||||
|
||||
if (dirName)
|
||||
{
|
||||
PR_DELETE(dirName);
|
||||
}
|
||||
nsCRT::free(profileName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче