Closed
Bug 340229
Opened 18 years ago
Closed 18 years ago
Removing a color completely from a category doesn't update the rule
Categories
(Calendar :: Sunbird Only, defect)
Calendar
Sunbird Only
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: mattwillis, Assigned: jminta)
Details
Attachments
(1 file, 2 obsolete files)
4.49 KB,
patch
|
mattwillis
:
first-review+
mvl
:
second-review+
|
Details | Diff | Splinter Review |
In testing bug 333923 jminta noticed that removing a color completely from a category doesn't update the rule. It doesn't look to be a regression.
Assignee | ||
Comment 1•18 years ago
|
||
When we catch the error for an empty preference, simply returning leaves the old rule. This patch makes sure we reset the border style.
Comment 2•18 years ago
|
||
Comment on attachment 225796 [details] [diff] [review] set border to none Setting the border style to 'none' is wrong. Themes might give items a border. (maybe the default theme even does, i'm not sure) We somehow need to reset or remove the rule.
Attachment #225796 -
Flags: first-review?(mvl) → first-review-
Assignee | ||
Comment 3•18 years ago
|
||
Now we actually find the rule, and in the case that the pref doesn't exist, we delete the rule.
Attachment #225796 -
Attachment is obsolete: true
Attachment #227754 -
Flags: first-review?(mvl)
Comment 4•18 years ago
|
||
Comment on attachment 227754 [details] [diff] [review] delete rule >Index: resources/content/calendarManagement.js >+ var ruleIndex; > function getRuleForObject(name) > { >+ ruleIndex = i; My c++ side doesn't like the use of a global varialbe as a return parameter (or in this case, some var in a bigger scope). I think we should look for a different way to return the value.
Assignee | ||
Comment 5•18 years ago
|
||
(In reply to comment #4) > (From update of attachment 227754 [details] [diff] [review] [edit]) > My c++ side doesn't like the use of a global varialbe as a return parameter (or > in this case, some var in a bigger scope). I think we should look for a > different way to return the value. > Would function getRuleDataForObject(aName) { ... return {index: i, rule: rule}; } be an acceptable solution for you or do i need to do deeper refactoring?
Comment 6•18 years ago
|
||
(In reply to comment #5) > Would > function getRuleDataForObject(aName) { > ... > return {index: i, rule: rule}; > } > be an acceptable solution for you or do i need to do deeper refactoring? > Yeah, that will do. JS makes that easy, so let's just use it. (And it agrees with my old perl background :) )
Comment 7•18 years ago
|
||
Comment on attachment 227754 [details] [diff] [review] delete rule minussing, to get it out of my queue.
Attachment #227754 -
Flags: first-review?(mvl) → first-review-
Assignee | ||
Comment 8•18 years ago
|
||
This patch still deletes the rule, but the function in question how now changed significantly. rule and ruleIndex are now in the right scope, so we don't need to go extra stuff with assignment/returning. Testing this bug, however, identified a problem in getPrefSafe. If you call deleteBranch, it will still return a valid value for the type of that pref. So, we need to put the get*Pref() call into a try block anyway.
Attachment #227754 -
Attachment is obsolete: true
Attachment #231518 -
Flags: second-review?(mvl)
Attachment #231518 -
Flags: first-review?(mattwillis)
Reporter | ||
Comment 9•18 years ago
|
||
Comment on attachment 231518 [details] [diff] [review] still delete rule, and fix getPrefSafe r=lilmatt
Attachment #231518 -
Flags: first-review?(mattwillis) → first-review+
Comment 10•18 years ago
|
||
Comment on attachment 231518 [details] [diff] [review] still delete rule, and fix getPrefSafe > function getPrefSafe(aPrefName, aDefault) { >+ var getFunc; > switch (prefB.getPrefType(aPrefName)) { > case nsIPrefBranch.PREF_BOOL: >- return prefB.getBoolPref(aPrefName); >+ getFunc = prefB.getBoolPref; >+ break; >+ try { >+ return getFunc(aPrefName); Nice use of javascript features, but for readability, just put the entire swtich block in the try block, and don't mess with a getFunc. r=mvl with that changed.
Attachment #231518 -
Flags: second-review?(mvl) → second-review+
Assignee | ||
Comment 11•18 years ago
|
||
Patch checked in.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 12•18 years ago
|
||
verified with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060902 Calendar/0.3a2+
Status: RESOLVED → VERIFIED
Updated•18 years ago
|
Whiteboard: [litmus testcase wanted]
You need to log in
before you can comment on or make changes to this bug.
Description
•