diff --git a/mozilla/cck/docs/prefstree/PrefsTreeFileFormat.htm b/mozilla/cck/docs/prefstree/PrefsTreeFileFormat.htm
index c5eac9a1dbf..c3823793b56 100644
--- a/mozilla/cck/docs/prefstree/PrefsTreeFileFormat.htm
+++ b/mozilla/cck/docs/prefstree/PrefsTreeFileFormat.htm
@@ -1,4 +1,6 @@
-
Structure of the Pref Editor XML File for the PrefsTree Widget
+
+
+ Structure of the Pref Editor XML File for the PrefsTree Widget
Added useradded attribute 28 Jan 2002
Added the MANAGE element. 24 Jan 2002
Removed elements INSTALLATIONFILE and PREFFILE. Changed processPrefsTree() number of params. 02 Jan 2002
@@ -6,8 +8,11 @@ Removed choose attribute. 13 Dec 2001
Original version. 11 Dec 2001
Steve Meredith
+
Structure of the Pref Editor XML File for the PrefsTree Widget
+
Introduction
+
The Pref Editor is a widget for CCK/Factory, named PrefsTree
in .ini files. It is a tree control which displays prefs in a hierarchy and
allows a user to edit their values. It reads an XML file to determine the
@@ -22,7 +27,8 @@ by the install builder to write preferences in the install image. A SCRIPT.I
entry must be made in order for it process the .XML file: processPrefsTree(,browser.xpi,bin/netscp6.cfg). Note that spaces are not allowed between the parameters. For details on
adding a PrefsTree control to wizard pages, see the document PrefsTree.htm
-A Note on Prefs
The XML described herein contains elements for prefs and elements to control how they are
+A Note on Prefs
+The XML described herein contains elements for prefs and elements to control how they are
grouped in a UI. It was specifically designed for use in this Pref Editor
tree control, but a complete representation of prefs in XML could be useful
in other ways. But for this use, the only prefs which should be included
@@ -37,28 +43,50 @@ be set in advance and stored in a .cfg file. The Pref Editor would have to
be modified to respect this new information and only present the appropriate
prefs for editting. Otherwise, any new elements and attributes are ignored
as long as the basic structure of the file remains valid (<PREF>s are grouped within <PREFSGROUP>s) and the required attributes and subelements exist.
+
+
The following prefs should not be placed into this XML file for use in the
prefs editor because they are handled outside the prefs editor, and used
to point to the file created by the install builder and prefs editor.
+
+
- autoadmin.global_config_url
- autoadmin.append_emailaddr
- autoadmin.offline_failover
+
+Problem Prefs
+
+browser.search.defaultengine: This is a string type, but it looks
+like it's a URL to a local file (engine://). I can't set this to a resonable
+default value as I don't know where Netscape is going to be installed.
+
+browser.startup.homepage: Problem when used with lockPref().
+
Who This Document is For
-
+
+
+
You will need to understand the structure of the XML file if you want to
add or remove prefs to the Pref Editor or change how they are grouped.
+
Conventions
+
For XML item tags, we use ALL CAPS. For attribute names, we use lower case.
“true” and “false” are also written in lower case. Generally, for PREF items,
the attributes are those things about the pref which are fixed, and use elements
for thing the CCK/Factory app will change. The exception is for <CHOICES>, which are difficult to represent as attributes, so these are elements.
-General Structure
Example 1
+
+General Structure
+Example 1
+
The simplest file that may exist consists of one group containing one pref.
+
+
<?xml version="1.0"?>
<PREFSGROUP uiname="Netscape Preferences">
<PREF uiname="Open Browser on Startup" prefname="general.startup.browser"
@@ -67,14 +95,22 @@ a browser window.">
<VALUE>true</VALUE>
<LOCKED>false</LOCKED>
</PREF>
</PREFSGROUP>
+
+
The above file will result in a tree control with one parent, the group, and one child, the pref. See the example below.
+
+
+
Example 2
+
The more complicated example below shows the top level group, with two sub groups, each with two preferences.
+
+
<?xml version="1.0"?>
<PREFSGROUP uiname="Netscape Preferences">
@@ -116,19 +152,29 @@ type="bool" lockable="true" description="Show Go button on browser toolbar.">
The above example also demonstrates how to include multiple choice
prefs. These make it easier for the CCK/Factory user to select pref values
without understanding how they are implemented. This XML file results in the prefs tree structure in the example below.
+
+
+
-Reference
The structure of the file is important. Not much work
+
+Reference
+The structure of the file is important. Not much work
as been put into handling malformed files. If the XML is invalid, you'll
get an error that the file failed to load, an error type, and a line number. If you create valid XML, but don't follow
the rules as defined here, the behaviour is undefined. It's probably easiest
to start with an existing prefs XML file, then cut, paste, and edit the <PREF>s from there.
+
<PREFSGROUP>
+
Each <PREFSGROUP> element will make a new level of hierarchy in the tree control. A <PREFSGROUP> may contain <PREF>s or other <PREFSGROUP> or both, but must not be empty. The first element in the file must be a <PREFSGROUP>. These may be nested arbitrarily deep.
+
+
+
Attribute
@@ -143,16 +189,21 @@ Each <PREFSGROUP> element will make a new level of hierarchy in t
|
uiname="Netscape Preferences"
|
- This is the name of the group as it appears in the tree control.
+ | This is the name of the group as it appears in the tree control. By convention, capitalize the words as if this were a title.
|
+
<PREF>
+
Each pref element will make a leaf node in the tree control--a pref which
the user can edit.These elements must be contained in some <PREFSGROUP>.
+
+
+
Attribute
@@ -169,7 +220,7 @@ the user can edit.These elements must be contained in some <PREFSGROUP>
|
This is the name of the pref as is appears in the
tree control. It doesn't have to be the name of the pref--it should be something
-easy for the user to understand.
+easy for the user to understand. By convention, capitalize the words as if this were a title.
|
@@ -201,7 +252,10 @@ For example, pref("general.startup.browser", true);
lockable="true"
|
- Determines whether or not the Pref Editor user can change the lock state the pref.
+ | Determines whether or not the Pref Editor user can change the lock state the pref.
+ This is included in case there are prefs which, for technical reasons, don't
+work when locked or locking them does not have the correct affect. If set
+to true, the Pref Editor should disable the "Lock this pref" checkbox.
|
@@ -213,14 +267,14 @@ For example, pref("general.startup.browser", true);
to the Pref Editor user. It appears when the user selected the pref for editing.
Any text which helps the user under the pref should go here.
There is space in the editor for maybe 125 characters or so. Of course,
-you can edit the dialog resource to hold more if this becomes a limitation.
+you can edit the dialog resource to hold more if this becomes a limitation. Use proper sentences.
useradded
|
useradded="true"
|
- This pref is added by the Pref Editor for all new
+ | This pref is added and set to true by the Pref Editor for all new
prefs added by the user via the UI. It is normally not present, and is assumed
to be false if missing. User added prefs are deletable via the Pref Editor
UI.
@@ -229,20 +283,32 @@ UI.
|
+
<CHOICES>
+
This element can optionally appear in <PREF> element if the values are to be translated into easy to understand multiple choice options. It contains more than one <CHOICE>
element. When the
user edits one of these prefs, he gets a list box from which he can select
from those choices described in the <CHOICE> elements which are contained in the <CHOICES> element. It will work for any type, but it is up to the person creating the XML to set the values in the value attribute to the correct type for the enclosing <PREF>. See Example 2, and <CHOICE>.
+
+
The example below shows how a multiple choice pref will look like when the user selects it for editing.
+
+
+
+
<CHOICE>
+
This element appears in <CHOICES> elements to describe one item of a multiple choice. Each <CHOICE> element in a <CHOICES> element for a <PREF> appears in a list box when the user edits a pref of this type. When selected, the value of the value attribute for the selected <CHOICE> is saved as the pref's value. See Example 2, and <CHOICES>.
+
+
+
Attribute
@@ -270,13 +336,20 @@ This element appears in <CHOICES> elements to describe one item o
|
-<VALUE>
One and only one must appear in a <PREF> element. This is the value of the pref. No quotes, regardless
+
+<VALUE>
+One and only one must appear in a <PREF> element. This is the value of the pref. No quotes, regardless
of type. This gets modified when the user edits the pref. Note that the modified
file is saved to the working config directory.
-<LOCKED>
One and only one must appear in a <PREF> element. This is true or false, depending on whether the pref is locked or not. If locked, prefs are written as lockPref() instead of pref(). See also <PREF lockable="true">.
+
+<LOCKED>
+One and only one must appear in a <PREF> element. This is true or false, depending on whether the pref is locked or not. If locked, prefs are written as lockPref() instead of pref(). See also <PREF lockable="true">.
+
<MANAGE>
+
This pref is added by the pref editor, and is normally absent in a prefs
XML file until it has been processed by the prefs editor. If the <MANAGE>
tag is present, and its value is true, then this pref will be written to
the output prefs file when the XML is processed by the install builder app.
+
\ No newline at end of file
diff --git a/mozilla/cck/driver/WizardMachine.aps b/mozilla/cck/driver/WizardMachine.aps
index 65390e3cfac..1432d942d83 100644
Binary files a/mozilla/cck/driver/WizardMachine.aps and b/mozilla/cck/driver/WizardMachine.aps differ
diff --git a/mozilla/cck/driver/WizardMachine.rc b/mozilla/cck/driver/WizardMachine.rc
index 48a24e5a06d..b6520ace9aa 100644
--- a/mozilla/cck/driver/WizardMachine.rc
+++ b/mozilla/cck/driver/WizardMachine.rc
@@ -520,7 +520,7 @@ BEGIN
BEGIN
MENUITEM "&Edit Pref", ID_EDITPREFITEM
MENUITEM "&Add Pref", ID_ADDPREF
- MENUITEM "&Delete Pref", ID_DELPREF
+ MENUITEM "&Delete Pref\tDel", ID_DELPREF
MENUITEM SEPARATOR
MENUITEM "&Find Pref\tCtrl+F", ID_FINDPREF
MENUITEM "Find &Next\tF3", ID_FINDNEXTPREF
diff --git a/mozilla/cck/driver/dlgeditprefstr.cpp b/mozilla/cck/driver/dlgeditprefstr.cpp
index 97681423c0d..bcd2dcb1334 100644
--- a/mozilla/cck/driver/dlgeditprefstr.cpp
+++ b/mozilla/cck/driver/dlgeditprefstr.cpp
@@ -24,6 +24,7 @@ CDlgEditPrefStr::CDlgEditPrefStr(CWnd* pParent /*=NULL*/)
m_bLocked = FALSE;
m_bValue = FALSE;
m_bManage = FALSE;
+ m_bLockable = TRUE;
//}}AFX_DATA_INIT
}
@@ -167,5 +168,5 @@ void CDlgEditPrefStr::EnableControls(BOOL bEnable)
m_editValue.EnableWindow(bEnable);
m_listValue.EnableWindow(bEnable);
m_checkValue.EnableWindow(bEnable);
- m_checkLocked.EnableWindow(bEnable);
+ m_checkLocked.EnableWindow(bEnable && m_bLockable);
}
\ No newline at end of file
diff --git a/mozilla/cck/driver/dlgeditprefstr.h b/mozilla/cck/driver/dlgeditprefstr.h
index 89d587c1914..a65452f3a58 100644
--- a/mozilla/cck/driver/dlgeditprefstr.h
+++ b/mozilla/cck/driver/dlgeditprefstr.h
@@ -37,6 +37,7 @@ public:
BOOL m_bLocked;
BOOL m_bValue;
BOOL m_bManage;
+ BOOL m_bLockable;
//}}AFX_DATA
diff --git a/mozilla/cck/driver/prefeditview.cpp b/mozilla/cck/driver/prefeditview.cpp
index 86e4f9917b6..7940660caeb 100644
--- a/mozilla/cck/driver/prefeditview.cpp
+++ b/mozilla/cck/driver/prefeditview.cpp
@@ -724,6 +724,7 @@ void CPrefEditView::EditSelectedPrefsItem()
dlg.m_strSelectedChoice = pe->GetSelectedChoiceString();
dlg.m_bChoose = pe->IsChoose();
dlg.m_bManage = pe->IsManage();
+ dlg.m_bLockable = pe->IsLockable();
if (dlg.DoModal() == IDOK)
diff --git a/mozilla/cck/ib/ib.cpp b/mozilla/cck/ib/ib.cpp
index ff3435165a4..da4e076b8a6 100644
--- a/mozilla/cck/ib/ib.cpp
+++ b/mozilla/cck/ib/ib.cpp
@@ -667,7 +667,7 @@ int ModifyHashedPref(CString HashedPrefsFile, CString PrefName, CString NewPrefV
else
{
// Create a plain text prefs with only a comment.
- CreateNewFile(PlainTextPrefsFile, "/* prefs configured in NADK */\n");
+ CreateNewFile(PlainTextPrefsFile, "/* prefs configured in NCADM */\n");
}
// Modify the pref.
@@ -876,7 +876,7 @@ BOOL ModifyUserJS(CString HashedPrefsFile, CString jsSourceFile)
else
{
// Create a plain text prefs with only a comment.
- CreateNewFile(PlainTextPrefsFile, "/* protected prefs */\n");
+ CreateNewFile(PlainTextPrefsFile, "/* prefs configured in NCADM */\n");
}
// find the block and replace it with the contents of the source file
@@ -1039,7 +1039,7 @@ BOOL MarkCFGVersion(CString HashedPrefsFile, CString versionTxt)
else
{
// Create a plain text prefs with only a comment.
- CreateNewFile(PlainTextPrefsFile, "/* protected prefs */\n");
+ CreateNewFile(PlainTextPrefsFile, "/* prefs configured in NCADM */\n");
}
// find the block and replace it with the contents of the source file
diff --git a/mozilla/cck/prefs/prefselement.cpp b/mozilla/cck/prefs/prefselement.cpp
index f09a9f69451..a4dc7a1c719 100644
--- a/mozilla/cck/prefs/prefselement.cpp
+++ b/mozilla/cck/prefs/prefselement.cpp
@@ -165,6 +165,10 @@ void CPrefElement::startElement(const char* name, const char** atts)
// and a value.
ASSERT(atts[0] && atts[1] && atts[2] && atts[3] && !atts[4]);
+ // If you get this assertion, you have too many elements inside
+ // a element. Boost MAX_CHOICES in prefselement.h.
+ ASSERT( m_iChoices < MAX_CHOICES);
+
int i = 0;
while(atts[i])
{
diff --git a/mozilla/cck/prefs/prefselement.h b/mozilla/cck/prefs/prefselement.h
index 524ebf01611..6dcfe8c8908 100644
--- a/mozilla/cck/prefs/prefselement.h
+++ b/mozilla/cck/prefs/prefselement.h
@@ -9,7 +9,8 @@
#pragma once
#endif // _MSC_VER > 1000
-#define MAX_CHOICES 20
+// Number of elements in a element.
+#define MAX_CHOICES 80
class CPrefElement
{