checking in ben goodger's (rgoodger@ihug.co.nz) profile selection UI.

r=sspitzer

I made changes so that:

1)  exit quits the app, and doesn't start up app with the last current profile
2)  fix a spelling error (personalisation -> personalization), this is en-US, not en-UK
3)  fix it so start actually starts the selected profile.
4)  -SelectProfile launches this new dialog
5)  if the user starts with no command line, and they have more than one profile, they get -SelectProfile, and not -installer.
This commit is contained in:
sspitzer%netscape.com 1999-10-28 23:08:46 +00:00
Родитель 5bb15e742c
Коммит 33ecda1631
17 изменённых файлов: 548 добавлений и 4 удалений

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

@ -9,3 +9,5 @@ newProfile1_2.js
profileManager.js
profileManager.xul
renameProfile.xul
profileSelection.js
profileSelection.xul

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

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

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

@ -32,6 +32,8 @@ FILES=\
profileManager.js \
profileManager.xul \
renameProfile.xul \
profileSelection.xul \
profileSelection.js \
$(NULL)
install::

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

@ -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 : <profileSelection.js>::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 : <profileSelection.js>::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 : <profileSelection.js>::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 : <profileSelection.js>::onExit();
// purpose : quits startup process (User Choice: "Exit")
function onExit()
{
try {
profile.forgetCurrentProfile();
}
catch (ex) {
dump("Failed to forget current profile.\n");
}
ExitApp();
}
// function : <profileSelection.js>::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 : <profileSelection.js>::setButtonsDisabledState();
// purpose : sets the enabling of buttons
function setButtonsDisabledState(state)
{
startButton = document.getElementById("start");
startButton.setAttribute("disabled", state);
}
// function : <profileSelection.js>::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 : <profileSelection.js>::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;
}
}
}

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

@ -0,0 +1,108 @@
<?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.
Contributors:
Code: Ben Goodger (28/10/99)
UI Ideas: Matthew Thomas, Ben Gregory
-->
<?xml-stylesheet href="chrome://profile/skin/profileSelection.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://profile/locale/profileSelection.dtd" >
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="dialog"
title="&windowtitle.label;"
align="vertical"
onload="StartUp();"
width="450" height="226">
<html:script language="javascript" src="chrome://global/content/strres.js" />
<html:script language="javascript" src="chrome://profile/content/profileSelection.js"/>
<box align="horizontal">
<box align="vertical" style="width: 245px;">
<html:div id="welcometo">&welcometo.label;</html:div>
<html:div id="mozilla">&mozilla.label;</html:div>
<spring style="height: 7px;"/>
<box align="vertical" id="prattle">
<html:div class="label">&introgeneral.label;</html:div>
<!-- sspitzer roaming not supported yet 10-28-199
<html:div class="label">&introroaming.label;</html:div>
-->
</box>
</box>
<box align="vertical" flex="100%">
<html:div style="width: 190px; height: 172px;">
<spring style="height: 1px;"/>
<tree
id="profiles" style="width: 190px; height: 150px;"
onclick="return showSelection(event.target.parentNode.parentNode);"
ondblclick="return startWithProfile(event.target.parentNode.parentNode);"
onkeypress="if(event.which == 13) return startWithProfile(event.target.parentNode.parentNode);">
<treehead>
<treerow>
<treecell>&availprofiles.label;</treecell>
</treerow>
</treehead>
<treechildren id="profilekids">
<!-- sspitzer roaming not supported yet 10-28-199
<treeitem id="roamingitem">
<treerow>
<treecell id="roamingcell">Roaming Access profile</treecell>
</treerow>
</treeitem>
-->
</treechildren>
</tree>
<!-- sspitzer workoffline not supported yet 10-28-199
<html:table>
<html:tr>
<html:td valign="middle"><html:input type="checkbox" id="offline"/></html:td>
<html:td valign="middle">
<html:label for="offline" style="padding-top: 3px;">&workoffline.label;</html:label>
</html:td>
</html:tr>
</html:table>
-->
</html:div>
</box>
<box align="vertical">
<spring style="width: 15px; height: 58px;"/>
<spring id="makeup" style="width: 15px; height: 100px;"/>
</box>
</box>
<spring style="height: 10px;"/>
<html:div class="rule"/>
<spring style="height: 5px;"/>
<box class="selection" align="horizontal">
<titledbutton class="padded" id="manage" value="&manage.label;" onclick="onManageProfiles();"/>
<spring flex="100%"/>
<titledbutton id="exit" value="&exit.label;" onclick="onExit();"/>
<spring style="width: 5px;"/>
<titledbutton class="padded" id="start" value="&start.label;" onclick="onStart();"/>
<spring style="width: 19px;"/>
</box>
<keyset>
<key id="fooKey" key="s" command="true" shift="true" onkeydown="foo()"/>
</keyset>
</window>

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

@ -7,3 +7,4 @@ profileManagerMigrateAll.dtd
profileManagerRename.dtd
createProfileWizard.properties
newProfile1_2.properties
profileSelection.dtd

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

@ -33,6 +33,7 @@ FILES = \
profileManagerRename.dtd \
createProfileWizard.properties \
newProfile1_2.properties \
profileSelection.dtd \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -30,6 +30,7 @@ FILES=\
profileManagerRename.dtd \
createProfileWizard.properties \
newProfile1_2.properties \
profileSelection.dtd \
$(NULL)
install::

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

@ -0,0 +1,45 @@
<!-- -*- 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.
Contributors:
Ben Goodger (28/10/99)
-->
<!ENTITY windowtitle.label "Select User Profile">
<!ENTITY welcometo.label "Welcome to">
<!ENTITY mozilla.label "MOZILLA">
<!ENTITY introgeneral.label "To access your personal profile, which contains your mail, settings and other personalized information, please choose your profile from the list, and click Start Mozilla to begin your session.">
<!ENTITY introroaming.label "If you have a Roaming Access profile which does not exist on this computer, choose Roaming Access. Mozilla will then prompt you to log into your Roaming Access server.">
<!ENTITY profilename.label "Profile Name:">
<!ENTITY workoffline.label "Work Offline">
<!ENTITY password.label "Password:">
<!ENTITY manageprofiles.label "Manage Profiles">
<!ENTITY start.label "Start Mozilla">
<!ENTITY exit.label "Exit">
<!ENTITY manage.label "Manage Profiles...">
<!ENTITY availprofiles.label "Available Profiles">

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

@ -3,3 +3,6 @@ profile.css
profileManager.css
pwiz_panels.css
header.gif
profileSelection.css
profileicon-selected.gif
profileicon.gif

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

@ -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

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

@ -26,6 +26,9 @@ FILES=\
profileManager.css \
pwiz_panels.css \
header.gif \
profileSelection.css \
profileicon-selected.gif \
profileicon.gif \
$(NULL)
install::

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

@ -40,4 +40,4 @@ treehead treeitem treecell {
//popup {
//display: none;
//}
//}

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

@ -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;
}

Двоичные данные
profile/resources/skin/profileicon-selected.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 65 B

Двоичные данные
profile/resources/skin/profileicon.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 65 B

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

@ -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))
{