Patch for kabc resources

David Faure faure at
Tue Jan 6 17:53:23 GMT 2004

On Tuesday 06 January 2004 18:45, Tobias Koenig wrote:
> On Tue, Jan 06, 2004 at 05:15:38PM +0100, Holger Freyther wrote:
> > On Tuesday 06 January 2004 17:04, Tobias Koenig wrote:
> Hi,
> > > On Tue, Jan 06, 2004 at 02:57:39PM +0100, Bo Thorsen wrote:
> > > Hi Bo,
> > > I'd like to keep this method to have an additional abstraction layer to
> > > add new config items. Cornelius?
> > In what way to add? This is a virtual function right? So we want to force 
> > Resources to call the base class method so we can add config items there 
> > later? This sounds broken. In the case where we want/must to be called we 
> > should use other techniques.
> The writeConfig() method of the base class has to be called, because
> KRES::Resource writes some standard config items to the file.
> Is there any nice design pattern wich covers this issue, so that the
> method of the base class don't have to be called from every
> implementation explicitely?

An easy solution is to separate the public method from the virtual, protected, method.
Hmm, well the public method is also virtual here, so this would give
something like

 virtual void writeConfig() {

  virtual void doWriteConfig() { }

This way you know for sure that the baseclass method is always called,
and subclasses should only reimplement doWriteConfig (better name
needed, like writeResourceConfig() or anything more appropriate).

David FAURE, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list