fix my KCModule issues once and for all

Matthias Kretz kretz at kde.org
Wed Sep 24 18:06:55 BST 2003


Hi,

you've probably seen my quest to "fix" all KCMs after a little change to the 
KCModule interface. I probably finished about 1/4 of them - I'd like to stop 
now. :-P

Here's the first idea I had to fix 'em all in one go:

Every KCModule needs to call setChanged(false) after calling load() or save(), 
so I was looking for a way to do that automatically. I've not seen a way to 
do it clean enough in KCModule keeping compatibility so that's no option. But 
I was thinking of a Proxy or Decorator object to do the work I was doing by 
patching all KCMs. The Proxy is created in KCModuleLoader right before 
returning the KCModule and just wraps the KCModule while keeping the same 
interface (since it inherits from KCModule).
The Proxy transparently keeps track of whether the module was changed and does 
the setChanged calls in load() and save() itself. The code in the patch calls 
load() after the KCModule ctor but I think this should not be done before KDE 
4. The files for the first solution are the *-evil.patch ones.


And my second idea (after one night and a little design patterns reading):

Define a new Interface for programs that want to talk to "sane" KCModules 
(even if the KCMs are "broken" - the KCModuleDecorator (KCMD) makes it look 
like they're not). Code that embeds KCMs now can use KCMDs instead and use it 
just like a normal QWidget. The KCMD transparently loads the KCModule as soon 
as it's needed - that makes code like the KCMultiDialog::aboutToShow a lot 
easier. With that approach I can undo my changes to the KCModule interface 
and undo my changes to kcontrol so that all this works like before (I still 
don't like how it works but it's just too much for me at this point). 
KCMultiDialog and KPluginSelector use KCMD now, though. And it solves all my 
needs :-) even better than before.
The files are the remaining *-2nd.patch files.


I think the second solution is nicer and should work out better in the long 
run. But if you're interested in the first patch - or even think that it's 
better let me know.

PS: Sorry for mixing Proxy and Decorator, it could very well be that the first 
idea is more of a Decorator while the second is a Proxy. I can still change 
the names :-)

--
C'ya
        Matthias
________________________________________________________
Matthias Kretz (Germany)                          <><
http://Vir.homeip.net/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcmodule-evil.patch
Type: text/x-diff
Size: 1791 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030924/8b86530f/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcontrol-evil.patch
Type: text/x-diff
Size: 2532 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030924/8b86530f/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kutils-evil.patch
Type: text/x-diff
Size: 9377 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030924/8b86530f/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcmodule-2nd.patch
Type: text/x-diff
Size: 4340 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030924/8b86530f/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcontrol-2nd.patch
Type: text/x-diff
Size: 3629 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030924/8b86530f/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kutils-2nd.patch
Type: text/x-diff
Size: 20710 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030924/8b86530f/attachment-0005.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030924/8b86530f/attachment.sig>


More information about the kde-core-devel mailing list