Bug 492279

Summary: Opening digital clock changes the colors of the enabled calendars (the colors are sent then to nextcloud each time)
Product: [Plasma] plasmashell Reporter: Akseli Lahtinen <akselmo>
Component: Digital Clock widgetAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: kdedev, m_louis30, nate
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Akseli Lahtinen 2024-08-27 17:51:57 UTC
SUMMARY
When calendar events plugin is enabled and calendars selected, the selected calendars change color each time i open the digital clock calendar view.


STEPS TO REPRODUCE
1. Add digital clock to panel
2. Right click digital clock, open config
3. In calendar tab, select calendar events (make sure you have some calendars aded with korganizer or merkuro)
4. Enable calendars and press apply (if you check this same tab again, the calendars will be unchecked)
5. Close configuration menu by pressing OK
6. Click on digital clock applet to see the calendar
7. Check the calendar colors
8. Repeat step 6 and 7


OBSERVED RESULT

The calendar colors change. This color is also sent to my Nextcloud, since I have added these calendars to Korganizer as CalDAV items.

EXPECTED RESULT
Colors would be never touched by this plugin.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.80
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2
Kernel Version: 6.10.6-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600

ADDITIONAL INFORMATION
I am on kdesrc-built session, with akonadi built with kdesrc-build as well.
Comment 1 Louis Moureaux 2024-08-27 20:48:41 UTC
Seems like AkonadiPimDataSource::calendarColorForIncidence can modify the color:

https://invent.kde.org/pim/kdepim-addons/-/blob/master/plugins/plasma/pimeventsplugin/akonadipimdatasource.cpp?ref_type=heads#L88

This happens when the color is not registered as an Akonadi::CollectionColorAttribute in the parent collection.
Comment 2 Louis Moureaux 2024-08-27 21:09:57 UTC
[continuing, sorry for submitting too fast]

...or when the color returned by the attribute is invalid.
It then checks the KOrganizer config for settings that are not set in my case. The default is "blue" but this doesn't appear to be effective. If the color fetched from the settings is not valid, a random color is chosen and set on the resource.

The ical/icaldir resources do not have support for calendar colors, so they are added by a KOrganizer/EventView overlay.

One bug is that the colors have been moved to eventviewsrc instead of korganizerrc. Let's hope this is the only one.
Comment 3 Bug Janitor Service 2024-08-27 22:19:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/kdepim-addons/-/merge_requests/56
Comment 4 Carl Schwan 2024-08-28 08:32:14 UTC
Git commit b5f70b11b8f618d639598c5d04e264ab1463d321 by Carl Schwan, on behalf of Louis Moureaux.
Committed on 28/08/2024 at 08:14.
Pushed by carlschwan into branch 'master'.

Fix loading calendar colors from EventViews in the events plugin

The plugin was trying to load colors from the KOrganizer config, but
this has been moved to EventViews. As a result, the data source was
assigning random colors to the Akonadi resources, which ended up messing
up KOrganizer's colors.

M  +1    -1    plugins/plasma/pimeventsplugin/akonadipimdatasource.cpp

https://invent.kde.org/pim/kdepim-addons/-/commit/b5f70b11b8f618d639598c5d04e264ab1463d321
Comment 5 Akseli Lahtinen 2024-08-30 12:10:09 UTC
Not fixed with the patch, unfortunately, at least when I tried using the kdepim-addons build with the patch.

I think this problem is somewhere deeper, since it happens every time the calendar information is loaded, not just with digital clock.
Comment 6 Akseli Lahtinen 2024-08-30 12:10:26 UTC

*** This bug has been marked as a duplicate of bug 492396 ***