You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds CalDAV calendar visibility toggles to the calendar account editor.
Stores discovered CalDAV calendar metadata in app state under calendar_discovery
Shows discovered calendars when editing an existing CalDAV account
Persists selected calendar IDs to calendar.account.<id>.calendars
Keeps calendars = [] as the existing “all calendars” behavior
Leaves Google calendar selection unchanged (why - in additional notes)
Worth mentioning, the list of calendars is available only after first sync.
Motivation
CalDAV accounts can discover multiple calendars, but settings did not expose a way to choose which discovered calendars should sync. This adds UI for that existing config field without changing the public config contract.
Type of Change
Bug fix
New feature
Breaking change
Refactoring
Build / packaging
Related Issue
This PR probably handles #3158 (if I understood it correctly)
nix develop --command meson test -C build-debug calendar_discovery_state config_schema_roundtrip --print-errorlogs
nix develop --command meson test -C build-debug calendar_discovery_state --print-errorlogs
Manual testing via Nix flake local path + rebuild
Manual Coverage
Tested on Niri
Tested on Hyprland
Tested on Sway
Tested on another compositor:
Tested with different bar positions and density settings
Tested at different interface scaling values
Tested with multiple monitors
Screenshots / Videos
When creating a new calendar (unchanged):
When editing already synced calendar(blurred = calendar names):
Checklist
This PR is ready for review, or it is marked as Draft.
I read and followed the relevant guidance in CONTRIBUTING.md.
I ran just format with clang-format v22+ installed, or this PR has no code changes.
I ran the relevant build or test commands, or explained why they were not run.
I self-reviewed the changes.
I checked for new warnings or errors.
I will update end-user documentation after merge, or this PR does not change user-facing configuration or behavior.
I added or updated assets/translations/en.json, or this PR adds no new user-facing strings.
I did not edit non-English translation files unless this PR is explicitly for translation tooling, an import/export sync, or a maintainer-requested locale change.
I used the existing canonical names for config keys, IPC names, paths, and identifiers.
Additional Notes
Google calendar selection is intentionally unchanged, cause it is handled by Google API's selected field. This PR only exposes calendar selection for CalDAV accounts.
Dead code: selectedCalendarSources is never used in production. It's exported in the header and covered by the test, but the real filtering path in calendar_service.cpp:234-239 operates inline on CalDavCollection (a different type). Either wire this helper into a real call site or drop it — as-is it's an untested-in-anger export that reads as if it's load-bearing. (calendar_discovery_state.h:14)
Orphaned state on account deletion. removeAccount (settings_window_popups.cpp:1056-1059) clears all four calendar_credentials._* keys but not the new calendar_discovery._calendars entry this PR introduces. Deleting a CalDAV account leaves a stale discovery blob in state.toml. Add the matching cleanup line for symmetry.
Test coverage is inverted. The trickiest new logic — setCalendarSourceChecked's materialize/collapse/can't-empty behavior — lives in an anonymous namespace in settings_window_popups.cpp and is untested, while the unused selectedCalendarSources is the one with unit tests. The serialize/parse round-trip and malformed-JSON cases are good; consider extracting the toggle logic somewhere testable (it's pure and doesn't depend on UI).
Minor
The calendars override is now pushed unconditionally (settings_window_popups.cpp:1398), including for Google accounts where the UI never edits it. It's a harmless no-op round-trip of account->calendars, but worth a one-line comment noting the field is CalDAV-driven so a future reader doesn't think Google selection is wired here.
Dead code: selectedCalendarSources is never used in production. It's exported in the header and covered by the test, but the real filtering path in calendar_service.cpp:234-239 operates inline on CalDavCollection (a different type). Either wire this helper into a real call site or drop it — as-is it's an untested-in-anger export that reads as if it's load-bearing. (calendar_discovery_state.h:14)
Orphaned state on account deletion. removeAccount (settings_window_popups.cpp:1056-1059) clears all four calendar_credentials._* keys but not the new calendar_discovery._calendars entry this PR introduces. Deleting a CalDAV account leaves a stale discovery blob in state.toml. Add the matching cleanup line for symmetry.
Test coverage is inverted. The trickiest new logic — setCalendarSourceChecked's materialize/collapse/can't-empty behavior — lives in an anonymous namespace in settings_window_popups.cpp and is untested, while the unused selectedCalendarSources is the one with unit tests. The serialize/parse round-trip and malformed-JSON cases are good; consider extracting the toggle logic somewhere testable (it's pure and doesn't depend on UI).
Minor
The calendars override is now pushed unconditionally (settings_window_popups.cpp:1398), including for Google accounts where the UI never edits it. It's a harmless no-op round-trip of account->calendars, but worth a one-line comment noting the field is CalDAV-driven so a future reader doesn't think Google selection is wired here.
Hey, thanks for the review.
Dead code is resolved: I've removed the unused export and replaced it with selectedCalendarSourceIds. The new helper is now used by the real CalDAV filtering path in CalendarService::fetchCalDav, so the tested logic matches production behavior.
Orphaned state on acc deletion: Updated removeAccount to also clear calendar_discovery.<accountId>_calendars, alongside the four credential entries. Deleted CalDAV accounts no longer leave stale discovery data in state.toml.
Test coverage is inverted: Extracted setCalendarSourceChecked from the settings UI’s anonymous namespace into calendar_discovery_state. Also added more tests to cover the whole logic.
Preserved the existing behavior because it is a harmless round-trip, but added a comment explaining that manual calendar selection is currently CalDAV-driven and Google selection comes from the CalendarList selected field.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds CalDAV calendar visibility toggles to the calendar account editor.
calendar_discoverycalendar.account.<id>.calendarscalendars = []as the existing “all calendars” behaviorWorth mentioning, the list of calendars is available only after first sync.
Motivation
CalDAV accounts can discover multiple calendars, but settings did not expose a way to choose which discovered calendars should sync. This adds UI for that existing config field without changing the public config contract.
Type of Change
Related Issue
This PR probably handles #3158 (if I understood it correctly)
Testing
nix develop --command meson compile -C build-debug noctalianix develop --command meson test -C build-debug calendar_discovery_state config_schema_roundtrip --print-errorlogsnix develop --command meson test -C build-debug calendar_discovery_state --print-errorlogsManual Coverage
Screenshots / Videos
When creating a new calendar (unchanged):
When editing already synced calendar(blurred = calendar names):
Checklist
CONTRIBUTING.md.just formatwith clang-format v22+ installed, or this PR has no code changes.assets/translations/en.json, or this PR adds no new user-facing strings.Additional Notes
Google calendar selection is intentionally unchanged, cause it is handled by Google API's
selectedfield. This PR only exposes calendar selection for CalDAV accounts.