PATCH: Custom dcop interface for KMainWindow-derived classes.

David Faure dfaure at
Wed Jul 16 17:44:57 BST 2003

KMainwindow creates a KMainWindowInterface DCOPObject with the widget name as 
dcopobject name.
But in Konqueror I'd like to provide a derived interface with those methods 
and other additional methods.
I can't add a virtual method to KMainWindow for this (calling it from the 
constructor wouldn't do much good anyway), and creating my own KonqMainWindow 
DCOP object after KMainWindow created its own, leads to a name conflict.
If I rename the KonqMainWindow's dcop interface, it would break existing 
scripts. So the dcop interface really has to inherit and replace 
kmainwindow's, and it has to be available right away (not on-demand like in 
KOffice), still for compat purposes.

I tried adding a new constructor to KMainWindow, with a DCOPObject* parameter, 
to make it possible for an application to provide its own dcop object for its 
mainwindow... but this doesn't work either since KMainWindowInterface assumes 
the mainwindow to be constructed already, which is not the case if I create 
it before the mainwindow (so it crashes in KMainWindowInterface).

Of course one could delete the KMainWindow-created dcop object,
but that's a small waste of time.

Therefore the only solution I see is passing a bool createDCOPInterface
to the constructors (KMainWindow, KParts::MainWindow), so that KonqMainWindow 
can set it to false and create its own dcop interface afterwards.
bools suck for readability and extensibility, so it's an enum instead.
Sorry for the long explanation, here comes the patch.

PS: virtual inheritance from DCOPObject makes it quite awkward to pass a name 
to the DCOPObject, I wish we'd stop using this weird inheritance for this 

David FAURE, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (
Qtella users - stability patches at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kmainwindow.diff
Type: text/x-diff
Size: 3782 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kparts_mainwindow.diff
Type: text/x-diff
Size: 1521 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: konq.diff
Type: text/x-diff
Size: 2319 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list