Closed
Bug 181973
Opened 22 years ago
Closed 21 years ago
Many pref panels need to reverse the sense of boolean prefs
Categories
(SeaMonkey :: Preferences, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: neil, Assigned: neil)
Details
(Keywords: polish)
Attachments
(1 file, 3 obsolete files)
5.25 KB,
patch
|
alecf
:
superreview+
|
Details | Diff | Splinter Review |
The scripts & plugins page is a good example of this; the checkbox listitems
control prefs that need to be set to the inverse of the checkbox value.
Assignee | ||
Comment 1•22 years ago
|
||
Create a preftype of "inverse" which is the inverse of the "boolean" preftype.
Assignee | ||
Updated•22 years ago
|
Attachment #107463 -
Flags: review?(ben)
Assignee | ||
Updated•22 years ago
|
Assignee | ||
Updated•22 years ago
|
Attachment #107463 -
Flags: superreview?(jaggernaut)
Comment 2•22 years ago
|
||
I like the idea, but the name "inverse" seems too generic. Up to Ben though,
it's his code.
Assignee | ||
Comment 3•22 years ago
|
||
I did at one point consider !boolean but callion said it was worse...
Comment 4•22 years ago
|
||
FWIW, I suggested a new attribute to the effect of: prefinverse="true|false"
with false being the default value....
Assignee | ||
Comment 5•22 years ago
|
||
I've come up with a better way of handling this, via GetFields().
Assignee | ||
Comment 6•22 years ago
|
||
Because it's now possible to hook into the prefs between the front and back end
using GetFields and SetFields this simplfies the code.
Attachment #107463 -
Attachment is obsolete: true
Assignee | ||
Updated•22 years ago
|
Attachment #121893 -
Flags: superreview?(jaggernaut)
Attachment #121893 -
Flags: review?(caillon)
Comment 7•22 years ago
|
||
Comment on attachment 121893 [details] [diff] [review]
Use GetFields() and SetFields() to invert the prefs
>Index: pref-scripts.js
>===================================================================
>+function InvertBoolPrefs(aDataObject){
>+ var listitems = document.getElementById('allowScripts').childNodes;
>+ for (var i = 0; i < listitems.length; ++i) {
I know bz checked in a fix some time ago for normal DOM content lists to not
re-iterate all the elements each time .length is called, but I don't think
anything was ever done like that for XUL since it has it's own content model
(ie, doesn't inherit from nsGenericElement). Could you please double check on
that? And switch to |var len = listitems.length; for (var i = 0; i <
listitems.length; ++i)| if it's not lazy counting?
>+ var id = listitems[i].id;
>+ aDataObject[id].checked = !aDataObject[id].checked;
>+ }
> }
Comment 8•22 years ago
|
||
Comment on attachment 121893 [details] [diff] [review]
Use GetFields() and SetFields() to invert the prefs
Okay, I found out your usage of .length is fine. r=caillon
Attachment #121893 -
Flags: review?(caillon) → review+
Comment 9•21 years ago
|
||
Comment on attachment 107463 [details] [diff] [review]
Proposed patch
removing obsolete review requests
Attachment #107463 -
Flags: superreview?(jag)
Attachment #107463 -
Flags: review?(bugs)
Assignee | ||
Updated•21 years ago
|
Attachment #121893 -
Flags: superreview?(jag) → superreview?(alecf)
Comment 10•21 years ago
|
||
Comment on attachment 121893 [details] [diff] [review]
Use GetFields() and SetFields() to invert the prefs
I've got to be honest, I think the InvertBoolPrefs to be kind of a hack. I much
prefer prefinverse=true (or prefreverse=true)
I don't feel like GetFields and SetFields was not meant to be used this way -
the list of fields is easy to get and set, and to add this odd layer where
you're blindly flippping values in the aDataObject.. you're depending on the
data object being set up in just the right way.. it seems fragile. At the very
least, instead of InvertBoolPrefs, you should have a SetInvertedBoolPrefs() and
GetInvertedBoolPrefs() which retrieve the values from the dom nodes. That would
be far less fragile.. but still the simplest solution in my mind is the
prefinverted=true - frankly I'm amazed we don't have that already.
Assignee | ||
Comment 11•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #134632 -
Flags: review?(caillon)
Comment 12•21 years ago
|
||
nice, see how much cleaner that made it? :) I'll let neil review first, but I
love all that code that's been yanked.
Comment 13•21 years ago
|
||
Comment on attachment 134632 [details] [diff] [review]
Define a new prefinverse="true" attribute
Great. I like this much better. r=caillon
Attachment #134632 -
Flags: review?(caillon) → review+
Assignee | ||
Updated•21 years ago
|
Attachment #134632 -
Flags: superreview?(alecf)
Comment 14•21 years ago
|
||
Comment on attachment 134632 [details] [diff] [review]
Define a new prefinverse="true" attribute
sr=alecf
Attachment #134632 -
Flags: superreview?(alecf) → superreview+
Assignee | ||
Comment 15•21 years ago
|
||
Fix checked in.
Comment 16•21 years ago
|
||
Comment on attachment 121893 [details] [diff] [review]
Use GetFields() and SetFields() to invert the prefs
I'm marking this obsolete since we went with a different option.
Attachment #121893 -
Attachment is obsolete: true
Attachment #121893 -
Flags: superreview?(alecf)
Comment 17•21 years ago
|
||
This caused bug 227623
Assignee | ||
Comment 18•21 years ago
|
||
Really marking fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 19•21 years ago
|
||
Attachment #134632 -
Attachment is obsolete: true
Assignee | ||
Updated•21 years ago
|
Assignee: bugs → neil.parkwaycc.co.uk
Status: RESOLVED → ASSIGNED
Resolution: FIXED → ---
Assignee | ||
Comment 20•21 years ago
|
||
Comment on attachment 146978 [details] [diff] [review]
Make reversed="true" work for <listitem type="checkbox"/>
So, after all that, it turns out that ordinary checkboxes had this
reversed="true" attribute all along :-[
Attachment #146978 -
Attachment description: Make reversed="true" work → Make reversed="true" work for <listitem type="checkbox"/>
Attachment #146978 -
Flags: superreview?(alecf)
Attachment #146978 -
Flags: review?(caillon)
Assignee | ||
Comment 21•21 years ago
|
||
Comment on attachment 146978 [details] [diff] [review]
Make reversed="true" work for <listitem type="checkbox"/>
caillon gave r= over irc.
Comment 22•21 years ago
|
||
Comment on attachment 146978 [details] [diff] [review]
Make reversed="true" work for <listitem type="checkbox"/>
heh. oops.
sr=alecf
Attachment #146978 -
Flags: superreview?(alecf) → superreview+
Assignee | ||
Comment 23•21 years ago
|
||
Really fixed this time ;-)
Status: ASSIGNED → RESOLVED
Closed: 21 years ago → 21 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Attachment #146978 -
Flags: review?(caillon)
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•