[mkcal] Add a special case for notebook change in save. #25
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.
Handle notebook change as a deletion in the previous notebook,
and an addition in the new one. Like that any sync on the
previous notebook can propagate the deletion.
@pvuorela , from our discussion yesterday, I think I've found a low-level way to properly treat the notebook change. I've added a test to demonstrate it. It should work also for recurring events with exceptions, but there is a bug upstream, see https://invent.kde.org/frameworks/kcalendarcore/-/merge_requests/99.
When a downstream code is calling
calendar->setNotebook()on an existing incidence, the calendar is callingcalendarIncidenceChanged()for every observers. Then, on nextsave()call this incidence is sent toSqliteFormat::modifyComponent()with aDBUpdateoperation. The idea of the patch is to read the old notebook value in case of an update operation, in the same SQL request than the one fetching the rowid. If the notebook differs, we substitute the update operation with a mark as deleted on the incidence followed by an insert operation on the same incidence but with a different notebook id.If you think it's ok, I will have to update the bindings to replace the current delete + add code with the proper
calendar->setNotebook()one. And also reenable all the signals that a notebook has been changed and reenable the action in the UI. But first things first, what do you think of this low level patch ?