Review Request 126895: Make KGlobalAccel dependency in KXmlGui optional

Andreas Hartmetz ahartmetz at gmail.com
Wed Jan 27 20:28:36 UTC 2016


On Mittwoch, 27. Januar 2016 17:21:33 CET Boudewijn Rempt wrote:
[snip]

> whether kglobalshortcuts is functional or not is besides the point:
> the point is that whether it works or not it doesn't add any
> functionality to the average application. Global shortcuts are useful
> only for a very limited set of applications, so it should always have
> been an optional dependency.
> 
Here is something that is never beside the point:
maintenance burden and continuous-integration-ability.
ifdefs are somewhat bad for maintainability and really, really bad for a 
continuous integration systems's ability to detect relevant build 
breakage. I am repeating Martin's argument here with different words.

The most maintainable way to make a feature optional is to disable it at 
runtime. Only when this severely hurts performance or a feature plain 
won't build on a certain platform should it be disabled via ifdefs, and 
in the latter case, maybe it can be put into its own class that gets a 
real and a dummy implementation.

My argument is first and foremost but for putting the knife where the 
least amount of stuff needs to be cut, even if that results in shipping 
an unnecessary (small!) module.

Maybe there is a better solution, though.
How about a dummy KGlobalShortcuts implementation in KXmlGui? There may 
be a few places where ifdefs are still required (e.g. completely hiding 
- and I don't mean removing - inert UI), but the vast majority of things 
in KGlobalShortcuts can be faked very easily by doing nothing at all. 
Most code paths don't need to be removed if there is simply no way to 
trigger them.
The thing to be faked is a system that has no global shortcuts and where 
setting them somehow always fails. Maybe pretend to applications that it 
doesn't fail, shouldn't really matter.

[snip]


More information about the Kde-frameworks-devel mailing list