diff --git a/mozilla/cck/docs/prefstree/PrefsTreeEx3.jpg b/mozilla/cck/docs/prefstree/PrefsTreeEx3.jpg index a07c735bd4d..e5d3aa1d133 100644 Binary files a/mozilla/cck/docs/prefstree/PrefsTreeEx3.jpg and b/mozilla/cck/docs/prefstree/PrefsTreeEx3.jpg differ diff --git a/mozilla/cck/docs/prefstree/PrefsTreeFileFormat.htm b/mozilla/cck/docs/prefstree/PrefsTreeFileFormat.htm index 5c2ece5536d..d49f0984552 100644 --- a/mozilla/cck/docs/prefstree/PrefsTreeFileFormat.htm +++ b/mozilla/cck/docs/prefstree/PrefsTreeFileFormat.htm @@ -1,372 +1,424 @@ - + + + + - Structure of the Pref Editor XML File for the PrefsTree Widget -
Mention the XSL stylesheet.    30 Jan 2002
-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
-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 -structure of the tree control. This XML file includes information on each -pref, including its name, its default value, a description of it, etc. It -also includes structure for how these prefs are grouped in the tree control. -The name of the XML file is specified in the .ini section for the PrefsTree -Widget. The default file must be located in the same directory as the WIZARDMACHINE.EXE -. When used, a copy of the file is saved in the working config directory. -This copy contains the changes made by the CCK/Factory user, and is used -by the install builder to write preferences in the install image. A SCRIPT.IB -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
-

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

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 -in this file are prefs which can be set in advance and saved to a .cfg or .jsc file. -Note that this excludes some prefs which might be found in a profile prefs.js -, such as those prefs which define specific mail and news accounts, servers, -and identities. These pref names are generated on the fly by the client. -If this XML is to be expanded for use in other ways, for example as described -in Bugzilla bug 17199 -, new tags could be added to each pref to indicate whether or not it could -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.
- - - -

Problem Prefs

- - - - - -

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 of the XML File

-

XSL Stylesheet

-There may be a reference to an XSL stylesheet at the start of the XML file. For example, <?xml-stylesheet type="text/xsl" href="metaprefs.xsl"?> - . This is not used by the Pref Editor. It is used when the XML file is loaded -into a Gecko browser (or IE 6) to format the XML into an HTML table that -is easy to read. It is included so that the XML file may be self-documenting -for internal use. The referenced XSL file must also exist in the same directory -for the stylesheet to work.
- -

Examples

The easiest way to understand the format of the XML is to look at some short examples.
-

Example1

- - -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" -type="bool" lockable="true" description="When the app starts, open -a browser.">
-    <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 1 - + + + Structure of the Pref Editor XML File for the PrefsTree Widget + + +
Removed MANAGE element. Added REMOTEADMIN +element and default attribute    13 Feb 2002
+Mention the XSL stylesheet.    30 Jan 2002
+ 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
+ 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 structure of the tree control. This XML file includes information on +each pref, including its name, its default value, a description of it, etc. +It also includes structure for how these prefs are grouped in the tree control. +The name of the XML file is specified in the .ini section for the PrefsTree +Widget. The default file must be located in the same directory as the +WIZARDMACHINE.EXE . When used, a copy of the file is saved in the working +config directory. This copy contains the changes made by the CCK/Factory +user, and is used by the install builder to write preferences in the install +image. A SCRIPT.IB 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
+ +

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.
+ +

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 in this file are prefs which can be set in advance and +saved to a .cfg or .jsc file. Note that this excludes some prefs which might +be found in a profile prefs.js , such as those prefs which define +specific mail and news accounts, servers, and identities. These pref names +are generated on the fly by the client. If this XML is to be expanded for +use in other ways, for example as described in +Bugzilla bug 17199 , new tags could be added to each pref to indicate +whether or not it could 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.
+ + + +

Problem Prefs

+ + + +

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 of the XML File

+ +

XSL Stylesheet

+ There may be a reference to an XSL stylesheet at the start of the XML file. +For example, <?xml-stylesheet type="text/xsl" href="metaprefs.xsl"?> + . This is not used by the Pref Editor. It is used when the XML file is +loaded into a Gecko browser (or IE 6) to format the XML into an HTML table +that is easy to read. It is included so that the XML file may be self-documenting +for internal use. The referenced XSL file must also exist in the same directory +for the stylesheet to work.
+ +

Examples

+The easiest way to understand the format of the XML is to look at some short +examples.
+ +

Example1

+ 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" +type="bool" default="true" lockable="true" description="When the app starts, +open a browser.">
+     <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 1 +

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">
-  <PREFSGROUP uiname="Group 1">
-    <PREF uiname="Autoload What's Related" prefname="browser.related.autoload" -type="int" lockable="true" description="A good description -of this pref goes here.">
-      <CHOICES>
-        <CHOICE uiname="Always" value="0"/>
-        <CHOICE uiname="After First Use" value="1"/>
-        <CHOICE uiname="Never" value="2"/>
-      </CHOICES>
-      <VALUE>0</VALUE>
-      <LOCKED>false</LOCKED>
    </PREF>
-    <PREF uiname="Start Page" prefname="browser.startup.page" -type="int" lockable="true" description="Display this page when + 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">
+   <PREFSGROUP uiname="Group 1">
+     <PREF uiname="Autoload What's Related" prefname="browser.related.autoload" +type="int" default="0" lockable="true" description="A good description of +this pref goes here.">
+       <CHOICES>
+         <CHOICE uiname="Always" value="0"/>
+         <CHOICE uiname="After First +Use" value="1"/>
+         <CHOICE uiname="Never" value="2"/>
+       </CHOICES>
+       <VALUE>0</VALUE>
+       <LOCKED>false</LOCKED>
+    </PREF>
+     <PREF uiname="Start Page" prefname="browser.startup.page" +type="int" lockable="true" default="0" description="Display this page when Navigator starts up.">
-      <CHOICES>
-        <CHOICE uiname="Blank Page" value="0"/>
-        <CHOICE uiname="Home Page" value="1"/>
-        <CHOICE uiname="Last Page Visited" value="2"/>
-      </CHOICES>
-      <VALUE>0</VALUE>
-      <LOCKED>false</LOCKED>
    </PREF>
-  </PREFSGROUP>
-  <PREFSGROUP uiname="Group 2">
-    <PREF uiname="Bookmarks" prefname="browser.toolbars.showbutton.bookmarks" -type="bool" lockable="true" description="Show Booksmarks button on browser -toolbar.">
-      <VALUE>true</VALUE>
-      <LOCKED>false</LOCKED>
    </PREF>
-    <PREF uiname="Go" prefname="browser.toolbars.showbutton.go" -type="bool" lockable="true" description="Show Go button on browser toolbar.">
-      <VALUE>true</VALUE>
-      <LOCKED>false</LOCKED>
    </PREF>
-  </PREFSGROUP>
-</PREFSGROUP>
-
-
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.
- -
- -Example 2 - -
- +       <CHOICES>
+         <CHOICE uiname="Blank Page" value="0"/>
+         <CHOICE uiname="Home Page" value="1"/>
+         <CHOICE uiname="Last Page Visited" value="2"/>
+       </CHOICES>
+       <VALUE>0</VALUE>
+       <LOCKED>false</LOCKED>
+    </PREF>
+   </PREFSGROUP>
+   <PREFSGROUP uiname="Group 2">
+     <PREF uiname="Bookmarks" prefname="browser.toolbars.showbutton.bookmarks" +type="bool" default="true" lockable="true" description="Show Booksmarks button +on browser toolbar.">
+       <VALUE>true</VALUE>
+       <LOCKED>false</LOCKED>
+    </PREF>
+     <PREF uiname="Go" prefname="browser.toolbars.showbutton.go" +type="bool" default="true" lockable="true" description="Show Go button on +browser toolbar.">
+       <VALUE>true</VALUE>
+       <LOCKED>false</LOCKED>
+    </PREF>
+   </PREFSGROUP>
+ </PREFSGROUP>
+
+
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.
+
+ Example 2 +
+

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.
- - + 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.
- -
- + 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
-
Example
-
Description
-
uiname
-
uiname="Netscape Preferences"
-
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.
-
Attribute
+
Example
+
Description
+
uiname
+
uiname="Netscape Preferences"
+
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>.
- -
- + 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
+
Example
+
Description
+
uiname
+
uiname="Open Browser on Startup"
+
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. By convention, capitalize the words as if +this were a title.
+
prefname
+
prefname="general.startup.browser"This is the real name of the pref as it is used by +the Netscape client products.
+
type
+
type="bool"
+
Must be one of int, bool +, or string. This determines how the pref will be edited +in the Pref Editor and how it is written to the prefs file in the install +image.
+
+ bool Pref Editor user allowed to select “true” or +“false” from a drop-down. No quotes are used when writing the pref in the +pref file. For example, pref("general.startup.browser", true);
+
+ int  Pref Editor user allowed to enter integers. +No quotes are used when writing the pref in the pref file. For example, +pref("network.proxy.socks_version", 5);
+
+ string  Pref Editor user may enter whatever he +likes. Quotes are used when writing the pref in the pref file. For example, + pref("general.useragent.vendorComment", "AK-MyISP");
+
lockable
+
lockable="true"
+
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.
+
description
+
description="When the application starts, open +a browser window."
+
This is some text which further describes the pref +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. Use proper sentences.
+
Attribute
-
Example
-
Description
-
useradded
+
useradded="true"
+
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.
+
uiname
+
default
+
default="true"
uiname="Open Browser on Startup"
-
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. By convention, capitalize the words as if this were a title.
-
prefname
-
prefname="general.startup.browser"This is the real name of the pref as it is used by the Netscape client products.
-
type
-
type="bool"
-
Must be one of int, bool, or string. This determines how the pref will be edited in the Pref Editor and how it is written to the prefs file in the install image.
-
- bool Pref Editor user allowed to select “true” or “false” -from a drop-down. No quotes are used when writing the pref in the pref file. -For example, pref("general.startup.browser", true);
-
- int  Pref Editor user allowed to enter integers. No quotes are used when writing the pref in the pref file. For example, pref("network.proxy.socks_version", 5);
-
- string  Pref Editor user may enter whatever he likes. Quotes are used when writing the pref in the pref file. For example, pref("general.useragent.vendorComment", "AK-MyISP");
+
The Netscape default value for this pref. That is, +the value that the pref will get in set to in the code or in some default +.js file.
lockable
-
lockable="true"
-
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.
-
description
-
description="When the application starts, open a browser window."
-
This is some text which further describes the pref -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. Use proper sentences.
-
useradded
-
useradded="true"
-
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.
-
- +

<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.
- -
- -Example 3 - -
- + 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.
+
+ Example 3 +
+

<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>.
- -
- + 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
-
Example
-
Description
-
uiname
-
uiname="Blank Page"
-
The text of this choice in the list box for this choice.
-
value
-
value="0"
-
The value saved in the <VALUE> element for the <PREF> when the pref is edit and this choice is selected in the list box. The type of the value must be correct for the enclosing <PREF> element.
-
Attribute
+
Example
+
Description
+
uiname
+
uiname="Blank Page"
+
The text of this choice in the list box for this +choice.
+
value
+
value="0"
+
The value saved in the <VALUE> element +for the <PREF> when the pref is edit and this choice is selected +in the list box. The type of the value must be correct for the enclosing + <PREF> element.
+
- +

<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.
- + 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">.
- -

<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 + 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">.
+ +

<REMOTEADMIN>

+ 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 <REMOTEADMIN> + tag is present, and its value is true, then this pref will be written to +the autoconfig.jsc prefs file when the XML is processed by the install builder +app.
+ + + diff --git a/mozilla/cck/driver/WizardMachine.aps b/mozilla/cck/driver/WizardMachine.aps index 1432d942d83..f980f32e75a 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 b6520ace9aa..b822c06f2c0 100644 --- a/mozilla/cck/driver/WizardMachine.rc +++ b/mozilla/cck/driver/WizardMachine.rc @@ -236,31 +236,31 @@ BEGIN ES_READONLY | WS_VSCROLL,WS_EX_DLGMODALFRAME END -IDD_EDITPREF DIALOG DISCARDABLE 0, 0, 294, 198 +IDD_EDITPREF DIALOG DISCARDABLE 0, 0, 294, 207 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Pref Properties" FONT 8, "MS Sans Serif" BEGIN - CONTROL "Manage this pref (save in .cfg or .jsc file)", - IDC_MANAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,27,102, - 245,10 + GROUPBOX "About",IDC_STATIC,7,7,280,74 RTEXT "Pref Name:",IDC_STATIC,15,18,68,8 LTEXT "",IDC_PREFNAME,93,18,184,8 RTEXT "Description:",IDC_STATIC,15,33,68,8 LTEXT "",IDC_DESCRIPTION,93,33,184,45 - RTEXT "Pref Value:",IDC_STATIC,15,127,68,8 + GROUPBOX "Properties",IDC_STATIC,7,86,280,91 CONTROL "",IDC_VALCHECK,"Button",BS_AUTOCHECKBOX | NOT - WS_VISIBLE | WS_TABSTOP,93,127,184,10 - EDITTEXT IDC_VALUE,93,124,184,14,ES_AUTOHSCROLL - COMBOBOX IDC_VALLIST,93,124,184,67,CBS_DROPDOWNLIST | CBS_SORT | + WS_VISIBLE | WS_TABSTOP,20,102,184,10 + EDITTEXT IDC_VALUE,20,99,184,14,ES_AUTOHSCROLL + COMBOBOX IDC_VALLIST,20,99,184,67,CBS_DROPDOWNLIST | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP - RTEXT "Pref Lock:",IDC_STATIC,15,144,68,8 - CONTROL "Locked from user changes",IDC_LOCKED,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,93,144,184,10 - DEFPUSHBUTTON "OK",IDOK,88,177,50,14 - PUSHBUTTON "Cancel",IDCANCEL,154,177,50,14 - GROUPBOX "About",IDC_STATIC,7,7,280,74 - GROUPBOX "Properties",IDC_STATIC,7,86,280,81 + PUSHBUTTON "Reset to Netscape Default",IDC_DEFAULT,19,121,92,14 + CONTROL "Lock this setting (do not allow user to change)", + IDC_LOCKED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,144, + 184,10 + CONTROL "Allow remote administration of this setting", + IDC_REMOTEADMIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20, + 160,184,10 + DEFPUSHBUTTON "OK",IDOK,88,186,50,14 + PUSHBUTTON "Cancel",IDCANCEL,154,186,50,14 END IDD_ADDPREF DIALOG DISCARDABLE 0, 0, 294, 165 @@ -465,7 +465,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 287 TOPMARGIN, 7 - BOTTOMMARGIN, 191 + BOTTOMMARGIN, 200 END IDD_ADDPREF, DIALOG diff --git a/mozilla/cck/driver/dlgeditprefstr.cpp b/mozilla/cck/driver/dlgeditprefstr.cpp index bcd2dcb1334..e69775e6185 100644 --- a/mozilla/cck/driver/dlgeditprefstr.cpp +++ b/mozilla/cck/driver/dlgeditprefstr.cpp @@ -23,7 +23,7 @@ CDlgEditPrefStr::CDlgEditPrefStr(CWnd* pParent /*=NULL*/) m_strValue = _T(""); m_bLocked = FALSE; m_bValue = FALSE; - m_bManage = FALSE; + m_bRemoteAdmin = FALSE; m_bLockable = TRUE; //}}AFX_DATA_INIT } @@ -37,8 +37,8 @@ void CDlgEditPrefStr::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_VALCHECK, m_checkValue); DDX_Control(pDX, IDC_VALUE, m_editValue); DDX_Control(pDX, IDC_LOCKED, m_checkLocked); - DDX_Control(pDX, IDC_MANAGE, m_checkManage); - DDX_Check(pDX, IDC_MANAGE, m_bManage); + DDX_Control(pDX, IDC_REMOTEADMIN, m_checkRemoteAdmin); + DDX_Check(pDX, IDC_REMOTEADMIN, m_bRemoteAdmin); DDX_Text(pDX, IDC_DESCRIPTION, m_strDescription); DDX_Text(pDX, IDC_PREFNAME, m_strPrefName); DDX_Text(pDX, IDC_VALUE, m_strValue); @@ -52,7 +52,7 @@ BEGIN_MESSAGE_MAP(CDlgEditPrefStr, CDialog) //{{AFX_MSG_MAP(CDlgEditPrefStr) ON_WM_CREATE() ON_WM_CANCELMODE() - ON_BN_CLICKED(IDC_MANAGE, OnManage) + ON_BN_CLICKED(IDC_DEFAULT, OnResetDefault) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -65,9 +65,6 @@ int CDlgEditPrefStr::OnCreate(LPCREATESTRUCT lpCreateStruct) return -1; SetWindowText(m_strTitle); - - - return 0; } @@ -76,9 +73,6 @@ BOOL CDlgEditPrefStr::PreCreateWindow(CREATESTRUCT& cs) { BOOL retval = CDialog::PreCreateWindow(cs); - // TODO: Add your specialized code here and/or call the base class - - return retval; } @@ -122,7 +116,6 @@ BOOL CDlgEditPrefStr::OnInitDialog() m_checkValue.ShowWindow(SW_HIDE); } - EnableControls(m_bManage); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -155,18 +148,23 @@ void CDlgEditPrefStr::OnOK() CDialog::OnOK(); } -void CDlgEditPrefStr::OnManage() +void CDlgEditPrefStr::OnResetDefault() { - m_bManage = m_checkManage.GetCheck(); - EnableControls(m_bManage); - + if (m_bChoose) + { + m_listValue.SelectString(0, m_strDefault); + } + + else if (m_strType.CompareNoCase("bool") == 0) + { + if (m_strDefault.CompareNoCase("true") == 0) + m_checkValue.SetCheck(TRUE); + } + + else // string or int type + { + m_editValue.SetWindowText(m_strDefault); + } } -void CDlgEditPrefStr::EnableControls(BOOL bEnable) -{ - m_editValue.EnableWindow(bEnable); - m_listValue.EnableWindow(bEnable); - m_checkValue.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 a65452f3a58..64bf9fc7cca 100644 --- a/mozilla/cck/driver/dlgeditprefstr.h +++ b/mozilla/cck/driver/dlgeditprefstr.h @@ -22,6 +22,7 @@ public: CString m_strTitle; CDlgEditPrefStr(CWnd* pParent = NULL); // standard constructor BOOL m_bChoose; + CString m_strDefault; // Dialog Data //{{AFX_DATA(CDlgEditPrefStr) @@ -29,14 +30,14 @@ public: CComboBox m_listValue; CButton m_checkValue; CButton m_checkLocked; - CButton m_checkManage; + CButton m_checkRemoteAdmin; CEdit m_editValue; CString m_strDescription; CString m_strPrefName; CString m_strValue; BOOL m_bLocked; BOOL m_bValue; - BOOL m_bManage; + BOOL m_bRemoteAdmin; BOOL m_bLockable; //}}AFX_DATA @@ -57,12 +58,10 @@ protected: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); virtual BOOL OnInitDialog(); virtual void OnOK(); - afx_msg void OnManage(); + afx_msg void OnResetDefault(); //}}AFX_MSG DECLARE_MESSAGE_MAP() -private: - void EnableControls(BOOL bEnable); }; //{{AFX_INSERT_LOCATION}} diff --git a/mozilla/cck/driver/prefeditview.cpp b/mozilla/cck/driver/prefeditview.cpp index 7940660caeb..6dd2dff7f19 100644 --- a/mozilla/cck/driver/prefeditview.cpp +++ b/mozilla/cck/driver/prefeditview.cpp @@ -310,13 +310,14 @@ HTREEITEM CPrefEditView::InsertPrefElement(CPrefElement* pe, HTREEITEM group) int imageIndex = 0; // tree ctrl images int imageIndexSel = bm_closedFolder; - if (!pe->IsManage()) + if (pe->IsDefault()) imageIndexSel = imageIndex = bm_unlockedPadGray; - else if (pe->IsLocked()) - imageIndexSel = imageIndex = bm_lockedPad; else imageIndexSel = imageIndex = bm_unlockedPad; + if (pe->IsLocked()) + imageIndexSel = imageIndex = bm_lockedPad; + CTreeCtrl &treeCtrl = GetTreeCtrl(); HTREEITEM hNewItem = treeCtrl.InsertItem(pe->GetPrettyNameValueString(), imageIndex, imageIndexSel, group, TVI_LAST); @@ -723,9 +724,12 @@ void CPrefEditView::EditSelectedPrefsItem() dlg.m_pstrChoices = pe->GetChoiceStringArray(); dlg.m_strSelectedChoice = pe->GetSelectedChoiceString(); dlg.m_bChoose = pe->IsChoose(); - dlg.m_bManage = pe->IsManage(); + dlg.m_bRemoteAdmin = pe->IsRemoteAdmin(); dlg.m_bLockable = pe->IsLockable(); - + if (pe->IsChoose()) + dlg.m_strDefault = pe->GetDefaultChoiceString(); + else + dlg.m_strDefault = pe->GetDefaultValue(); if (dlg.DoModal() == IDOK) { @@ -736,7 +740,7 @@ void CPrefEditView::EditSelectedPrefsItem() // set '0' or '1' or whatever the value for the selected choice. pe->SetPrefValue(dlg.m_strValue); pe->SetLocked(dlg.m_bLocked); - pe->SetManage(dlg.m_bManage); + pe->SetRemoteAdmin(dlg.m_bRemoteAdmin); // Adjust the tree control to reflect the changes. treeCtrl.SetItemText(hTreeCtrlItem, pe->GetPrettyNameValueString()); @@ -744,13 +748,13 @@ void CPrefEditView::EditSelectedPrefsItem() int imageIndex = 0; // tree ctrl images int imageIndexSel = 0; - if (!pe->IsManage()) + if (pe->IsDefault()) imageIndexSel = imageIndex = bm_unlockedPadGray; - else if (pe->IsLocked()) - imageIndexSel = imageIndex = bm_lockedPad; else imageIndexSel = imageIndex = bm_unlockedPad; + if (pe->IsLocked()) + imageIndexSel = imageIndex = bm_lockedPad; treeCtrl.SetItemImage(hTreeCtrlItem, imageIndex, imageIndexSel); diff --git a/mozilla/cck/driver/resource.h b/mozilla/cck/driver/resource.h index 6e015e250d3..d9aa56bd374 100644 --- a/mozilla/cck/driver/resource.h +++ b/mozilla/cck/driver/resource.h @@ -48,6 +48,8 @@ #define IDC_PREFTYPE_BOOL 1017 #define IDC_PREFTYPEGROUP 1018 #define IDC_MANAGE 1019 +#define IDC_DEFAULT 1020 +#define IDC_REMOTEADMIN 1021 #define IDC_PROGRESS1 1036 #define IDC_PROGESSTEXT_STATIC 1037 #define IDD_HELP_DLG 1537 @@ -66,7 +68,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 148 #define _APS_NEXT_COMMAND_VALUE 32779 -#define _APS_NEXT_CONTROL_VALUE 1020 +#define _APS_NEXT_CONTROL_VALUE 1022 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/mozilla/cck/ib/ib.cpp b/mozilla/cck/ib/ib.cpp index 90096ebfb9f..633e6bba395 100644 --- a/mozilla/cck/ib/ib.cpp +++ b/mozilla/cck/ib/ib.cpp @@ -44,6 +44,7 @@ CString nscpxpiPath; CString cdshellPath; CString outputPath; CString xpiDstPath; +CString remoteAdminFile; // variables for CCK Linux build CString curPlatform; @@ -56,7 +57,8 @@ CString templinuxDir; CString tarfile; // For use with PrefsTree -CString gstrPrefFile; +CString gstrCFGPrefFile; +CString gstrPlainPrefFile; CString gstrInstallFile; WIDGET *tempWidget; @@ -731,31 +733,45 @@ void endElement(void *userData, const char *name) if (stricmp(name, "PREF") == 0) { - // Only write those prefs that have been marked as "Manage." Ignore all others. - BOOL bManage = ((CPrefElement*)userData)->IsManage(); - if (!bManage) - return; - - // Write the pref element to prefs file. - ExtractXPIFile(gstrInstallFile, gstrPrefFile); - + // If locked, write to the .cfg file. Don't care if it's default or not. BOOL bLocked = ((CPrefElement*)userData)->IsLocked(); - - // Should go into a hashed file if prefs file is .cfg. - if (gstrPrefFile.Find(".cfg") > 0) + BOOL bDefault = ((CPrefElement*)userData)->IsDefault(); + if (bLocked) { - // hashed - ModifyHashedPref(gstrPrefFile, ((CPrefElement*)userData)->GetPrefName(), ((CPrefElement*)userData)->GetPrefValue(), ((CPrefElement*)userData)->GetPrefType(), bLocked); - + // Write the pref element to prefs file. + ExtractXPIFile(gstrInstallFile, gstrCFGPrefFile); + ModifyHashedPref(gstrCFGPrefFile, ((CPrefElement*)userData)->GetPrefName(), ((CPrefElement*)userData)->GetPrefValue(), ((CPrefElement*)userData)->GetPrefType(), TRUE); } - else + + // If not locked, and not NS default, write to the .js file. + else if (!bDefault) { - // not hashed + ExtractXPIFile(gstrInstallFile, gstrPlainPrefFile); + if ((((CPrefElement*)userData)->GetPrefType() == "int") || (((CPrefElement*)userData)->GetPrefType() == "bool")) - ModifyJS2(gstrPrefFile, ((CPrefElement*)userData)->GetPrefName(), ((CPrefElement*)userData)->GetPrefValue(), bLocked); + ModifyJS2(gstrPlainPrefFile, ((CPrefElement*)userData)->GetPrefName(), ((CPrefElement*)userData)->GetPrefValue(), FALSE); else // string - ModifyJS(gstrPrefFile, ((CPrefElement*)userData)->GetPrefName(), ((CPrefElement*)userData)->GetPrefValue(), bLocked); + ModifyJS(gstrPlainPrefFile, ((CPrefElement*)userData)->GetPrefName(), ((CPrefElement*)userData)->GetPrefValue(), FALSE); + } + + // If remote admin, write to the .jsc file. + BOOL bRemoteAdmin = ((CPrefElement*)userData)->IsRemoteAdmin(); + if (bRemoteAdmin) + { + if (!FileExists(remoteAdminFile)) + { + CString strURL = GetGlobal("RemoteAdminURL"); + CString strComment; + strComment.Format("/* This Remote Admin file should be placed at %s */\n", strURL); + CreateNewFile(remoteAdminFile, strComment); + } + + if ((((CPrefElement*)userData)->GetPrefType() == "int") || (((CPrefElement*)userData)->GetPrefType() == "bool")) + ModifyJS2(remoteAdminFile, ((CPrefElement*)userData)->GetPrefName(), ((CPrefElement*)userData)->GetPrefValue(), TRUE); + + else // string + ModifyJS(remoteAdminFile, ((CPrefElement*)userData)->GetPrefName(), ((CPrefElement*)userData)->GetPrefValue(), TRUE); } } @@ -763,12 +779,11 @@ void endElement(void *userData, const char *name) } -// Converts the strPrefFile (netscp6.cfg) to a plain text file (autoconfig.jsc) in the output directory, then sets the -// autoadmin.global_config_url in strPrefFile to strURL. -BOOL ConvertToRemoteAdmin(CString strURL, CString strPrefFile, CString strRemoteAdminFile) +// Sets the autoadmin.global_config_url in strPrefFile to strURL. +BOOL ConfigureRemoteAdmin(CString strURL, CString strPrefFile) { - ASSERT(!strURL.IsEmpty() && !strPrefFile.IsEmpty() && !strRemoteAdminFile.IsEmpty()); - if (strURL.IsEmpty() || strPrefFile.IsEmpty() || strRemoteAdminFile.IsEmpty()) + ASSERT(!strURL.IsEmpty() && !strPrefFile.IsEmpty()); + if (strURL.IsEmpty() || strPrefFile.IsEmpty()) return FALSE; ASSERT(strPrefFile.Find(".cfg") > 0); @@ -776,14 +791,6 @@ BOOL ConvertToRemoteAdmin(CString strURL, CString strPrefFile, CString strRemote return FALSE; - // Convert the strPrefFile to plain text remote admin file. - CString strPlainTextFile = outputPath + "\\" + strRemoteAdminFile; - - if (!UnHash(strPrefFile, strPlainTextFile)) - return FALSE; - - // Delete the original pref file and replace it with a file with only remote admin entries. - DeleteFile(strPrefFile); ModifyHashedPref(strPrefFile, "autoadmin.global_config_url", strURL, "string", TRUE); CString strFailoverCached = GetGlobal("RemoteAdminFailoverToCached"); @@ -805,12 +812,10 @@ BOOL ConvertToRemoteAdmin(CString strURL, CString strPrefFile, CString strRemote // This function can easily be rewriten to parse the XML file by hand if it // needs to be ported to a non-MS OS. The XML is pretty simple. -BOOL ProcessPrefsTree(CString strPrefsTreeFile, CString strPrefFile, CString strInstallFile) +BOOL ProcessPrefsTree(CString strPrefsTreeFile) { - gstrPrefFile = strPrefFile; - gstrInstallFile = strInstallFile; - + //AfxMessageBox("Pause", MB_OK); XML_Parser parser = XML_ParserCreate(NULL); XML_SetElementHandler(parser, startElement, endElement); @@ -1252,14 +1257,6 @@ int interpret(char *cmd) newvalue = (char *)(LPCTSTR) GetGlobal(value); } - // Search for a locked pref variable for this pref name. - // It will be a global with name: "lockpref."+prefname - CString LockPrefGlobalName; - LockPrefGlobalName.Format("lockpref.%s", value); - CString LockedPrefCheckboxVal = GetGlobal(LockPrefGlobalName); - BOOL bLockPref = (LockedPrefCheckboxVal.Compare("1") == 0); // "1" if locked - - if (!xpiname || !xpifile || !entity || !newvalue) return TRUE;//*** Changed FALSE to TRUE @@ -1270,19 +1267,19 @@ int interpret(char *cmd) ExtractJARFile(xpiname, jarname, xpifile); if (strcmp(cmdname, "modifyHashedPrefString") == 0) - ModifyHashedPref(xpifile,entity,newvalue, "string", bLockPref); + ModifyHashedPref(xpifile,entity,newvalue, "string", TRUE); else if (strcmp(cmdname, "modifyHashedPrefInt") == 0) - ModifyHashedPref(xpifile,entity,newvalue, "int", bLockPref); + ModifyHashedPref(xpifile,entity,newvalue, "int", TRUE); else if (strcmp(cmdname, "modifyHashedPrefBool") == 0) - ModifyHashedPref(xpifile,entity,newvalue, "bool", bLockPref); + ModifyHashedPref(xpifile,entity,newvalue, "bool", TRUE); else if (strcmp(cmdname, "modifyJS") == 0) - ModifyJS(xpifile,entity,newvalue, bLockPref); + ModifyJS(xpifile,entity,newvalue, FALSE); else if (strcmp(cmdname, "modifyProperties") == 0) ModifyProperties(xpifile,entity,newvalue); else if (strcmp(cmdname, "modifyJS1") == 0) - ModifyJS1(xpifile,entity,newvalue, bLockPref); + ModifyJS1(xpifile,entity,newvalue, FALSE); else if (strcmp(cmdname, "modifyJS2") == 0) - ModifyJS2(xpifile,entity,newvalue, bLockPref); + ModifyJS2(xpifile,entity,newvalue, FALSE); else { // If the browser window's title bar text field is empty, @@ -1299,13 +1296,21 @@ int interpret(char *cmd) else if (strcmp(cmdname, "processPrefsTree") == 0) { - char *prefsTreeFile = strtok(NULL, ",)"); - char *installFile = strtok(NULL, ",)"); - char *prefFile = strtok(NULL, ",)"); + char *prefsTreeFile = strtok(NULL, ",)"); CString fileWithPath = configPath + "\\" + prefsTreeFile; - ProcessPrefsTree(fileWithPath, prefFile, installFile); + + char *installFile = strtok(NULL, ",)"); + gstrInstallFile = installFile; + + char *cfgPrefFile = strtok(NULL, ",)"); + gstrCFGPrefFile = cfgPrefFile; + + char *plainPrefFile = strtok(NULL, ",)"); + gstrPlainPrefFile = plainPrefFile; + + ProcessPrefsTree(fileWithPath); } - else if (strcmp(cmdname, "convertToRemoteAdmin") == 0) + else if (strcmp(cmdname, "configureRemoteAdmin") == 0) { char *vConvert = strtok(NULL, ",)"); // if set, then do the convert to remote admin if (vConvert[0] == '%') @@ -1336,12 +1341,11 @@ int interpret(char *cmd) } char *prefFile = strtok(NULL, ",)"); - char *remoteAdminFile = strtok(NULL, ",)"); - if (!prefFile || !remoteAdminFile) + if (!prefFile) return TRUE; - ConvertToRemoteAdmin(url, prefFile, remoteAdminFile); + ConfigureRemoteAdmin(url, prefFile); } else if (strcmp(cmdname, "modifyUserJS") == 0) @@ -1917,6 +1921,7 @@ int StartIB(/*CString parms, WIDGET *curWidget*/) outputPath = configPath + "\\Output"; cdPath = configPath + "\\Output\\Core"; cdshellPath = configPath + "\\Output\\Shell"; + remoteAdminFile = outputPath + "\\autoconfig.jsc"; networkPath = configPath + "\\Network"; tempPath = configPath + "\\Temp"; iniDstPath = cdPath + "\\config.ini"; diff --git a/mozilla/cck/prefs/prefselement.cpp b/mozilla/cck/prefs/prefselement.cpp index a4dc7a1c719..426c2cc9536 100644 --- a/mozilla/cck/prefs/prefselement.cpp +++ b/mozilla/cck/prefs/prefselement.cpp @@ -43,12 +43,13 @@ void CPrefElement::ReInit() { m_strUIName = ""; m_strPrefValue = ""; + m_strDefaultValue = ""; m_strPrefName = ""; m_strType = ""; m_strDescription = ""; m_bLocked = FALSE; m_bLockable = TRUE; - m_bManage = FALSE; + m_bRemoteAdmin = FALSE; m_bUserAdded = FALSE; m_iChoices = 0; } @@ -86,6 +87,22 @@ CString CPrefElement::GetSelectedChoiceString() } +// Get the ui name of the default choice for this pref. +CString CPrefElement::GetDefaultChoiceString() +{ + ASSERT( m_iChoices <= MAX_CHOICES); + + for (int i = 0; i < m_iChoices; i++) + { + if (m_astrChoiceVal[i].CompareNoCase(m_strDefaultValue) == 0) + return m_astrChoiceName[i]; + } + + return ""; + +} + + // Get the value from the choice string. See also GetSelectedChoiceString(). CString CPrefElement::GetValueFromChoiceString(CString strChoiceString) { @@ -140,6 +157,8 @@ void CPrefElement::startElement(const char* name, const char** atts) m_strPrefName = attrVal; else if (stricmp(attrName, "type") == 0) m_strType = attrVal; + else if (stricmp(attrName, "default") == 0) + m_strDefaultValue = attrVal; else if (stricmp(attrName, "lockable") == 0) m_bLockable = (stricmp(attrVal, "true") == 0); else if (stricmp(attrName, "description") == 0) @@ -196,7 +215,7 @@ void CPrefElement::startElement(const char* name, const char** atts) return; } - else if (stricmp(name, "MANAGE") == 0) + else if (stricmp(name, "REMOTEADMIN") == 0) { if (!m_bPrefOpen) return; @@ -245,7 +264,7 @@ void CPrefElement::characterData(const char* s, int len) // Done with the data for this tag. m_strCurrentTag = ""; } - else if (m_strCurrentTag.CompareNoCase("MANAGE") == 0) + else if (m_strCurrentTag.CompareNoCase("REMOTEADMIN") == 0) { CString tmp; char* p = tmp.GetBufferSetLength(len); @@ -254,7 +273,7 @@ void CPrefElement::characterData(const char* s, int len) tmp.TrimLeft("\r\n"); tmp.TrimRight("\r\n"); - m_bManage = (tmp.CompareNoCase("true") == 0); + m_bRemoteAdmin = (tmp.CompareNoCase("true") == 0); // Done with the data for this tag. m_strCurrentTag = ""; @@ -268,6 +287,11 @@ void CPrefElement::endElement(const char* name) if (stricmp(name, "PREF") == 0) { m_bPrefOpen = FALSE; + + // Minimal check for required attributes. + ASSERT(!m_strPrefName.IsEmpty()); + ASSERT(!m_strType.IsEmpty()); + } else if (stricmp(name, "CHOICES") == 0) { @@ -323,9 +347,10 @@ CString CPrefElement::XML(int iIndentSize, int iIndentLevel) int iIndentSpaces = iIndentSize * iIndentLevel; CString strRet; - strRet.Format("%*s\n", + strRet.Format("%*s\n", iIndentSpaces, " ", GetUIName(), GetPrefName(), GetPrefType(), - IsLockable()?"true":"false", GetPrefDescription(), IsUserAdded()?"true":"false"); + GetDefaultValue(), IsLockable()?"true":"false", GetPrefDescription(), + IsUserAdded()?"true":"false"); CString strTmp; if (IsChoose()) @@ -349,7 +374,7 @@ CString CPrefElement::XML(int iIndentSize, int iIndentLevel) strTmp.Format("%*s%s\n", iIndentSpaces + iIndentSize, " ", IsLocked()?"true":"false"); strRet += strTmp; - strTmp.Format("%*s%s\n", iIndentSpaces + iIndentSize, " ", IsManage()?"true":"false"); + strTmp.Format("%*s%s\n", iIndentSpaces + iIndentSize, " ", IsRemoteAdmin()?"true":"false"); strRet += strTmp; CString strCloseTag; @@ -358,4 +383,9 @@ CString CPrefElement::XML(int iIndentSize, int iIndentLevel) strRet += strCloseTag; return strRet; +} + +BOOL CPrefElement::IsDefault() +{ + return (m_strDefaultValue.Compare(m_strPrefValue) == 0); } \ No newline at end of file diff --git a/mozilla/cck/prefs/prefselement.h b/mozilla/cck/prefs/prefselement.h index 6dcfe8c8908..f6bcb2db128 100644 --- a/mozilla/cck/prefs/prefselement.h +++ b/mozilla/cck/prefs/prefselement.h @@ -21,23 +21,27 @@ public: CString GetPrettyNameValueString(); CString GetSelectedChoiceString(); + CString GetDefaultChoiceString(); BOOL IsChoose(); BOOL IsLockable() {return m_bLockable; }; BOOL IsLocked() { return m_bLocked; }; void SetLocked(BOOL bLocked) { m_bLocked = bLocked; }; - BOOL IsManage() { return m_bManage; }; - void SetManage(BOOL bManage) { m_bManage = bManage; }; + BOOL IsRemoteAdmin() {return m_bRemoteAdmin; }; + void SetRemoteAdmin(BOOL bRemoteAdmin) { m_bRemoteAdmin = bRemoteAdmin; }; BOOL IsUserAdded() { return m_bUserAdded; }; void SetUserAdded(BOOL bUserAdded) { m_bUserAdded = bUserAdded; }; CString GetUIName() { return m_strUIName; }; CString GetPrefValue() { return m_strPrefValue; }; void SetPrefValue(CString strValue); + CString GetDefaultValue() { return m_strDefaultValue; }; + void SetDefaultValue(CString strDefaultValue) { m_strDefaultValue = strDefaultValue; }; + BOOL IsDefault(); CString GetPrefName() { return m_strPrefName; }; CString GetPrefType() { return m_strType; }; CString GetPrefDescription() { return m_strDescription; }; CString GetValueFromChoiceString(CString strChoiceString); BOOL FindString(CString strFind); - CString* GetChoiceStringArray() {return m_astrChoiceName; }; + CString* GetChoiceStringArray() { return m_astrChoiceName; }; CString XML(int iIndentSize, int iIndentLevel); // Called from XML parser. @@ -58,11 +62,12 @@ private: CString m_strPrefName; CString m_strDescription; CString m_strType; + CString m_strDefaultValue; BOOL m_bLocked; BOOL m_bLockable; - BOOL m_bManage; BOOL m_bUserAdded; + BOOL m_bRemoteAdmin; CString m_astrChoiceName[MAX_CHOICES+1]; // Array of possible choice names. Last is empty string. CString m_astrChoiceVal[MAX_CHOICES+1]; // Matching values for the above names.