• Friedrich W. H. Kossebau's avatar
    Make SourceFormatter plugins enablable, hide actions with no plugins · a6a42ec3
    Friedrich W. H. Kossebau authored
    Summary:
    Source formatting is a feature seemingly only used by some.
    So it makes sense to allow disabling this feature, for some minimal smaller
    runtime footprint and less unused clutter in the UI (like menu actions or
    settings).
    
    This patch achieves this to a good degree:
    * makes the plugins astyle & customscript normal global plugins which can be
      enabled/disabled by the user
    * removes the SourceFormatterController actions from the menus when there are
      no formatters available
    * shows no source formatting settings page in the project settings
      when there are no formatters available
    
    Not yet done is to hide the source formatting settings page from the
    application settings dialog in case no formatters are available. That might
    need some more custom logic all over the shell code, which is not so nice.
    Instead the option should be investigated to make the source formatting
    controller a normal plugin with a suited interface, which then can be
    queried by other code needing that service.
    
    Test Plan:
    See plugins astyle & customscript turn up in plugin selection settings.
    Disable and enable both and see how actions in the main Edit menu and the
    context menu on file items are present or not present, as well as the
    formatting settings page in the project settings dialog being shown or not.
    
    See also the formatting settings pages for projects and the global one only
    offering the formatters of the enabled plugins.
    
    Reviewers: #kdevelop, kfunk, mwolff
    
    Reviewed By: #kdevelop, kfunk, mwolff
    
    Subscribers: mwolff, kfunk, kdevelop-devel
    
    Differential Revision: https://phabricator.kde.org/D8492
    a6a42ec3
sourceformatterplugin.cpp 1.99 KB