Skip to content
  • Denis Kuplyakov's avatar
    KoSectionModel instead of KoSectionManager implemented · 500f574c
    Denis Kuplyakov authored
    Summary:
    **The main goal. Why it is done?**
    We need to store and maintain section tree in document. KoSectionManager were doing it lazy way: some changes can destroy its data and in that case you should call from code a special method to rebuild //entirely whole tree// of a document. This way comes more uncomfortable when we are going to visualize section tree (Author's outliner for example), as in that case you need to update widget by timer and in case of big documents such method will require high amount of computing.
    
    So I decided to use Qts model as a base for the new KoSectionModel. New main aim: tree should be up-to-date always, and should be updated only by commiting local changes to it instead or rebuilding. Another pro of using Qt model that it is now super easy to show tree in UI with any data you want (check now QIdentityModel using with this in ConfigureSectionDialog).
    
    **Other changes**
      # I've found some bugs in handling of sections during deletion, unit-test reference data;
      # Added more unit-tests for other types of sections operation, now also testing KoSectionModel;
      # Small rewrites in a few places;
      # Putted a detailed documentation on how sections handling now done to KoSectionModel.h;
      # Introduced SplitSectionsCommand and corresponding tool that allows to insert paragraphs between directly nested sections, with that options user can create //any// section structure;
    
    That's all that I remember, look at commit messages for details.
    
    **Connected future plans**
    I think that that SplitSections dialog UI should be reworked, some tips should be added to user about "why I need this?". Unfortunately, there is no place to look how it can be done, as LO doesn't allow such operation and there is no sections analog in MSO.
    
    And good luck to reviewers: change is big enough ;)
    
    Test Plan:
    **What I have done**
      - testKoTextEditor unit-test passing;
      - Manually checked split sections functionality.
    
    **What I want to reviewers make attention**
    There is a bunch of FIXME and TODO in code. Personally to boud: there is some unit-test I have commented in KoTextEditor, it is pointed with FIXME, check it plz.
    
    Reviewers: boemann, rempt, staniek
    
    Reviewed By: staniek
    
    Subscribers: staniek, #calligra:_3.0
    
    Projects: #calligra:_3.0
    
    Differential Revision: https://phabricator.kde.org/D235
    500f574c