Closed Bug 265232 Opened 20 years ago Closed 20 years ago

Make sure we respect locked prefs throughout Mailnews UI

Categories

(SeaMonkey :: MailNews: Account Configuration, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: iannbugzilla, Assigned: iannbugzilla)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 7 obsolete files)

This is the mailnews part of bug 264675
Attached patch Work in progress 0.1 (obsolete) — Splinter Review
So far:
* Implements missing pref locking in pref-notifications
* Persists the last sound directory and passes it in to the filepicker in
pref-notifications
* Filters by .wav / .wave in pref-notifications
* Implements missing pref locking in pref-receipts
Assignee: sspitzer → bugzilla
Status: NEW → ASSIGNED
Blocks: 70538
Summary: Make sure we respect locked prefs throughout UI → Make sure we respect locked prefs throughout Mailnews UI
This patch:
* Implements missing pref locking in pref-mailnews
* Implements missing pref locking in pref-viewing_messages - color picker not
being disabled correctly
* Implements missing pref locking in pref-notifications
* Persists the last sound directory and passes it in to the filepicker in
pref-notifications
* Filters by .wav / .wave in pref-notifications
* Implements missing pref locking in pref-labels - color picker not being
disabled correctly and make restore defaults not try and overwrite locked prefs

* Implements missing pref locking in pref-receipts
* Implements missing pref locking in pref-offline
* Implements missing pref locking in pref-composing_messages - color picker not
being disabled correctly
Attachment #162712 - Attachment is obsolete: true
Attachment #162776 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #162776 - Flags: review?(neil.parkwaycc.co.uk)
As per v0.1 patch but also:
* Ensures sound.url is a URL
Attachment #162776 - Attachment is obsolete: true
Attachment #162856 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #162856 - Flags: review?(neil.parkwaycc.co.uk)
pref-notifications changes are now in patch on bug 266192
Attachment #162856 - Attachment is obsolete: true
Attachment #163487 - Flags: review?(neil.parkwaycc.co.uk)
Product: Browser → Seamonkey
Attachment #163487 - Flags: review?(neil.parkwaycc.co.uk)
Attached patch mailnews lockpref patch v0.2b (obsolete) — Splinter Review
Changes since v0.2a
* Removed use of global variables when not needed
* Moved lockpref changes into if statement for pref-viewing_messages.xul
Attachment #163487 - Attachment is obsolete: true
Attachment #170164 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #170164 - Flags: review?(neil.parkwaycc.co.uk)
Changes since v0.2b
* Colorpickers can be locked and use prefs now (since bug 260335 landed) so
take advantage of that.
* Removed unused JS from pref-mailnews.js
Attachment #170164 - Attachment is obsolete: true
Attachment #170314 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 170314 [details] [diff] [review]
mailnews lockpref and colorpicker fix up patch v0.2c

> /* Function to restore pref values to application defaults */
> function restoreColorAndDescriptionToDefaults()
> {
>   var prefColor;
>   var description;
>   var pickerColor;
>   var dataColor;
>   var labelDescription;
Some of these are no longer used...

>   var prefService = Components.classes["@mozilla.org/preferences-service;1"]
>                               .getService(Components.interfaces.nsIPrefService);
>   var prefs = prefService.getDefaultBranch(null);
[In theory you could get branches for the descriptions and labels]

>-	for(var i = 1; i <= 5; i++)
>-  {
>+  for (var i = 1; i <= 5; i++) {
Changing brace style is bad form (unless there are mixed styles).

>+    if (labelDescription.getAttribute("disabled") != "true") {
Consider !labelDescription.disabled (also applies to the colour).

>+      description = prefs.getComplexValue("mailnews.labels.description." + i,
>+                                           Components.interfaces.nsIPrefLocalizedString).data;
>+      labelDescription.value = description;
Interesting that you didn't just write labelDescription.value =
prefs.getComplexValue(...).data; like you did for the colour.

>     <colorpicker
>         class="small-margin"
>         type="button"
>-        id="labelColorPicker1"
>-        palettename="standard"
>-        onchange="setColorWell(this);"/>
>-    <data
>         id="label1Color"
>-        pref="true"
>-        preftype="color"
>-        prefstring="mailnews.labels.color.1"
>-        prefattribute="value"
>-        wsm_attributes="value"/>
>+        palettename="standard"
>+        prefstring="mailnews.labels.color.1"/>
Swapping the id and palettename lines makes the diff smaller ;-)

>+  notInToCcLabel.disabled = disableAll;
>+  outsideDomainLabel.disabled = disableAll;
>+  otherCasesLabel.disabled = disableAll;
Strange; we don't normally disable labels, do we?

>     if (aCheckbox.checked)
>-      aField.removeAttribute("disabled");
>+      if (!parent.hPrefWindow.getPrefIsLocked(aField.getAttribute("prefstring")))
>+        aField.removeAttribute("disabled");
>     else
>       aField.setAttribute("disabled", "true");
At last, a bug! The else now mismatches the if.
Attachment #170314 - Flags: review?(neil.parkwaycc.co.uk) → review-
Changes since v0.2c
* In pref-labels.js made suggested changes to unused variables,
getDefaultBranch and setting of labelDescription.value
* In pref-labels.xul reordered id and palettename as suggested
* In pref-offline.xul amended enableField to only use two variables and got rid
of if statements for how aField.disabled was set

wrt disabling labels:
a) Looks better if we do
b) Matches behaviour of when a radiogroup is disabled.
Attachment #170314 - Attachment is obsolete: true
Attachment #170343 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 170343 [details] [diff] [review]
fix for colorpickers and mailnews lockprefs v0.2d

>+    var aField = document.getElementById("offlineCompactFolderMin");
>+    aField.disabled = (!aCheckbox.checked ||
>+                       parent.hPrefWindow.getPrefIsLocked(aField.getAttribute("prefstring")));
> 
>     if (!aField.disabled && setFocus)
>       aField.focus();
Might be worth renaming that variable - only arguments are supposed to have a
leading "a".

(In reply to comment #8)
>wrt disabling labels:
>a) Looks better if we do
But still different to when the three menulists are locked.
>b) Matches behaviour of when a radiogroup is disabled.
But menulists have labels that display the current value as well as labels that
describe the menulist; radio buttons only have the latter.

Still, I'm happy with leaving it at the status quo.
Attachment #170343 - Flags: review?(neil.parkwaycc.co.uk) → review+
Changes since v0.2d
* Changed aField to folderMin as per reviewer's request

Carrying forward r+ and request sr
Attachment #170343 - Attachment is obsolete: true
Attachment #170393 - Flags: superreview?(bienvenu)
Attachment #170393 - Flags: review+
Attachment #170393 - Flags: superreview?(bienvenu) → superreview+
Comment on attachment 170393 [details] [diff] [review]
mailnew colorpickers/lockprefs fix v0.2e (Checked in)

Checked in
Attachment #170393 - Attachment description: mailnew colorpickers/lockprefs fix v0.2e → mailnew colorpickers/lockprefs fix v0.2e (Checked in)
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: