Closed
Bug 411254
Opened 17 years ago
Closed 13 years ago
categories have no default colors
Categories
(Calendar :: Calendar Frontend, defect)
Calendar
Calendar Frontend
Tracking
(Not tracked)
RESOLVED
FIXED
1.7
People
(Reporter: andreas.treumann, Assigned: Fallen)
Details
Attachments
(1 file, 4 obsolete files)
15.35 KB,
patch
|
Taraman
:
review+
|
Details | Diff | Splinter Review |
STEPS TO REPRODUCE:
===================
- create a new event and add a default category
RESULT:
=======
- the category has no color
EXPECTED RESULT:
================
- the category should have a default color
REPRODUCIBLE:
=============
- always
Updated•17 years ago
|
Flags: blocking-calendar0.8+
Updated•17 years ago
|
Flags: blocking-calendar0.8+ → wanted-calendar0.8+
Comment 1•17 years ago
|
||
Not going to happen for 0.8.
Flags: wanted-calendar0.8+ → wanted-calendar0.8-
Updated•16 years ago
|
Status: NEW → ASSIGNED
Updated•16 years ago
|
Assignee: nobody → firefox
Comment 2•16 years ago
|
||
This is proposed set of colors for categories to get this bug going; I've used names for colors so it would be easier to discuss / review.
Attachment #342509 -
Flags: review?(mschroeder)
Updated•16 years ago
|
Attachment #342509 -
Flags: ui-review?(christian.jansen)
Comment 3•16 years ago
|
||
I doubt that this will work in non English localizations of Lightning. All localizations define their own category names that won't match the rules added in the patch.
Comment 4•16 years ago
|
||
Comment on attachment 342509 [details] [diff] [review]
Proposed fix v1
This needs ui-review before review, and I second Stefan's concerns.
Attachment #342509 -
Flags: review?(mschroeder)
Comment 5•16 years ago
|
||
(In reply to comment #3)
> I doubt that this will work in non English localizations of Lightning. All
> localizations define their own category names that won't match the rules added
> in the patch.
doh! I've missed this...
[quote=lightning.js]
> // categories settings
> // XXX One day we might want to move this to a locale specific file
> // and include a list of locale specific default categories
> pref("calendar.categories.names", "");
then this comment can be removed
(\calendar\locales\en-US\chrome\calendar\categories.properties lists default localizable categories)
so there are 2 options:
1. based on localizations add locale specific categories to lightning.js - rather not a good idea...
2. make every category a pref with localizeable name - name of the pref would be constant but display differently depending on the locale - my patch would fit this case
3. other ?
Assignee | ||
Comment 6•16 years ago
|
||
Personally I'd find it quite spiffy if the default color for a category would be set dynamically based on a hash of the characters used. This way if you have two installations of lightning/sunbird, you don't need to set the same color again, you just need to have the same category name.
Not sure how that fits in with default pref values and such.
Comment 7•16 years ago
|
||
I like your idea but I also second your concerns, so maybe it should only apply to the new (added by the user) categories ?
Until there are test results it's hard to say if we would be happy from the outcome (auto-colored default categories).
I think we must answer the question - do we (and how much) care for the color every category has by default (there might be some "standards" in this matter, I'm not sure) or not.
Comment 8•16 years ago
|
||
Comment on attachment 342509 [details] [diff] [review]
Proposed fix v1
Thanks for the patch. I personally do not like the used colors. They are in parts too flashy.
I suggest to use a more softened color palette
anniversary #E5696F
birthday #F4985A
business #FFCC53
calls #FFF95B
clients #88D27F
competition #7FD3B7
customer #779EDA
favorites #C587A5
follow up #C7CEDE
gifts #4B5978
holidays #000000
ideas #B14F0D
issues #AB7B05
meeting #999400
miscellaneous #2C6625
personal #5F6C3A
projects #AD7FA8
public holiday #75507B
status #5C3566
suppliers #729FCF
travel #3465A4
vacation #204A87
ui- due to the used colors.
Attachment #342509 -
Flags: ui-review?(christian.jansen) → ui-review-
Assignee | ||
Comment 9•16 years ago
|
||
We might want to be careful with using default colors. If we decide to later use dynamic colors, then users might wonder why their category colors changed after upgrading.
I doubt there is a standard for a such color hashing algorithm, I've seen pidgin im hash chat user-colors, so maybe we should take a look how they do it. Maybe we can even use their algorithm directly.
Another thing that strikes me is the color picker. Obviously the color picker won't be able to allow you to choose those colors, so users might wonder how to return to the default colors (no, using about:config is not an option ;-). I have some graveyard code that allows specifying the colors used for the colorpicker widget, I might be able to dig that up so we can allow the users to pick those colors. It might also be a valuable addition to toolkit.
Comment 10•16 years ago
|
||
Assigning to nobody - I'm not working on this and it has to be decided how to tackle this (my proposal would be to use good static defaults - maybe even investigate what colors for categories other calendaring soft is using and use hashes for new user added categories - proposed colors; also there's still the l10n case - comment #5)
Nominating wanted, as it would be good to have for 1.0
Assignee: firefox → nobody
Status: ASSIGNED → NEW
Flags: wanted-calendar1.0?
Updated•16 years ago
|
Flags: wanted-calendar1.0?
Flags: wanted-calendar1.0+
Flags: wanted-calendar0.8-
Assignee | ||
Comment 11•15 years ago
|
||
I have a WiP patch for this. It converts the category name to a color using a simple hash algorithm. I have used the colors available in the default color picker to make sure the user has no surprises when choosing colors.
The patch allows generating default colors even for localized builds by executing a specific .js file via xpcshell. I need to think about how to best include the prefs in our files.
Assignee: nobody → philipp
Status: NEW → ASSIGNED
Assignee | ||
Comment 12•15 years ago
|
||
This patch takes care. The default set of category colors calculated by this algorithm isn't exactly the prettiest, but there's not much we can do if we use an automatic creation algorithm. Even if we do change the algorithm for the en-US colors, the localized colors might not look that good then either.
What we could do is reduce the set of colors for automatic generation, but that means its more probable, that two default categories get the same color.
Attachment #342509 -
Attachment is obsolete: true
Attachment #429109 -
Flags: review?(ssitter)
Comment 13•15 years ago
|
||
Comment on attachment 429109 [details] [diff] [review]
Fix - v2
Taking the review from Stefan.
Although I'm not done yet some comments on the patch:
Patch is bitrotten, change from Bug 349987 has to included into Patch. I will post an updated version hereafter.
I think we should move categories.properties to subdir /preferences. Although categories strings may occur outside preferences until now they don't. Since category handling code for runtime is in the views, I believe this properties file will not be used outside prefs. In fact this was the first place I searched for the file.
why don't you put the new helper-functions in calUtils.jsm i.s.o. calUtils.js?
Quote from calUtils.jsm:
>// New code must not load/import calUtils.js, but should use calUtils.jsm.>
>
>EXPORTED_SYMBOLS = ["cal"];
>let cal = {
> // new code should land here,
Attachment #429109 -
Flags: review?(ssitter) → review?(Mozilla)
Comment 14•15 years ago
|
||
The debitrotted patch with change from Bug 349987
Attachment #429109 -
Attachment is obsolete: true
Attachment #437607 -
Flags: review?(Mozilla)
Attachment #429109 -
Flags: review?(Mozilla)
Comment 15•15 years ago
|
||
Comment on attachment 437607 [details] [diff] [review]
Fix v2.1
When unchecking the "use Color" box in the edit Dialog I get the following error in the error-console:
>Warning: Expected color but found 'null'. Error in parsing value for 'background-color'. Declaration dropped.
>Source File: chrome://calendar/content/preferences/editCategory.xul
>Line: 0
This is similar to Bug 349987.
>+ if (!customColorSelected && document.getElementById("useColor").checked) {
>+ // Color is wanted, choose the color based on the category name's hash.
>+ document.getElementById("categoryColor").color = cal.hashColor(newValue);
>+ }
This function is not working for me. No automatic color is assigned.
No error message is shown.
>+/**
>+ * Handler function to be called when the color picker's color has been changed.
>+ */
>+function colorPickerChanged() {
>+ document.getElementById('useColor').checked = true;
>+ customColorSelected = true;
>+}
This function is not called by the color-picker:
> <colorpicker id="categoryColor"
> type="button"
> onchange="document.getElementById('useColor').checked=true;"/>
If we touch editCategory.xul here, shouldn't we fix the indentation on this file as well in this patch?
with this and the stuff from comment #13: r-
Attachment #437607 -
Flags: review?(Mozilla) → review-
Comment 16•13 years ago
|
||
Please see also https://bugzilla.mozilla.org/show_bug.cgi?id=733338
Assignee | ||
Comment 17•13 years ago
|
||
Wow this is an old bug, I just found it again! It shouldn't be too hard to update the code, I'm on it as soon as I get my builds back up. I've filed bug 736280 to get new colors into the toolkit colorpicker widget.
Assignee | ||
Comment 18•13 years ago
|
||
(In reply to Markus Adrario [:Taraman] from comment #15)
> Comment on attachment 437607 [details] [diff] [review]
> Fix v2.1
>
> When unchecking the "use Color" box in the edit Dialog I get the following
> error in the error-console:
> >Warning: Expected color but found 'null'. Error in parsing value for 'background-color'. Declaration dropped.
> >Source File: chrome://calendar/content/preferences/editCategory.xul
> >Line: 0
> This is similar to Bug 349987.
Where it was likely fixed, doesn't show up anymore.
>
> >+ if (!customColorSelected && document.getElementById("useColor").checked) {
> >+ // Color is wanted, choose the color based on the category name's hash.
> >+ document.getElementById("categoryColor").color = cal.hashColor(newValue);
> >+ }
> This function is not working for me. No automatic color is assigned.
> No error message is shown.
For me a color is assigned as soon as I click add a new category, enter a name for the category and then click the "use color" checkbox. I guess this could be changed to change the color while the user is entering the text though to make it more obvious.
> If we touch editCategory.xul here, shouldn't we fix the indentation on this
> file as well in this patch?
Fixed in debitrot.
Assignee | ||
Comment 19•13 years ago
|
||
Attachment #437607 -
Attachment is obsolete: true
Attachment #606384 -
Flags: review?(Mozilla)
Comment 20•13 years ago
|
||
Comment on attachment 606384 [details] [diff] [review]
Fix - v3
I found some problems in this patch.
>function doOK() {
> let color = document.getElementById("useColor").checked ?
> document.getElementById("categoryColor") :
> null;
.color missing in line 3 should read:
document.getElementById("categoryColor").color :
else no color gets assigned and outcome is always "transparent"
in editCategory.xul, the colorpicker onchange has to be updated:
><colorpicker id="categoryColor"
> type="button"
> onchange="document.getElementById('useColor').checked=true;"/>
onchange="colorPickerChanged()"/>
else the mentioned Function is never called.
style nit in jar.mn:
> content/calendar/preferences/editCategory.xul (content/preferences/editCategory.xul)
>+content/calendar/preferences/editCategory.js (content/preferences/editCategory.js)
> content/calendar/preferences/general.js (content/preferences/general.js)
indentation should be fixed
With these fixed, the patch works as expected.
I'll upload a fixed patch.
r-
Attachment #606384 -
Flags: review?(Mozilla) → review-
Comment 21•13 years ago
|
||
Patch updated to fix the above mentioned problems.
r=markus
Attachment #606384 -
Attachment is obsolete: true
Attachment #616535 -
Flags: review+
Comment 22•13 years ago
|
||
Comment on attachment 616535 [details] [diff] [review]
fix V3.1
Markus, Philipp: What is the status of this patch? checkin-needed?
Assignee | ||
Comment 23•13 years ago
|
||
Looks pretty much checkin-needed to me :-)
Keywords: checkin-needed
Comment 24•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 1.7
You need to log in
before you can comment on or make changes to this bug.
Description
•