fix my KCModule issues once and for all

Matthias Kretz kretz at kde.org
Thu Sep 25 18:32:27 BST 2003


On Thursday September 25 2003 18:09, Roger Larsson wrote:
> On Wednesday 24 September 2003 19.06, Matthias Kretz wrote:
> > 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.
>
> I like it :-)

I guess you mean the second patch?

> If it can be used as a Widget, why not call it KCMWidget?

Because Proxy or Decorator are known patterns and people might understand 
easier what it does. Widget on the other hand is not very descriptive since a 
KCM is a widget, too.

> BTW this code - is this OK?

Well, after I commit my patch the "emit changed" is done automatically - 
KControl does it itself and KCMultiDialog uses KCModuleDecorator to do it. So 
after a load() or save() "emit changed( false )" is called. I don't call 
"emit changed( true )" after defaults(), because it could very well be that 
the current settings are the defaults - so pressing the button didn't change 
any settings. I'm not sure if it's a good thing to do usability wise since 
the user might expect the apply button to be enabled after clicking 
"Defaults" (so this is up for discussion).

In the rare case that saving failed and the KCM would like to keep a changed 
state you would call:
QTimer::singleShot( 0, this, slotEmitChanged() );

with that slot calling "emit changed( true );".

So for the KDevelop template I think you can just leave out the "emit changed" 
from the save(), load() and defaults() methods (because that's what I am 
trying to fix with my patches - that those calls are not necessary anymore).

-- 
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: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030925/1f9ba62f/attachment.sig>


More information about the kde-core-devel mailing list