[mkcal] Move alarm handling to a new class. #65
Merged
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.
Also change the alarm setting behaviour.
Instead of dealing per incidence, it is
now clearing and setting alarms per UID.
If an incidence recurs and has exceptions,
all alarms sharing the same UID are removed
and then parent and all exceptions are reset.
@pvuorela , yet another spin off from #61.
In the current alarm code, a KCalendarCore::Calendar is required for two things:
notebookUidassociated to a given incidence,instances()list of a recurring incidence, so its next occurrence can be recalculated.In the context of the coming changes, there won't be necessary a unique KCalendarCore::Calendar that stores the incidences. So I tried to remove it from the alarm API:
QPAir<QString, QString>where the first element is the notebook uid and the second the incidence uid.instances()are retrieved by a convenient routine that implementers of AlarmHandler are providing. This routine either reread the DB (in the case where we change all alarms of a notebook, as it was done before), or return the full series for a given UID as in memory.As mentioned in #61, I'm also changing the behaviour to avoid doing per incidence alarm, and move to a per series alarm. In my opinion, this is less error-prone, with less cases to be treated. Just a clear all alarms with this NBUID/UID tuple, reset all alarms for the list of incidence sharing this NBUID/UID tuple.