Review Request: add KoRdfSemanticItem::createSystemStylesheet(...), so 3rd-party KoRdfSemanticItem subclasses can create themselves some system stylesheets

Friedrich W. H. Kossebau kossebau at kde.org
Thu Nov 29 18:35:27 GMT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107517/
-----------------------------------------------------------

Review request for Calligra and C. Boemann.


Description
-------

The constructor of KoSemanticStylesheet is protected, possibly to control who can create system stylesheets or user stylesheets.

Subclasses of KoRdfSemanticItem need to implement the abstract virtual "QList<hKoSemanticStylesheet> KoRdfSemanticItem::stylesheets() const", where they create the default system KoSemanticStylesheet. Having no stylesheet at all fails e.g. in KoRdfSemanticItem::defaultStylesheet() which assumes some ("Q_ASSERT(ret);"). And setting at least a user stylesheet as workaround seems to fail in other parts, where at least one system stylesheet is wanted, and still is a workaround.
Currently only the three subclasses of KoRdfSemanticItem which are part of Calligra libs can do that, create system stylesheets, because they are listed as friend classes for KoSemanticStylesheet and only because of that can use its constructor. 3rd-party subclasses can not. 

Attached patch changes that, by adding a protected helper method to KoRdfSemanticItem which enables all subclasses of it to create their system stylesheets as wanted. It also changes the subclasses which are part of Calligra libs to use this method, to show 3rd-party coders how to do it and also ensure a single way to create system stylesheets, for consistency and reducing exceptions and the need for friend class declarations.

Okay to apply to 2.6 and master?


Diffs
-----

  libs/main/rdf/KoRdfCalendarEvent.cpp d7b6417 
  libs/main/rdf/KoRdfFoaF.cpp e5bd1f2 
  libs/main/rdf/KoRdfLocation.cpp aa95956 
  libs/main/rdf/KoRdfSemanticItem.h d744139 
  libs/main/rdf/KoRdfSemanticItem.cpp 64ef7c3 
  libs/main/rdf/KoSemanticStylesheet.h 958f1d4 

Diff: http://git.reviewboard.kde.org/r/107517/diff/


Testing
-------

Enables to fix a crash introduced by 3rd-party code not being able to properly implement KoRdfSemanticItem::stylesheets(), runs fine now.


Thanks,

Friedrich W. H. Kossebau

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20121129/617b5666/attachment.htm>


More information about the calligra-devel mailing list