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:
sspitzer%netscape.com 1999-10-06 21:36:59 +00:00
Родитель 4629012b8e
Коммит 7ae0702f14
25 изменённых файлов: 587 добавлений и 353 удалений

Просмотреть файл

@ -62,7 +62,7 @@ interface nsIProfile : nsISupports {
void migrateProfileInfo(); void migrateProfileInfo();
void createNewProfile(in string data); void createNewProfile(in string profileName, in string nativeProfileDir);
void renameProfile(in string oldName, in string newName); void renameProfile(in string oldName, in string newName);
void deleteProfile(in string name, in string canDeleteFiles); void deleteProfile(in string name, in string canDeleteFiles);

Просмотреть файл

@ -3,7 +3,9 @@ createProfileWizard.xul
deleteProfile.xul deleteProfile.xul
migrateAllProfile.xul migrateAllProfile.xul
newProfile1_1.xul newProfile1_1.xul
newProfile1_1.js
newProfile1_2.xul newProfile1_2.xul
newProfile1_2.js
profileManager.js profileManager.js
profileManager.xul profileManager.xul
renameProfile.xul renameProfile.xul

Просмотреть файл

@ -33,6 +33,8 @@ FILES = \
renameProfile.xul \ renameProfile.xul \
newProfile1_1.xul \ newProfile1_1.xul \
newProfile1_2.xul \ newProfile1_2.xul \
newProfile1_1.js \
newProfile1_2.js \
$(NULL) $(NULL)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,3 +1,7 @@
// The WIZARD of GORE
var wizardMap = ["newProfile1_1.xul"]; var wizardMap = ["newProfile1_1.xul"];
var content; var content;
var wizardHash = new Array; var wizardHash = new Array;
@ -15,15 +19,11 @@ var currentPageTag;
var profName = ""; var profName = "";
var profDir = ""; var profDir = "";
function wizardPageLoaded(tag) { function wizardPageLoaded(tag)
//dump("**********wizardPageLoaded\n"); {
if (firstTime)
if (firstTime) {
Startup(); Startup();
}
currentPageTag = tag; currentPageTag = tag;
//dump("currentPageTag: "+currentPageTag+"\n");
SetButtons(); SetButtons();
populatePage(); populatePage();
} }
@ -34,64 +34,47 @@ var finishButton = null;
function loadPage(thePage) function loadPage(thePage)
{ {
if (!firstTime) { if (!firstTime)
saveData(); saveData();
}
//dump("**********loadPage\n");
//dump("thePage: "+thePage+"\n");
displayPage(thePage); displayPage(thePage);
firstTime = false; firstTime = false;
return(true); return(true);
} }
function SetButtons() function SetButtons()
{ {
if (!currentPageTag) return; if (!currentPageTag)
return;
if (!backButton) { if (!backButton)
backButton = document.getElementById("back"); backButton = document.getElementById("back");
} if (!nextButton)
if (!nextButton) {
nextButton = document.getElementById("next"); nextButton = document.getElementById("next");
}
if (!finishButton) {
finishButton = document.getElementById("finish");
}
//dump("currentPageTag == " + currentPageTag + "\n");
nextTag = testMap[currentPageTag].next; nextTag = testMap[currentPageTag].next;
//dump("nextTag == " + nextTag + "\n");
if (nextTag) { if (nextTag) {
//dump("next on, finish off\n"); var nextLabel = bundle.GetStringFromName("nextButtonLabel");
nextButton.setAttribute("disabled", "false"); nextButton.setAttribute("value",nextLabel);
finishButton.setAttribute("disabled", "true"); nextButton.setAttribute("onclick","onNext()");
} }
else { else {
//dump("next off, finish on\n"); var finishLabel = bundle.GetStringFromName("finishButtonLabel");
nextButton.setAttribute("disabled", "true"); nextButton.setAttribute("value",finishLabel);
finishButton.setAttribute("disabled", "false"); nextButton.setAttribute("onclick","Finish(opener)");
} }
prevTag = testMap[currentPageTag].previous; prevTag = testMap[currentPageTag].previous;
//dump("prevTag == " + prevTag + "\n"); if (prevTag)
if (prevTag) {
//dump("back on\n");
backButton.setAttribute("disabled", "false"); backButton.setAttribute("disabled", "false");
} else
else {
//dump("back off\n");
backButton.setAttribute("disabled", "true"); backButton.setAttribute("disabled", "true");
}
} }
function onNext() function onNext()
{ {
//dump("in onnext\n");
if (nextButton.getAttribute("disabled") == "true") { if (nextButton.getAttribute("disabled") == "true") {
return; return;
} }
saveData(); saveData();
var nextPageTag = testMap[currentPageTag].next; var nextPageTag = testMap[currentPageTag].next;
var url = getUrlFromTag(nextPageTag); var url = getUrlFromTag(nextPageTag);
@ -100,9 +83,9 @@ function onNext()
function onBack() function onBack()
{ {
if (backButton.getAttribute("disabled") == "true") { //dump("in onback\n");
if (backButton.getAttribute("disabled") == "true")
return; return;
}
saveData(); saveData();
previousPageTag = testMap[currentPageTag].previous; previousPageTag = testMap[currentPageTag].previous;
@ -112,67 +95,46 @@ function onBack()
function displayPage(content) function displayPage(content)
{ {
//dump(content + "\n");
//dump("********INSIDE DISPLAYPAGE\n\n");
if (content != "") if (content != "")
{ {
var contentFrame = document.getElementById("content"); var contentFrame = document.getElementById("content");
if (contentFrame) if (contentFrame)
{
contentFrame.setAttribute("src", content); contentFrame.setAttribute("src", content);
}
} }
} }
function populatePage() function populatePage()
{ {
//dump("************initializePage\n");
var contentWindow = window.frames["content"]; var contentWindow = window.frames["content"];
var doc = contentWindow.document; var doc = contentWindow.document;
for (var i in wizardHash)
for (var i in wizardHash) { {
var formElement=doc.getElementById(i); var element = doc.getElementById(i);
//dump("formElement: "+formElement+"\n"); if (element)
contentWindow.SetFields(element,wizardHash[i]);
if (formElement) { }
formElement.value = wizardHash[i];
//dump("wizardHash["+"i]: "+wizardHash[i]+"\n");
}
}
} }
function saveData() function saveData()
{ {
//dump("************ SAVE DATA\n");
var contentWindow = window.frames["content"]; var contentWindow = window.frames["content"];
var doc = contentWindow.document; var data = contentWindow.GetFields();
if(data != undefined) {
var inputs = doc.getElementsByTagName("FORM")[0].elements; for(var i = 0; i < data.length; i++)
wizardHash[data[i][0]] = data[i][1];
//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");
} }
function onCancel() function onCancel()
{ {
//dump("************** ON CANCEL\n"); // we came from the profile manager window...
saveData(); if (top.window.opener)
var i; window.close();
for (i in wizardHash) { else
//dump("element: "+i+"\n"); ExitApp()
//dump("value: "+wizardHash[i]+"\n");
}
} }
// utility functions // utility functions
function getUrlFromTag(title) function getUrlFromTag(title)
{ {
@ -186,16 +148,12 @@ function Startup()
function Finish(opener) function Finish(opener)
{ {
if (finishButton.getAttribute("disabled") == "true") { // lets check if we're at final stage using null
return; if(testMap[currentPageTag].next)
} return null;
//dump("******FINISH ROUTINE\n");
try { try {
saveData(); saveData();
processCreateProfileData(); processCreateProfileData();
if (opener) { if (opener) {
opener.CreateProfile(); opener.CreateProfile();
} }
@ -208,34 +166,22 @@ function Finish(opener)
function processCreateProfileData() function processCreateProfileData()
{ {
//Process Create Profile Data //Process Create Profile Data
//dump("******processCreateProfileData ROUTINE\n");
var i; var i;
var data = "";
for (i in wizardHash) { for (i in wizardHash) {
//dump("element: "+i+"\n"); if (i == "ProfileName") {
//dump("value: "+wizardHash[i]+"\n"); profName = wizardHash[i];
}
if (i == "ProfileName") { if (i == "ProfileDir") {
profName = wizardHash[i]; profDir = wizardHash[i];
data = data+i+"="+profName+"%"; }
}
if (i == "ProfileDir") {
profDir = wizardHash[i];
data = data+i+"="+profDir+"%";
}
} }
//dump("data: "+data+"\n");
var profile = Components.classes["component://netscape/profile/manager"].createInstance(); var profile = Components.classes["component://netscape/profile/manager"].createInstance();
profile = profile.QueryInterface(Components.interfaces.nsIProfile); profile = profile.QueryInterface(Components.interfaces.nsIProfile);
//dump("profile = " + profile + "\n");
//dump("********DATA: "+data+"\n\n");
try { try {
profile.createNewProfile(data); //dump("name,dir = " + profName + "," + profDir + "\n");
profile.createNewProfile(profName, profDir);
profile.startCommunicator(profName); profile.startCommunicator(profName);
} }
catch (ex) { catch (ex) {
@ -247,19 +193,10 @@ function processCreateProfileData()
function ExitApp() function ExitApp()
{ {
// Need to call this to stop the event loop // Need to call this to stop the event loop
var appShell = Components.classes['component://netscape/appshell/appShellService'].getService(); var appShell = Components.classes['component://netscape/appshell/appShellService'].getService();
appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService); appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService);
appShell.Quit(); appShell.Quit();
} }
function onCancel() var bundle = srGetStrBundle("chrome://profile/locale/createProfileWizard.properties");
{
if (top.window.opener) {
// we came from the profile manager window...
window.close();
}
else {
ExitApp()
}
}

Просмотреть файл

@ -1,35 +1,42 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?xml-stylesheet href="chrome://profile/skin/createProfileWizard.css" type="text/css"?> <?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">
<!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" <window title="&window.title.label;" style="width: 100%; height: 100%" align="vertical"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
onload="loadPage('newProfile1_1.xul')" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
width="500" height="400"> onload="loadPage('newProfile1_1.xul')">
<html:script src="createProfileWizard.js" /> <html:script language="javascript" src="chrome://global/content/strres.js" />
<html:script src="createProfileWizard.js" />
<tabcontrol align="vertical">
<tabbox align="horizontal"> <box id="header" align="vertical">
<tab onclick="loadPage('newProfile1_1.xul');">&newprofile.title;</tab> <box align="vertical">
</tabbox> <html:div id="cplabel">&createprofile.heading;</html:div>
<html:div id="cpsubl">&createprofile.subheading;</html:div>
<tabpanel /> </box>
</tabcontrol> <tabcontrol align="vertical">
<tabbox align="horizontal">
<html:iframe src="about:blank" flex="100%" name="content" id="content" scrolling="auto"/> <tab class="selected">&newprofile.title;</tab>
<!-- <tab class="nonselected" onclick="loadPage('mailnews.xul');">&mailnewssettings.title;</tab>-->
<box align="horizontal"> </tabbox>
<titledbutton id="back" value="&back.label;" onclick="onBack()" align="left" disabled="true" style="margin-top: 1em;"/> </tabcontrol>
<titledbutton id="next" value="&next.label;" onclick="onNext()" align="left" style="margin-top: 1em;"/> </box>
<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 id="contentsink" flex="100%">
<html:iframe src="about:blank" style="width: 100%;" name="content" id="content" scrolling="auto" flex="100%"/>
</box> </box>
<box align="horizontal" style="width: 450px;">
<spring flex="100%"/>
</window> <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 \ deleteProfile.xul \
migrateAllProfile.xul \ migrateAllProfile.xul \
newProfile1_1.xul \ newProfile1_1.xul \
newProfile1_1.js \
newProfile1_2.xul \ newProfile1_2.xul \
newProfile1_2.js \
profileManager.js \ profileManager.js \
profileManager.xul \ profileManager.xul \
renameProfile.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; -*- --> <?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 The contents of this file are subject to the Netscape Public License
compliance with the NPL. You may obtain a copy of the NPL at Version 1.0 (the "NPL"); you may not use this file except in
http://www.mozilla.org/NPL/ 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 Software distributed under the NPL is distributed on an "AS IS" basis,
for the specific language governing rights and limitations under the WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
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 The Initial Developer of this code under the NPL is Netscape
Copyright (C) 1998 Netscape Communications Corporation. All Rights Communications Corporation. Portions created by Netscape are
Reserved. Copyright (C) 1998 Netscape Communications Corporation. All Rights
Reserved.
-->
-->
<?xml-stylesheet href="chrome://profile/skin/profileManager.css" type="text/css"?>
<!-- this is PAGE ONE of the Profile Creation Wizard -->
<!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_1.dtd" >
<window <?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?>
xmlns:html="http://www.w3.org/TR/REC-html40" <?xml-stylesheet href="chrome://profile/skin/pwiz_panels.css" type="text/css"?>
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog"
width="500" height="500" <!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_1.dtd" >
onload="parent.wizardPageLoaded('newProfile1_1');"> <window
xmlns:html="http://www.w3.org/TR/REC-html40"
<html:div flex="100%" style="width: 100%; height: 100%;"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog"
<html:div style="width: 300px;">&heading;</html:div> onload="parent.wizardPageLoaded('newProfile1_1');">
<html:br/>
<html:script language="JavaScript" src="newProfile1_1.js"/>
<html:div>&title;</html:div>
<html:div>&para.one;</html:div> <box flex="100%" align="vertical">
<html:br/> <html:div>&pnl1.p1.text;</html:div>
<spring flex="50%"/>
<html:div>&para.two;</html:div> <html:div>&pnl1.p2.text;</html:div>
<html:br/> <spring flex="50%"/>
<html:div>&pnl1.p3.text;</html:div>
<html:div>&para.three;</html:div> <spring flex="50%"/>
<html:br/> <html:div>&pnl1.p4.text;</html:div>
<html:div>&para.four;</html:div> <spring flex="50%"/>
</html:div> </box>
</window> </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; -*- --> <?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
<!-- <!--
The contents of this file are subject to the Netscape Public License 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 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 compliance with the NPL. You may obtain a copy of the NPL at
http://www.mozilla.org/NPL/ http://www.mozilla.org/NPL/
Software distributed under the NPL is distributed on an "AS IS" basis, Software distributed under the NPL is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
for the specific language governing rights and limitations under the for the specific language governing rights and limitations under the
NPL. NPL.
The Initial Developer of this code under the NPL is Netscape The Initial Developer of this code under the NPL is Netscape
Communications Corporation. Portions created by Netscape are Communications Corporation. Portions created by Netscape are
Copyright (C) 1998 Netscape Communications Corporation. All Rights Copyright (C) 1998 Netscape Communications Corporation. All Rights
Reserved. Reserved.
--> -->
<?xml-stylesheet href="chrome://profile/skin/profileManager.css" type="text/css"?> <!-- this is PAGE TWO of the Profile Creation Wizard -->
<!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_2.dtd" > <?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?>
<window <?xml-stylesheet href="chrome://profile/skin/pwiz_panels.css" type="text/css"?>
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog" <!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_2.dtd" >
width="500" height="500" <window
onload="parent.wizardPageLoaded('newProfile1_2');"> xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog"
<html:script> width="500" height="500"
function foo() onload="parent.wizardPageLoaded('newProfile1_2');">
{
// what the hell is this? <html:script language="javascript" src="chrome://global/content/strres.js" />
} <html:script language="JavaScript" src="newProfile1_2.js"/>
function InitializeValues() <box flex="100%" align="vertical">
{ <html:div>&pnl2.intro.text;</html:div>
element = document.getElementById("ProfileName"); <spring flex="50%"/>
element.value = parent.profName; <html:div>&pnl2.pname.label;</html:div>
<html:div class="input1">
element = document.getElementById("ProfileDir"); <html:input type="text" id="ProfileName" value="mozProfile" style="width: 95%"/>
element.value = parent.profDir; <spring flex="5%"/>
} </html:div>
<html:div style="padding-bottom: 0px;">
function commit() &pnl2.pdir.label;
{ <html:span id="deffoldername">&pnl2.deffldr.label;</html:span>
var element; </html:div>
<box align="horizontal" id="dirbox">
element = document.getElementById("ProfileName"); <html:div class="dirLabel" flex="100%">
parent.SetValue(element.id, element.value); <!-- replace this button with an input field when they start responding
parent.profName = element.value; to css styles properly as the cropping is a problem. -->
<titledbutton id="ProfileDir" value="" crop="right"/>
element = document.getElementById("ProfileDir"); </html:div>
data += "ProfileDir="+element.value+"%"; <spring flex="100%"/>
parent.SetValue(element.id, element.value); <box align="vertical" id="folderbuttons">
parent.profDir = element.value; <titledbutton value="&button.choosefolder.label;" onclick="getProfileDir(null,true);"/>
} </box>
<spring flex="5%"/>
setTimeout("foo()", 0); </box>
</html:script> <html:div>&pnl2.finish.text;</html:div>
<spring flex="50%"/>
<html:div flex="100%" style="width: 100%; height: 100%;"> </box>
<html:div>&intro;</html:div> </window>
<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>&para;</html:div>
</html:div>
</window>

Просмотреть файл

@ -5,3 +5,5 @@ profileManager.dtd
profileManagerDelete.dtd profileManagerDelete.dtd
profileManagerMigrateAll.dtd profileManagerMigrateAll.dtd
profileManagerRename.dtd profileManagerRename.dtd
createProfileWizard.properties
newProfile1_2.properties

Просмотреть файл

@ -31,6 +31,8 @@ FILES = \
profileManagerDelete.dtd \ profileManagerDelete.dtd \
profileManagerMigrateAll.dtd \ profileManagerMigrateAll.dtd \
profileManagerRename.dtd \ profileManagerRename.dtd \
createProfileWizard.properties \
newProfile1_2.properties \
$(NULL) $(NULL)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,11 +1,13 @@
<!-- extracted from cpw.xul --> <!-- extracted from cpw.xul -->
<!ENTITY window.title.label "Communicator Profile Manager"> <!ENTITY window.title.label "Mozilla Profile Manager">
<!ENTITY newprofile.title "New Profile"> <!ENTITY newprofile.title "Create New Profile">
<!ENTITY dialup.title "Dialup"> <!ENTITY dialup.title "Dialup">
<!ENTITY mailnews.title "Mail News"> <!ENTITY mailnews.title "Mail News">
<!ENTITY addrbook.title "Address Book"> <!ENTITY addrbook.title "Address Book">
<!ENTITY back.label "Back"> <!ENTITY back.label "Back">
<!ENTITY next.label "Next"> <!ENTITY next.label "Next">
<!ENTITY cancel.label "Cancel"> <!ENTITY cancel.label "Cancel">
<!ENTITY finish.label "Finish"> <!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 \ profileManagerDelete.dtd \
profileManagerMigrateAll.dtd \ profileManagerMigrateAll.dtd \
profileManagerRename.dtd \ profileManagerRename.dtd \
createProfileWizard.properties \
newProfile1_2.properties \
$(NULL) $(NULL)
install:: install::

Просмотреть файл

@ -1,8 +1,5 @@
<!-- extracted from test-content1_1.xul -->
<!ENTITY heading "Communicator Profile Manager"> <!ENTITY pnl1.p1.text "Mozilla stores information about your settings, preferences, bookmarks, and stored messages in your personal profile.">
<!ENTITY title "Creating a New 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 para.one "Communicator stores information about your settings, preferences, bookmarks, and stored messages in your personal profile."> <!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 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 pnl1.p4.text "To begin creating your profile, click Next.">
<!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.">

Просмотреть файл

@ -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 button.choosefolder.label "Change Folder...">
<!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.">

Просмотреть файл

@ -0,0 +1,2 @@
useDefaultFolder=Use Default Folder
defaultString= the default folder.

Просмотреть файл

@ -1,3 +1,5 @@
createProfileWizard.css createProfileWizard.css
profile.css profile.css
profileManager.css profileManager.css
pwiz_panels.css
header.gif

Просмотреть файл

@ -24,9 +24,11 @@ include $(DEPTH)/config/autoconf.mk
FILES = \ FILES = \
profile.css \ profile.css \
createProfileWizard.css \ createProfileWizard.css \
profileManager.css \ profileManager.css \
pwiz_panels.css \
header.gif \
$(NULL) $(NULL)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -7,7 +7,7 @@ window {
iframe { iframe {
width: 100%; width: 100%;
height: 100%; height: 100%;
border: 0px; border: 1px outset #CCCCDD;
} }
box { box {
@ -16,20 +16,62 @@ box {
display: block; 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 { titledbutton.active {
color: yellow; border : 0px;
border: 0px; margin : 2px;
margin: 1px; padding : 3px 13px 0px 11px
padding: 3px 2px 0px 1px
} }
titledbutton[disabled] { titledbutton[disabled] {
color: black; color : black;
} }
titledbutton { titledbutton {
color: black; color : black;
margin: 1px; width : 35px;
padding: 2px 1px 1px 2px 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 \ profile.css \
createProfileWizard.css \ createProfileWizard.css \
profileManager.css \ profileManager.css \
pwiz_panels.css \
header.gif \
$(NULL) $(NULL)
install:: 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 // 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; nsresult rv = NS_OK;
#if defined(DEBUG_profile) #if defined(DEBUG_profile)
printf("ProfileManager : CreateNewProfile\n"); 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 #endif
NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);
@ -1048,38 +1048,29 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(const char* charData)
if (NS_FAILED(rv) || !locator) if (NS_FAILED(rv) || !locator)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsString data(charData); if (!profileName) return NS_ERROR_FAILURE;
// Set the gathered info into an array
SetDataArray(data);
char* dirName = GetValue("ProfileDir");
char* unescapedProfileName = GetValue("ProfileName");
if (!unescapedProfileName || !*unescapedProfileName)
return NS_ERROR_FAILURE;
// Escape profile name to create a valid direrctory, nsFileSpec dirSpec;
// if directory value is not provided
char* profileName = nsEscape(unescapedProfileName, url_Path); // temp hack if (!nativeProfileDir || !*nativeProfileDir)
nsFileSpec dirSpec(dirName);
if (!dirName || !*dirName)
{ {
// They didn't type a directory path... // They didn't type a directory path...
// Get current profile, make the new one a sibling... nsCOMPtr <nsIFileSpec> defaultRoot;
nsCOMPtr <nsIFileSpec> horribleCOMDirSpecThing; rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, getter_AddRefs(defaultRoot));
rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, getter_AddRefs(horribleCOMDirSpecThing));
if (NS_FAILED(rv) || !horribleCOMDirSpecThing) if (NS_FAILED(rv) || !defaultRoot)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
//Append profile name to form a directory name defaultRoot->GetFileSpec(&dirSpec);
horribleCOMDirSpecThing->GetFileSpec(&dirSpec); if (!dirSpec.Exists())
//dirSpec.SetLeafName(profileName); dirSpec.CreateDirectory();
//dirSpec += profileName;
// append profile name
dirSpec += profileName;
} }
else {
dirSpec = nativeProfileDir;
}
#if defined(DEBUG_profile) #if defined(DEBUG_profile)
printf("before SetProfileDir\n"); printf("before SetProfileDir\n");
@ -1088,31 +1079,20 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(const char* charData)
if (!dirSpec.Exists()) if (!dirSpec.Exists())
dirSpec.CreateDirectory(); dirSpec.CreateDirectory();
dirSpec += profileName;
// Set the directory value and add the entry to the registry tree. // Set the directory value and add the entry to the registry tree.
// Creates required user directories. // Creates required user directories.
rv = SetProfileDir(unescapedProfileName, dirSpec); rv = SetProfileDir(profileName, dirSpec);
PR_DELETE(unescapedProfileName);
#if defined(DEBUG_profile) #if defined(DEBUG_profile)
printf("after SetProfileDir\n"); printf("after SetProfileDir\n");
#endif #endif
if (NS_FAILED(rv))
{
nsCRT::free(profileName);
return rv;
}
// Get profile defaults folder.. // Get profile defaults folder..
nsCOMPtr <nsIFileSpec> profDefaultsDir; nsCOMPtr <nsIFileSpec> profDefaultsDir;
rv = locator->GetFileLocation(nsSpecialFileSpec::App_ProfileDefaultsFolder50, getter_AddRefs(profDefaultsDir)); rv = locator->GetFileLocation(nsSpecialFileSpec::App_ProfileDefaultsFolder50, getter_AddRefs(profDefaultsDir));
if (NS_FAILED(rv) || !profDefaultsDir) if (NS_FAILED(rv) || !profDefaultsDir)
{ {
nsCRT::free(profileName);
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -1126,12 +1106,6 @@ NS_IMETHODIMP nsProfile::CreateNewProfile(const char* charData)
defaultsDirSpec.RecursiveCopy(dirSpec); defaultsDirSpec.RecursiveCopy(dirSpec);
} }
if (dirName)
{
PR_DELETE(dirName);
}
nsCRT::free(profileName);
return NS_OK; return NS_OK;
} }