Eventviews: associate calendar color to remoteID rather than ID.
Needs ReviewPublic

Authored by dfaure on Oct 29 2018, 10:21 AM.

Details

Summary

This way, recreating the davgroupware resource won't lose all colors.
Same thing when the server temporarily "forgets" that those folders
exist, as we had recently on a kolab server.

I'm assuming that all resources actually set a remote ID.

Test Plan

Removing colors from eventviewsrc, and assigning colors to calendars in korganizer,
I can now see this in eventviewsrc:
https://caldav.kdab.com/calendars/dfaure@kdab.com/0a9636a30e83-8c02805b740e-0a0dee75/=126,140,141
and restarting korganizer shows the colors I picked.

Restoring an old backup of eventviewsrc with collection IDs as key, those colors still work
(so the compat code works).

In all of this, what is still missing is to upload user-chosen colors to the DAV server...

Diff Detail

Branch
Applications/18.08
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 4309
Build 4327: arc lint + arc unit
dfaure requested review of this revision.Oct 29 2018, 10:21 AM
dfaure created this revision.

Seems ok to me but as I haven't checked on my Nextcloud instance, so I can't really say it's good.

If you really want a double check, I can find time to do it next week

I'm having second thoughts about this one.

  1. because a remoteId isn't globally unique among resources, so this would need to be prefixed with a resource ID (and then recreating the resource wouldn't find the settings again, defeating the main point of this patch).
  2. because it seems that the actual bug I'm trying to fix (colors lost when recreating the DAV resource) would be best fixed by "uploading" the user-chosen colors to the DAV server. If that was implemented, then this patch wouldn't be needed, we would find the right colors again even with new collection IDs.

If you stored the entire path to the collection (hierarchical remote ID), then you would have a unique identifiers for collections based on RID

Of course, reading and storing the color from/to the DAV server is the preferred solution, assuming DAV actually supports that.

dkurz added a comment.Nov 2 2018, 11:49 AM

assuming DAV actually supports that.

It doesn't: https://stackoverflow.com/a/30871369.
I didn't find "color" nor "colour" in any CalDAV/WebDAV/iCal RFC either, except for one unrelated match in https://tools.ietf.org/html/rfc4791.

dfaure added a comment.Nov 2 2018, 4:02 PM

assuming DAV actually supports that.

It doesn't: https://stackoverflow.com/a/30871369.
I didn't find "color" nor "colour" in any CalDAV/WebDAV/iCal RFC either, except for one unrelated match in https://tools.ietf.org/html/rfc4791.

DAV clearly supports retrieving colors for calendar folders, that's what's happening here.
See davCollection.color(), and the fact that src/common/davcollectionsfetchjob.cpp:331 sets the color in the collection, based on the property "calendar-color" in the namespace "http://apple.com/ns/ical/". No idea which RFC this would come from though.

But what I'm missing is a way to upload a color, i.e. modify this server-side.
I guess this needs to be added in DavCollectionModifyJob...