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,66 +95,45 @@ 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");
//dump("value: "+wizardHash[i]+"\n");
if (i == "ProfileName") { if (i == "ProfileName") {
profName = wizardHash[i]; profName = wizardHash[i];
data = data+i+"="+profName+"%";
} }
if (i == "ProfileDir") { if (i == "ProfileDir") {
profDir = wizardHash[i]; 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) {
@ -253,13 +199,4 @@ function ExitApp()
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,4 +1,5 @@
<?xml version="1.0"?> <?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"?> <?xml-stylesheet href="chrome://profile/skin/createProfileWizard.css" type="text/css"?>
@ -8,28 +9,34 @@
xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="loadPage('newProfile1_1.xul')" onload="loadPage('newProfile1_1.xul')">
width="500" height="400">
<html:script language="javascript" src="chrome://global/content/strres.js" />
<html:script src="createProfileWizard.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"> <tabcontrol align="vertical">
<tabbox align="horizontal"> <tabbox align="horizontal">
<tab onclick="loadPage('newProfile1_1.xul');">&newprofile.title;</tab> <tab class="selected">&newprofile.title;</tab>
<!-- <tab class="nonselected" onclick="loadPage('mailnews.xul');">&mailnewssettings.title;</tab>-->
</tabbox> </tabbox>
<tabpanel />
</tabcontrol> </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> </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> </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,4 +1,5 @@
<?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
@ -18,29 +19,28 @@
--> -->
<?xml-stylesheet href="chrome://profile/skin/profileManager.css" type="text/css"?> <!-- 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" > <!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_1.dtd" >
<window <window
xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" class="dialog"
width="500" height="500"
onload="parent.wizardPageLoaded('newProfile1_1');"> onload="parent.wizardPageLoaded('newProfile1_1');">
<html:div flex="100%" style="width: 100%; height: 100%;"> <html:script language="JavaScript" src="newProfile1_1.js"/>
<html:div style="width: 300px;">&heading;</html:div>
<html:br/>
<html:div>&title;</html:div> <box flex="100%" align="vertical">
<html:div>&para.one;</html:div> <html:div>&pnl1.p1.text;</html:div>
<html:br/> <spring flex="50%"/>
<html:div>&pnl1.p2.text;</html:div>
<html:div>&para.two;</html:div> <spring flex="50%"/>
<html:br/> <html:div>&pnl1.p3.text;</html:div>
<spring flex="50%"/>
<html:div>&para.three;</html:div> <html:div>&pnl1.p4.text;</html:div>
<html:br/> <spring flex="50%"/>
<html:div>&para.four;</html:div> </box>
</html:div>
</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;
}

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

@ -18,7 +18,10 @@
--> -->
<?xml-stylesheet href="chrome://profile/skin/profileManager.css" type="text/css"?> <!-- 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" > <!DOCTYPE window SYSTEM "chrome://profile/locale/newProfile1_2.dtd" >
<window <window
@ -27,53 +30,35 @@ xmlns:html="http://www.w3.org/TR/REC-html40"
width="500" height="500" width="500" height="500"
onload="parent.wizardPageLoaded('newProfile1_2');"> onload="parent.wizardPageLoaded('newProfile1_2');">
<html:script> <html:script language="javascript" src="chrome://global/content/strres.js" />
function foo() <html:script language="JavaScript" src="newProfile1_2.js"/>
{
// what the hell is this?
}
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%"/>
}
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>&para;</html:div>
</html:div> </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> </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,7 +1,7 @@
<!-- 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">
@ -9,3 +9,5 @@
<!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

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

@ -27,6 +27,8 @@ 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,11 +16,33 @@ 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: 1px; margin : 2px;
padding: 3px 2px 0px 1px padding : 3px 13px 0px 11px
} }
titledbutton[disabled] { titledbutton[disabled] {
@ -29,7 +51,27 @@ titledbutton[disabled] {
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,37 +1048,28 @@ 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 nsFileSpec dirSpec;
SetDataArray(data);
char* dirName = GetValue("ProfileDir"); if (!nativeProfileDir || !*nativeProfileDir)
char* unescapedProfileName = GetValue("ProfileName");
if (!unescapedProfileName || !*unescapedProfileName)
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)
{ {
// 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)
@ -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;
} }