Skip to content

Rework page loading and saving

Arjen Hiemstra requested to merge work/ahiemstra/pagerefactor into master

While working on updated history and overview pages, I realised that there's a rather fatal flaw in the current mechanisms regarding page saving. Originally, I chose to use KConfig's cascade system to have local changes only store the differences between system pages and local pages when editing one of the system pages. However, if we then change the underlying page structure, the local changes end up completely corrupting the page because we now remove or add things to places that no longer match what the original page was.

This MR attempts to fix that by, at its core, switching page saving to no longer use cascading and instead always save the full page structure to a local file. To detect whether pages are still up to date, we add a version field to the page that is used to check whether a page is up to date. If it is not, there are a few things that may happen:

  • The page only exists in the user's local directory, so we just load it and on save we'll write the new version to the page, but nothing else needs to be done.
  • The page exists in multiple places, but the underlying structure hasn't changed much. The page will be marked as "outdated", local changes are kept and the user will be asked if they want to keep their changes or use the new version of the page.
  • The page exists in multiple places, and the underlying structure has changed significantly. In this case, we will move the local changes to a different file and notify the user that the changes have moved.

The last step can eventually be removed when we expect no one to use cascading pages anymore.

Ultimately I'm still not entirely satisfied by this, but I've spent quite some time on this already and at least the current thing works.

This requires libksysguard!402 (merged)

Edited by Arjen Hiemstra

Merge request reports

Loading