diff --git a/profile/resources/content/MANIFEST b/profile/resources/content/MANIFEST index 527a1a51c9b6..d8410ddfa5f3 100644 --- a/profile/resources/content/MANIFEST +++ b/profile/resources/content/MANIFEST @@ -9,3 +9,5 @@ newProfile1_2.js profileManager.js profileManager.xul renameProfile.xul +profileSelection.js +profileSelection.xul diff --git a/profile/resources/content/Makefile.in b/profile/resources/content/Makefile.in index 6d49d1bd9f55..8da3a80bc778 100644 --- a/profile/resources/content/Makefile.in +++ b/profile/resources/content/Makefile.in @@ -35,6 +35,8 @@ FILES = \ newProfile1_2.xul \ newProfile1_1.js \ newProfile1_2.js \ + profileSelection.xul \ + profileSelection.js \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/profile/resources/content/makefile.win b/profile/resources/content/makefile.win index 29ec31af89d6..1ed357dca822 100644 --- a/profile/resources/content/makefile.win +++ b/profile/resources/content/makefile.win @@ -32,6 +32,8 @@ FILES=\ profileManager.js \ profileManager.xul \ renameProfile.xul \ + profileSelection.xul \ + profileSelection.js \ $(NULL) install:: diff --git a/profile/resources/content/profileSelection.js b/profile/resources/content/profileSelection.js new file mode 100644 index 000000000000..640eb8dd1b7e --- /dev/null +++ b/profile/resources/content/profileSelection.js @@ -0,0 +1,191 @@ +/* + * 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 (28/10/99) + * Seth Spitzer + */ + +var selected = null; +var currProfile = ""; +var profile = Components.classes["component://netscape/profile/manager"].createInstance(); +if(profile) + profile = profile.QueryInterface(Components.interfaces.nsIProfile); +var bundle = null; +var unset = true; + +function StartUp() +{ + // bundle = srGetStrBundle("chrome://profile/locale/profileSelection.properties"); + loadElements(); +} + +// function : ::AddItem(); +// purpose : utility function for adding items to a tree. +function AddItem(aChildren,aCells,aIdfier) +{ + var kids = document.getElementById(aChildren); + var item = document.createElement("treeitem"); + var row = document.createElement("treerow"); + var cell = document.createElement("treecell"); + var button = document.createElement("titledbutton"); + button.setAttribute("value",aCells); + button.setAttribute("class","displaybutton"); + button.setAttribute("align","left"); + cell.appendChild(button); + row.appendChild(cell); + item.appendChild(row); + item.setAttribute("profile_name", aIdfier); + // 23/10/99 - no roaming access yet! + // var roaming = document.getElementById("roamingitem"); + // kids.insertBefore(item,roaming); + kids.appendChild(item); +} + +// function : ::loadElements(); +// purpose : load profiles into tree +function loadElements() +{ + var profileList = ""; + profileList = profile.getProfileList(); + profileList = profileList.split(","); + + try { + currProfile = profile.currentProfile; + } + catch (ex) { + if (profileList != "") + currProfile = profileList; + } + + for (var i = 0; i < profileList.length; i++) + { + var pvals = profileList[i].split(" - "); + AddItem("profilekids",pvals[0],pvals[0]); + } +} + +// function : ::onStart(); +// purpose : starts mozilla given the selected profile (user choice: "Start Mozilla") +function onStart() +{ + startButton = document.getElementById("start"); + if (startButton.getAttribute("disabled") == "true") + return; + if(!selected) + return; + + var profilename = selected.getAttribute("profile_name"); + + try { + dump("start with profile: " + profilename + "\n"); + profile.startApprunner(profilename); + ExitApp(); + } + catch (ex) { + var stringA = bundle.GetStringFromName(failProfileStartA); + var stringB = bundle.GetStringFromName(failProfileStartB); + alert(stringA + " " + profilename + " " + stringB); + } +} + +// function : ::onExit(); +// purpose : quits startup process (User Choice: "Exit") +function onExit() +{ + try { + profile.forgetCurrentProfile(); + } + catch (ex) { + dump("Failed to forget current profile.\n"); + } + ExitApp(); +} + +// function : ::ExitApp(); +// purpose : halts startup process forcefully +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(); +} + +// function : ::setButtonsDisabledState(); +// purpose : sets the enabling of buttons +function setButtonsDisabledState(state) +{ + startButton = document.getElementById("start"); + startButton.setAttribute("disabled", state); +} + +// function : ::showSelection(); +// purpose : selects the profile and enables the start button +function showSelection(node) +{ + // (see tree's onclick definition) + // Tree events originate in the smallest clickable object which is the cell. The object + // originating the event is available as event.target. We want the cell's row, so we go + // one further and get event.target.parentNode. + selected = node; + var tree = document.getElementById("profiles"); + if(tree.selectedItems.length > 0) + setButtonsDisabledState("false"); +} + +// function : ::startWithProfile(); +// purpose : starts mozilla with selected profile automatically on dblclick +function startWithProfile(node) +{ + selected = node; + onStart(); +} + +function onManageProfiles() +{ + window.openDialog("chrome://profile/content/profileManager.xul","","chrome"); +} + +function foo() +{ + var welcome = document.getElementById("welcometo"); + var mozilla = document.getElementById("mozilla"); + if(welcome.hasChildNodes() && mozilla.hasChildNodes()) { + if(unset) { + oldA = welcome.lastChild.nodeValue; + oldB = mozilla.lastChild.nodeValue; + welcome.removeChild(welcome.lastChild) + var text = document.createTextNode("What Is"); + welcome.appendChild(text); + mozilla.removeChild(mozilla.lastChild) + var text = document.createTextNode("MOZOLLIA?"); + mozilla.appendChild(text); + unset = false; + } else { + welcome.removeChild(welcome.lastChild) + var text = document.createTextNode(oldA); + welcome.appendChild(text); + mozilla.removeChild(mozilla.lastChild) + var text = document.createTextNode(oldB); + mozilla.appendChild(text); + unset = true; + } + } +} diff --git a/profile/resources/content/profileSelection.xul b/profile/resources/content/profileSelection.xul new file mode 100644 index 000000000000..4dac729507e7 --- /dev/null +++ b/profile/resources/content/profileSelection.xul @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + &welcometo.label; + &mozilla.label; + + + &introgeneral.label; + + + + + + + + + + &availprofiles.label; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/profile/resources/locale/en-US/MANIFEST b/profile/resources/locale/en-US/MANIFEST index 45d1e8eb3790..ee60e20c3d55 100644 --- a/profile/resources/locale/en-US/MANIFEST +++ b/profile/resources/locale/en-US/MANIFEST @@ -7,3 +7,4 @@ profileManagerMigrateAll.dtd profileManagerRename.dtd createProfileWizard.properties newProfile1_2.properties +profileSelection.dtd diff --git a/profile/resources/locale/en-US/Makefile.in b/profile/resources/locale/en-US/Makefile.in index 6ac0668b6da9..3e314921a530 100644 --- a/profile/resources/locale/en-US/Makefile.in +++ b/profile/resources/locale/en-US/Makefile.in @@ -33,6 +33,7 @@ FILES = \ profileManagerRename.dtd \ createProfileWizard.properties \ newProfile1_2.properties \ + profileSelection.dtd \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/profile/resources/locale/en-US/makefile.win b/profile/resources/locale/en-US/makefile.win index 3e6404ffdf09..492be7102da6 100644 --- a/profile/resources/locale/en-US/makefile.win +++ b/profile/resources/locale/en-US/makefile.win @@ -30,6 +30,7 @@ FILES=\ profileManagerRename.dtd \ createProfileWizard.properties \ newProfile1_2.properties \ + profileSelection.dtd \ $(NULL) install:: diff --git a/profile/resources/locale/en-US/profileSelection.dtd b/profile/resources/locale/en-US/profileSelection.dtd new file mode 100644 index 000000000000..e60875fd6387 --- /dev/null +++ b/profile/resources/locale/en-US/profileSelection.dtd @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/profile/resources/skin/MANIFEST b/profile/resources/skin/MANIFEST index 581daff368be..efe33abb1c54 100644 --- a/profile/resources/skin/MANIFEST +++ b/profile/resources/skin/MANIFEST @@ -3,3 +3,6 @@ profile.css profileManager.css pwiz_panels.css header.gif +profileSelection.css +profileicon-selected.gif +profileicon.gif diff --git a/profile/resources/skin/Makefile.in b/profile/resources/skin/Makefile.in index 31642fef4cf6..2bef70bb78f8 100644 --- a/profile/resources/skin/Makefile.in +++ b/profile/resources/skin/Makefile.in @@ -29,6 +29,9 @@ FILES = \ profileManager.css \ pwiz_panels.css \ header.gif \ + profileSelection.css \ + profileicon-selected.gif \ + profileicon.gif \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/profile/resources/skin/makefile.win b/profile/resources/skin/makefile.win index 67a7215bc534..404aee67f0be 100644 --- a/profile/resources/skin/makefile.win +++ b/profile/resources/skin/makefile.win @@ -26,6 +26,9 @@ FILES=\ profileManager.css \ pwiz_panels.css \ header.gif \ + profileSelection.css \ + profileicon-selected.gif \ + profileicon.gif \ $(NULL) install:: diff --git a/profile/resources/skin/profileManager.css b/profile/resources/skin/profileManager.css index b3be7c2e90b0..c28b95906212 100644 --- a/profile/resources/skin/profileManager.css +++ b/profile/resources/skin/profileManager.css @@ -40,4 +40,4 @@ treehead treeitem treecell { //popup { //display: none; -//} +//} \ No newline at end of file diff --git a/profile/resources/skin/profileSelection.css b/profile/resources/skin/profileSelection.css new file mode 100644 index 000000000000..4bc5c0e439fc --- /dev/null +++ b/profile/resources/skin/profileSelection.css @@ -0,0 +1,170 @@ +/* + * 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 (28/10/99) + */ + +/* note that I'm defining most of my styles here because I have not figured out + * a reigime under the new skin. I hope to update this soon. + * + * I am respecting user's choice of system colours by using them rather than + * defining my own, with the exception of the header text + */ + +window { + padding : 7px; + background : url('chrome://profile/skin/header.gif'); + background-repeat : no-repeat; + background-position : 0px -10px; + background-color : threedface; +} + +div.label { + margin-left : 10px; + margin-right : 7px; + margin-bottom : 10px; +} + +div.rule { + border-bottom : 2px threedface groove; + margin-left : -10px; + width : 100%; +} + +/* these two will probably break on Mac, as they did in profile wizard. */ +/* can we find a font? a nice font? */ +/* maybe perpetua *nudgenudge*/ +div#welcometo { + font-family : serif; + font-size : 20px; + font-weight : bold; + color : #61400A; +} + +div#mozilla { + font-family : serif; + font-size : 36px; + font-weight : bold; + color : #000000; + margin-top : -13px; + margin-left : 25px; +} + +hr { + height : 2px; + border : none; + background-color : black; +} + +tree#profiles { + border : 1px inset threedface; +/* outline : 1px inset #CCCCDD;*/ + background-color : transparent; +} + +treecell { + padding-left : 5px; + padding-top : 1px; + padding-bottom : 1px; +} + +tree > treechildren { + background-color : window; +} + +tree#profiles > treehead > treerow > treecell { + padding-left : 10px; + border-left : none; + border-top : none; + border-right : none; + border-bottom : 1px solid #61400A; + background-color : transparent; + color : windowtext; +} + +treecell#roamingcell { + border-top : 1px solid windowtext; +} + +treeitem#roamingitem { + margin-top : 5px; +} + +treeitem[selected="true"] treecell { + background-color : highlight; + color : highlighttext; +} + +treeitem[selected="true"] titledbutton.displaybutton { + border : none; + padding : 0px; + list-style-image : url('chrome://profile/skin/profileicon-selected.gif'); +} + +treeitem titledbutton.displaybutton { + border : none; + padding : 0px; + list-style-image : url('chrome://profile/skin/profileicon.gif'); +} + +box#prattle { + background-color : threedface; + border-top : 1px outset threedface; + margin-left : -7px; + padding-top : 7px; +} + +box.selection > titledbutton { + -moz-border-radius : 2px; +} +box.selection > titledbutton:hover { + text-decoration : none; +} +box.selection > titledbutton:active { + -moz-border-radius : 2px; +} + +titledbutton.padded { + padding-left : 20px; + padding-right : 20px; +} + +spring#makeup { + border-top : 1px outset threedface; + background-color : threedface; +} + +input[type="checkbox"] { + background-color : threedface; + border : 1px outset threedface; +/* outline : 1px solid threeddarkshadow;*/ + -moz-border-radius : 2px; +} + +input[type="checkbox"]:hover { + outline : 1px solid threeddarkshadow; +} + +input[type="checkbox"]:active { + background-color : threedface; + border : 1px inset threedface; +/* outline : 1px solid threeddarkshadow;*/ + -moz-border-radius : 2px; +} \ No newline at end of file diff --git a/profile/resources/skin/profileicon-selected.gif b/profile/resources/skin/profileicon-selected.gif new file mode 100644 index 000000000000..68905b3058ee Binary files /dev/null and b/profile/resources/skin/profileicon-selected.gif differ diff --git a/profile/resources/skin/profileicon.gif b/profile/resources/skin/profileicon.gif new file mode 100644 index 000000000000..7647a34ea184 Binary files /dev/null and b/profile/resources/skin/profileicon.gif differ diff --git a/profile/src/nsProfile.cpp b/profile/src/nsProfile.cpp index 9632c41adaab..13fffa04915a 100644 --- a/profile/src/nsProfile.cpp +++ b/profile/src/nsProfile.cpp @@ -99,6 +99,8 @@ // this used to be cpwPreg.xul, that no longer exists. we need to fix this. #define PROFILE_PREG_URL "chrome://profile/content/createProfileWizard.xul" +#define PROFILE_SELECTION_URL "chrome://profile/content/profileSelection.xul" +#define PROFILE_SELECTION_CMD_LINE_ARG "-SelectProfile" #define PROFILE_MANAGER_URL "chrome://profile/content/profileManager.xul" #define PROFILE_MANAGER_CMD_LINE_ARG "-ProfileManager" #define PROFILE_WIZARD_URL "chrome://profile/content/createProfileWizard.xul" @@ -314,7 +316,7 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr) profileURLStr = PROFILE_WIZARD_URL; } else if (numProfiles > 1) - profileURLStr = PROFILE_MANAGER_URL; + profileURLStr = PROFILE_SELECTION_URL; } @@ -455,8 +457,18 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs, profileURLStr = PROFILE_MANAGER_URL; } } - - // Start Profile Wizard + + // Start Profile Selection + rv = cmdLineArgs->GetCmdLineValue(PROFILE_SELECTION_CMD_LINE_ARG, &cmdResult); + if (NS_SUCCEEDED(rv)) + { + if (cmdResult) { + profileURLStr = PROFILE_SELECTION_URL; + } + } + + + // Start Profile Wizard rv = cmdLineArgs->GetCmdLineValue(PROFILE_WIZARD_CMD_LINE_ARG, &cmdResult); if (NS_SUCCEEDED(rv)) {