Bug 395216

Summary: Some calendar colors are not the same as set on the caldav
Product: [Applications] korganizer Reporter: Olivier Churlaud <olivier>
Component: groupwareAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: GIT (master)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Olivier Churlaud 2018-06-10 16:15:56 UTC
Some of my calendars do not display the color I set on the caldav server.

Some other have the correct color.

It is shown correctly on other clients (like DAVdroid).
Comment 1 Olivier Churlaud 2018-06-10 16:52:17 UTC
Some debugging in kde-runtime/resources/dav/resource/davgroupwareresource.cpp, line 1366,

DEBUG QColor(ARGB 1, 0.8, 0.192157, 0.486275)  <= CORRECT
DEBUG QColor(ARGB 1, 0.470588, 0.905882, 0.454902) <= CORRECT
DEBUG QColor(ARGB 1, 0.701961, 0, 1) <= WRONG: should be (1, 1, 0.701961, 0)
DEBUG QColor(ARGB 0.623529, 0.160784, 0.67451, 1) <= WRONG: should be (1, 0.623529, 0.160784, 0.67451)

It seems that there is a rotation somewhere in the colors
Comment 2 Olivier Churlaud 2018-06-10 17:30:05 UTC
Ok, the bug is in KDAv, in src/common/davcollectionsfetchjob.cpp, 

line 305:  color.setNamedColor(colorValue);

This waits a color of the type ARGB, whereas the dav proides a RGBA color, as specified by W3 [1].

Is it a Qt bug or should we implement it ourselves here? 

[1] https://www.w3.org/TR/2011/REC-css3-color-20110607/#foreground
Comment 3 Olivier Churlaud 2018-06-12 19:04:20 UTC
Git commit 082b7e2a734ecace2e79cd2bad4d635aea7352cc by Olivier CHURLAUD.
Committed on 12/06/2018 at 19:00.
Pushed by ochurlaud into branch 'master'.

Assign colors correctly also when the alpha channel is set.

DAV colors are in the form RGBA, whereas QColor takes them as ARGB.

Differential Revision: https://phabricator.kde.org/D13468

M  +8    -1    src/common/davcollectionsfetchjob.cpp

https://commits.kde.org/kdav/082b7e2a734ecace2e79cd2bad4d635aea7352cc